Chromium Code Reviews| Index: third_party/WebKit/Source/modules/accessibility/AXObject.cpp |
| diff --git a/third_party/WebKit/Source/modules/accessibility/AXObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXObject.cpp |
| index 6f074286088b6063a842fdcb80589590306b4608..a75d1700ec46e141b92b858a3f36f5a6c1bed8a4 100644 |
| --- a/third_party/WebKit/Source/modules/accessibility/AXObject.cpp |
| +++ b/third_party/WebKit/Source/modules/accessibility/AXObject.cpp |
| @@ -536,10 +536,14 @@ bool AXObject::computeIsInertOrAriaHidden( |
| ignoredReasons->push_back( |
| IgnoredReason(AXActiveModalDialog, dialogObject)); |
| else |
| - ignoredReasons->push_back(IgnoredReason(AXInert)); |
| + ignoredReasons->push_back(IgnoredReason(AXInertElement)); |
| } else { |
| - // TODO(aboxhall): handle inert attribute if it eventuates |
| - ignoredReasons->push_back(IgnoredReason(AXInert)); |
| + const AXObject* inertRoot = this->inertRoot(); |
| + if (inertRoot == this) { |
| + ignoredReasons->push_back(IgnoredReason(AXInertElement)); |
| + } else { |
| + ignoredReasons->push_back(IgnoredReason(AXInertSubtree, inertRoot)); |
| + } |
| } |
| } |
| return true; |
| @@ -556,10 +560,12 @@ bool AXObject::computeIsInertOrAriaHidden( |
| const AXObject* hiddenRoot = ariaHiddenRoot(); |
| if (hiddenRoot) { |
| if (ignoredReasons) { |
| - if (hiddenRoot == this) |
| - ignoredReasons->push_back(IgnoredReason(AXAriaHidden)); |
| - else |
| - ignoredReasons->push_back(IgnoredReason(AXAriaHiddenRoot, hiddenRoot)); |
| + if (hiddenRoot == this) { |
| + ignoredReasons->push_back(IgnoredReason(AXAriaHiddenElement)); |
| + } else { |
| + ignoredReasons->push_back( |
| + IgnoredReason(AXAriaHiddenSubtree, hiddenRoot)); |
| + } |
| } |
| return true; |
| } |
| @@ -592,6 +598,27 @@ const AXObject* AXObject::ariaHiddenRoot() const { |
| return 0; |
| } |
| +const AXObject* AXObject::inertRoot() const { |
| + const AXObject* object = this; |
| + if (!RuntimeEnabledFeatures::inertAttributeEnabled()) |
| + return nullptr; |
| + |
| + while (object && !object->isAXNodeObject()) |
| + object = object->parentObject(); |
| + Node* node = object->getNode(); |
| + node->updateDistribution(); |
|
esprehn
2017/02/16 06:28:12
updateDistribution can actually cause a detach(),
|
| + Element* element = node->isElementNode() |
| + ? toElement(node) |
| + : FlatTreeTraversal::parentElement(*node); |
| + while (element) { |
| + if (element->hasAttribute(inertAttr)) |
| + return axObjectCache().getOrCreate(element); |
| + element = FlatTreeTraversal::parentElement(*element); |
| + } |
| + |
| + return nullptr; |
| +} |
| + |
| bool AXObject::isDescendantOfDisabledNode() const { |
| updateCachedAttributeValuesIfNeeded(); |
| return m_cachedIsDescendantOfDisabledNode; |