[Libreoffice-commits] core.git: include/vcl vcl/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue Sep 7 08:51:56 UTC 2021
include/vcl/layout.hxx | 2 --
vcl/source/window/layout.cxx | 20 ++++----------------
2 files changed, 4 insertions(+), 18 deletions(-)
New commits:
commit 99141aea4d81d89ff5d14087e6647b25f7018e8b
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Sep 3 21:16:13 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Sep 7 10:51:24 2021 +0200
Related: tdf#142458 don't change border size during Paint
so GetOptimalSize/get_preferred_size before/after paint has the same result
Change-Id: I25abe31c069561e30a9af7c4b9b81582298e0f9d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121616
Tested-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index 14c85938d639..19eca5b5cf40 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -500,8 +500,6 @@ public:
private:
virtual Size calculateRequisition() const override;
virtual void setAllocation(const Size &rAllocation) override;
- // sets new border size and adapts scrollbar and child widget position/size as needed
- void updateBorderWidth(tools::Long nBorderWidth);
int CalcBorderWidth() const;
DECL_LINK(ScrollBarHdl, ScrollBar*, void);
void InitScrollBars(const Size &rRequest);
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 680a650f34f2..d9f479ee39e6 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -2100,27 +2100,15 @@ bool VclScrolledWindow::EventNotify(NotifyEvent& rNEvt)
return bDone || VclBin::EventNotify( rNEvt );
}
-void VclScrolledWindow::updateBorderWidth(tools::Long nBorderWidth)
-{
- if (m_nBorderWidth == nBorderWidth || nBorderWidth < 1)
- return;
-
- m_nBorderWidth = nBorderWidth;
- // update scrollbars and child window
- doSetAllocation(GetSizePixel(), false);
-};
-
void VclScrolledWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
{
+ VclBin::Paint(rRenderContext, rRect);
const tools::Rectangle aRect(tools::Rectangle(Point(0,0), GetSizePixel()));
DecorationView aDecoView(&rRenderContext);
const tools::Rectangle aContentRect = aDecoView.DrawFrame(aRect, m_eDrawFrameStyle, m_eDrawFrameFlags);
-
- // take potentially changed frame size into account before rendering content
- const tools::Long nFrameWidth = (aRect.GetWidth() - aContentRect.GetWidth()) / 2;
- updateBorderWidth(nFrameWidth);
-
- VclBin::Paint(rRenderContext, rRect);
+ const auto nBorderWidth = (aRect.GetWidth() - aContentRect.GetWidth()) / 2;
+ SAL_WARN_IF(nBorderWidth > m_nBorderWidth, "vcl.layout", "desired border at paint " <<
+ nBorderWidth << " is larger than expected " << m_nBorderWidth);
}
void VclViewport::setAllocation(const Size &rAllocation)
More information about the Libreoffice-commits
mailing list