diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-11-13 12:31:01 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-11-13 16:11:07 +0100 |
commit | 886583645cf8d977f11f527691515c2a4d7c33e8 (patch) | |
tree | d8d978727cf4c24f675d7adfac1657cbdbc8e767 /vcl/source/window/layout.cxx | |
parent | 4be2607af6c474ba2d879a3a84996de0bc1b73b7 (diff) |
Resolves: tdf#128758 scrollbars added during scrolledwindow layout
Change-Id: I1eee32278f6b46ff4f0447eb39543836c3d687f0
Reviewed-on: https://gerrit.libreoffice.org/82589
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source/window/layout.cxx')
-rw-r--r-- | vcl/source/window/layout.cxx | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 26981992bc04..981ac621aa60 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -1757,7 +1757,7 @@ void VclScrolledWindow::InitScrollBars(const Size &rRequest) m_pHScroll->Scroll(); } -void VclScrolledWindow::setAllocation(const Size &rAllocation) +void VclScrolledWindow::doSetAllocation(const Size &rAllocation, bool bRetryOnFailure) { Size aChildReq; @@ -1835,13 +1835,33 @@ void VclScrolledWindow::setAllocation(const Size &rAllocation) if (pChild && pChild->IsVisible()) { assert(dynamic_cast<VclViewport*>(pChild) && "scrolledwindow child should be a Viewport"); + + WinBits nOldBits = (GetStyle() & (WB_AUTOVSCROLL | WB_VSCROLL | WB_AUTOHSCROLL | WB_HSCROLL)); + setLayoutAllocation(*pChild, Point(1, 1), aInnerSize); + + // tdf#128758 if the layout allocation triggered some callback that + // immediately invalidates the layout by adding scrollbars then + // normally this would simply retrigger layout and another toplevel + // attempt is made later. But the initial layout attempt blocks + // relayouts, so just make another single effort here. + WinBits nNewBits = (GetStyle() & (WB_AUTOVSCROLL | WB_VSCROLL | WB_AUTOHSCROLL | WB_HSCROLL)); + if (nOldBits != nNewBits && bRetryOnFailure) + { + doSetAllocation(rAllocation, false); + return; + } } if (!m_bUserManagedScrolling) InitScrollBars(aChildReq); } +void VclScrolledWindow::setAllocation(const Size &rAllocation) +{ + doSetAllocation(rAllocation, true); +} + Size VclScrolledWindow::getVisibleChildSize() const { Size aRet(GetSizePixel()); |