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

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: Removed LocalFrame verification in Editor 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
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 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 } 988 }
989 default: 989 default:
990 if (source->isShadowRoot()) { 990 if (source->isShadowRoot()) {
991 // ShadowRoot cannot disconnect itself from the host node. 991 // ShadowRoot cannot disconnect itself from the host node.
992 exceptionState.throwDOMException(HierarchyRequestError, "The node pr ovided is a shadow root, which may not be adopted."); 992 exceptionState.throwDOMException(HierarchyRequestError, "The node pr ovided is a shadow root, which may not be adopted.");
993 return nullptr; 993 return nullptr;
994 } 994 }
995 995
996 if (source->isFrameOwnerElement()) { 996 if (source->isFrameOwnerElement()) {
997 HTMLFrameOwnerElement* frameOwnerElement = toHTMLFrameOwnerElement(s ource.get()); 997 HTMLFrameOwnerElement* frameOwnerElement = toHTMLFrameOwnerElement(s ource.get());
998 if (frame() && frame()->tree().isDescendantOf(frameOwnerElement->con tentFrame())) { 998 // FIXME(kenrb): the toLocalFrame() cast should be removed when the FrameTree supports RemoteFrames.
999 if (frame() && frame()->tree().isDescendantOf(toLocalFrame(frameOwne rElement->contentFrame()))) {
eseidel 2014/03/21 19:01:35 Why not just add the check now? What would this c
kenrb 2014/03/21 19:59:31 It will pass a Frame to the FrameTree rather than
999 exceptionState.throwDOMException(HierarchyRequestError, "The nod e provided is a frame which contains this document."); 1000 exceptionState.throwDOMException(HierarchyRequestError, "The nod e provided is a frame which contains this document.");
1000 return nullptr; 1001 return nullptr;
1001 } 1002 }
1002 } 1003 }
1003 if (source->parentNode()) { 1004 if (source->parentNode()) {
1004 source->parentNode()->removeChild(source.get(), exceptionState); 1005 source->parentNode()->removeChild(source.get(), exceptionState);
1005 if (exceptionState.hadException()) 1006 if (exceptionState.hadException())
1006 return nullptr; 1007 return nullptr;
1007 } 1008 }
1008 } 1009 }
(...skipping 4432 matching lines...) Expand 10 before | Expand all | Expand 10 after
5441 if (Element* element = treeScope().adjustedFocusedElement()) 5442 if (Element* element = treeScope().adjustedFocusedElement())
5442 return element; 5443 return element;
5443 return body(); 5444 return body();
5444 } 5445 }
5445 5446
5446 bool Document::hasFocus() const 5447 bool Document::hasFocus() const
5447 { 5448 {
5448 Page* page = this->page(); 5449 Page* page = this->page();
5449 if (!page) 5450 if (!page)
5450 return false; 5451 return false;
5451 if (!page->focusController().isActive() || !page->focusController().isFocuse d()) 5452 if (!page->focusController().isActive() || !page->focusController().isFocuse d() || !page->focusController().focusedFrame()->isLocalFrame())
5452 return false; 5453 return false;
5453 if (LocalFrame* focusedFrame = page->focusController().focusedFrame()) { 5454 if (LocalFrame* focusedFrame = toLocalFrame(page->focusController().focusedF rame())) {
eseidel 2014/03/21 19:01:35 Does this make sense? Will the Document be able t
kenrb 2014/03/21 19:59:31 I think so. We haven't started writing any code fo
5454 if (focusedFrame->tree().isDescendantOf(frame())) 5455 if (focusedFrame->tree().isDescendantOf(frame()))
5455 return true; 5456 return true;
5456 } 5457 }
5457 return false; 5458 return false;
5458 } 5459 }
5459 5460
5460 // FIXME: Remove this code once we have input routing in the browser 5461 // FIXME: Remove this code once we have input routing in the browser
5461 // process. See http://crbug.com/339659. 5462 // process. See http://crbug.com/339659.
5462 void Document::defaultEventHandler(Event* event) 5463 void Document::defaultEventHandler(Event* event)
5463 { 5464 {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
5496 } 5497 }
5497 5498
5498 void Document::invalidateNodeListCaches(const QualifiedName* attrName) 5499 void Document::invalidateNodeListCaches(const QualifiedName* attrName)
5499 { 5500 {
5500 HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end( ); 5501 HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end( );
5501 for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument. begin(); it != end; ++it) 5502 for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument. begin(); it != end; ++it)
5502 (*it)->invalidateCache(attrName); 5503 (*it)->invalidateCache(attrName);
5503 } 5504 }
5504 5505
5505 } // namespace WebCore 5506 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698