Related: tdf#148779 Avoid endless recursion in ImplSmallBorderWindowView::Init
commita82f8d5993f7dc061eb5465a4565f3c76555c74a
authorStephan Bergmann <sbergman@redhat.com>
Tue, 18 Jan 2022 09:35:22 +0000 (18 10:35 +0100)
committerCaolán McNamara <caolanm@redhat.com>
Thu, 28 Apr 2022 07:49:20 +0000 (28 09:49 +0200)
treee4bc492eb0af0a986fa7e600ea403abb4a36beae
parent364e13b384216fb952239441a7f9ab9746bd8200
Related: tdf#148779 Avoid endless recursion in ImplSmallBorderWindowView::Init

At least on macOS, some `make screenshot` tests crashed for me due to endless
recursion, like the processing of modules/swriter/ui/converttexttable.ui in
CppunitTest_sw_dialogs_test for LO_TEST_LOCALE=gu:

[...]
> ImplSmallBorderWindowView::Init at vcl/source/window/brdwin.cxx:557:20
> ImplBorderWindow::Resize at vcl/source/window/brdwin.cxx:1736
> vcl::Window::queue_resize at vcl/source/window/window2.cxx:1351:28
> ImplSmallBorderWindowView::Init at vcl/source/window/brdwin.cxx:557:20
> ImplBorderWindow::Resize at vcl/source/window/brdwin.cxx:1736
> vcl::Window::queue_resize at vcl/source/window/window2.cxx:1351:28
> ImplSmallBorderWindowView::Init at vcl/source/window/brdwin.cxx:557:20
[...]

where in the calls to ImplSmallBorderWindowView::Init, nWidth=24 and nHeight=31,
as well as mnLeftBorder=6, mnTopBorder=6, and mnBottomBorder=6 remain stable,
but mnRightBorder keeps changing between 6 and 5.

This appears to be caused by instabilities in the
ImplLogicToDevicePixel and ImplDevicePixelToLogic calculations in
OutputDevice::GetNativeControlRegion (vcl/source/outdev/nativecontrols.cxx),
which can be avoided when we compute a hypothetical native control region from
aCtrolRegion that includes the borders, and only remove the borders from the
resulting aBounds and aContent.  (The code to shrink aCtrlRegion prior to
calling GetNativeControlRegion had been introduced with
27be8a263eddb54cb6b66cc0f832bfd02016a694 "KDE4 fix edit box borders".)

Change-Id: I88c0d15ae7045a6888768226ca4d5fdd66bb41ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128549
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Jenkins
(cherry picked from commit 31700036e517691d154701f4b8aeecb85cde607f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133482
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
vcl/source/window/brdwin.cxx