Index: third_party/WebKit/Source/modules/accessibility/AXObjectImpl.cpp |
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.cpp b/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.cpp |
index 9d19ea1c3866b3f41e5906427fd283eb636df1ac..3ad283b756eee3dc8687f0dfd1e18f35a5e634c4 100644 |
--- a/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.cpp |
+++ b/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.cpp |
@@ -598,7 +598,26 @@ bool AXObjectImpl::IsClickable() const { |
} |
} |
-bool AXObjectImpl::AccessibilityIsIgnored() const { |
+bool AXObjectImpl::AccessibilityIsIgnored() { |
+ Node* node = GetNode(); |
+ if (!node) { |
+ AXObjectImpl* parent = this->ParentObject(); |
+ while (!node && parent) { |
+ node = parent->GetNode(); |
+ parent = parent->ParentObject(); |
+ } |
+ } |
+ |
+ if (node) |
+ node->UpdateDistribution(); |
+ |
+ // TODO(aboxhall): Instead of this, propagate inert down through frames |
+ Document* document = GetDocument(); |
+ while (document && document->LocalOwner()) { |
+ document->LocalOwner()->UpdateDistribution(); |
+ document = document->LocalOwner()->ownerDocument(); |
+ } |
+ |
UpdateCachedAttributeValuesIfNeeded(); |
return cached_is_ignored_; |
} |
@@ -680,11 +699,16 @@ bool AXObjectImpl::ComputeIsInertOrAriaHidden( |
ignored_reasons->push_back( |
IgnoredReason(kAXActiveModalDialog, dialog_object)); |
} else { |
- ignored_reasons->push_back(IgnoredReason(kAXInert)); |
+ ignored_reasons->push_back(IgnoredReason(kAXInertElement)); |
} |
} else { |
- // TODO(aboxhall): handle inert attribute if it eventuates |
- ignored_reasons->push_back(IgnoredReason(kAXInert)); |
+ const AXObjectImpl* inert_root_el = InertRoot(); |
+ if (inert_root_el == this) { |
+ ignored_reasons->push_back(IgnoredReason(kAXInertElement)); |
+ } else { |
+ ignored_reasons->push_back( |
+ IgnoredReason(kAXInertSubtree, inert_root_el)); |
+ } |
} |
} |
return true; |
@@ -702,10 +726,10 @@ bool AXObjectImpl::ComputeIsInertOrAriaHidden( |
if (hidden_root) { |
if (ignored_reasons) { |
if (hidden_root == this) { |
- ignored_reasons->push_back(IgnoredReason(kAXAriaHidden)); |
+ ignored_reasons->push_back(IgnoredReason(kAXAriaHiddenElement)); |
} else { |
ignored_reasons->push_back( |
- IgnoredReason(kAXAriaHiddenRoot, hidden_root)); |
+ IgnoredReason(kAXAriaHiddenSubtree, hidden_root)); |
} |
} |
return true; |
@@ -740,6 +764,26 @@ const AXObjectImpl* AXObjectImpl::AriaHiddenRoot() const { |
return 0; |
} |
+const AXObjectImpl* AXObjectImpl::InertRoot() const { |
+ const AXObjectImpl* object = this; |
+ if (!RuntimeEnabledFeatures::inertAttributeEnabled()) |
+ return 0; |
+ |
+ while (object && !object->IsAXNodeObject()) |
+ object = object->ParentObject(); |
+ Node* node = object->GetNode(); |
+ Element* element = node->IsElementNode() |
+ ? ToElement(node) |
+ : FlatTreeTraversal::ParentElement(*node); |
+ while (element) { |
+ if (element->hasAttribute(inertAttr)) |
+ return AxObjectCache().GetOrCreate(element); |
+ element = FlatTreeTraversal::ParentElement(*element); |
+ } |
+ |
+ return 0; |
+} |
+ |
bool AXObjectImpl::IsDescendantOfDisabledNode() const { |
UpdateCachedAttributeValuesIfNeeded(); |
return cached_is_descendant_of_disabled_node_; |