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

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

Issue 2088453002: Implement the inert attribute (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert histograms.xml Created 3 years, 7 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/AXObjectImpl.cpp
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.cpp b/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.cpp
index 9d19ea1c3866b3f41e5906427fd283eb636df1ac..3ad283b756eee3dc8687f0dfd1e18f35a5e634c4 100644
--- a/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.cpp
+++ b/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.cpp
@@ -598,7 +598,26 @@ bool AXObjectImpl::IsClickable() const {
}
}
-bool AXObjectImpl::AccessibilityIsIgnored() const {
+bool AXObjectImpl::AccessibilityIsIgnored() {
+ Node* node = GetNode();
+ if (!node) {
+ AXObjectImpl* parent = this->ParentObject();
+ while (!node && parent) {
+ node = parent->GetNode();
+ parent = parent->ParentObject();
+ }
+ }
+
+ if (node)
+ node->UpdateDistribution();
+
+ // TODO(aboxhall): Instead of this, propagate inert down through frames
+ Document* document = GetDocument();
+ while (document && document->LocalOwner()) {
+ document->LocalOwner()->UpdateDistribution();
+ document = document->LocalOwner()->ownerDocument();
+ }
+
UpdateCachedAttributeValuesIfNeeded();
return cached_is_ignored_;
}
@@ -680,11 +699,16 @@ bool AXObjectImpl::ComputeIsInertOrAriaHidden(
ignored_reasons->push_back(
IgnoredReason(kAXActiveModalDialog, dialog_object));
} else {
- ignored_reasons->push_back(IgnoredReason(kAXInert));
+ ignored_reasons->push_back(IgnoredReason(kAXInertElement));
}
} else {
- // TODO(aboxhall): handle inert attribute if it eventuates
- ignored_reasons->push_back(IgnoredReason(kAXInert));
+ const AXObjectImpl* inert_root_el = InertRoot();
+ if (inert_root_el == this) {
+ ignored_reasons->push_back(IgnoredReason(kAXInertElement));
+ } else {
+ ignored_reasons->push_back(
+ IgnoredReason(kAXInertSubtree, inert_root_el));
+ }
}
}
return true;
@@ -702,10 +726,10 @@ bool AXObjectImpl::ComputeIsInertOrAriaHidden(
if (hidden_root) {
if (ignored_reasons) {
if (hidden_root == this) {
- ignored_reasons->push_back(IgnoredReason(kAXAriaHidden));
+ ignored_reasons->push_back(IgnoredReason(kAXAriaHiddenElement));
} else {
ignored_reasons->push_back(
- IgnoredReason(kAXAriaHiddenRoot, hidden_root));
+ IgnoredReason(kAXAriaHiddenSubtree, hidden_root));
}
}
return true;
@@ -740,6 +764,26 @@ const AXObjectImpl* AXObjectImpl::AriaHiddenRoot() const {
return 0;
}
+const AXObjectImpl* AXObjectImpl::InertRoot() const {
+ const AXObjectImpl* object = this;
+ if (!RuntimeEnabledFeatures::inertAttributeEnabled())
+ return 0;
+
+ while (object && !object->IsAXNodeObject())
+ object = object->ParentObject();
+ Node* node = object->GetNode();
+ Element* element = node->IsElementNode()
+ ? ToElement(node)
+ : FlatTreeTraversal::ParentElement(*node);
+ while (element) {
+ if (element->hasAttribute(inertAttr))
+ return AxObjectCache().GetOrCreate(element);
+ element = FlatTreeTraversal::ParentElement(*element);
+ }
+
+ return 0;
+}
+
bool AXObjectImpl::IsDescendantOfDisabledNode() const {
UpdateCachedAttributeValuesIfNeeded();
return cached_is_descendant_of_disabled_node_;

Powered by Google App Engine
This is Rietveld 408576698