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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « Source/bindings/v8/V8WindowShell.cpp ('k') | Source/core/dom/TreeScope.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 } 979 }
980 default: 980 default:
981 if (source->isShadowRoot()) { 981 if (source->isShadowRoot()) {
982 // ShadowRoot cannot disconnect itself from the host node. 982 // ShadowRoot cannot disconnect itself from the host node.
983 exceptionState.throwDOMException(HierarchyRequestError, "The node pr ovided is a shadow root, which may not be adopted."); 983 exceptionState.throwDOMException(HierarchyRequestError, "The node pr ovided is a shadow root, which may not be adopted.");
984 return nullptr; 984 return nullptr;
985 } 985 }
986 986
987 if (source->isFrameOwnerElement()) { 987 if (source->isFrameOwnerElement()) {
988 HTMLFrameOwnerElement* frameOwnerElement = toHTMLFrameOwnerElement(s ource.get()); 988 HTMLFrameOwnerElement* frameOwnerElement = toHTMLFrameOwnerElement(s ource.get());
989 if (frame() && frame()->tree().isDescendantOf(frameOwnerElement->con tentFrame())) { 989 // FIXME(kenrb): the downcast can be removed when the FrameTree supp orts RemoteFrames.
990 if (frame() && frame()->tree().isDescendantOf(toLocalFrameTemporary( frameOwnerElement->contentFrame()))) {
990 exceptionState.throwDOMException(HierarchyRequestError, "The nod e provided is a frame which contains this document."); 991 exceptionState.throwDOMException(HierarchyRequestError, "The nod e provided is a frame which contains this document.");
991 return nullptr; 992 return nullptr;
992 } 993 }
993 } 994 }
994 if (source->parentNode()) { 995 if (source->parentNode()) {
995 source->parentNode()->removeChild(source.get(), exceptionState); 996 source->parentNode()->removeChild(source.get(), exceptionState);
996 if (exceptionState.hadException()) 997 if (exceptionState.hadException())
997 return nullptr; 998 return nullptr;
998 } 999 }
999 } 1000 }
(...skipping 4436 matching lines...) Expand 10 before | Expand all | Expand 10 after
5436 if (Element* element = treeScope().adjustedFocusedElement()) 5437 if (Element* element = treeScope().adjustedFocusedElement())
5437 return element; 5438 return element;
5438 return body(); 5439 return body();
5439 } 5440 }
5440 5441
5441 bool Document::hasFocus() const 5442 bool Document::hasFocus() const
5442 { 5443 {
5443 Page* page = this->page(); 5444 Page* page = this->page();
5444 if (!page) 5445 if (!page)
5445 return false; 5446 return false;
5446 if (!page->focusController().isActive() || !page->focusController().isFocuse d()) 5447 if (!page->focusController().isActive() || !page->focusController().isFocuse d() || !page->focusController().focusedFrame()->isLocalFrame())
5447 return false; 5448 return false;
5448 if (LocalFrame* focusedFrame = page->focusController().focusedFrame()) { 5449 if (LocalFrame* focusedFrame = toLocalFrame(page->focusController().focusedF rame())) {
5449 if (focusedFrame->tree().isDescendantOf(frame())) 5450 if (focusedFrame->tree().isDescendantOf(frame()))
5450 return true; 5451 return true;
5451 } 5452 }
5452 return false; 5453 return false;
5453 } 5454 }
5454 5455
5455 // FIXME: Remove this code once we have input routing in the browser 5456 // FIXME: Remove this code once we have input routing in the browser
5456 // process. See http://crbug.com/339659. 5457 // process. See http://crbug.com/339659.
5457 void Document::defaultEventHandler(Event* event) 5458 void Document::defaultEventHandler(Event* event)
5458 { 5459 {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
5491 } 5492 }
5492 5493
5493 void Document::invalidateNodeListCaches(const QualifiedName* attrName) 5494 void Document::invalidateNodeListCaches(const QualifiedName* attrName)
5494 { 5495 {
5495 HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end( ); 5496 HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end( );
5496 for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument. begin(); it != end; ++it) 5497 for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument. begin(); it != end; ++it)
5497 (*it)->invalidateCache(attrName); 5498 (*it)->invalidateCache(attrName);
5498 } 5499 }
5499 5500
5500 } // namespace WebCore 5501 } // namespace WebCore
OLDNEW
« 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