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

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: rebase 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 2e9b20e6a8035cd0d300595e0428bb40c482abc3..f9b6910d5f4f512ca418cd472eae3c68b19772ad 100644
--- a/third_party/WebKit/Source/modules/accessibility/AXObject.cpp
+++ b/third_party/WebKit/Source/modules/accessibility/AXObject.cpp
@@ -536,10 +536,15 @@ 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* inertRootEl = inertRoot();
esprehn 2017/02/15 01:40:47 don't abbreviate, intertRoot = this->inertRoot()
aboxhall 2017/02/15 02:06:16 Done.
+ if (inertRootEl == this) {
+ ignoredReasons->push_back(IgnoredReason(AXInertElement));
+ } else {
+ ignoredReasons->push_back(
+ IgnoredReason(AXInertSubtree, inertRootEl));
+ }
}
}
return true;
@@ -556,10 +561,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 +599,24 @@ const AXObject* AXObject::ariaHiddenRoot() const {
return 0;
}
+const AXObject* AXObject::inertRoot() const {
+ const AXObject* object = this;
+ if (!RuntimeEnabledFeatures::inertAttributeEnabled())
+ return 0;
esprehn 2017/02/15 01:40:47 nullptr
aboxhall 2017/02/15 02:06:16 Done.
+
+ while (object && !object->isAXNodeObject())
+ object = object->parentObject();
+ for (Node* node = object->getNode(); node;
+ node = FlatTreeTraversal::parentElement(*node)) {
+ if (!node->isElementNode())
esprehn 2017/02/15 01:40:47 This is definitely weird since it's doing parentEl
aboxhall 2017/02/15 02:06:16 Acknowledged.
+ continue;
+ if (toElement(node)->hasAttribute(inertAttr))
+ return axObjectCache().getOrCreate(node);
+ }
+
+ return 0;
esprehn 2017/02/15 01:40:47 ditto
aboxhall 2017/02/15 02:06:16 Done.
+}
+
bool AXObject::isDescendantOfDisabledNode() const {
updateCachedAttributeValuesIfNeeded();
return m_cachedIsDescendantOfDisabledNode;

Powered by Google App Engine
This is Rietveld 408576698