summaryrefslogtreecommitdiff
path: root/sw/source/core/text
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2023-02-28 08:11:01 +0100
committerMiklos Vajna <vmiklos@collabora.com>2023-02-28 08:07:36 +0000
commitf13eb476ea6620bc444d9533959fea78afe720c5 (patch)
tree484813923b9ae5899dab7fc91bf57a376ee4902d /sw/source/core/text
parent3d7b0a6ebbf5154933bc4a450613362052167791 (diff)
sw floattable: fix fly pos invalidation in follow anchor frames
The problem was that in case a row split moved the 2nd half of the row to a new page, the follow fly frame had a wrong position (top left corner of the page). What happened was that the follow anchor (text frame) was not yet positioned by the time the follow fly was positioned, and there was no invalidation once the follow anchor got its position. Fix the problem by improving SwTextFrame::MakePos(): it already had code to invalidate the position of follow flys when the position of the anchor changes, but it assumed that the flys of a follow anchor are in the follow anchor, while in fact flys are always nominally anchored in the master, so we didn't find the relevant fly frame and no invalidation happened. Once we use FindMaster() to look up the master and filter based on FindAnchorCharFrame(), we find the relevant fly to invalidate and the position is correct. Change-Id: Ic485527bb9dd05b3d5aed383eb5fa1c4f9f6a76d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147943 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/source/core/text')
-rw-r--r--sw/source/core/text/frmform.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 74d1a7cec04e..b1e98d9771bc 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -342,8 +342,20 @@ void SwTextFrame::MakePos()
{
SwFrame::MakePos();
- for (const auto& pFly : GetSplitFlyDrawObjs())
+ // Find the master frame.
+ const SwTextFrame* pMaster = this;
+ while (pMaster->IsFollow())
{
+ pMaster = pMaster->FindMaster();
+ }
+ // Find which flys are effectively anchored to this frame.
+ for (const auto& pFly : pMaster->GetSplitFlyDrawObjs())
+ {
+ SwTextFrame* pFlyAnchor = pFly->FindAnchorCharFrame();
+ if (pFlyAnchor != this)
+ {
+ continue;
+ }
// Possibly this fly was positioned relative to us, invalidate its position now that our
// position is changed.
pFly->InvalidatePos();