path: root/sw/source/core/layout/tabfrm.cxx
diff options
authorMichael Stahl <>2020-07-16 19:25:05 +0200
committerMichael Stahl <>2020-07-17 17:07:35 +0200
commit3d63eaa58c38d52daab460f03aa3daf74ea49c2e (patch)
tree3b3421fd65114b33ecf9c39007a6efc64e2c753d /sw/source/core/layout/tabfrm.cxx
parentfa84e889b8cabdd7c174b640883c692b8d514ae7 (diff)
sw: layout: fix missing invalidation of text frames in tables
... when the position of the SwTabFrame changes. The table is initially formatted on page 1, where one of its cells overlaps flys anchored in the footer, so the SwTextFrame in it contains SwFlyPortions. As the table doesn't fit on page 1, the SwTabFrame moves forward to page 2; lcl_RecalcTable() is called a bit later to invalidate pos and size of everything in the table. However, it turns out that that's not enough, when SwTextFrame::Format() is called it doesn't do anything because no part of the text has actually been invalidated via InvalidateRange_(). If the SwTextFrame were moved on its own (not via table), then SwContentFrame::MakeAll() would call Prepare(PrepareHint::FramePositionChanged) which calls ClearPara(). The SwTabFrame is moved via SwFlowFrame::PasteTree(), which calls SwTextFrame::Init() if it moves a text frame directly but does nothing for tables. So let's try to fix this similar to commit 068c133ac41c97652909b88c432e3b73010efc3e by calling Prepare(PrepareHint::FramePositionChanged) on every moved text frame if the position actually changes, like SwContentFrame::MakeAll() does; not sure what performance impact this has. (apparently regression from cc5916cd314a27b0cc99560ab887480026630a95 - whatever that means in this case, no idea how it worked before) Note: the problem only reproduces on libreoffice-6-3 branch because libreoffice-6-4 and later have another layout change from commit 3cccdabf19a99fd3f657985c1822436d7679df2b that needs reverting Change-Id: I65d3e367d56b8799e1ed32172fbbc0249c2852eb Reviewed-on: Tested-by: Jenkins Reviewed-by: Michael Stahl <>
Diffstat (limited to 'sw/source/core/layout/tabfrm.cxx')
1 files changed, 18 insertions, 0 deletions
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index fda00cee5c3f..e997b71f5e59 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -1825,6 +1825,22 @@ void FriendHackInvalidateRowFrame(SwFrameAreaDefinition & rRowFrame)
+static void InvalidateFramePositions(SwFrame * pFrame)
+ while (pFrame)
+ {
+ if (pFrame->IsLayoutFrame())
+ {
+ InvalidateFramePositions(pFrame->GetLower());
+ }
+ else if (pFrame->IsTextFrame())
+ {
+ pFrame->Prepare(PrepareHint::FramePositionChanged);
+ }
+ pFrame = pFrame->GetNext();
+ }
void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
if ( IsJoinLocked() || StackHack::IsLocked() || StackHack::Count() > 50 )
@@ -2023,6 +2039,8 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
if (GetLower())
{ // it's possible that the rows already have valid pos - but it is surely wrong if the table's pos changed!
+ // invalidate text frames to get rid of their SwFlyPortions
+ InvalidateFramePositions(GetLower());