vcl/source/window/layout.cxx | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-)
New commits: commit bcfcc787168e7b9ffd577285694ef0e57dbeb8fa Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Apr 1 10:31:27 2021 +0100 Commit: Adolfo Jayme Barrientos <fit...@ubuntu.com> CommitDate: Thu Apr 1 16:31:09 2021 +0200 Resolves: tdf#141258 turn scrollbars on/off once per layout loop in this scenario the vertical scrollbar is turned off, then turned on back to its original state but the off/on triggers another layout loop later which does the same thing. Turn on/off just once per loop so only one state change can occur so new layout is only triggered if the state really changes. Change-Id: I5736264a74723a15034e5fb467262dca6c0f283c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113370 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 2cf77e81a688..9406aa4585f5 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -1913,31 +1913,36 @@ void VclScrolledWindow::doSetAllocation(const Size &rAllocation, bool bRetryOnFa tools::Long nAvailHeight = rAllocation.Height() - 2 * m_nBorderWidth; tools::Long nAvailWidth = rAllocation.Width() - 2 * m_nBorderWidth; + // vert. ScrollBar + bool bShowVScroll; if (GetStyle() & WB_AUTOVSCROLL) - { - m_pVScroll->Show(nAvailHeight < aChildReq.Height()); - } - else if (m_pVScroll->IsVisible() != bool(GetStyle() & WB_VSCROLL)) - m_pVScroll->Show((GetStyle() & WB_VSCROLL) != 0); + bShowVScroll = nAvailHeight < aChildReq.Height(); + else + bShowVScroll = (GetStyle() & WB_VSCROLL) != 0; - if (m_pVScroll->IsVisible()) + if (bShowVScroll) nAvailWidth -= getLayoutRequisition(*m_pVScroll).Width(); // horz. ScrollBar + bool bShowHScroll; if (GetStyle() & WB_AUTOHSCROLL) { - bool bShowHScroll = nAvailWidth < aChildReq.Width(); - m_pHScroll->Show(bShowHScroll); + bShowHScroll = nAvailWidth < aChildReq.Width(); if (bShowHScroll) nAvailHeight -= getLayoutRequisition(*m_pHScroll).Height(); if (GetStyle() & WB_AUTOVSCROLL) - m_pVScroll->Show(nAvailHeight < aChildReq.Height()); + bShowVScroll = nAvailHeight < aChildReq.Height(); } - else if (m_pHScroll->IsVisible() != bool(GetStyle() & WB_HSCROLL)) - m_pHScroll->Show((GetStyle() & WB_HSCROLL) != 0); + else + bShowHScroll = (GetStyle() & WB_HSCROLL) != 0; + + if (m_pHScroll->IsVisible() != bShowHScroll) + m_pHScroll->Show(bShowHScroll); + if (m_pVScroll->IsVisible() != bShowVScroll) + m_pVScroll->Show(bShowVScroll); Size aInnerSize(rAllocation); aInnerSize.AdjustWidth(-2 * m_nBorderWidth); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits