diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-09-03 21:16:13 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-09-07 10:51:24 +0200 |
commit | 99141aea4d81d89ff5d14087e6647b25f7018e8b (patch) | |
tree | dee9624a12a765c009570f842ae24f7cd857de6b /vcl | |
parent | ef32c3b4f9b80918d6018e14297fa41245afd381 (diff) |
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@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/window/layout.cxx | 20 |
1 files changed, 4 insertions, 16 deletions
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) |