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 fe84d5230c062bd93b1a00ab8a1bf928e2dd52c9..7507e653030b5d55b107405e6d84f927afb862a6 100644 |
| --- a/third_party/WebKit/Source/modules/accessibility/AXObject.cpp |
| +++ b/third_party/WebKit/Source/modules/accessibility/AXObject.cpp |
| @@ -533,13 +533,16 @@ bool AXObject::computeIsInertOrAriaHidden( |
| if (dialog) { |
| AXObject* dialogObject = axObjectCache().getOrCreate(dialog); |
| if (dialogObject) |
| - ignoredReasons->push_back( |
| + ignoredReasons->append( |
| IgnoredReason(AXActiveModalDialog, dialogObject)); |
| else |
| - ignoredReasons->push_back(IgnoredReason(AXInert)); |
| + ignoredReasons->append(IgnoredReason(AXInertElement)); |
| } else { |
| - // TODO(aboxhall): handle inert attribute if it eventuates |
| - ignoredReasons->push_back(IgnoredReason(AXInert)); |
| + const AXObject* inertRootEl = inertRoot(); |
| + if (inertRootEl == this) |
| + ignoredReasons->append(IgnoredReason(AXInertElement)); |
| + else |
| + ignoredReasons->append(IgnoredReason(AXInertSubtree, inertRootEl)); |
| } |
| } |
| return true; |
| @@ -556,10 +559,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 +597,20 @@ const AXObject* AXObject::ariaHiddenRoot() const { |
| return 0; |
| } |
| +const AXObject* AXObject::inertRoot() const { |
| + const AXObject* object = this; |
| + while (object && !object->isAXNodeObject()) |
| + object = object->parentObject(); |
| + for (Node* node = object->getNode(); node; node = node->parentNode()) { |
|
dmazzoni
2017/01/18 16:38:54
I'm assuming this should also be parentOrShadowHos
aboxhall
2017/01/19 02:44:26
Ah yep, good catch, thanks.
|
| + if (!node->isElementNode()) |
| + continue; |
| + if (toElement(node)->hasAttribute(inertAttr)) |
|
dmazzoni
2017/01/18 16:38:54
Need to check RuntimeEnabledFeatures here too
aboxhall
2017/01/19 02:44:26
Hm - probably doesn't matter in practice, since th
|
| + return axObjectCache().getOrCreate(node); |
| + } |
| + |
| + return 0; |
| +} |
| + |
| bool AXObject::isDescendantOfDisabledNode() const { |
| updateCachedAttributeValuesIfNeeded(); |
| return m_cachedIsDescendantOfDisabledNode; |