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 2cae448cea5924e6a4d2b86e6dc2643618255bf7..2062c34ec7fa3c9b260026302b799ef51dec2ca6 100644 |
--- a/third_party/WebKit/Source/modules/accessibility/AXObject.cpp |
+++ b/third_party/WebKit/Source/modules/accessibility/AXObject.cpp |
@@ -533,7 +533,24 @@ bool AXObject::IsClickable() const { |
} |
} |
-bool AXObject::AccessibilityIsIgnored() const { |
+bool AXObject::AccessibilityIsIgnored() { |
+ Node* node = GetNode(); |
+ if (!node) { |
+ AXObject* 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(); |
+ if (document && document->LocalOwner()) |
+ document->LocalOwner()->UpdateDistribution(); |
esprehn
2017/05/12 21:16:54
Why are you updating the distribution of the paren
aboxhall
2017/05/18 01:30:49
It crashes (DCHECK fails) without this in certain
|
+ |
UpdateCachedAttributeValuesIfNeeded(); |
return cached_is_ignored_; |
} |
@@ -615,10 +632,15 @@ bool AXObject::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 AXObject* 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; |
@@ -635,11 +657,12 @@ bool AXObject::ComputeIsInertOrAriaHidden( |
const AXObject* hidden_root = AriaHiddenRoot(); |
if (hidden_root) { |
if (ignored_reasons) { |
- if (hidden_root == this) |
- ignored_reasons->push_back(IgnoredReason(kAXAriaHidden)); |
- else |
+ if (hidden_root == this) { |
+ ignored_reasons->push_back(IgnoredReason(kAXAriaHiddenElement)); |
+ } else { |
ignored_reasons->push_back( |
- IgnoredReason(kAXAriaHiddenRoot, hidden_root)); |
+ IgnoredReason(kAXAriaHiddenSubtree, hidden_root)); |
+ } |
} |
return true; |
} |
@@ -672,6 +695,26 @@ 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(); |
+ Node* node = object->GetNode(); |
+ Element* element = node->IsElementNode() |
+ ? ToElement(node) |
+ : FlatTreeTraversal::ParentElement(*node); |
esprehn
2017/05/12 21:16:54
You could add FlatTreeTraversal::ParentElementOrSe
aboxhall
2017/05/18 01:30:49
This actually doesn't seem to be a super common ca
|
+ while (element) { |
+ if (element->hasAttribute(inertAttr)) |
+ return AxObjectCache().GetOrCreate(element); |
+ element = FlatTreeTraversal::ParentElement(*element); |
+ } |
+ |
+ return 0; |
+} |
+ |
bool AXObject::IsDescendantOfDisabledNode() const { |
UpdateCachedAttributeValuesIfNeeded(); |
return cached_is_descendant_of_disabled_node_; |
@@ -1216,11 +1259,7 @@ void AXObject::ClearChildren() { |
} |
Document* AXObject::GetDocument() const { |
- FrameView* frame_view = DocumentFrameView(); |
- if (!frame_view) |
- return 0; |
- |
- return frame_view->GetFrame().GetDocument(); |
+ return &(AxObjectCache().GetDocument()); |
} |
FrameView* AXObject::DocumentFrameView() const { |