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

Unified Diff: Source/core/dom/Document.cpp

Issue 189573002: Convert HTMLFrameOwnerElement and FocusController to use Frame. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Missed a null check Created 6 years, 9 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
« no previous file with comments | « Source/bindings/v8/V8WindowShell.cpp ('k') | Source/core/dom/TreeScope.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index adb5aa2c44ad394a0a821dae999404196a3ab5e2..e9e7627af18eeb908b7a20e814ba60491f24d140 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -986,7 +986,8 @@ PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionState& ex
if (source->isFrameOwnerElement()) {
HTMLFrameOwnerElement* frameOwnerElement = toHTMLFrameOwnerElement(source.get());
- if (frame() && frame()->tree().isDescendantOf(frameOwnerElement->contentFrame())) {
+ // FIXME(kenrb): the downcast can be removed when the FrameTree supports RemoteFrames.
+ if (frame() && frame()->tree().isDescendantOf(toLocalFrameTemporary(frameOwnerElement->contentFrame()))) {
exceptionState.throwDOMException(HierarchyRequestError, "The node provided is a frame which contains this document.");
return nullptr;
}
@@ -5443,9 +5444,9 @@ bool Document::hasFocus() const
Page* page = this->page();
if (!page)
return false;
- if (!page->focusController().isActive() || !page->focusController().isFocused())
+ if (!page->focusController().isActive() || !page->focusController().isFocused() || !page->focusController().focusedFrame()->isLocalFrame())
return false;
- if (LocalFrame* focusedFrame = page->focusController().focusedFrame()) {
+ if (LocalFrame* focusedFrame = toLocalFrame(page->focusController().focusedFrame())) {
if (focusedFrame->tree().isDescendantOf(frame()))
return true;
}
« no previous file with comments | « Source/bindings/v8/V8WindowShell.cpp ('k') | Source/core/dom/TreeScope.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698