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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 21 13:09:26 UTC 2021


 sw/source/core/layout/pagechg.cxx  |    2 +-
 sw/source/core/layout/paintfrm.cxx |    7 ++++---
 sw/source/core/layout/sectfrm.cxx  |    5 ++---
 3 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 2e6e87decdb87221a7b832958e03195b1d8fc133
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jun 21 13:18:00 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jun 21 15:08:47 2021 +0200

    replace dynamic_cast<SwLayoutFrame> with cheaper check
    
    Change-Id: I2102d27fe2b38e3787e39a2b7234991a57c30d99
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117578
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index d699d59ecb80..6fa74682c675 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -2085,7 +2085,7 @@ static void lcl_MoveAllLowers( SwFrame* pFrame, const Point& rOffset )
     lcl_MoveAllLowerObjs( pFrame, rOffset );
 
     // finally, for layout frames we have to call this function recursively:
-    if ( dynamic_cast< const SwLayoutFrame *>( pFrame ) !=  nullptr )
+    if ( pFrame && pFrame->IsLayoutFrame() )
     {
         SwFrame* pLowerFrame = pFrame->GetLower();
         while ( pLowerFrame )
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 2243f2084226..982cd95f98af 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2423,10 +2423,11 @@ void SwTabFramePainter::HandleFrame(const SwLayoutFrame& rLayoutFrame, const SwR
     const SwFrame* pLower = rLayoutFrame.Lower();
     while ( pLower )
     {
-        const SwLayoutFrame* pLowerLayFrame = dynamic_cast<const SwLayoutFrame*>(pLower);
-        if ( pLowerLayFrame && !pLowerLayFrame->IsTabFrame() )
+        if (pLower->IsLayoutFrame() && !pLower->IsTabFrame())
+        {
+            const SwLayoutFrame* pLowerLayFrame = static_cast<const SwLayoutFrame*>(pLower);
             HandleFrame(*pLowerLayFrame, rPaintArea);
-
+        }
         pLower = pLower->GetNext();
     }
 }
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index 079e7de2b264..052626d8ac82 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -1241,10 +1241,9 @@ class ExtraFormatToPositionObjs
                     pAnchoredObj->SetClearedEnvironment( false );
                 }
             }
-            SwLayoutFrame* pLayoutFrame = dynamic_cast<SwLayoutFrame*>(&rFrame);
-            if ( pLayoutFrame != nullptr )
+            if ( rFrame.IsLayoutFrame() )
             {
-                SwFrame* pLowerFrame = pLayoutFrame->GetLower();
+                SwFrame* pLowerFrame = rFrame.GetLower();
                 while ( pLowerFrame != nullptr )
                 {
                     InitObjs( *pLowerFrame );


More information about the Libreoffice-commits mailing list