Title: [269848] trunk/Source/WebCore
- Revision
- 269848
- Author
- [email protected]
- Date
- 2020-11-16 04:29:26 -0800 (Mon, 16 Nov 2020)
Log Message
Optimization for AccessibilityNodeObject::accessibilityDescription.
https://bugs.webkit.org/show_bug.cgi?id=218959
Reviewed by Darin Adler.
No change in functionality, optimization.
AccessibilityObject::title() can be an expensive operations because it
can invoke textUnderElement which causes text extraction for all
descendants of the object. Thus, rewrote this snippet in a more
efficient way.
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::accessibilityDescription const):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (269847 => 269848)
--- trunk/Source/WebCore/ChangeLog 2020-11-16 12:17:49 UTC (rev 269847)
+++ trunk/Source/WebCore/ChangeLog 2020-11-16 12:29:26 UTC (rev 269848)
@@ -1,3 +1,20 @@
+2020-11-16 Andres Gonzalez <[email protected]>
+
+ Optimization for AccessibilityNodeObject::accessibilityDescription.
+ https://bugs.webkit.org/show_bug.cgi?id=218959
+
+ Reviewed by Darin Adler.
+
+ No change in functionality, optimization.
+
+ AccessibilityObject::title() can be an expensive operations because it
+ can invoke textUnderElement which causes text extraction for all
+ descendants of the object. Thus, rewrote this snippet in a more
+ efficient way.
+
+ * accessibility/AccessibilityNodeObject.cpp:
+ (WebCore::AccessibilityNodeObject::accessibilityDescription const):
+
2020-11-16 Youenn Fablet <[email protected]>
TextEncoderStreamEncoder should not be exposed
Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (269847 => 269848)
--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp 2020-11-16 12:17:49 UTC (rev 269847)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp 2020-11-16 12:29:26 UTC (rev 269848)
@@ -1635,8 +1635,12 @@
// If this point is reached (i.e. there's no accessibilityDescription) and there's no title(), we should fallback to using the title attribute.
// The title attribute is normally used as help text (because it is a tooltip), but if there is nothing else available, this should be used (according to ARIA).
// https://bugs.webkit.org/show_bug.cgi?id=170475: An exception is when the element is semantically unimportant. In those cases, title text should remain as help text.
- if (title().isEmpty() && !roleIgnoresTitle())
- return getAttribute(titleAttr);
+ if (!roleIgnoresTitle()) {
+ // title() can be an expensive operation because it can invoke textUnderElement for all descendants. Thus call it last.
+ auto titleAttribute = getAttribute(titleAttr);
+ if (!titleAttribute.isEmpty() && title().isEmpty())
+ return titleAttribute;
+ }
return String();
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes