sw/source/core/inc/cntfrm.hxx    |   11 +++++++++++
 sw/source/core/layout/tabfrm.cxx |    6 +++---
 2 files changed, 14 insertions(+), 3 deletions(-)

New commits:
commit 9c7171a1aa94068fd9df3f5dc47f836a95d27546
Author:     Don Lewis <truck...@apache.org>
AuthorDate: Wed Aug 1 04:58:36 2018 +0000
Commit:     Don Lewis <truck...@apache.org>
CommitDate: Wed Aug 1 04:58:36 2018 +0000

    Fix SwCntntFrm::CalcLowers() so that it visits all on-page objects.
    
    SwCntntFrm::CalcLowers() walks the object tree walk and it assumes
    that the objects visited will be at a monotonically increasing
    distance from the top of the page, so it terminates the walk once
    it encounters the first object below the bottom of the page.  Even
    though the objects are vertically sorted in each branch of the tree,
    there is no guarantee that the order of the objects visited in the
    depth-first walk will be perfectly sorted vertically, so the walk
    may terminate before visiting all of the objects on the page.  Fix
    this problem by pruning branches when they cross the lower page
    boundary and only terminating the walk once there are no longer any
    paths forward.

diff --git a/sw/source/core/inc/cntfrm.hxx b/sw/source/core/inc/cntfrm.hxx
index d3ace06bca53..7ee16e55b539 100644
--- a/sw/source/core/inc/cntfrm.hxx
+++ b/sw/source/core/inc/cntfrm.hxx
@@ -103,6 +103,7 @@ public:
     sal_Bool MoveFtnCntFwd( sal_Bool, SwFtnBossFrm* );//von MoveFwd gerufen 
bei Ftn-Inhalt
 
     inline  SwCntntFrm* GetNextCntntFrm() const;
+    inline  SwCntntFrm* GetNextCntntFrm( bool ) const;
     inline  SwCntntFrm* GetPrevCntntFrm() const;
     static bool CalcLowers( SwLayoutFrm* pLay, const SwLayoutFrm* pDontLeave, 
long nBottom, bool bSkipRowSpanCells );
     void RegisterToNode( SwCntntNode& );
@@ -117,6 +118,16 @@ inline SwCntntFrm* SwCntntFrm::GetNextCntntFrm() const
         return (SwCntntFrm*)ImplGetNextCntntFrm( true );
 }
 
+inline SwCntntFrm* SwCntntFrm::GetNextCntntFrm( bool bPrune ) const
+{
+    if ( bPrune && !GetPrev() )
+        return NULL;
+    else if ( bPrune || !(GetNext() && GetNext()->IsCntntFrm()))
+        return (SwCntntFrm*)ImplGetNextCntntFrm( true );
+    else
+        return (SwCntntFrm*)GetNext();
+}
+
 inline SwCntntFrm* SwCntntFrm::GetPrevCntntFrm() const
 {
     if ( GetPrev() && GetPrev()->IsCntntFrm() )
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index ae435dfb4287..18fc3843f618 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -1536,6 +1536,7 @@ bool SwCntntFrm::CalcLowers( SwLayoutFrm* pLay, const 
SwLayoutFrm* pDontLeave,
     // LONG_MAX == nBottom means we have to calculate all
     bool bAll = LONG_MAX == nBottom;
     bool bRet = sal_False;
+    bool bPrune;
     SwCntntFrm *pCnt = pLay->ContainsCntnt();
     SWRECTFN( pLay )
 
@@ -1612,9 +1613,8 @@ bool SwCntntFrm::CalcLowers( SwLayoutFrm* pLay, const 
SwLayoutFrm* pDontLeave,
             pCnt->GetUpper()->Calc();
         }
         // <--
-        if( ! bAll && (*fnRect->fnYDiff)((pCnt->Frm().*fnRect->fnGetTop)(), 
nBottom) > 0 )
-            break;
-        pCnt = pCnt->GetNextCntntFrm();
+        bPrune = !bAll && ( 
(*fnRect->fnYDiff)((pCnt->Frm().*fnRect->fnGetTop)(), nBottom) > 0 );
+        pCnt = pCnt->GetNextCntntFrm( bPrune );
     }
     return bRet;
 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to