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

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

Issue 397733004: Allow assertions to be enabled in Blink Release builds. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 6 years, 5 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/RenderMultiColumnSet.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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 213
214 // Function to return our enclosing flow thread if we are contained inside o ne. This 214 // Function to return our enclosing flow thread if we are contained inside o ne. This
215 // function follows the containing block chain. 215 // function follows the containing block chain.
216 RenderFlowThread* flowThreadContainingBlock() const 216 RenderFlowThread* flowThreadContainingBlock() const
217 { 217 {
218 if (flowThreadState() == NotInsideFlowThread) 218 if (flowThreadState() == NotInsideFlowThread)
219 return 0; 219 return 0;
220 return locateFlowThreadContainingBlock(); 220 return locateFlowThreadContainingBlock();
221 } 221 }
222 222
223 #ifndef NDEBUG 223 #if ENABLE(ASSERT)
224 void setHasAXObject(bool flag) { m_hasAXObject = flag; } 224 void setHasAXObject(bool flag) { m_hasAXObject = flag; }
225 bool hasAXObject() const { return m_hasAXObject; } 225 bool hasAXObject() const { return m_hasAXObject; }
226 226
227 // Helper class forbidding calls to setNeedsLayout() during its lifetime. 227 // Helper class forbidding calls to setNeedsLayout() during its lifetime.
228 class SetLayoutNeededForbiddenScope { 228 class SetLayoutNeededForbiddenScope {
229 public: 229 public:
230 explicit SetLayoutNeededForbiddenScope(RenderObject&); 230 explicit SetLayoutNeededForbiddenScope(RenderObject&);
231 ~SetLayoutNeededForbiddenScope(); 231 ~SetLayoutNeededForbiddenScope();
232 private: 232 private:
233 RenderObject& m_renderObject; 233 RenderObject& m_renderObject;
234 bool m_preexistingForbidden; 234 bool m_preexistingForbidden;
235 }; 235 };
236 236
237 void assertRendererLaidOut() const 237 void assertRendererLaidOut() const
238 { 238 {
239 #ifndef NDEBUG
239 if (needsLayout()) 240 if (needsLayout())
240 showRenderTreeForThis(); 241 showRenderTreeForThis();
242 #endif
241 ASSERT_WITH_SECURITY_IMPLICATION(!needsLayout()); 243 ASSERT_WITH_SECURITY_IMPLICATION(!needsLayout());
242 } 244 }
243 245
244 void assertSubtreeIsLaidOut() const 246 void assertSubtreeIsLaidOut() const
245 { 247 {
246 for (const RenderObject* renderer = this; renderer; renderer = renderer- >nextInPreOrder()) 248 for (const RenderObject* renderer = this; renderer; renderer = renderer- >nextInPreOrder())
247 renderer->assertRendererLaidOut(); 249 renderer->assertRendererLaidOut();
248 } 250 }
249 251
250 #endif 252 #endif
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 // Only update if our flow thread state is different from our new parent and if we're not a RenderFlowThread. 291 // Only update if our flow thread state is different from our new parent and if we're not a RenderFlowThread.
290 // A RenderFlowThread is always considered to be inside itself, so it ne ver has to change its state 292 // A RenderFlowThread is always considered to be inside itself, so it ne ver has to change its state
291 // in response to parent changes. 293 // in response to parent changes.
292 FlowThreadState newState = parent ? parent->flowThreadState() : NotInsid eFlowThread; 294 FlowThreadState newState = parent ? parent->flowThreadState() : NotInsid eFlowThread;
293 if (newState != flowThreadState() && !isRenderFlowThread()) 295 if (newState != flowThreadState() && !isRenderFlowThread())
294 setFlowThreadStateIncludingDescendants(newState); 296 setFlowThreadStateIncludingDescendants(newState);
295 } 297 }
296 298
297 ////////////////////////////////////////// 299 //////////////////////////////////////////
298 private: 300 private:
299 #ifndef NDEBUG 301 #if ENABLE(ASSERT)
300 bool isSetNeedsLayoutForbidden() const { return m_setNeedsLayoutForbidden; } 302 bool isSetNeedsLayoutForbidden() const { return m_setNeedsLayoutForbidden; }
301 void setNeedsLayoutIsForbidden(bool flag) { m_setNeedsLayoutForbidden = flag ; } 303 void setNeedsLayoutIsForbidden(bool flag) { m_setNeedsLayoutForbidden = flag ; }
302 #endif 304 #endif
303 305
304 void addAbsoluteRectForLayer(LayoutRect& result); 306 void addAbsoluteRectForLayer(LayoutRect& result);
305 bool requiresAnonymousTableWrappers(const RenderObject*) const; 307 bool requiresAnonymousTableWrappers(const RenderObject*) const;
306 308
307 // Gets pseudoStyle from Shadow host(in case of input elements) 309 // Gets pseudoStyle from Shadow host(in case of input elements)
308 // or from Parent element. 310 // or from Parent element.
309 PassRefPtr<RenderStyle> getUncachedPseudoStyleFromParentOrShadowHost() const ; 311 PassRefPtr<RenderStyle> getUncachedPseudoStyleFromParentOrShadowHost() const ;
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 1106
1105 bool hasImmediateNonWhitespaceTextChildOrPropertiesDependentOnColor() const; 1107 bool hasImmediateNonWhitespaceTextChildOrPropertiesDependentOnColor() const;
1106 1108
1107 RenderStyle* cachedFirstLineStyle() const; 1109 RenderStyle* cachedFirstLineStyle() const;
1108 StyleDifference adjustStyleDifference(StyleDifference) const; 1110 StyleDifference adjustStyleDifference(StyleDifference) const;
1109 1111
1110 Color selectionColor(int colorProperty) const; 1112 Color selectionColor(int colorProperty) const;
1111 1113
1112 void removeShapeImageClient(ShapeValue*); 1114 void removeShapeImageClient(ShapeValue*);
1113 1115
1114 #ifndef NDEBUG 1116 #if ENABLE(ASSERT)
1115 void checkBlockPositionedObjectsNeedLayout(); 1117 void checkBlockPositionedObjectsNeedLayout();
1116 #endif 1118 #endif
1117 const char* invalidationReasonToString(InvalidationReason) const; 1119 const char* invalidationReasonToString(InvalidationReason) const;
1118 1120
1119 static bool isAllowedToModifyRenderTreeStructure(Document&); 1121 static bool isAllowedToModifyRenderTreeStructure(Document&);
1120 1122
1121 RefPtr<RenderStyle> m_style; 1123 RefPtr<RenderStyle> m_style;
1122 1124
1123 Node* m_node; 1125 Node* m_node;
1124 1126
1125 RenderObject* m_parent; 1127 RenderObject* m_parent;
1126 RenderObject* m_previous; 1128 RenderObject* m_previous;
1127 RenderObject* m_next; 1129 RenderObject* m_next;
1128 1130
1129 #ifndef NDEBUG 1131 #if ENABLE(ASSERT)
1130 unsigned m_hasAXObject : 1; 1132 unsigned m_hasAXObject : 1;
1131 unsigned m_setNeedsLayoutForbidden : 1; 1133 unsigned m_setNeedsLayoutForbidden : 1;
1132 #endif 1134 #endif
1133 1135
1134 #define ADD_BOOLEAN_BITFIELD(name, Name) \ 1136 #define ADD_BOOLEAN_BITFIELD(name, Name) \
1135 private:\ 1137 private:\
1136 unsigned m_##name : 1;\ 1138 unsigned m_##name : 1;\
1137 public:\ 1139 public:\
1138 bool name() const { return m_##name; }\ 1140 bool name() const { return m_##name; }\
1139 void set##Name(bool name) { m_##name = name; }\ 1141 void set##Name(bool name) { m_##name = name; }\
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 setOnlyNeededPositionedMovementLayout(needsPositionedMovementLayoutOnly()); 1358 setOnlyNeededPositionedMovementLayout(needsPositionedMovementLayoutOnly());
1357 setNeededLayoutBecauseOfChildren(needsLayoutBecauseOfChildren()); 1359 setNeededLayoutBecauseOfChildren(needsLayoutBecauseOfChildren());
1358 setLayoutDidGetCalled(true); 1360 setLayoutDidGetCalled(true);
1359 setSelfNeedsLayout(false); 1361 setSelfNeedsLayout(false);
1360 setEverHadLayout(true); 1362 setEverHadLayout(true);
1361 setPosChildNeedsLayout(false); 1363 setPosChildNeedsLayout(false);
1362 setNeedsSimplifiedNormalFlowLayout(false); 1364 setNeedsSimplifiedNormalFlowLayout(false);
1363 setNormalChildNeedsLayout(false); 1365 setNormalChildNeedsLayout(false);
1364 setNeedsPositionedMovementLayout(false); 1366 setNeedsPositionedMovementLayout(false);
1365 setAncestorLineBoxDirty(false); 1367 setAncestorLineBoxDirty(false);
1366 #ifndef NDEBUG 1368 #if ENABLE(ASSERT)
1367 checkBlockPositionedObjectsNeedLayout(); 1369 checkBlockPositionedObjectsNeedLayout();
1368 #endif 1370 #endif
1369 } 1371 }
1370 1372
1371 inline void RenderObject::setChildNeedsLayout(MarkingBehavior markParents, Subtr eeLayoutScope* layouter) 1373 inline void RenderObject::setChildNeedsLayout(MarkingBehavior markParents, Subtr eeLayoutScope* layouter)
1372 { 1374 {
1373 ASSERT(!isSetNeedsLayoutForbidden()); 1375 ASSERT(!isSetNeedsLayoutForbidden());
1374 bool alreadyNeededLayout = normalChildNeedsLayout(); 1376 bool alreadyNeededLayout = normalChildNeedsLayout();
1375 setNormalChildNeedsLayout(true); 1377 setNormalChildNeedsLayout(true);
1376 // FIXME: Replace MarkOnlyThis with the SubtreeLayoutScope code path and rem ove the MarkingBehavior argument entirely. 1378 // FIXME: Replace MarkOnlyThis with the SubtreeLayoutScope code path and rem ove the MarkingBehavior argument entirely.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 void showTree(const WebCore::RenderObject*); 1491 void showTree(const WebCore::RenderObject*);
1490 void showLineTree(const WebCore::RenderObject*); 1492 void showLineTree(const WebCore::RenderObject*);
1491 void showRenderTree(const WebCore::RenderObject* object1); 1493 void showRenderTree(const WebCore::RenderObject* object1);
1492 // We don't make object2 an optional parameter so that showRenderTree 1494 // We don't make object2 an optional parameter so that showRenderTree
1493 // can be called from gdb easily. 1495 // can be called from gdb easily.
1494 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2); 1496 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2);
1495 1497
1496 #endif 1498 #endif
1497 1499
1498 #endif // RenderObject_h 1500 #endif // RenderObject_h
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderMultiColumnSet.cpp ('k') | Source/core/rendering/RenderObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698