framework/source/layoutmanager/helpers.cxx |    6 ++++++
 sc/source/core/data/table2.cxx             |   23 ++++++++++++++++++-----
 sc/source/ui/view/viewdata.cxx             |    7 ++++++-
 sfx2/source/sidebar/DeckLayouter.cxx       |    7 ++++++-
 sfx2/source/sidebar/SidebarController.cxx  |    9 +++++++--
 sfx2/source/sidebar/TabBar.cxx             |    5 +++++
 sfx2/source/view/lokhelper.cxx             |    3 +++
 7 files changed, 51 insertions(+), 9 deletions(-)

New commits:
commit 129a42fd08850226eb3eed0dce2fb923b4d48697
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Fri Jan 22 21:10:49 2021 +0000
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Mon Apr 5 20:26:56 2021 +0100

    lok: avoid expensive fetching of a property.
    
    --doc_setView
       SfxLokHelper::setView
       SfxViewFrame::MakeActive_Impl
       SfxApplication::SetViewFrame_Impl
       |
        --SfxDispatcher::Update_Impl
                  |
                   --SfxWorkWindow::UpdateObjectBars_Impl
                     SfxWorkWindow::UpdateObjectBars_Impl2
                     |
                      --framework::LayoutManager::requestElement
                        framework::LayoutManager::createElement
                        |
                        --11.97%--framework::implts_isPreviewModel
    
    We re-calculate the calc print-area on every setView via this
    code-path; pointlessly expensive.
    
    Change-Id: I36dbdc60a789fac4e2a82825b145725a4a4d6439
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109805
    Tested-by: Jenkins
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>

diff --git a/framework/source/layoutmanager/helpers.cxx 
b/framework/source/layoutmanager/helpers.cxx
index 7c620b699fcd..f5fe1fc48f44 100644
--- a/framework/source/layoutmanager/helpers.cxx
+++ b/framework/source/layoutmanager/helpers.cxx
@@ -28,6 +28,7 @@
 #include <com/sun/star/awt/XWindowListener.hpp>
 #include <com/sun/star/ui/XUIElement.hpp>
 
+#include <comphelper/lok.hxx>
 #include <unotools/mediadescriptor.hxx>
 #include <vcl/svapp.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
@@ -261,6 +262,11 @@ uno::Reference< frame::XModel > impl_getModelFromFrame( 
const uno::Reference< fr
 
 bool implts_isPreviewModel( const uno::Reference< frame::XModel >& xModel )
 {
+    // the cost in calc of calling getArgs for this property
+    // includes measuring the entire sheet - which is extremely slow.
+    if (comphelper::LibreOfficeKit::isActive())
+        return false;
+
     if ( xModel.is() )
     {
         utl::MediaDescriptor aDesc( xModel->getArgs() );
commit 2519a7d1392ecec9bd8027117bb02b08fb7bcfa8
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Fri Jan 22 21:17:25 2021 +0000
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Mon Apr 5 20:26:56 2021 +0100

    sc: GetRowForHeight performance improvement.
    
    Instead of just skipping hidden rows, either skip or interpolate
    into visible ones.
    
    This method, and it's single caller look rather unusual to me. It is
    unclear why we would want to return the results we do, and why the
    one caller subtracts a row.
    
    Some surprising proportion of tile rendering was exercising this code
    path extremely slowly.
    
    --5.94%--ScDocument::GetPrintArea
              |
              |--5.04%--ScDrawLayer::GetPrintArea
              |          ScTable::GetRowForHeight
              |          |
              |           --4.58%--ScFlatBoolRowSegments::getRangeData
              |                     |
              |                      --2.46%--ScFlatSegmentsImpl<bool, 
bool>::getRangeData
    
    Change-Id: I75418d6af59a33b99e8bb0c374139e1a4ee6ef87
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109837
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Tested-by: Michael Meeks <michael.me...@collabora.com>
    Reviewed-by: Ashod Nakashian <a...@collabora.com>
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109848
    Tested-by: Jenkins

diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 02a9ad19cbaf..33ca0d85128f 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -3998,16 +3998,25 @@ SCROW ScTable::GetRowForHeight(sal_uLong nHeight) const
                 break;
         }
 
-        nSum += aRowHeightRange.mnValue;
+        // find the last common row between hidden & height spans
+        SCROW nLastCommon = std::min(aData.mnRow2, aRowHeightRange.mnRow2);
+        assert (nLastCommon >= nRow);
+        SCROW nCommon = nLastCommon - nRow + 1;
 
-        if (nSum > nHeight)
+        // how much further to go ?
+        sal_uLong nPixelsLeft = nHeight - nSum;
+        sal_uLong nCommonPixels = aRowHeightRange.mnValue * nCommon;
+
+        // are we in the zone ?
+        if (nCommonPixels > nPixelsLeft)
         {
+            nRow += (nPixelsLeft + aRowHeightRange.mnValue - 1) / 
aRowHeightRange.mnValue;
+
+            // FIXME: finding this next row is far from elegant,
+            // we have a single caller, which subtracts one as well(!?)
             if (nRow >= rDocument.MaxRow())
                 return rDocument.MaxRow();
 
-            // Find the next visible row.
-            ++nRow;
-
             if (!mpHiddenRows->getRangeData(nRow, aData))
                 // Failed to fetch the range data for whatever reason.
                 break;
@@ -4018,6 +4027,10 @@ SCROW ScTable::GetRowForHeight(sal_uLong nHeight) const
 
             return nRow <= rDocument.MaxRow() ? nRow : rDocument.MaxRow();
         }
+
+        // skip the range and keep hunting
+        nSum += nCommonPixels;
+        nRow = nLastCommon;
     }
     return -1;
 }
commit 4f5d9dab387217ea57f299c8ba596857f3af074e
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Sun Jan 24 04:10:41 2021 +0000
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Mon Apr 5 20:26:56 2021 +0100

    lok: avoid a set of invalidations per view on re-size.
    
    Unfortunate to have N^2 invalidations in the number of views on
    resize - particularly for calc, when you re-size/wrap-text on a
    row during editing.
    
    Change-Id: I93f75c4543ad072684e5575a2cbe0e8abcab0d80
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109913
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112094
    Tested-by: Jenkins
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>

diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index f86b69a8af29..295bc59a70dd 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -530,7 +530,10 @@ void 
SfxLokHelper::notifyDocumentSizeChangedAllViews(vcl::ITiledRenderable* pDoc
         // Should we then do this for all views of all open documents
         // or not?
         if (pCurrentViewShell == nullptr || pViewShell->GetDocId() == 
pCurrentViewShell-> GetDocId())
+        {
             SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pDoc, 
bInvalidateAll);
+            bInvalidateAll = false; // we direct invalidations to all views 
anyway.
+        }
         pViewShell = SfxViewShell::GetNext(*pViewShell);
     }
 }
commit 442d510afaeb16d9745d7a8e138e8c9aed953df1
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Wed Mar 24 15:38:59 2021 +0100
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Mon Apr 5 20:26:56 2021 +0100

    Avoid infinite loop in AddPixelsWhile when removing Sheet
    
    When 2 sessions in online were used:
    A was in chart editing mode in the last sheet
    B removed last sheet
    
    infinite loop occured as GetRowHeight returned 0 due
    to invalid tab number.
    
    Change-Id: If5c4ba583dfb1154ff44e0bf651a098fa78bafda
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113044
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>

diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index c389c6d34f2b..0ad17c2ace93 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -4030,7 +4030,12 @@ void ScViewData::AddPixelsWhile( tools::Long & rScrY, 
tools::Long nEndPixels, SC
         if (nHeightEndRow > nEndRow)
             nHeightEndRow = nEndRow;
         if (!nHeight)
-            nRow = nHeightEndRow + 1;
+        {
+            if (ValidTab(nTabNo) && nTabNo <= pDoc->GetMaxTableNumber())
+                nRow = nHeightEndRow + 1;
+            else
+                break;
+        }
         else
         {
             SCROW nRows = nHeightEndRow - nRow + 1;
commit 28d4b28501a3ec5e0429f82dd894c0d57f29f279
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Mon Mar 29 09:18:07 2021 -0400
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Mon Apr 5 20:26:56 2021 +0100

    lok: fix nullptr de-reference
    
    Change-Id: I8a9a7444d66e5e6449a0215bde174253a41f09b3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113317
    Tested-by: Jenkins
    Reviewed-by: Henry Castro <hcas...@collabora.com>
    (cherry picked from commit 949085b12a8a57b2257f4e59cc597e4c59b42f76)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113285
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>

diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index 39900e95b216..636c63a3ef22 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -244,7 +244,8 @@ void SidebarController::disposeDecks()
                                                        (hide + 
"=false").c_str());
         }
 
-        mpParentWindow->ReleaseLOKNotifier();
+        if (mpParentWindow)
+            mpParentWindow->ReleaseLOKNotifier();
     }
 
     mpCurrentDeck.clear();
commit 12d54a3e952bbe53c1f404074e2538ca753286ae
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Sat Jan 16 17:56:34 2021 +0000
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Mon Apr 5 20:26:56 2021 +0100

    sidebar: avoid invalidation thrash with LOK.
    
    Avoids complete sidebar invalidate when entering text into a cell
    and hitting enter.
    
    Change-Id: I88ee3792589a1c0a16ae555da77ed7c12ca5f296
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109403
    Tested-by: Jenkins
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>

diff --git a/sfx2/source/sidebar/DeckLayouter.cxx 
b/sfx2/source/sidebar/DeckLayouter.cxx
index c4c9cd4b9a81..f90ec176b2d0 100644
--- a/sfx2/source/sidebar/DeckLayouter.cxx
+++ b/sfx2/source/sidebar/DeckLayouter.cxx
@@ -613,7 +613,12 @@ void UpdateFiller (
     vcl::Window& rFiller,
     const tools::Rectangle& rBox)
 {
-    if (rBox.GetHeight() > 0)
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        // Not shown on LOK, and causes invalidation thrash
+        rFiller.Hide();
+    }
+    else if (rBox.GetHeight() > 0)
     {
         // Show the filler.
         rFiller.SetBackground(Theme::GetColor(Theme::Color_PanelBackground));
diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index b78e8e41d0ae..39900e95b216 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -807,7 +807,11 @@ void SidebarController::SwitchToDeck (
 
         msCurrentDeckId = rDeckDescriptor.msId;
     }
-    mpTabBar->Invalidate();
+
+    // invisible with LOK, so avoid invalidations
+    if (!comphelper::LibreOfficeKit::isActive())
+        mpTabBar->Invalidate();
+
     mpTabBar->HighlightDeck(msCurrentDeckId);
 
     // Determine the panels to display in the deck.
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index 8164c3e34884..d7f52741fd6e 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -27,6 +27,7 @@
 
 #include <sfx2/sfxresid.hxx>
 
+#include <comphelper/lok.hxx>
 #include <comphelper/processfactory.hxx>
 #include <o3tl/safeint.hxx>
 #include <vcl/commandevent.hxx>
@@ -108,6 +109,10 @@ sal_Int32 TabBar::GetDefaultWidth()
 
 void TabBar::SetDecks(const ResourceManager::DeckContextDescriptorContainer& 
rDecks)
 {
+    // invisible with LOK, so keep empty to avoid invalidations
+    if (comphelper::LibreOfficeKit::isActive())
+        return;
+
     // Remove the current buttons.
     maItems.clear();
     for (auto const& deck : rDecks)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to