- Revision
- 256631
- Author
- andresg...@apple.com
- Date
- 2020-02-14 11:29:34 -0800 (Fri, 14 Feb 2020)
Log 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:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (256630 => 256631)
--- trunk/Source/WebCore/ChangeLog 2020-02-14 19:22:33 UTC (rev 256630)
+++ trunk/Source/WebCore/ChangeLog 2020-02-14 19:29:34 UTC (rev 256631)
@@ -1,5 +1,31 @@
2020-02-14 Andres Gonzalez <andresg...@apple.com>
+ 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:
+
+2020-02-14 Andres Gonzalez <andresg...@apple.com>
+
When updating a subtree of the IsolatedTree, first remove the entire subtree, not just the subtree root.
https://bugs.webkit.org/show_bug.cgi?id=207759
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (256630 => 256631)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2020-02-14 19:22:33 UTC (rev 256630)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2020-02-14 19:29:34 UTC (rev 256631)
@@ -2115,24 +2115,6 @@
return AccessibilityOrientation::Undefined;
}
-bool AccessibilityObject::isDescendantOfObject(const AXCoreObject* axObject) const
-{
- if (!axObject || !axObject->hasChildren())
- return false;
-
- return Accessibility::findAncestor<AccessibilityObject>(*this, false, [axObject] (const AccessibilityObject& object) {
- return &object == axObject;
- }) != nullptr;
-}
-
-bool AccessibilityObject::isAncestorOfObject(const AXCoreObject* axObject) const
-{
- if (!axObject)
- return false;
-
- return this == axObject || axObject->isDescendantOfObject(this);
-}
-
AccessibilityObject* AccessibilityObject::firstAnonymousBlockChild() const
{
for (AccessibilityObject* child = firstChild(); child; child = child->nextSibling()) {
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (256630 => 256631)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.h 2020-02-14 19:22:33 UTC (rev 256630)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h 2020-02-14 19:29:34 UTC (rev 256631)
@@ -484,8 +484,6 @@
AccessibilityObject* activeDescendant() const override { return nullptr; }
void handleActiveDescendantChanged() override { }
void handleAriaExpandedChanged() override { }
- bool isDescendantOfObject(const AXCoreObject*) const override;
- bool isAncestorOfObject(const AXCoreObject*) const override;
AccessibilityObject* firstAnonymousBlockChild() const override;
WEBCORE_EXPORT static AccessibilityRole ariaRoleToWebCoreRole(const String&);
Modified: trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h (256630 => 256631)
--- trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h 2020-02-14 19:22:33 UTC (rev 256630)
+++ trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h 2020-02-14 19:29:34 UTC (rev 256631)
@@ -888,8 +888,8 @@
virtual AXCoreObject* activeDescendant() const = 0;
virtual void handleActiveDescendantChanged() = 0;
virtual void handleAriaExpandedChanged() = 0;
- virtual bool isDescendantOfObject(const AXCoreObject*) const = 0;
- virtual bool isAncestorOfObject(const AXCoreObject*) const = 0;
+ bool isDescendantOfObject(const AXCoreObject*) const;
+ bool isAncestorOfObject(const AXCoreObject*) const;
virtual AXCoreObject* firstAnonymousBlockChild() const = 0;
virtual bool hasAttribute(const QualifiedName&) const = 0;
@@ -1222,4 +1222,17 @@
} // namespace Accessibility
+inline bool AXCoreObject::isDescendantOfObject(const AXCoreObject* axObject) const
+{
+ return axObject && axObject->hasChildren()
+ && Accessibility::findAncestor<AXCoreObject>(*this, false, [axObject] (const AXCoreObject& object) {
+ return &object == axObject;
+ }) != nullptr;
+}
+
+inline bool AXCoreObject::isAncestorOfObject(const AXCoreObject* axObject) const
+{
+ return axObject && (this == axObject || axObject->isDescendantOfObject(this));
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp (256630 => 256631)
--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp 2020-02-14 19:22:33 UTC (rev 256630)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp 2020-02-14 19:29:34 UTC (rev 256631)
@@ -155,6 +155,7 @@
setProperty(AXPropertyName::LayoutCount, object.layoutCount());
setProperty(AXPropertyName::EstimatedLoadingProgress, object.estimatedLoadingProgress());
setProperty(AXPropertyName::SupportsARIAOwns, object.supportsARIAOwns());
+ setProperty(AXPropertyName::HasChildren, object.hasChildren());
setProperty(AXPropertyName::HasPopup, object.hasPopup());
setProperty(AXPropertyName::PopupValue, object.popupValue());
setProperty(AXPropertyName::PressedIsPresent, object.pressedIsPresent());
@@ -1573,12 +1574,6 @@
return false;
}
-bool AXIsolatedObject::hasChildren() const
-{
- ASSERT_NOT_REACHED();
- return false;
-}
-
void AXIsolatedObject::setNeedsToUpdateChildren()
{
ASSERT_NOT_REACHED();
@@ -1622,18 +1617,6 @@
ASSERT_NOT_REACHED();
}
-bool AXIsolatedObject::isDescendantOfObject(const AXCoreObject*) const
-{
- ASSERT_NOT_REACHED();
- return false;
-}
-
-bool AXIsolatedObject::isAncestorOfObject(const AXCoreObject*) const
-{
- ASSERT_NOT_REACHED();
- return false;
-}
-
AXCoreObject* AXIsolatedObject::firstAnonymousBlockChild() const
{
ASSERT_NOT_REACHED();
Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h (256630 => 256631)
--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h 2020-02-14 19:22:33 UTC (rev 256630)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h 2020-02-14 19:29:34 UTC (rev 256631)
@@ -132,6 +132,7 @@
FileUploadButtonReturnsValueInTitle,
FocusableAncestor,
HasARIAValueNow,
+ HasChildren,
HasPopup,
HeadingLevel,
HelpText,
@@ -771,7 +772,7 @@
void insertChild(AXCoreObject*, unsigned) override;
bool shouldIgnoreAttributeRole() const override;
bool canHaveChildren() const override;
- bool hasChildren() const override;
+ bool hasChildren() const override { return boolAttributeValue(AXPropertyName::HasChildren); }
void setNeedsToUpdateChildren() override;
void setNeedsToUpdateSubtree() override;
void clearChildren() override;
@@ -781,8 +782,6 @@
AXCoreObject* activeDescendant() const override;
void handleActiveDescendantChanged() override;
void handleAriaExpandedChanged() override;
- bool isDescendantOfObject(const AXCoreObject*) const override;
- bool isAncestorOfObject(const AXCoreObject*) const override;
AXCoreObject* firstAnonymousBlockChild() const override;
bool hasAttribute(const QualifiedName&) const override;
const AtomString& getAttribute(const QualifiedName&) const override;