Index: third_party/WebKit/Source/core/dom/Document.cpp |
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp |
index 8ce94026ce0a80a89b6a8d59d8084551a8d60b6f..273fd5cb58948db813b8ae0544fdf3445be2033f 100644 |
--- a/third_party/WebKit/Source/core/dom/Document.cpp |
+++ b/third_party/WebKit/Source/core/dom/Document.cpp |
@@ -2311,22 +2311,22 @@ Document& Document::axObjectCacheOwner() const |
// of the AXObjectCache (http://crbug.com/510410), but the proper fix |
// will be for each Document to have its own AXObjectCache |
// (http://crbug.com/532249). |
- |
+ Document* top = const_cast<Document*>(this); |
LocalFrame* frame = this->frame(); |
if (!frame) |
- return *const_cast<Document*>(this); |
- |
- frame = frame->localFrameRoot(); |
- if (!frame || !frame->document()) |
- return *const_cast<Document*>(this); |
- |
- Document* owner = frame->document(); |
- if (frame->pagePopupOwner()) { |
- ASSERT(!owner->m_axObjectCache); |
- return frame->pagePopupOwner()->document().axObjectCacheOwner(); |
+ return *top; |
+ while (frame && frame->owner() && frame->owner()->isLocal()) { |
dcheng
2015/12/28 22:12:19
Nit: add a comment so someone (e.g. me) doesn't se
dmazzoni
2015/12/29 00:13:08
Done.
|
+ HTMLFrameOwnerElement* owner = toHTMLFrameOwnerElement(frame->owner()); |
+ top = &owner->document(); |
+ frame = top->frame(); |
+ } |
+ if (top->frame() && top->frame()->pagePopupOwner()) { |
+ ASSERT(!top->m_axObjectCache); |
+ return top->frame()->pagePopupOwner()->document().axObjectCacheOwner(); |
} |
- return *owner; |
+ ASSERT(top); |
+ return *top; |
} |
void Document::clearAXObjectCache() |