Changeset 256631 in webkit


Ignore:
Timestamp:
Feb 14, 2020 11:29:34 AM (4 years ago)
Author:
Andres Gonzalez
Message:

Implementation of AXIsolatedObject::isDescendantOfObject.
https://bugs.webkit.org/show_bug.cgi?id=207697

Reviewed by Chris Fleizach.

  • Moved the implementation of AccessibilityObject::isDescendantOfObject

and isAncestorOfObject to the base class AXCoreObject.

  • Implemented AXIsolatedObject::hasChildren by caching the value from

the associated AXObject. It is used in isDescendantOfObject.

  • accessibility/AccessibilityObject.cpp:

(WebCore::AccessibilityObject::isDescendantOfObject const): MOved to AXCoreObject.
(WebCore::AccessibilityObject::isAncestorOfObject const): Moved to AXCoreObject.

  • accessibility/AccessibilityObject.h:
  • accessibility/AccessibilityObjectInterface.h:

(WebCore::AXCoreObject::isDescendantOfObject const):
(WebCore::AXCoreObject::isAncestorOfObject const):

  • accessibility/isolatedtree/AXIsolatedObject.cpp:

(WebCore::AXIsolatedObject::initializeAttributeData): Sets the HasChildren attribute.
(WebCore::AXIsolatedObject::hasChildren const): Deleted.
(WebCore::AXIsolatedObject::isDescendantOfObject const): Deleted.
(WebCore::AXIsolatedObject::isAncestorOfObject const): Deleted.

  • accessibility/isolatedtree/AXIsolatedObject.h:
Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r256630 r256631  
     12020-02-14  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        Implementation of AXIsolatedObject::isDescendantOfObject.
     4        https://bugs.webkit.org/show_bug.cgi?id=207697
     5
     6        Reviewed by Chris Fleizach.
     7
     8        - Moved the implementation of AccessibilityObject::isDescendantOfObject
     9        and isAncestorOfObject to the base class AXCoreObject.
     10        - Implemented AXIsolatedObject::hasChildren by caching the value from
     11        the associated AXObject. It is used in isDescendantOfObject.
     12
     13        * accessibility/AccessibilityObject.cpp:
     14        (WebCore::AccessibilityObject::isDescendantOfObject const): MOved to AXCoreObject.
     15        (WebCore::AccessibilityObject::isAncestorOfObject const): Moved to AXCoreObject.
     16        * accessibility/AccessibilityObject.h:
     17        * accessibility/AccessibilityObjectInterface.h:
     18        (WebCore::AXCoreObject::isDescendantOfObject const):
     19        (WebCore::AXCoreObject::isAncestorOfObject const):
     20        * accessibility/isolatedtree/AXIsolatedObject.cpp:
     21        (WebCore::AXIsolatedObject::initializeAttributeData): Sets the HasChildren attribute.
     22        (WebCore::AXIsolatedObject::hasChildren const): Deleted.
     23        (WebCore::AXIsolatedObject::isDescendantOfObject const): Deleted.
     24        (WebCore::AXIsolatedObject::isAncestorOfObject const): Deleted.
     25        * accessibility/isolatedtree/AXIsolatedObject.h:
     26
    1272020-02-14  Andres Gonzalez  <andresg_22@apple.com>
    228
  • trunk/Source/WebCore/accessibility/AccessibilityObject.cpp

    r255839 r256631  
    21152115    return AccessibilityOrientation::Undefined;
    21162116}   
    2117 
    2118 bool AccessibilityObject::isDescendantOfObject(const AXCoreObject* axObject) const
    2119 {
    2120     if (!axObject || !axObject->hasChildren())
    2121         return false;
    2122 
    2123     return Accessibility::findAncestor<AccessibilityObject>(*this, false, [axObject] (const AccessibilityObject& object) {
    2124         return &object == axObject;
    2125     }) != nullptr;
    2126 }
    2127 
    2128 bool AccessibilityObject::isAncestorOfObject(const AXCoreObject* axObject) const
    2129 {
    2130     if (!axObject)
    2131         return false;
    2132 
    2133     return this == axObject || axObject->isDescendantOfObject(this);
    2134 }
    21352117
    21362118AccessibilityObject* AccessibilityObject::firstAnonymousBlockChild() const
  • trunk/Source/WebCore/accessibility/AccessibilityObject.h

    r255899 r256631  
    485485    void handleActiveDescendantChanged() override { }
    486486    void handleAriaExpandedChanged() override { }
    487     bool isDescendantOfObject(const AXCoreObject*) const override;
    488     bool isAncestorOfObject(const AXCoreObject*) const override;
    489487    AccessibilityObject* firstAnonymousBlockChild() const override;
    490488
  • trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h

    r256442 r256631  
    889889    virtual void handleActiveDescendantChanged() = 0;
    890890    virtual void handleAriaExpandedChanged() = 0;
    891     virtual bool isDescendantOfObject(const AXCoreObject*) const = 0;
    892     virtual bool isAncestorOfObject(const AXCoreObject*) const = 0;
     891    bool isDescendantOfObject(const AXCoreObject*) const;
     892    bool isAncestorOfObject(const AXCoreObject*) const;
    893893    virtual AXCoreObject* firstAnonymousBlockChild() const = 0;
    894894
     
    12231223} // namespace Accessibility
    12241224
     1225inline bool AXCoreObject::isDescendantOfObject(const AXCoreObject* axObject) const
     1226{
     1227    return axObject && axObject->hasChildren()
     1228        && Accessibility::findAncestor<AXCoreObject>(*this, false, [axObject] (const AXCoreObject& object) {
     1229            return &object == axObject;
     1230        }) != nullptr;
     1231}
     1232
     1233inline bool AXCoreObject::isAncestorOfObject(const AXCoreObject* axObject) const
     1234{
     1235    return axObject && (this == axObject || axObject->isDescendantOfObject(this));
     1236}
     1237
    12251238} // namespace WebCore
  • trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp

    r256630 r256631  
    156156    setProperty(AXPropertyName::EstimatedLoadingProgress, object.estimatedLoadingProgress());
    157157    setProperty(AXPropertyName::SupportsARIAOwns, object.supportsARIAOwns());
     158    setProperty(AXPropertyName::HasChildren, object.hasChildren());
    158159    setProperty(AXPropertyName::HasPopup, object.hasPopup());
    159160    setProperty(AXPropertyName::PopupValue, object.popupValue());
     
    15741575}
    15751576
    1576 bool AXIsolatedObject::hasChildren() const
    1577 {
    1578     ASSERT_NOT_REACHED();
    1579     return false;
    1580 }
    1581 
    15821577void AXIsolatedObject::setNeedsToUpdateChildren()
    15831578{
     
    16231618}
    16241619
    1625 bool AXIsolatedObject::isDescendantOfObject(const AXCoreObject*) const
    1626 {
    1627     ASSERT_NOT_REACHED();
    1628     return false;
    1629 }
    1630 
    1631 bool AXIsolatedObject::isAncestorOfObject(const AXCoreObject*) const
    1632 {
    1633     ASSERT_NOT_REACHED();
    1634     return false;
    1635 }
    1636 
    16371620AXCoreObject* AXIsolatedObject::firstAnonymousBlockChild() const
    16381621{
  • trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h

    r256630 r256631  
    133133        FocusableAncestor,
    134134        HasARIAValueNow,
     135        HasChildren,
    135136        HasPopup,
    136137        HeadingLevel,
     
    772773    bool shouldIgnoreAttributeRole() const override;
    773774    bool canHaveChildren() const override;
    774     bool hasChildren() const override;
     775    bool hasChildren() const override { return boolAttributeValue(AXPropertyName::HasChildren); }
    775776    void setNeedsToUpdateChildren() override;
    776777    void setNeedsToUpdateSubtree() override;
     
    782783    void handleActiveDescendantChanged() override;
    783784    void handleAriaExpandedChanged() override;
    784     bool isDescendantOfObject(const AXCoreObject*) const override;
    785     bool isAncestorOfObject(const AXCoreObject*) const override;
    786785    AXCoreObject* firstAnonymousBlockChild() const override;
    787786    bool hasAttribute(const QualifiedName&) const override;
Note: See TracChangeset for help on using the changeset viewer.