Implementation of AXIsolatedObject::isStaticText and isLandmark methods.
authorandresg_22@apple.com <andresg_22@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Jan 2020 18:40:19 +0000 (18:40 +0000)
committerandresg_22@apple.com <andresg_22@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Jan 2020 18:40:19 +0000 (18:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=206745

Reviewed by Chris Fleizach.

- isStaticText moved from the AXObject class to the base AXCoreObject so
that it is used by isolated objects as well.
- Implemented isLandmark.
- Ordered alphabetically the setProperty calls for most IsXXX
properties in initializeAttributeData for easier identification.

* accessibility/AccessibilityObject.h:
* accessibility/AccessibilityObjectInterface.h:
(WebCore::AXCoreObject::isStaticText const):
* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::initializeAttributeData):
(WebCore::AXIsolatedObject::isLandmark const): Deleted, inline in header file.
(WebCore::AXIsolatedObject::isStaticText const): Deleted, implemented in AXCoreObject.
* accessibility/isolatedtree/AXIsolatedObject.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255080 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityObject.h
Source/WebCore/accessibility/AccessibilityObjectInterface.h
Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp
Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h

index 9dff8c8..9afcaf5 100644 (file)
@@ -1,3 +1,25 @@
+2020-01-24  Andres Gonzalez  <andresg_22@apple.com>
+
+        Implementation of AXIsolatedObject::isStaticText and isLandmark methods.
+        https://bugs.webkit.org/show_bug.cgi?id=206745
+
+        Reviewed by Chris Fleizach.
+
+        - isStaticText moved from the AXObject class to the base AXCoreObject so
+        that it is used by isolated objects as well.
+        - Implemented isLandmark.
+        - Ordered alphabetically the setProperty calls for most IsXXX
+        properties in initializeAttributeData for easier identification.
+
+        * accessibility/AccessibilityObject.h:
+        * accessibility/AccessibilityObjectInterface.h:
+        (WebCore::AXCoreObject::isStaticText const):
+        * accessibility/isolatedtree/AXIsolatedObject.cpp:
+        (WebCore::AXIsolatedObject::initializeAttributeData):
+        (WebCore::AXIsolatedObject::isLandmark const): Deleted, inline in header file.
+        (WebCore::AXIsolatedObject::isStaticText const): Deleted, implemented in AXCoreObject.
+        * accessibility/isolatedtree/AXIsolatedObject.h:
+
 2020-01-23  Antoine Quint  <graouts@apple.com>
 
         [Web Animations] Support multiple CSS Animations with the same name in animation-name
index 9bf0497..f43cdf7 100644 (file)
@@ -220,7 +220,6 @@ public:
     bool hasSameFont(RenderObject*) const override { return false; }
     bool hasSameFontColor(RenderObject*) const override { return false; }
     bool hasSameStyle(RenderObject*) const override { return false; }
-    bool isStaticText() const override { return roleValue() == AccessibilityRole::StaticText; }
     bool hasUnderline() const override { return false; }
     bool hasHighlighting() const override;
 
index 0720319..2d231bb 100644 (file)
@@ -621,7 +621,7 @@ public:
     virtual bool hasSameFont(RenderObject*) const = 0;
     virtual bool hasSameFontColor(RenderObject*) const = 0;
     virtual bool hasSameStyle(RenderObject*) const = 0;
-    virtual bool isStaticText() const = 0;
+    bool isStaticText() const { return roleValue() == AccessibilityRole::StaticText; }
     virtual bool hasUnderline() const = 0;
     virtual bool hasHighlighting() const = 0;
 
index 52eb40f..4f71cc7 100644 (file)
@@ -49,82 +49,88 @@ AXIsolatedObject::~AXIsolatedObject() = default;
 
 void AXIsolatedObject::initializeAttributeData(AXCoreObject& object, bool isRoot)
 {
+    setProperty(AXPropertyName::ARIALandmarkRoleDescription, object.ariaLandmarkRoleDescription().isolatedCopy());
     setProperty(AXPropertyName::BoundingBoxRect, object.boundingBoxRect());
+    setProperty(AXPropertyName::Description, object.descriptionAttributeValue().isolatedCopy());
     setProperty(AXPropertyName::ElementRect, object.elementRect());
-    setProperty(AXPropertyName::RoleValue, static_cast<int>(object.roleValue()));
-    setProperty(AXPropertyName::RolePlatformString, object.rolePlatformString().isolatedCopy());
-    setProperty(AXPropertyName::ARIALandmarkRoleDescription, object.ariaLandmarkRoleDescription().isolatedCopy());
-    setProperty(AXPropertyName::RoleDescription, object.roleDescription().isolatedCopy());
+    setProperty(AXPropertyName::HelpText, object.helpTextAttributeValue().isolatedCopy());
+    setProperty(AXPropertyName::IsARIATreeGridRow, object.isARIATreeGridRow());
+    setProperty(AXPropertyName::IsAccessibilityIgnored, object.accessibilityIsIgnored());
+    setProperty(AXPropertyName::IsActiveDescendantOfFocusedContainer, object.isActiveDescendantOfFocusedContainer());
     setProperty(AXPropertyName::IsAttachment, object.isAttachment());
-    setProperty(AXPropertyName::IsLink, object.isLink());
-    setProperty(AXPropertyName::IsImageMapLink, object.isImageMapLink());
-    setProperty(AXPropertyName::IsImage, object.isImage());
+    setProperty(AXPropertyName::IsBusy, object.isBusy());
+    setProperty(AXPropertyName::IsButton, object.isButton());
+    setProperty(AXPropertyName::IsChecked, object.isChecked());
+    setProperty(AXPropertyName::IsCollapsed, object.isCollapsed());
+    setProperty(AXPropertyName::IsControl, object.isControl());
+    setProperty(AXPropertyName::IsDescriptionList, object.isDescriptionList());
+    setProperty(AXPropertyName::IsEnabled, object.isEnabled());
+    setProperty(AXPropertyName::IsExpanded, object.isExpanded());
+    setProperty(AXPropertyName::IsFieldset, object.isFieldset());
     setProperty(AXPropertyName::IsFileUploadButton, object.isFileUploadButton());
-    setProperty(AXPropertyName::IsAccessibilityIgnored, object.accessibilityIsIgnored());
-    setProperty(AXPropertyName::IsTree, object.isTree());
-    setProperty(AXPropertyName::IsScrollbar, object.isScrollbar());
-    setProperty(AXPropertyName::RelativeFrame, object.relativeFrame());
-    setProperty(AXPropertyName::SpeechHint, object.speechHintAttributeValue().isolatedCopy());
-    setProperty(AXPropertyName::Title, object.titleAttributeValue().isolatedCopy());
-    setProperty(AXPropertyName::Description, object.descriptionAttributeValue().isolatedCopy());
-    setProperty(AXPropertyName::HelpText, object.helpTextAttributeValue().isolatedCopy());
-    setProperty(AXPropertyName::IsSearchField, object.isSearchField());
+    setProperty(AXPropertyName::IsFocused, object.isFocused());
+    setProperty(AXPropertyName::IsGroup, object.isGroup());
+    setProperty(AXPropertyName::IsHeading, object.isHeading());
+    setProperty(AXPropertyName::IsHovered, object.isHovered());
+    setProperty(AXPropertyName::IsImage, object.isImage());
+    setProperty(AXPropertyName::IsImageMapLink, object.isImageMapLink());
+    setProperty(AXPropertyName::IsIndeterminate, object.isIndeterminate());
+    setProperty(AXPropertyName::IsInlineText, object.isInlineText());
+    setProperty(AXPropertyName::IsInputImage, object.isInputImage());
+    setProperty(AXPropertyName::IsLandmark, object.isLandmark());
+    setProperty(AXPropertyName::IsLink, object.isLink());
+    setProperty(AXPropertyName::IsLinked, object.isLinked());
+    setProperty(AXPropertyName::IsList, object.isList());
+    setProperty(AXPropertyName::IsLoaded, object.isLoaded());
     setProperty(AXPropertyName::IsMediaTimeline, object.isMediaTimeline());
-    setProperty(AXPropertyName::IsMenuRelated, object.isMenuRelated());
     setProperty(AXPropertyName::IsMenu, object.isMenu());
     setProperty(AXPropertyName::IsMenuBar, object.isMenuBar());
     setProperty(AXPropertyName::IsMenuButton, object.isMenuButton());
     setProperty(AXPropertyName::IsMenuItem, object.isMenuItem());
-    setProperty(AXPropertyName::IsInputImage, object.isInputImage());
-    setProperty(AXPropertyName::IsProgressIndicator, object.isProgressIndicator());
-    setProperty(AXPropertyName::IsSlider, object.isSlider());
-    setProperty(AXPropertyName::IsControl, object.isControl());
-    setProperty(AXPropertyName::IsList, object.isList());
-    setProperty(AXPropertyName::IsUnorderedList, object.isUnorderedList());
-    setProperty(AXPropertyName::IsOrderedList, object.isOrderedList());
-    setProperty(AXPropertyName::IsDescriptionList, object.isDescriptionList());
-    setProperty(AXPropertyName::IsTableRow, object.isTableRow());
-    setProperty(AXPropertyName::IsTableColumn, object.isTableColumn());
-    setProperty(AXPropertyName::IsTableCell, object.isTableCell());
-    setProperty(AXPropertyName::IsFieldset, object.isFieldset());
-    setProperty(AXPropertyName::IsGroup, object.isGroup());
-    setProperty(AXPropertyName::IsARIATreeGridRow, object.isARIATreeGridRow());
     setProperty(AXPropertyName::IsMenuList, object.isMenuList());
-    setProperty(AXPropertyName::IsMenuListPopup, object.isMenuListPopup());
     setProperty(AXPropertyName::IsMenuListOption, object.isMenuListOption());
-    setProperty(AXPropertyName::IsTextControl, object.isTextControl());
-    setProperty(AXPropertyName::IsButton, object.isButton());
+    setProperty(AXPropertyName::IsMenuListPopup, object.isMenuListPopup());
+    setProperty(AXPropertyName::IsMenuRelated, object.isMenuRelated());
+    setProperty(AXPropertyName::IsMultiSelectable, object.isMultiSelectable());
+    setProperty(AXPropertyName::IsOffScreen, object.isOffScreen());
+    setProperty(AXPropertyName::IsOnScreen, object.isOnScreen());
+    setProperty(AXPropertyName::IsOrderedList, object.isOrderedList());
+    setProperty(AXPropertyName::IsOutput, object.isOutput());
+    setProperty(AXPropertyName::IsPasswordField, object.isPasswordField());
+    setProperty(AXPropertyName::IsPressed, object.isPressed());
+    setProperty(AXPropertyName::IsProgressIndicator, object.isProgressIndicator());
     setProperty(AXPropertyName::IsRangeControl, object.isRangeControl());
+    setProperty(AXPropertyName::IsRequired, object.isRequired());
+    setProperty(AXPropertyName::IsScrollbar, object.isScrollbar());
+    setProperty(AXPropertyName::IsSearchField, object.isSearchField());
+    setProperty(AXPropertyName::IsSelected, object.isSelected());
+    setProperty(AXPropertyName::IsSelectedOptionActive, object.isSelectedOptionActive());
+    setProperty(AXPropertyName::IsSlider, object.isSlider());
     setProperty(AXPropertyName::IsStyleFormatGroup, object.isStyleFormatGroup());
-    setProperty(AXPropertyName::IsOutput, object.isOutput());
+    setProperty(AXPropertyName::IsTableCell, object.isTableCell());
+    setProperty(AXPropertyName::IsTableColumn, object.isTableColumn());
+    setProperty(AXPropertyName::IsTableRow, object.isTableRow());
+    setProperty(AXPropertyName::IsTextControl, object.isTextControl());
+    setProperty(AXPropertyName::IsTree, object.isTree());
+    setProperty(AXPropertyName::IsUnorderedList, object.isUnorderedList());
+    setProperty(AXPropertyName::IsUnvisited, object.isUnvisited());
+    setProperty(AXPropertyName::IsValueAutofillAvailable, object.isValueAutofillAvailable());
+    setProperty(AXPropertyName::IsValueAutofilled, object.isValueAutofilled());
+    setProperty(AXPropertyName::IsVisible, object.isVisible());
+    setProperty(AXPropertyName::IsVisited, object.isVisited());
+    setProperty(AXPropertyName::RelativeFrame, object.relativeFrame());
+    setProperty(AXPropertyName::RoleDescription, object.roleDescription().isolatedCopy());
+    setProperty(AXPropertyName::RolePlatformString, object.rolePlatformString().isolatedCopy());
+    setProperty(AXPropertyName::RoleValue, static_cast<int>(object.roleValue()));
+    setProperty(AXPropertyName::SpeechHint, object.speechHintAttributeValue().isolatedCopy());
+    setProperty(AXPropertyName::Title, object.titleAttributeValue().isolatedCopy());
     setProperty(AXPropertyName::SupportsDatetimeAttribute, object.supportsDatetimeAttribute());
     setProperty(AXPropertyName::DatetimeAttributeValue, object.datetimeAttributeValue());
     setProperty(AXPropertyName::CanSetFocusAttribute, object.canSetFocusAttribute());
     setProperty(AXPropertyName::CanSetTextRangeAttributes, object.canSetTextRangeAttributes());
     setProperty(AXPropertyName::CanSetValueAttribute, object.canSetValueAttribute());
     setProperty(AXPropertyName::CanSetNumericValue, object.canSetNumericValue());
-    setProperty(AXPropertyName::IsPasswordField, object.isPasswordField());
-    setProperty(AXPropertyName::IsHeading, object.isHeading());
-    setProperty(AXPropertyName::IsChecked, object.isChecked());
-    setProperty(AXPropertyName::IsEnabled, object.isEnabled());
-    setProperty(AXPropertyName::IsSelected, object.isSelected());
-    setProperty(AXPropertyName::IsFocused, object.isFocused());
-    setProperty(AXPropertyName::IsHovered, object.isHovered());
-    setProperty(AXPropertyName::IsIndeterminate, object.isIndeterminate());
-    setProperty(AXPropertyName::IsLoaded, object.isLoaded());
-    setProperty(AXPropertyName::IsMultiSelectable, object.isMultiSelectable());
-    setProperty(AXPropertyName::IsOnScreen, object.isOnScreen());
-    setProperty(AXPropertyName::IsOffScreen, object.isOffScreen());
-    setProperty(AXPropertyName::IsPressed, object.isPressed());
-    setProperty(AXPropertyName::IsUnvisited, object.isUnvisited());
-    setProperty(AXPropertyName::IsVisited, object.isVisited());
-    setProperty(AXPropertyName::IsRequired, object.isRequired());
     setProperty(AXPropertyName::SupportsRequiredAttribute, object.supportsRequiredAttribute());
-    setProperty(AXPropertyName::IsLinked, object.isLinked());
-    setProperty(AXPropertyName::IsExpanded, object.isExpanded());
-    setProperty(AXPropertyName::IsVisible, object.isVisible());
-    setProperty(AXPropertyName::IsCollapsed, object.isCollapsed());
-    setProperty(AXPropertyName::IsSelectedOptionActive, object.isSelectedOptionActive());
     setProperty(AXPropertyName::CanSetSelectedAttribute, object.canSetSelectedAttribute());
     setProperty(AXPropertyName::CanSetSelectedChildrenAttribute, object.canSetSelectedChildrenAttribute());
     setProperty(AXPropertyName::CanSetExpandedAttribute, object.canSetExpandedAttribute());
@@ -143,7 +149,6 @@ void AXIsolatedObject::initializeAttributeData(AXCoreObject& object, bool isRoot
     setProperty(AXPropertyName::LayoutCount, object.layoutCount());
     setProperty(AXPropertyName::EstimatedLoadingProgress, object.estimatedLoadingProgress());
     setProperty(AXPropertyName::SupportsARIAOwns, object.supportsARIAOwns());
-    setProperty(AXPropertyName::IsActiveDescendantOfFocusedContainer, object.isActiveDescendantOfFocusedContainer());
     setProperty(AXPropertyName::HasPopup, object.hasPopup());
     setProperty(AXPropertyName::PopupValue, object.popupValue());
     setProperty(AXPropertyName::PressedIsPresent, object.pressedIsPresent());
@@ -180,8 +185,6 @@ void AXIsolatedObject::initializeAttributeData(AXCoreObject& object, bool isRoot
     setProperty(AXPropertyName::SupportsPressAction, object.supportsPressAction());
     setProperty(AXPropertyName::ClickPoint, object.clickPoint());
     setProperty(AXPropertyName::ComputedRoleString, object.computedRoleString());
-    setProperty(AXPropertyName::IsValueAutofilled, object.isValueAutofilled());
-    setProperty(AXPropertyName::IsValueAutofillAvailable, object.isValueAutofillAvailable());
     setProperty(AXPropertyName::ValueAutofillButtonType, static_cast<int>(object.valueAutofillButtonType()));
     setProperty(AXPropertyName::URL, object.url());
     setProperty(AXPropertyName::AccessKey, object.accessKey());
@@ -207,8 +210,6 @@ void AXIsolatedObject::initializeAttributeData(AXCoreObject& object, bool isRoot
     setProperty(AXPropertyName::LiveRegionStatus, object.liveRegionStatus());
     setProperty(AXPropertyName::LiveRegionRelevant, object.liveRegionRelevant());
     setProperty(AXPropertyName::LiveRegionAtomic, object.liveRegionAtomic());
-    setProperty(AXPropertyName::IsBusy, object.isBusy());
-    setProperty(AXPropertyName::IsInlineText, object.isInlineText());
     if (object.isTextControl())
         setProperty(AXPropertyName::TextLength, object.textLength());
 
@@ -1033,12 +1034,6 @@ bool AXIsolatedObject::isBlockquote() const
     return false;
 }
 
-bool AXIsolatedObject::isLandmark() const
-{
-    ASSERT_NOT_REACHED();
-    return false;
-}
-
 bool AXIsolatedObject::isFigureElement() const
 {
     ASSERT_NOT_REACHED();
@@ -1153,12 +1148,6 @@ bool AXIsolatedObject::hasSameStyle(RenderObject*) const
     return false;
 }
 
-bool AXIsolatedObject::isStaticText() const
-{
-    ASSERT_NOT_REACHED();
-    return false;
-}
-
 bool AXIsolatedObject::hasUnderline() const
 {
     ASSERT_NOT_REACHED();
index ce62197..f89b1e8 100644 (file)
@@ -165,13 +165,14 @@ private:
         IsInlineText,
         IsInputImage,
         IsInsideLiveRegion,
+        IsHeading,
+        IsHovered,
+        IsLandmark,
         IsLink,
         IsLinked,
         IsList,
         IsListBox,
         IsLoaded,
-        IsHeading,
-        IsHovered,
         IsMathElement,
         IsMathFraction,
         IsMathFenced,
@@ -338,6 +339,7 @@ private:
 
     // Attribute retrieval overrides.
     bool isHeading() const override { return boolAttributeValue(AXPropertyName::IsHeading); }
+    bool isLandmark() const override { return boolAttributeValue(AXPropertyName::IsLandmark); }
     bool isLink() const override { return boolAttributeValue(AXPropertyName::IsLink); }
     bool isImage() const override { return boolAttributeValue(AXPropertyName::IsImage); }
     bool isPasswordField() const override { return boolAttributeValue(AXPropertyName::IsPasswordField); }
@@ -672,7 +674,6 @@ private:
     bool isARIATextControl() const override;
     bool isNonNativeTextControl() const override;
     bool isBlockquote() const override;
-    bool isLandmark() const override;
     bool isFigureElement() const override;
     bool isKeyboardFocusable() const override;
     bool isHovered() const override;
@@ -693,7 +694,6 @@ private:
     bool hasSameFont(RenderObject*) const override;
     bool hasSameFontColor(RenderObject*) const override;
     bool hasSameStyle(RenderObject*) const override;
-    bool isStaticText() const override;
     bool hasUnderline() const override;
     bool hasHighlighting() const override;
     Element* element() const override;