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

Side by Side Diff: Source/core/dom/ContainerNode.h

Issue 16379002: inline WebCore::Node::Node constructor more safely (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: style fixes Created 7 years, 6 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 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 void detachChildren(); 131 void detachChildren();
132 void detachChildrenIfNeeded(); 132 void detachChildrenIfNeeded();
133 133
134 void disconnectDescendantFrames(); 134 void disconnectDescendantFrames();
135 135
136 virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const { return true; } 136 virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const { return true; }
137 137
138 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; 138 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
139 139
140 protected: 140 protected:
141 ContainerNode(Document*, ConstructionType = CreateContainer); 141 ContainerNode(TreeScope*, ConstructionType = CreateContainer);
142 142
143 static void queuePostAttachCallback(NodeCallback, Node*); 143 static void queuePostAttachCallback(NodeCallback, Node*);
144 static bool postAttachCallbacksAreSuspended(); 144 static bool postAttachCallbacksAreSuspended();
145 145
146 template<class GenericNode, class GenericNodeContainer> 146 template<class GenericNode, class GenericNodeContainer>
147 friend void appendChildToContainer(GenericNode* child, GenericNodeContainer* ); 147 friend void appendChildToContainer(GenericNode* child, GenericNodeContainer* );
148 148
149 template<class GenericNode, class GenericNodeContainer> 149 template<class GenericNode, class GenericNodeContainer>
150 friend void Private::addChildNodesToDeletionQueue(GenericNode*& head, Generi cNode*& tail, GenericNodeContainer*); 150 friend void Private::addChildNodesToDeletionQueue(GenericNode*& head, Generi cNode*& tail, GenericNodeContainer*);
151 151
(...skipping 25 matching lines...) Expand all
177 177
178 inline const ContainerNode* toContainerNode(const Node* node) 178 inline const ContainerNode* toContainerNode(const Node* node)
179 { 179 {
180 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isContainerNode()); 180 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isContainerNode());
181 return static_cast<const ContainerNode*>(node); 181 return static_cast<const ContainerNode*>(node);
182 } 182 }
183 183
184 // This will catch anyone doing an unnecessary cast. 184 // This will catch anyone doing an unnecessary cast.
185 void toContainerNode(const ContainerNode*); 185 void toContainerNode(const ContainerNode*);
186 186
187 inline ContainerNode::ContainerNode(Document* document, ConstructionType type) 187 inline ContainerNode::ContainerNode(TreeScope* treeScope, ConstructionType type)
188 : Node(document, type) 188 : Node(treeScope, type)
189 , m_firstChild(0) 189 , m_firstChild(0)
190 , m_lastChild(0) 190 , m_lastChild(0)
191 { 191 {
192 } 192 }
193 193
194 inline void ContainerNode::attachChildren() 194 inline void ContainerNode::attachChildren()
195 { 195 {
196 for (Node* child = firstChild(); child; child = child->nextSibling()) { 196 for (Node* child = firstChild(); child; child = child->nextSibling()) {
197 ASSERT(!child->attached() || childAttachedAllowedWhenAttachingChildren(t his)); 197 ASSERT(!child->attached() || childAttachedAllowedWhenAttachingChildren(t his));
198 if (!child->attached()) 198 if (!child->attached())
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 m_node->resumePostAttachCallbacks(); 358 m_node->resumePostAttachCallbacks();
359 } 359 }
360 360
361 private: 361 private:
362 ContainerNode* m_node; 362 ContainerNode* m_node;
363 }; 363 };
364 364
365 } // namespace WebCore 365 } // namespace WebCore
366 366
367 #endif // ContainerNode_h 367 #endif // ContainerNode_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698