[Libreoffice-commits] core.git: sw/qa sw/source

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Fri Apr 3 08:06:54 UTC 2020


 sw/qa/extras/layout/data/tdf131707_flyWrap.doc |binary
 sw/qa/extras/layout/layout.cxx                 |   10 ++++++++
 sw/source/core/layout/frmtool.cxx              |   31 ++++++++++++-------------
 3 files changed, 25 insertions(+), 16 deletions(-)

New commits:
commit f497d1dc27b4fee3db1e2228647a00971922eb5f
Author:     Justin Luth <justin.luth at collabora.com>
AuthorDate: Tue Mar 31 14:49:13 2020 +0300
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Apr 3 10:06:18 2020 +0200

    tdf#131707 sw layout try2: ConsiderTextWrap on positioning
    
    rework 7.0 commit 1052acae9a599c54e518c8fc17d6a994d8778757
    
    jmux and I were working on related bugs at the same time.
    My patch happened to get committed before his. Since mine
    regressed, use jmux's version instead.
    
    This should fix tdf#119748 and tdf#123257
    
    Change-Id: I705d9f6c4ac81216c31009948cf1c9150017bbf3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91420
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/sw/qa/extras/layout/data/tdf131707_flyWrap.doc b/sw/qa/extras/layout/data/tdf131707_flyWrap.doc
new file mode 100755
index 000000000000..c32e5dafd924
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf131707_flyWrap.doc differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 2a24e68ccd35..70cf21c1ef8a 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2279,6 +2279,16 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf114163)
     // This failed, if the legend first label is not "Data3". The legend position is right.
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf131707)
+{
+    createDoc("tdf131707_flyWrap.doc");
+    xmlDocPtr pXmlDoc = parseLayoutDump();
+
+    assertXPath(pXmlDoc, "//body/tab/row[3]/cell[2]/txt/infos/bounds", "top", "2185");
+    // the image should be inside of the cell boundary - so the same top or higher
+    assertXPath(pXmlDoc, "//body/tab/row[3]/cell[2]/txt/anchored/fly/infos/bounds", "top", "2185");
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf125335)
 {
     SwDoc* pDoc = createDoc("tdf125335.odt");
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index a7ffd2c51920..c7424c95d4a8 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -702,8 +702,7 @@ SwFlyNotify::~SwFlyNotify()
         // #i54138# - suppress restart of the layout process
         // on changed frame height.
         // Note: It doesn't seem to be necessary and can cause layout loops.
-        // Also suppress on initial positioning - required to trigger text wrapping (tdf#119748).
-        if ( bPosChgd && maFrame.Pos().X() != FAR_AWAY )
+        if ( bPosChgd )
         {
             // indicate a restart of the layout process
             pFly->SetRestartLayoutProcess( true );
@@ -712,21 +711,21 @@ SwFlyNotify::~SwFlyNotify()
         {
             // lock position
             pFly->LockPosition();
+        }
 
-            if ( !pFly->ConsiderForTextWrap() )
-            {
-                // indicate that object has to be considered for text wrap
-                pFly->SetConsiderForTextWrap( true );
-                // invalidate 'background' in order to allow its 'background'
-                // to wrap around it.
-                pFly->NotifyBackground( pFly->GetPageFrame(),
-                                        pFly->GetObjRectWithSpaces(),
-                                        PrepareHint::FlyFrameArrive );
-                // invalidate position of anchor frame in order to force
-                // a re-format of the anchor frame, which also causes a
-                // re-format of the invalid previous frames of the anchor frame.
-                pFly->AnchorFrame()->InvalidatePos();
-            }
+        if ( !pFly->ConsiderForTextWrap() )
+        {
+            // indicate that object has to be considered for text wrap
+            pFly->SetConsiderForTextWrap( true );
+            // invalidate 'background' in order to allow its 'background'
+            // to wrap around it.
+            pFly->NotifyBackground( pFly->GetPageFrame(),
+                                    pFly->GetObjRectWithSpaces(),
+                                    PrepareHint::FlyFrameArrive );
+            // invalidate position of anchor frame in order to force
+            // a re-format of the anchor frame, which also causes a
+            // re-format of the invalid previous frames of the anchor frame.
+            pFly->AnchorFrame()->InvalidatePos();
         }
     }
 }


More information about the Libreoffice-commits mailing list