svx/source/accessibility/AccessibleTextHelper.cxx |   18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

New commits:
commit 8e5c1982c41c234027245fe2da6bf9bc3f5fe238
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Jul 27 11:04:34 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Jul 27 17:07:54 2022 +0200

    tdf#108560 horribly slow to paste many lines into editeng with a11y active
    
    looks to me that once the bound rect (and visible children) are synced
    that they won't change again so continued recalculation of bounds
    doesn't achieve anything except super expensive calc for no effect.
    
    Change-Id: I1684e3724bca28d03f7c255c2d7a40eee1b70eae
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137497
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx 
b/svx/source/accessibility/AccessibleTextHelper.cxx
index 5c8ce773b028..b18c33510211 100644
--- a/svx/source/accessibility/AccessibleTextHelper.cxx
+++ b/svx/source/accessibility/AccessibleTextHelper.cxx
@@ -1118,6 +1118,8 @@ namespace accessibility
             bEverythingUpdated = true;
         }
 
+        bool bUpdatedBoundRectAndVisibleChildren(false);
+
         while( !maEventQueue.IsEmpty() )
         {
             ::std::unique_ptr< SfxHint > pHint( maEventQueue.PopFront() );
@@ -1252,14 +1254,22 @@ namespace accessibility
                         }
 
                         // in all cases, check visibility afterwards.
-                        UpdateVisibleChildren();
-                        UpdateBoundRect();
+                        if (!bUpdatedBoundRectAndVisibleChildren)
+                        {
+                            UpdateVisibleChildren();
+                            UpdateBoundRect();
+                            bUpdatedBoundRectAndVisibleChildren = true;
+                        }
                     }
                     else if ( dynamic_cast<const SvxViewChangedHint*>( &rHint 
) )
                     {
                         // just check visibility
-                        UpdateVisibleChildren();
-                        UpdateBoundRect();
+                        if (!bUpdatedBoundRectAndVisibleChildren)
+                        {
+                            UpdateVisibleChildren();
+                            UpdateBoundRect();
+                            bUpdatedBoundRectAndVisibleChildren = true;
+                        }
                     }
                     // it's VITAL to keep the SfxSimpleHint last! It's the 
base of some classes above!
                     else if( rHint.GetId() == SfxHintId::Dying)

Reply via email to