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

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Wed May 20 07:32:28 UTC 2020


 sw/source/core/layout/tabfrm.cxx |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

New commits:
commit c71ebc0a9f0e8a35d7c315df68cc42159f909d41
Author:     Justin Luth <justin.luth at collabora.com>
AuthorDate: Thu May 7 14:43:17 2020 +0300
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed May 20 09:31:50 2020 +0200

    NFC sw layout: optimize assignment of bAllowSplitOfRow
    
    1.) Remove unnecessary test for !bDontSplit,
    since by definition, bTableRowKeep requires !bDontSplit
    
    const bool bDontSplit
    const bool bTableRowKeep = !bDontSplit && ...
    const bool bAllowSplitOfRow = bTableRowKeep && ...
    
    2.) Put the trivial !bPrevInd test first and so
    potentially avoid the non-trivial lookup of
    AreAllRowsKeepWithNext(pFirstNonHeadlineRow)
    
    3.) bAllowSplitOfRow by definition contains the two
    requirements of !bDontSplit and !pIndPrev,
    so pull out and test earlier - potentially avoiding further tests.
    This also emphasizes its similarity to bEmulateTableKeep.
    
    Change-Id: I41cb72aa03371eacfdb68d63dc3df21f85e755bb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93635
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 300232cefe17..b0376110a433 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -2380,18 +2380,15 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
         const SwRowFrame* pFirstNonHeadlineRow = GetFirstNonHeadlineRow();
         // #i120016# if this row wants to keep, allow split in case that all rows want to keep with next,
         // the table can not move forward as it is the first one and a split is in general allowed.
-        const bool bAllowSplitOfRow = ( bTableRowKeep &&
-                                        AreAllRowsKeepWithNext( pFirstNonHeadlineRow ) ) &&
-                                      !pIndPrev &&
-                                      !bDontSplit;
+        const bool bAllowSplitOfRow = bTableRowKeep && !pIndPrev && AreAllRowsKeepWithNext(pFirstNonHeadlineRow);
         // tdf91083 MSCompat: this extends bAllowSplitOfRow (and perhaps should just replace it).
         // If the kept-together items cannot move to a new page, a table split is in general allowed.
         const bool bEmulateTableKeepSplitAllowed =  bEmulateTableKeep && !IsKeepFwdMoveAllowed(/*IgnoreMyOwnKeepValue=*/true);
 
         if ( pFirstNonHeadlineRow && nUnSplitted > 0 &&
-             ( bEmulateTableKeepSplitAllowed ||
+             ( bEmulateTableKeepSplitAllowed || bAllowSplitOfRow ||
                ( ( !bTableRowKeep || pFirstNonHeadlineRow->GetNext() ||
-                   !pFirstNonHeadlineRow->ShouldRowKeepWithNext() || bAllowSplitOfRow
+                   !pFirstNonHeadlineRow->ShouldRowKeepWithNext()
                  ) && ( !bDontSplit || !pIndPrev )
            ) ) )
         {


More information about the Libreoffice-commits mailing list