Changeset 269848 in webkit


Ignore:
Timestamp:
Nov 16, 2020 4:29:26 AM (3 years ago)
Author:
Andres Gonzalez
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r269847 r269848  
     12020-11-16  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        Optimization for AccessibilityNodeObject::accessibilityDescription.
     4        https://bugs.webkit.org/show_bug.cgi?id=218959
     5
     6        Reviewed by Darin Adler.
     7
     8        No change in functionality, optimization.
     9
     10        AccessibilityObject::title() can be an expensive operations because it
     11        can invoke textUnderElement which causes text extraction for all
     12        descendants of the object. Thus, rewrote this snippet in a more
     13        efficient way.
     14
     15        * accessibility/AccessibilityNodeObject.cpp:
     16        (WebCore::AccessibilityNodeObject::accessibilityDescription const):
     17
    1182020-11-16  Youenn Fablet  <youenn@apple.com>
    219
  • trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp

    r266026 r269848  
    16361636    // 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).
    16371637    // 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.
    1638     if (title().isEmpty() && !roleIgnoresTitle())
    1639         return getAttribute(titleAttr);
     1638    if (!roleIgnoresTitle()) {
     1639        // title() can be an expensive operation because it can invoke textUnderElement for all descendants. Thus call it last.
     1640        auto titleAttribute = getAttribute(titleAttr);
     1641        if (!titleAttribute.isEmpty() && title().isEmpty())
     1642            return titleAttribute;
     1643    }
    16401644
    16411645    return String();
Note: See TracChangeset for help on using the changeset viewer.