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..6f074286088b6063a842fdcb80589590306b4608 100644 |
--- a/third_party/WebKit/Source/modules/accessibility/AXObject.cpp |
+++ b/third_party/WebKit/Source/modules/accessibility/AXObject.cpp |
@@ -724,14 +724,17 @@ bool AXObject::isHiddenForTextAlternativeCalculation() const { |
// aria-labelledby. So we need to explicitly call the style resolver to check |
// whether it's invisible or display:none, rather than relying on the style |
// cached in the LayoutObject. |
- Document* doc = getDocument(); |
- if (doc && doc->frame() && getNode() && getNode()->isElementNode()) { |
- RefPtr<ComputedStyle> style = |
- doc->ensureStyleResolver().styleForElement(toElement(getNode())); |
- return style->display() == EDisplay::None || |
- style->visibility() != EVisibility::kVisible; |
+ Document* document = getDocument(); |
+ if (!document || !document->frame()) |
+ return false; |
+ if (Node* node = getNode()) { |
+ if (node->isConnected() && node->isElementNode()) { |
+ RefPtr<ComputedStyle> style = |
+ document->ensureStyleResolver().styleForElement(toElement(node)); |
+ return style->display() == EDisplay::None || |
+ style->visibility() != EVisibility::kVisible; |
+ } |
} |
- |
return false; |
} |