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

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: dmazzoni comments Created 3 years, 11 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 fe84d5230c062bd93b1a00ab8a1bf928e2dd52c9..07f538611711da0d118dbd4ab5adba42a3adb316 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(
esprehn 2017/02/07 23:50:59 Why rename this back?
aboxhall 2017/02/08 05:26:02 bad merge :(
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,24 @@ const AXObject* AXObject::ariaHiddenRoot() const {
return 0;
}
+const AXObject* AXObject::inertRoot() const {
+ const AXObject* object = this;
+ if (!RuntimeEnabledFeatures::inertAttributeEnabled())
+ return 0;
+
+ while (object && !object->isAXNodeObject())
+ object = object->parentObject();
+ for (Node* node = object->getNode(); node;
esprehn 2017/02/07 23:50:59 ditto, this wants the composed/flat tree.
aboxhall 2017/02/08 05:26:01 Done.
+ node = node->parentOrShadowHostElement()) {
+ if (!node->isElementNode())
+ continue;
+ if (toElement(node)->hasAttribute(inertAttr))
+ return axObjectCache().getOrCreate(node);
+ }
+
+ return 0;
+}
+
bool AXObject::isDescendantOfDisabledNode() const {
updateCachedAttributeValuesIfNeeded();
return m_cachedIsDescendantOfDisabledNode;

Powered by Google App Engine
This is Rietveld 408576698