[Libreoffice-commits] core.git: vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Oct 16 10:12:17 UTC 2019


 vcl/source/window/layout.cxx |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

New commits:
commit f33b6e341fb7dd1ab3acd4fe5457b716be316e89
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Oct 16 09:48:38 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Oct 16 12:11:39 2019 +0200

    overlapping scrollbars when both visible
    
    Change-Id: I75644c526e401ce0bc9a46a66d3d31e90bafb1d6
    Reviewed-on: https://gerrit.libreoffice.org/80874
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 609a7ca5d66b..c9dda1e98f9a 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -1802,27 +1802,32 @@ void VclScrolledWindow::setAllocation(const Size &rAllocation)
     Size aInnerSize(rAllocation);
     aInnerSize.AdjustWidth(-2);
     aInnerSize.AdjustHeight(-2);
-    long nScrollBarWidth = 0, nScrollBarHeight = 0;
+
+    bool bBothVisible = m_pVScroll->IsVisible() && m_pHScroll->IsVisible();
+    auto nScrollBarWidth = getLayoutRequisition(*m_pVScroll).Width();
+    auto nScrollBarHeight = getLayoutRequisition(*m_pHScroll).Height();
 
     if (m_pVScroll->IsVisible())
     {
-        nScrollBarWidth = getLayoutRequisition(*m_pVScroll).Width();
         Point aScrollPos(rAllocation.Width() - nScrollBarWidth - 2, 1);
         Size aScrollSize(nScrollBarWidth, rAllocation.Height() - 2);
+        if (bBothVisible)
+            aScrollSize.AdjustHeight(-nScrollBarHeight);
         setLayoutAllocation(*m_pVScroll, aScrollPos, aScrollSize);
         aInnerSize.AdjustWidth( -nScrollBarWidth );
     }
 
     if (m_pHScroll->IsVisible())
     {
-        nScrollBarHeight = getLayoutRequisition(*m_pHScroll).Height();
         Point aScrollPos(1, rAllocation.Height() - nScrollBarHeight);
         Size aScrollSize(rAllocation.Width() - 2, nScrollBarHeight);
+        if (bBothVisible)
+            aScrollSize.AdjustWidth(-nScrollBarWidth);
         setLayoutAllocation(*m_pHScroll, aScrollPos, aScrollSize);
         aInnerSize.AdjustHeight( -nScrollBarHeight );
     }
 
-    if (m_pVScroll->IsVisible() && m_pHScroll->IsVisible())
+    if (bBothVisible)
     {
         Point aBoxPos(aInnerSize.Width() + 1, aInnerSize.Height() + 1);
         m_aScrollBarBox->SetPosSizePixel(aBoxPos, Size(nScrollBarWidth, nScrollBarHeight));


More information about the Libreoffice-commits mailing list