summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-11-13 12:31:01 +0000
committerMiklos Vajna <vmiklos@collabora.com>2019-11-15 13:50:04 +0100
commitd9ec8e44a2029c77a008a8d0a0337c70e5e680e5 (patch)
tree81abe44d09cf84872272214f1e03116893c21ffa
parenttdf#128538: Open filesystem directories in Finder after all (diff)
downloadcore-d9ec8e44a2029c77a008a8d0a0337c70e5e680e5.tar.gz
core-d9ec8e44a2029c77a008a8d0a0337c70e5e680e5.zip
Resolves: tdf#128758 scrollbars added during scrolledwindow layout
Change-Id: I1eee32278f6b46ff4f0447eb39543836c3d687f0 Reviewed-on: https://gerrit.libreoffice.org/82596 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--include/vcl/layout.hxx1
-rw-r--r--vcl/source/window/layout.cxx22
2 files changed, 22 insertions, 1 deletions
diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index cb031a0efe3b..02485487fc84 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -491,6 +491,7 @@ public:
//set to true to disable the built-in scrolling callbacks to allow the user
//to override it
void setUserManagedScrolling(bool bUserManagedScrolling) { m_bUserManagedScrolling = bUserManagedScrolling;}
+ void doSetAllocation(const Size &rAllocation, bool bRetryOnFailure);
private:
virtual Size calculateRequisition() const override;
virtual void setAllocation(const Size &rAllocation) override;
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 33f70be753c9..932310e19258 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -1898,7 +1898,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;
@@ -1971,13 +1971,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());