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

Side by Side Diff: sky/engine/core/dom/ContainerNode.cpp

Issue 928393003: Remove the concept of document.documentElement (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | « sky/engine/core/css/resolver/StyleResolver.cpp ('k') | sky/engine/core/dom/Document.h » ('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 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 return; 92 return;
93 } 93 }
94 } 94 }
95 95
96 void ContainerNode::checkAcceptChildHierarchy(const Node& newChild, const Node* oldChild, ExceptionState& exceptionState) const 96 void ContainerNode::checkAcceptChildHierarchy(const Node& newChild, const Node* oldChild, ExceptionState& exceptionState) const
97 { 97 {
98 if (containsConsideringHostElements(newChild)) { 98 if (containsConsideringHostElements(newChild)) {
99 exceptionState.ThrowDOMException(HierarchyRequestError, "The new child e lement contains the parent."); 99 exceptionState.ThrowDOMException(HierarchyRequestError, "The new child e lement contains the parent.");
100 return; 100 return;
101 } 101 }
102
103 // TODO(esprehn): Remove this, sky should allow multiple top level elements.
104 if (isDocumentNode()) {
105 unsigned elementCount = 0;
106 if (newChild.isElementNode()) {
107 elementCount = 1;
108 } else if (newChild.isDocumentFragment()) {
109 for (Element* element = ElementTraversal::firstChild(newChild); elem ent; element = ElementTraversal::nextSibling(*element))
110 ++elementCount;
111 }
112 if (elementCount > 1 || ((!oldChild || !oldChild->isElementNode()) && el ementCount && document().documentElement())) {
113 exceptionState.ThrowDOMException(HierarchyRequestError, "Document ca n only contain one Element.");
114 return;
115 }
116 }
117 } 102 }
118 103
119 PassRefPtr<Node> ContainerNode::insertBefore(PassRefPtr<Node> newChild, Node* re fChild, ExceptionState& exceptionState) 104 PassRefPtr<Node> ContainerNode::insertBefore(PassRefPtr<Node> newChild, Node* re fChild, ExceptionState& exceptionState)
120 { 105 {
121 // Check that this node is not "floating". 106 // Check that this node is not "floating".
122 // If it is, it can be deleted as a side effect of sending mutation events. 107 // If it is, it can be deleted as a side effect of sending mutation events.
123 ASSERT(refCount() || parentOrShadowHostNode()); 108 ASSERT(refCount() || parentOrShadowHostNode());
124 109
125 RefPtr<Node> protect(this); 110 RefPtr<Node> protect(this);
126 111
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 return true; 996 return true;
1012 997
1013 if (node->isElementNode() && toElement(node)->shadow()) 998 if (node->isElementNode() && toElement(node)->shadow())
1014 return true; 999 return true;
1015 1000
1016 return false; 1001 return false;
1017 } 1002 }
1018 #endif 1003 #endif
1019 1004
1020 } // namespace blink 1005 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/css/resolver/StyleResolver.cpp ('k') | sky/engine/core/dom/Document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698