Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Unified Diff: third_party/WebKit/Source/modules/accessibility/AXObject.cpp

Issue 2088453002: Implement the inert attribute (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move flat tree checks up to the top of isInert Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698