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

Side by Side Diff: Source/core/rendering/RenderObject.h

Issue 295513003: add 'slow' prefix to RenderObject's firstChild() / lastChild() methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderListItem.cpp ('k') | Source/core/rendering/RenderObject.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) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 virtual const char* renderName() const = 0; 163 virtual const char* renderName() const = 0;
164 164
165 String debugName() const; 165 String debugName() const;
166 166
167 RenderObject* parent() const { return m_parent; } 167 RenderObject* parent() const { return m_parent; }
168 bool isDescendantOf(const RenderObject*) const; 168 bool isDescendantOf(const RenderObject*) const;
169 169
170 RenderObject* previousSibling() const { return m_previous; } 170 RenderObject* previousSibling() const { return m_previous; }
171 RenderObject* nextSibling() const { return m_next; } 171 RenderObject* nextSibling() const { return m_next; }
172 172
173 // FIXME: These should be renamed slowFirstChild, slowLastChild, etc. 173 RenderObject* slowFirstChild() const
174 // to discourage their use. The virtualChildren() call inside these
175 // can be slow for hot code paths.
176 // Currently, some subclasses like RenderBlock, override these NON-virtual
177 // functions to make these fast when we already have a more specific pointer type.
178 RenderObject* firstChild() const
179 { 174 {
180 if (const RenderObjectChildList* children = virtualChildren()) 175 if (const RenderObjectChildList* children = virtualChildren())
181 return children->firstChild(); 176 return children->firstChild();
182 return 0; 177 return 0;
183 } 178 }
184 RenderObject* lastChild() const 179 RenderObject* slowLastChild() const
185 { 180 {
186 if (const RenderObjectChildList* children = virtualChildren()) 181 if (const RenderObjectChildList* children = virtualChildren())
187 return children->lastChild(); 182 return children->lastChild();
188 return 0; 183 return 0;
189 } 184 }
190 185
191 virtual RenderObjectChildList* virtualChildren() { return 0; } 186 virtual RenderObjectChildList* virtualChildren() { return 0; }
192 virtual const RenderObjectChildList* virtualChildren() const { return 0; } 187 virtual const RenderObjectChildList* virtualChildren() const { return 0; }
193 188
194 RenderObject* nextInPreOrder() const; 189 RenderObject* nextInPreOrder() const;
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1478 void showTree(const WebCore::RenderObject*); 1473 void showTree(const WebCore::RenderObject*);
1479 void showLineTree(const WebCore::RenderObject*); 1474 void showLineTree(const WebCore::RenderObject*);
1480 void showRenderTree(const WebCore::RenderObject* object1); 1475 void showRenderTree(const WebCore::RenderObject* object1);
1481 // We don't make object2 an optional parameter so that showRenderTree 1476 // We don't make object2 an optional parameter so that showRenderTree
1482 // can be called from gdb easily. 1477 // can be called from gdb easily.
1483 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2); 1478 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2);
1484 1479
1485 #endif 1480 #endif
1486 1481
1487 #endif // RenderObject_h 1482 #endif // RenderObject_h
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderListItem.cpp ('k') | Source/core/rendering/RenderObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698