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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Fri May 3 10:05:23 UTC 2019


 dev/null                           |binary
 sw/qa/extras/uiwriter/uiwriter.cxx |   27 --------------
 sw/source/core/layout/findfrm.cxx  |    8 ----
 sw/source/core/layout/flowfrm.cxx  |    9 +---
 sw/source/core/layout/tabfrm.cxx   |   67 +++++++++----------------------------
 5 files changed, 21 insertions(+), 90 deletions(-)

New commits:
commit 93fd7ddf70046916885f76b51e9265d58a701892
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Tue Mar 26 00:48:12 2019 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri May 3 12:01:58 2019 +0200

    tdf#114306: Revert commits fixing this issue ( 6.1 only )
    
    Revert "tdf#114306 fix crash caused by special document 2"
    
    This reverts commit d30eefb677b446886f7b5bab6de93d489ba63529.
    
    Revert "tdf#114306 fix crash caused by special document"
    
    This reverts commit e4400f4c4e267f8528df3a7d5a09623c888bd10c.
    
    Revert "tdf#114306 fix unexpected page break in row-spanned table"
    
    This reverts commit 18765b9fa739337d2d891513f6e2fb7c3ce23b50
    
    Reviewed-on: https://gerrit.libreoffice.org/69848
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    (cherry picked from commit f15146021b722dda0cf10cb08de6e0a3c525168a)
    
    Change-Id: Ifff799616f12ee428a3f923f6510b20059f5bc71

diff --git a/sw/qa/extras/uiwriter/data/fdo114306.odt b/sw/qa/extras/uiwriter/data/fdo114306.odt
deleted file mode 100755
index 5a7d2f9ca864..000000000000
Binary files a/sw/qa/extras/uiwriter/data/fdo114306.odt and /dev/null differ
diff --git a/sw/qa/extras/uiwriter/data/fdo114306_2.odt b/sw/qa/extras/uiwriter/data/fdo114306_2.odt
deleted file mode 100755
index b4bebc58add5..000000000000
Binary files a/sw/qa/extras/uiwriter/data/fdo114306_2.odt and /dev/null differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 2140b0dda3df..6d10cc17c369 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -297,8 +297,6 @@ public:
     void testTdf99689TableOfTables();
     void testTdf112448();
     void testTdf113790();
-    void testTdf114306();
-    void testTdf114306_2();
     void testTdf114536();
     void testTdf115065();
     void testTdf115013();
@@ -478,8 +476,6 @@ public:
     CPPUNIT_TEST(testTdf99689TableOfTables);
     CPPUNIT_TEST(testTdf112448);
     CPPUNIT_TEST(testTdf113790);
-    CPPUNIT_TEST(testTdf114306);
-    CPPUNIT_TEST(testTdf114306_2);
     CPPUNIT_TEST(testTdf114536);
     CPPUNIT_TEST(testTdf115065);
     CPPUNIT_TEST(testTdf115013);
@@ -5373,29 +5369,6 @@ void SwUiWriterTest::testTdf112025()
     CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xStyle, "IsLandscape"));
 }
 
-void SwUiWriterTest::testTdf114306()
-{
-    load(DATA_DIRECTORY, "fdo114306.odt");
-    xmlDocPtr pXmlDoc = parseLayoutDump();
-
-    // There are 2 long paragraphs in cell A1.
-    // A part of paragraph 2 should flow over to the second page but
-    // *not* the whole paragraph. There should be 2 paragraphs on
-    // page 1 and 1 paragraph on page 2.
-    assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row[1]/cell[1]/txt", 2);
-    assertXPath(pXmlDoc, "/root/page[2]/body/tab[1]/row[1]/cell[1]/txt", 1);
-}
-
-void SwUiWriterTest::testTdf114306_2()
-{
-    // tdf#114306 fix unexpected page break in row-spanned table
-    // load regression document without writer crash
-    load(DATA_DIRECTORY, "fdo114306_2.odt");
-
-    // correct number of pages
-    CPPUNIT_ASSERT_EQUAL(4, getPages());
-}
-
 void SwUiWriterTest::testTdf108524()
 {
     createDoc("tdf108524.odt");
diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx
index daccef43edcc..3a3607934481 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -1303,14 +1303,8 @@ bool SwFrame::IsMoveable( const SwLayoutFrame* _pLayoutFrame ) const
                   _pLayoutFrame->IsInDocBody() ||
                   _pLayoutFrame->IsInFootnote() )
         {
-            // If IsMovable() is called before a MoveFwd() the method
-            // may return false if there is no NextCellLeaf. If
-            // IsMovable() is called before a MoveBwd() the method may
-            // return false if there is no PrevCellLeaf.
             if ( _pLayoutFrame->IsInTab() && !IsTabFrame() &&
-                 ( !IsContentFrame() || (!const_cast<SwFrame*>(this)->GetNextCellLeaf()
-                                      && !const_cast<SwFrame*>(this)->GetPrevCellLeaf()) )
-                )
+                 ( !IsContentFrame() || !const_cast<SwFrame*>(this)->GetNextCellLeaf() ) )
             {
                 bRetVal = false;
             }
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index 78b78e61b8e9..83043c78278f 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -2021,19 +2021,14 @@ bool SwFlowFrame::MoveBwd( bool &rbReformat )
         const SwLayoutFrame* pUpperFrame = m_rThis.GetUpper();
         while ( pUpperFrame )
         {
-            if ( pUpperFrame->IsTabFrame() || pUpperFrame->IsRowFrame() )
+            if ( pUpperFrame->IsTabFrame() )
             {
                 return false;
             }
             // If the text frame is a follow-section-in-table, that can move
             // backward as well.
             bool bIsFollowSection = pUpperFrame->IsSctFrame() && static_cast<const SwSectionFrame*>(pUpperFrame)->GetPrecede();
-
-            // If the text frame is a follow-in-table, that can move
-            // backward as well.
-            bool bIsFollow = const_cast<SwLayoutFrame*>(pUpperFrame)->GetPrevCellLeaf();
-
-            if ( ( pUpperFrame->IsColumnFrame() && pUpperFrame->IsInSct() ) || bIsFollowSection || bIsFollow )
+            if ( ( pUpperFrame->IsColumnFrame() && pUpperFrame->IsInSct() ) || bIsFollowSection )
             {
                 break;
             }
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 52cb1fdb91ff..ad30bd1d0342 100755
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -173,7 +173,7 @@ void SwTabFrame::RegistFlys()
 }
 
 void SwInvalidateAll( SwFrame *pFrame, long nBottom );
-static bool lcl_RecalcRow( SwRowFrame* pRow, long nBottom );
+static void lcl_RecalcRow( SwRowFrame& rRow, long nBottom );
 static bool lcl_ArrangeLowers( SwLayoutFrame *pLay, long lYStart, bool bInva );
 // #i26945# - add parameter <_bOnlyRowsAndCells> to control
 // that only row and cell frames are formatted.
@@ -299,7 +299,7 @@ static void lcl_InvalidateLowerObjs( SwLayoutFrame& _rLayoutFrame,
     }
 }
 
-// Local helper function to shrink all lowers of pRow to 0 height
+// Local helper function to shrink all lowers of rRow to 0 height
 static void lcl_ShrinkCellsAndAllContent( SwRowFrame& rRow )
 {
     SwCellFrame* pCurrMasterCell = static_cast<SwCellFrame*>(rRow.Lower());
@@ -691,7 +691,7 @@ static bool lcl_RecalcSplitLine( SwRowFrame& rLastLine, SwRowFrame& rFollowLine,
     rLastLine.SetInSplit();
 
     // Do the recalculation
-    lcl_RecalcRow( &rLastLine, LONG_MAX );
+    lcl_RecalcRow( rLastLine, LONG_MAX );
     // #115759# - force a format of the last line in order to
     // get the correct height.
     rLastLine.InvalidateSize();
@@ -1565,8 +1565,7 @@ static bool lcl_InnerCalcLayout( SwFrame *pFrame,
     return bRet;
 }
 
-// returns false if pRow is invalid
-static bool lcl_RecalcRow( SwRowFrame* pRow, long nBottom )
+static void lcl_RecalcRow( SwRowFrame& rRow, long nBottom )
 {
     // FME 2007-08-30 #i81146# new loop control
     int nLoopControlRuns_1 = 0;
@@ -1580,14 +1579,14 @@ static bool lcl_RecalcRow( SwRowFrame* pRow, long nBottom )
         int nLoopControlRuns_2 = 0;
         sal_uInt16 nLoopControlStage_2 = 0;
 
-        while( lcl_InnerCalcLayout( pRow, nBottom ) )
+        while( lcl_InnerCalcLayout( &rRow, nBottom ) )
         {
             if ( ++nLoopControlRuns_2 > nLoopControlMax )
             {
                 SAL_WARN_IF(nLoopControlStage_2 == 0, "sw.layout", "LoopControl_2 in lcl_RecalcRow: Stage 1!");
                 SAL_WARN_IF(nLoopControlStage_2 == 1, "sw.layout", "LoopControl_2 in lcl_RecalcRow: Stage 2!!");
                 SAL_WARN_IF(nLoopControlStage_2 >= 2, "sw.layout", "LoopControl_2 in lcl_RecalcRow: Stage 3!!!");
-                pRow->ValidateThisAndAllLowers( nLoopControlStage_2++ );
+                rRow.ValidateThisAndAllLowers( nLoopControlStage_2++ );
                 nLoopControlRuns_2 = 0;
                 if( nLoopControlStage_2 > 2 )
                     break;
@@ -1600,39 +1599,14 @@ static bool lcl_RecalcRow( SwRowFrame* pRow, long nBottom )
         {
             // #115759# - force another format of the
             // lowers, if at least one of it was invalid.
-
-            // tdf#114306 writer may crash because pRow points to a deleted SwRowFrame
-            SwRowFrame* pOriginalRow = pRow;
-            OSL_ENSURE(pOriginalRow->GetUpper() && pOriginalRow->GetUpper()->IsTabFrame(), "No table");
-            SwTabFrame* pOriginalTab = static_cast<SwTabFrame*>(pRow->GetUpper());
-
-            bCheck = SwContentFrame::CalcLowers( pRow, pRow->GetUpper(), nBottom, true );
-
-            bool bRowStillExists = false;
-            SwFrame* pTestRow = pOriginalTab->Lower();
-
-            while (pTestRow)
-            {
-                if (pTestRow == pRow)
-                {
-                    bRowStillExists = true;
-                    break;
-                }
-                pTestRow = pTestRow->GetNext();
-            }
-
-            if (!bRowStillExists)
-            {
-                SAL_WARN("sw.layout", "no row anymore at " << pRow);
-                return false;
-            }
+            bCheck = SwContentFrame::CalcLowers( &rRow, rRow.GetUpper(), nBottom, true );
 
             // NEW TABLES
             // First we calculate the cells with row span of < 1, afterwards
             // all cells with row span of > 1:
             for ( int i = 0; i < 2; ++i )
             {
-                SwCellFrame* pCellFrame = static_cast<SwCellFrame*>(pRow->Lower());
+                SwCellFrame* pCellFrame = static_cast<SwCellFrame*>(rRow.Lower());
                 while ( pCellFrame )
                 {
                     const bool bCalc = 0 == i ?
@@ -1658,7 +1632,7 @@ static bool lcl_RecalcRow( SwRowFrame* pRow, long nBottom )
                     SAL_WARN_IF(nLoopControlStage_1 == 0, "sw.layout", "LoopControl_1 in lcl_RecalcRow: Stage 1!");
                     SAL_WARN_IF(nLoopControlStage_1 == 1, "sw.layout", "LoopControl_1 in lcl_RecalcRow: Stage 2!!");
                     SAL_WARN_IF(nLoopControlStage_1 >= 2, "sw.layout", "LoopControl_1 in lcl_RecalcRow: Stage 3!!!");
-                    pRow->ValidateThisAndAllLowers( nLoopControlStage_1++ );
+                    rRow.ValidateThisAndAllLowers( nLoopControlStage_1++ );
                     nLoopControlRuns_1 = 0;
                     if( nLoopControlStage_1 > 2 )
                         break;
@@ -1668,8 +1642,7 @@ static bool lcl_RecalcRow( SwRowFrame* pRow, long nBottom )
             }
         }
         break;
-    } while (true);
-    return true;
+    } while( true );
 }
 
 static void lcl_RecalcTable( SwTabFrame& rTab,
@@ -1684,7 +1657,7 @@ static void lcl_RecalcTable( SwTabFrame& rTab,
             rNotify.SetLowersComplete( true );
         }
         ::SwInvalidatePositions( pFirstRow, LONG_MAX );
-        lcl_RecalcRow( static_cast<SwRowFrame*>(pFirstRow), LONG_MAX );
+        lcl_RecalcRow( static_cast<SwRowFrame&>(*pFirstRow), LONG_MAX );
     }
 }
 
@@ -2149,7 +2122,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
                             {
                                 ::SwInvalidateAll( pLastLine, LONG_MAX );
                                 SetRebuildLastLine( true );
-                                lcl_RecalcRow( static_cast<SwRowFrame*>(pLastLine), LONG_MAX );
+                                lcl_RecalcRow( static_cast<SwRowFrame&>(*pLastLine), LONG_MAX );
                                 SetRebuildLastLine( false );
                             }
 
@@ -2272,7 +2245,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
                 }
                 else if (m_bONECalcLowers)
                 {
-                    lcl_RecalcRow( static_cast<SwRowFrame*>(Lower()), LONG_MAX );
+                    lcl_RecalcRow( static_cast<SwRowFrame&>(*Lower()), LONG_MAX );
                     m_bONECalcLowers = false;
                 }
             }
@@ -2295,7 +2268,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
             }
             else if (m_bONECalcLowers)
             {
-                lcl_RecalcRow( static_cast<SwRowFrame*>(Lower()), LONG_MAX );
+                lcl_RecalcRow( static_cast<SwRowFrame&>(*Lower()), LONG_MAX );
                 m_bONECalcLowers = false;
             }
 
@@ -2352,7 +2325,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
 
             // 1. Try: bTryToSplit = true  => Try to split the row.
             // 2. Try: bTryToSplit = false => Split the table between the rows.
-            if ((pFirstNonHeadlineRow && pFirstNonHeadlineRow->GetNext()) || bTryToSplit )
+            if ( pFirstNonHeadlineRow->GetNext() || bTryToSplit )
             {
                 SwTwips nDeadLine = aRectFnSet.GetPrtBottom(*GetUpper());
                 if( IsInSct() || GetUpper()->IsInTab() ) // TABLE IN TABLE)
@@ -2361,11 +2334,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
 
                 {
                     SetInRecalcLowerRow( true );
-                    SwRowFrame* pRow = static_cast<SwRowFrame*>(Lower());
-                    if (!lcl_RecalcRow(pRow, nDeadLine))
-                    {
-                        pFirstNonHeadlineRow = GetFirstNonHeadlineRow();
-                    }
+                    ::lcl_RecalcRow( static_cast<SwRowFrame&>(*Lower()), nDeadLine );
                     SetInRecalcLowerRow( false );
                 }
                 m_bLowersFormatted = true;
@@ -2465,7 +2434,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
                     // to nDeadLine may not be enough.
                     if ( bSplitError && bTryToSplit ) // no restart if we did not try to split: i72847, i79426
                     {
-                        lcl_RecalcRow( static_cast<SwRowFrame*>(Lower()), LONG_MAX );
+                        lcl_RecalcRow( static_cast<SwRowFrame&>(*Lower()), LONG_MAX );
                         setFrameAreaPositionValid(false);
                         bTryToSplit = false;
                         continue;
@@ -2506,7 +2475,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
                             // its content.
                             const bool bOldJoinLock =  GetFollow()->IsJoinLocked();
                             GetFollow()->LockJoin();
-                            ::lcl_RecalcRow( static_cast<SwRowFrame*>(GetFollow()->Lower()),
+                            ::lcl_RecalcRow( static_cast<SwRowFrame&>(*GetFollow()->Lower()),
                                              fnRectX.GetBottom(GetFollow()->GetUpper()->getFrameArea()) );
                             // #i43913#
                             // #i63632# Do not unlock the


More information about the Libreoffice-commits mailing list