sw/source/core/layout/ftnfrm.cxx |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 3d8533cb894614394f1ecf05b3d6dc60f3bf6dd6
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Tue Mar 8 17:36:41 2022 +0100
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Sat Mar 12 11:15:35 2022 +0100

    tdf#139687 sw: invalidate text frame in footnote when moving it
    
    The problem (which only reproduces here on copy/paste with
    SAL_USE_VCLPLUGIN=kf5, not with gtk3) is that on SwTextFrame 2638 in a
    footnote on page 19 containing "Saeed, 100–101." there should be a top
    margin of 0 but it's actually 144.
    
    The footnote was initially created on a previous page with another
    footnote with SwTextFrame 2635 before it, that's how it got this top
    margin.
    
    Invalidate the print area in SwFootnoteFrame::Paste(), which is called
    when the footnote is moved to a different container.
    
    (somehow regression from commit 723728cd358693b8f4bc9d913541aa4479f2bd48)
    
    Change-Id: I7346fd03fccad3eddccbbcd56c4b50127a337b24
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131217
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit 86081afc3021fa0ae6c2b32d11b4b20cc8a190a3)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131201
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index 1a11bbb5dfdf..c41b315ad685 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -605,10 +605,20 @@ void SwFootnoteFrame::Paste(  SwFrame* pParent, SwFrame* 
pSibling )
     if( 
aRectFnSet.GetWidth(getFrameArea())!=aRectFnSet.GetWidth(pParent->getFramePrintArea())
 )
         InvalidateSize_();
     InvalidatePos_();
+    if (SwFrame *const pContent = ContainsContent())
+    {   // tdf#139687 invalidate possibly stale top margin (computed from 
previous frame)
+        pContent->InvalidatePrt_();
+    }
     SwPageFrame *pPage = FindPageFrame();
     InvalidatePage( pPage );
-    if ( GetNext() )
-        GetNext()->InvalidatePos_();
+    if (SwFootnoteFrame *const pNext = static_cast<SwFootnoteFrame 
*>(GetNext()))
+    {
+        pNext->InvalidatePos_();
+        if (SwFrame *const pContent = pNext->ContainsContent())
+        {   // tdf#139687 invalidate possibly stale top margin (computed from 
previous frame)
+            pContent->InvalidatePrt_();
+        }
+    }
     if( aRectFnSet.GetHeight(getFrameArea()) )
         pParent->Grow( aRectFnSet.GetHeight(getFrameArea()) );
 

Reply via email to