sd/source/core/stlsheet.cxx |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 596ac57136a28bfacc89764ed3b1a7933f20a0f7
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Mon Oct 14 12:17:44 2024 +0100
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Oct 17 11:10:50 2024 +0200

    shave some time off SdStyleSheet::setParentStyle
    
    much of the time the construction of curMaster isn't needed
    
    a similar mega-master-page scenario as reported in tdf#158773
    
    50s -> 48s
    
    Change-Id: Iedb1d0cf189eec7a9abca1836295d7afacdc301c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174896
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    (cherry picked from commit 0ab83b467e39d03953178f83f03b2fe4c4c9b6e5)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175032
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index e262e7a713ff..9a47edf3fc1a 100644
--- a/sd/source/core/stlsheet.cxx
+++ b/sd/source/core/stlsheet.cxx
@@ -961,13 +961,18 @@ void SAL_CALL SdStyleSheet::setParentStyle( const 
OUString& rParentName  )
         {
             // we hope that we have only sd style sheets
             SdStyleSheet* pSdStyleSheet = static_cast<SdStyleSheet*>(pStyle);
+
+            // check that the master msApiName matches, as msApiName exists 
once per
+            // master page
+            if (pSdStyleSheet->msApiName != rParentName)
+                continue;
+
             OUString const curName(pStyle->GetName());
             sal_Int32 const curSep(curName.indexOf(SD_LT_SEPARATOR));
             OUString const curMaster((curSep == -1)
                     ? OUString() : curName.copy(0, curSep));
-            // check that the master matches, as msApiName exists once per
-            // master page
-            if (pSdStyleSheet->msApiName == rParentName && master == curMaster)
+            // check that the master matches
+            if (master == curMaster)
             {
                 if( pStyle != this )
                 {

Reply via email to