tdf#152961 sw: fix layout loop on removing fly from page
commit57d1de08dee74b691b8686c8b35f3e61257b8107
authorMiklos Vajna <vmiklos@collabora.com>
Thu, 12 Jan 2023 07:40:14 +0000 (12 08:40 +0100)
committerMiklos Vajna <vmiklos@collabora.com>
Fri, 13 Jan 2023 13:54:19 +0000 (13 13:54 +0000)
tree5e7aafade4d13a53c679dc9a016090cdb67932af
parenta1ef8d35d4b664b5d896ff4030a70a4020b26968
tdf#152961 sw: fix layout loop on removing fly from page

Loading the document resulted in a layout loop.

This is a problem since commit cf2c070de2bafeec3b476c6bff7bb4ac87ba46db
(sw layout: invalidate margins of body content when moving a fly from
page, 2022-12-09), which started invalidating the content of an old page
in case we remove a fly from it, because some frames calculate their
margins based on the flys of the page.

Fix the problem by invalidating only the table frames of those page
lowers: the direct need for this invalidation comes from
SwTabFrame::CalcFlyOffsets(), which is not relevant for other frames.
Also, in case non-table lowers are not invalidated, then the new bugdoc
loads fine, which means this fixes the new problem while keeping the old
problem fixed.

This assumes that non-table frames have their equivalent of
SwTabFrame::CalcFlyOffsets(), which do their own invalidation, so
SwPageFrame::MoveFly() doesn't have to do it.

Change-Id: I807d55d077bb0e023beb66775ab68bbca2680eb5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145384
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
(cherry picked from commit 432aefa738ed0b3a6215629569a5bcffdeb504d5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145436
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
sw/qa/core/layout/data/page-remove-fly-no-table.fodt [new file with mode: 0644]
sw/qa/core/layout/layout.cxx
sw/source/core/layout/flylay.cxx