Title: [291769] trunk/Source/WebCore
Revision
291769
Author
[email protected]
Date
2022-03-23 14:57:34 -0700 (Wed, 23 Mar 2022)

Log Message

ITM: Lazy caching of HelpText property that results in a call to textUnderElement().
https://bugs.webkit.org/show_bug.cgi?id=237923
<rdar://problem/90332779>

Reviewed by Chris Fleizach.

Caching HelpText in the initialization of an IsolatedObject properties
for all objects often results in a call to AXRenderObject::textUnderElement,
which can be expensive and makes the creation and update of the isolated
tree costly. With this patch we cache HelpText on first request.

* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::getOrRetrievePropertyValue):
* accessibility/isolatedtree/AXIsolatedObject.h:
* accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm:
(WebCore::AXIsolatedObject::initializePlatformProperties):
(WebCore::AXIsolatedObject::helpTextAttributeValue const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (291768 => 291769)


--- trunk/Source/WebCore/ChangeLog	2022-03-23 21:55:02 UTC (rev 291768)
+++ trunk/Source/WebCore/ChangeLog	2022-03-23 21:57:34 UTC (rev 291769)
@@ -1,3 +1,23 @@
+2022-03-23  Andres Gonzalez  <[email protected]>
+
+        ITM: Lazy caching of HelpText property that results in a call to textUnderElement().
+        https://bugs.webkit.org/show_bug.cgi?id=237923
+        <rdar://problem/90332779>
+
+        Reviewed by Chris Fleizach.
+
+        Caching HelpText in the initialization of an IsolatedObject properties
+        for all objects often results in a call to AXRenderObject::textUnderElement,
+        which can be expensive and makes the creation and update of the isolated
+        tree costly. With this patch we cache HelpText on first request.
+
+        * accessibility/isolatedtree/AXIsolatedObject.cpp:
+        (WebCore::AXIsolatedObject::getOrRetrievePropertyValue):
+        * accessibility/isolatedtree/AXIsolatedObject.h:
+        * accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm:
+        (WebCore::AXIsolatedObject::initializePlatformProperties):
+        (WebCore::AXIsolatedObject::helpTextAttributeValue const):
+
 2022-03-23  Jer Noble  <[email protected]>
 
         [Cocoa] MSE-backed videos fail to play in Captive Portal mode

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp (291768 => 291769)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp	2022-03-23 21:55:02 UTC (rev 291768)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp	2022-03-23 21:57:34 UTC (rev 291769)
@@ -983,6 +983,9 @@
         case AXPropertyName::Description:
             value = axObject->descriptionAttributeValue().isolatedCopy();
             break;
+        case AXPropertyName::HelpText:
+            value = axObject->helpTextAttributeValue().isolatedCopy();
+            break;
         case AXPropertyName::TitleAttributeValue:
             value = axObject->titleAttributeValue().isolatedCopy();
             break;

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h (291768 => 291769)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h	2022-03-23 21:55:02 UTC (rev 291768)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h	2022-03-23 21:57:34 UTC (rev 291769)
@@ -338,7 +338,7 @@
     bool fileUploadButtonReturnsValueInTitle() const override { return boolAttributeValue(AXPropertyName::FileUploadButtonReturnsValueInTitle); }
     String speechHintAttributeValue() const override { return stringAttributeValue(AXPropertyName::SpeechHint); }
     String descriptionAttributeValue() const override;
-    String helpTextAttributeValue() const override { return stringAttributeValue(AXPropertyName::HelpText); }
+    String helpTextAttributeValue() const override;
     String titleAttributeValue() const override;
 #endif
 #if PLATFORM(MAC)

Modified: trunk/Source/WebCore/accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm (291768 => 291769)


--- trunk/Source/WebCore/accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm	2022-03-23 21:55:02 UTC (rev 291768)
+++ trunk/Source/WebCore/accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm	2022-03-23 21:57:34 UTC (rev 291769)
@@ -35,7 +35,6 @@
 void AXIsolatedObject::initializePlatformProperties(const AXCoreObject& object, bool isRoot)
 {
     setProperty(AXPropertyName::HasApplePDFAnnotationAttribute, object.hasApplePDFAnnotationAttribute());
-    setProperty(AXPropertyName::HelpText, object.helpTextAttributeValue().isolatedCopy());
     setProperty(AXPropertyName::SpeechHint, object.speechHintAttributeValue().isolatedCopy());
     setProperty(AXPropertyName::CaretBrowsingEnabled, object.caretBrowsingEnabled());
 
@@ -108,6 +107,11 @@
     return const_cast<AXIsolatedObject*>(this)->getOrRetrievePropertyValue<String>(AXPropertyName::Description);
 }
 
+String AXIsolatedObject::helpTextAttributeValue() const
+{
+    return const_cast<AXIsolatedObject*>(this)->getOrRetrievePropertyValue<String>(AXPropertyName::HelpText);
+}
+
 String AXIsolatedObject::titleAttributeValue() const
 {
     return const_cast<AXIsolatedObject*>(this)->getOrRetrievePropertyValue<String>(AXPropertyName::TitleAttributeValue);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to