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

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Tue Apr 27 01:03:11 UTC 2021


 sw/source/core/layout/layact.cxx |   41 +++++++++------------------------------
 1 file changed, 10 insertions(+), 31 deletions(-)

New commits:
commit eadc7c4f0ba21d35fff09bb53e08e64194a65278
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Apr 16 20:18:22 2021 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Tue Apr 27 03:02:29 2021 +0200

    SW merge layout shortcut into the full layout code
    
    The shortcut codepath just skips a large part of the full layout
    code. To make this more obvious, this refactors the main layout
    loop by merging both paths, really skipping the code in the
    shortcut case and getting rid of all the duplicate code.
    
    Change-Id: I015202e86e75576f03901746e1a082e9f6811549
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114118
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>

diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index a54c20d6e7cf..422b8aee0c46 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -484,37 +484,13 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext)
         m_pOptTab = nullptr;
 
         // No Shortcut for Idle or CalcLayout
-        if ( !IsIdle() && !IsComplete() && IsShortCut( pPage ) )
-        {
-            m_pRoot->DeleteEmptySct();
-            if (lcl_isLayoutLooping()) return;
-            if ( !IsInterrupt() &&
-                 (m_pRoot->IsSuperfluous() || m_pRoot->IsAssertFlyPages()) )
-            {
-                if ( m_pRoot->IsAssertFlyPages() )
-                    m_pRoot->AssertFlyPages();
-                if ( m_pRoot->IsSuperfluous() )
-                {
-                    bool bOld = IsAgain();
-                    m_pRoot->RemoveSuperfluous();
-                    m_bAgain = bOld;
-                }
-                if (lcl_isLayoutLooping()) return;
-                pPage = static_cast<SwPageFrame*>(m_pRoot->Lower());
-                while ( pPage && !pPage->IsInvalid() && !pPage->IsInvalidFly() )
-                    pPage = static_cast<SwPageFrame*>(pPage->GetNext());
-                while ( pPage && pPage->GetNext() &&
-                        pPage->GetPhyPageNum() < nFirstPageNum )
-                    pPage = static_cast<SwPageFrame*>(pPage->GetNext());
-                continue;
-            }
-            break;
-        }
-        else
-        {
-            m_pRoot->DeleteEmptySct();
-            if (lcl_isLayoutLooping()) return;
+        const bool bTakeShortcut = !IsIdle() && !IsComplete() && IsShortCut(pPage);
+
+        m_pRoot->DeleteEmptySct();
+        if (lcl_isLayoutLooping()) return;
 
+        if (!bTakeShortcut)
+        {
             while ( !IsInterrupt() && !IsNextCycle() &&
                     ((pPage->GetSortedObjs() && pPage->IsInvalidFly()) || pPage->IsInvalid()) )
             {
@@ -630,7 +606,8 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext)
             }
             CheckIdleEnd();
         }
-        if ( !pPage && !IsInterrupt() &&
+
+        if ((bTakeShortcut || !pPage) && !IsInterrupt() &&
              (m_pRoot->IsSuperfluous() || m_pRoot->IsAssertFlyPages()) )
         {
             if ( m_pRoot->IsAssertFlyPages() )
@@ -649,6 +626,8 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext)
                     pPage->GetPhyPageNum() < nFirstPageNum )
                 pPage = static_cast<SwPageFrame*>(pPage->GetNext());
         }
+        else if (bTakeShortcut)
+            break;
     }
     if ( IsInterrupt() && pPage )
     {


More information about the Libreoffice-commits mailing list