| Index: Source/modules/accessibility/AXNodeObject.cpp
|
| diff --git a/Source/modules/accessibility/AXNodeObject.cpp b/Source/modules/accessibility/AXNodeObject.cpp
|
| index a5438ac4ada964ee02f7734e009ef76f7e326b59..ac3c7a9403c046f474ba0046cb340f815c045794 100644
|
| --- a/Source/modules/accessibility/AXNodeObject.cpp
|
| +++ b/Source/modules/accessibility/AXNodeObject.cpp
|
| @@ -51,6 +51,7 @@
|
| #include "core/html/shadow/MediaControlElements.h"
|
| #include "core/layout/LayoutObject.h"
|
| #include "modules/accessibility/AXObjectCacheImpl.h"
|
| +#include "modules/accessibility/InspectorTypeBuilderHelper.h"
|
| #include "platform/UserGestureIndicator.h"
|
| #include "wtf/text/StringBuilder.h"
|
|
|
| @@ -59,6 +60,8 @@ namespace blink {
|
|
|
| using namespace HTMLNames;
|
|
|
| +using TypeBuilder::Accessibility::AXIgnoredReasons;
|
| +
|
| AXNodeObject::AXNodeObject(Node* node, AXObjectCacheImpl* axObjectCache)
|
| : AXObject(axObjectCache)
|
| , m_ariaRole(UnknownRole)
|
| @@ -158,24 +161,43 @@ void AXNodeObject::ariaLabeledByElements(WillBeHeapVector<RawPtrWillBeMember<Ele
|
| elementsFromAttribute(elements, aria_labelledbyAttr);
|
| }
|
|
|
| -bool AXNodeObject::computeAccessibilityIsIgnored() const
|
| +bool AXNodeObject::computeAccessibilityIsIgnored(PassRefPtr<TypeBuilder::Array<TypeBuilder::Accessibility::AXProperty>> passIgnoredReasons) const
|
| {
|
| #if ENABLE(ASSERT)
|
| // Double-check that an AXObject is never accessed before
|
| // it's been initialized.
|
| ASSERT(m_initialized);
|
| #endif
|
| + RefPtr<TypeBuilder::Array<TypeBuilder::Accessibility::AXProperty>> ignoredReasons = passIgnoredReasons;
|
|
|
| // If this element is within a parent that cannot have children, it should not be exposed.
|
| - if (isDescendantOfBarrenParent())
|
| + if (isDescendantOfLeafNode()) {
|
| + if (ignoredReasons)
|
| + ignoredReasons->addItem(createProperty(AXIgnoredReasons::AncestorIsLeafNode, createRelatedNodeValue(leafNodeAncestor())));
|
| return true;
|
| + }
|
|
|
| // Ignore labels that are already referenced by a control's title UI element.
|
| AXObject* controlObject = correspondingControlForLabelElement();
|
| - if (controlObject && !controlObject->deprecatedExposesTitleUIElement() && controlObject->isCheckboxOrRadio())
|
| + if (controlObject && !controlObject->deprecatedExposesTitleUIElement() && controlObject->isCheckboxOrRadio()) {
|
| + if (ignoredReasons) {
|
| + HTMLLabelElement* label = labelElementContainer();
|
| + if (label && !label->isSameNode(node())) {
|
| + AXObject* labelAXObject = axObjectCache()->getOrCreate(label);
|
| + ignoredReasons->addItem(createProperty(AXIgnoredReasons::LabelContainer, createRelatedNodeValue(labelAXObject)));
|
| + }
|
| +
|
| + ignoredReasons->addItem(createProperty(AXIgnoredReasons::LabelFor, createRelatedNodeValue(controlObject)));
|
| + }
|
| return true;
|
| + }
|
|
|
| - return m_role == UnknownRole;
|
| + if (m_role == UnknownRole) {
|
| + if (ignoredReasons)
|
| + ignoredReasons->addItem(createProperty(AXIgnoredReasons::Uninteresting, createBooleanValue(true)));
|
| + return true;
|
| + }
|
| + return false;
|
| }
|
|
|
| static bool isListElement(Node* node)
|
| @@ -233,33 +255,35 @@ static bool isRequiredOwnedElement(AXObject* parent, AccessibilityRole childRole
|
| return false;
|
| }
|
|
|
| -bool AXNodeObject::computeHasInheritedPresentationalRole() const
|
| +AXObject* AXNodeObject::inheritsPresentationalRoleFrom() const
|
| {
|
| // ARIA states if an item can get focus, it should not be presentational.
|
| if (canSetFocusAttribute())
|
| - return false;
|
| + return 0;
|
|
|
| if (isPresentational())
|
| - return true;
|
| + return 0;
|
|
|
| // http://www.w3.org/TR/wai-aria/complete#presentation
|
| // ARIA spec says that the user agent MUST apply an inherited role of presentation
|
| // to any owned elements that do not have an explicit role defined.
|
| if (ariaRoleAttribute() != UnknownRole)
|
| - return false;
|
| + return 0;
|
|
|
| AXObject* parent = parentObject();
|
| if (!parent)
|
| - return false;
|
| + return 0;
|
|
|
| Node* curNode = node();
|
| if (!parent->hasInheritedPresentationalRole()
|
| && !isPresentationRoleInTable(parent, curNode))
|
| - return false;
|
| + return 0;
|
|
|
| // ARIA spec says that when a parent object is presentational and this object
|
| // is a required owned element of that parent, then this object is also presentational.
|
| - return isRequiredOwnedElement(parent, roleValue(), curNode);
|
| + if (isRequiredOwnedElement(parent, roleValue(), curNode))
|
| + return parent;
|
| + return 0;
|
| }
|
|
|
| bool AXNodeObject::isDescendantOfElementType(const HTMLQualifiedName& tagName) const
|
| @@ -1452,7 +1476,7 @@ static bool shouldUseAccessibilityObjectInnerText(AXObject* obj)
|
|
|
| // If something doesn't expose any children, then we can always take the inner text content.
|
| // This is what we want when someone puts an <a> inside a <button> for example.
|
| - if (obj->isDescendantOfBarrenParent())
|
| + if (obj->isDescendantOfLeafNode())
|
| return true;
|
|
|
| // Skip focusable children, so we don't include the text of links and controls.
|
|
|