[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sw/qa sw/source

Dennis Francis (via logerrit) logerrit at kemper.freedesktop.org
Wed Dec 4 16:41:05 UTC 2019


 sw/qa/extras/layout/data/tdf105481.odt |binary
 sw/qa/extras/layout/layout.cxx         |   63 +++++++++++++++++++++++++++++++++
 sw/source/core/text/frmform.cxx        |    3 -
 3 files changed, 64 insertions(+), 2 deletions(-)

New commits:
commit 7dd84a761202097c3afda7fe8296604791b58d2f
Author:     Dennis Francis <dennis.francis at collabora.com>
AuthorDate: Sun Nov 24 16:09:47 2019 +0530
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Dec 4 17:40:23 2019 +0100

    tdf#105481 : Do not skip invalidation of as-char anchored objects
    
    inside a growing text-frame after doing recalc of positions of
    other frames (visually above current) in the tree. Otherwise
    the as-char anchored objects gets wrong reference (base) position
    (more accurately the base Y position) and hence get displayed at
    wrong vertical positions (in case of the bug document, it goes
    out of the page area).
    
    Some notes about the bug:
    
    Above mentioned problem is visible (at least) when you have a frame
    anchored to the bottom of the page with auto-height and it contains
    one or more <text:p> with at least one of them having a draw object
    like a shape or math formula with 'as-char' anchoring. Only the
    draw object in the last <text:p> is affected by the bug possibly
    because this text-frame is the cause of growth of the parent (upper)
    frame.
    
    Change-Id: If968c8c00aa57d26b1000e3250b352b24df47cf6
    Reviewed-on: https://gerrit.libreoffice.org/83603
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    (cherry picked from commit 318229900fe6d30d9b82256d908dadda8b2f4d61)
    Reviewed-on: https://gerrit.libreoffice.org/84260

diff --git a/sw/qa/extras/layout/data/tdf105481.odt b/sw/qa/extras/layout/data/tdf105481.odt
new file mode 100644
index 000000000000..73cd892620a6
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf105481.odt differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index d1517323b581..70dd29b73cc1 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -3454,6 +3454,69 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128399)
     CPPUNIT_ASSERT_EQUAL(nExpected, aPosition.nNode.GetIndex());
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf105481)
+{
+    createDoc("tdf105481.odt");
+    xmlDocPtr pXmlDoc = parseLayoutDump();
+    CPPUNIT_ASSERT(pXmlDoc);
+
+    // Without the accompanying fix in place, this test would have failed
+    // because the vertical position of the as-char shape object and the
+    // as-char math object will be wrong (below/beyond the text frame's bottom).
+
+    SwTwips nTxtTop = getXPath(pXmlDoc,
+                               "/root/page/anchored/fly/txt[2]"
+                               "/infos/bounds",
+                               "top")
+                          .toInt32();
+    SwTwips nTxtBottom = nTxtTop
+                         + getXPath(pXmlDoc,
+                                    "/root/page/anchored/fly/txt[2]"
+                                    "/infos/bounds",
+                                    "height")
+                               .toInt32();
+
+    SwTwips nFormula1Top = getXPath(pXmlDoc,
+                                    "/root/page/anchored/fly/txt[2]"
+                                    "/anchored/fly[1]/infos/bounds",
+                                    "top")
+                               .toInt32();
+    SwTwips nFormula1Bottom = nFormula1Top
+                              + getXPath(pXmlDoc,
+                                         "/root/page/anchored/fly/txt[2]"
+                                         "/anchored/fly[1]/infos/bounds",
+                                         "height")
+                                    .toInt32();
+
+    SwTwips nFormula2Top = getXPath(pXmlDoc,
+                                    "/root/page/anchored/fly/txt[2]"
+                                    "/anchored/fly[2]/infos/bounds",
+                                    "top")
+                               .toInt32();
+    SwTwips nFormula2Bottom = nFormula2Top
+                              + getXPath(pXmlDoc,
+                                         "/root/page/anchored/fly/txt[2]"
+                                         "/anchored/fly[2]/infos/bounds",
+                                         "height")
+                                    .toInt32();
+
+    // Ensure that the two formula positions are at least between top and bottom of the text frame.
+    // The below two are satisfied even without the fix.
+    CPPUNIT_ASSERT_GREATEREQUAL(nTxtTop, nFormula1Top);
+    CPPUNIT_ASSERT_GREATEREQUAL(nTxtTop, nFormula2Top);
+
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected less than or equal to : 14423
+    // - Actual  : 14828
+    // that is, the formula is below the text-frame's y bound.
+    CPPUNIT_ASSERT_LESSEQUAL(nTxtBottom, nFormula1Bottom);
+    // Similarly for formula # 2 :
+    // - Expected less than or equal to : 14423
+    // - Actual  : 15035
+    // that is, the formula is below the text-frame's y bound.
+    CPPUNIT_ASSERT_LESSEQUAL(nTxtBottom, nFormula2Bottom);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 37543c700b76..752e82cb1663 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -436,8 +436,7 @@ void SwTextFrame::AdjustFrame( const SwTwips nChgHght, bool bHasToFit )
                 MakePos();
                 if ( aOldPos != getFrameArea().Pos() )
                 {
-                    // i#28701 - No format is performed for the floating screen objects.
-                    InvalidateObjs();
+                    InvalidateObjs(false);
                 }
             }
             nChgHeight = 0;


More information about the Libreoffice-commits mailing list