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

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

Issue 204843002: Reduce invalidation on children-needs-layout containers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: And more and more... 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/RenderBox.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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 } 242 }
243 243
244 void assertSubtreeIsLaidOut() const 244 void assertSubtreeIsLaidOut() const
245 { 245 {
246 for (const RenderObject* renderer = this; renderer; renderer = renderer- >nextInPreOrder()) 246 for (const RenderObject* renderer = this; renderer; renderer = renderer- >nextInPreOrder())
247 renderer->assertRendererLaidOut(); 247 renderer->assertRendererLaidOut();
248 } 248 }
249 249
250 #endif 250 #endif
251 251
252 bool skipInvalidationWhenLaidOutChildren() const;
253
254 // FIXME: This could be used when changing the size of a renderer without ch ildren to skip some invalidations.
255 bool rendererHasNoBoxEffect() const
256 {
257 return !style()->hasVisualOverflowingEffect() && !style()->hasBorder() & & !style()->hasBackground();
258 }
259
252 // Obtains the nearest enclosing block (including this block) that contribut es a first-line style to our inline 260 // Obtains the nearest enclosing block (including this block) that contribut es a first-line style to our inline
253 // children. 261 // children.
254 virtual RenderBlock* firstLineBlock() const; 262 virtual RenderBlock* firstLineBlock() const;
255 263
256 // Called when an object that was floating or positioned becomes a normal fl ow object 264 // Called when an object that was floating or positioned becomes a normal fl ow object
257 // again. We have to make sure the render tree updates as needed to accommo date the new 265 // again. We have to make sure the render tree updates as needed to accommo date the new
258 // normal flow object. 266 // normal flow object.
259 void handleDynamicFloatPositionChange(); 267 void handleDynamicFloatPositionChange();
260 268
261 // RenderObject tree manipulation 269 // RenderObject tree manipulation
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 bool hasBoxDecorationBackground() const { return m_bitfields.boxDecorationBa ckgroundState() != NoBoxDecorationBackground; } 531 bool hasBoxDecorationBackground() const { return m_bitfields.boxDecorationBa ckgroundState() != NoBoxDecorationBackground; }
524 bool boxDecorationBackgroundIsKnownToBeObscured(); 532 bool boxDecorationBackgroundIsKnownToBeObscured();
525 bool canRenderBorderImage() const; 533 bool canRenderBorderImage() const;
526 bool mustInvalidateBackgroundOrBorderPaintOnWidthChange() const; 534 bool mustInvalidateBackgroundOrBorderPaintOnWidthChange() const;
527 bool mustInvalidateBackgroundOrBorderPaintOnHeightChange() const; 535 bool mustInvalidateBackgroundOrBorderPaintOnHeightChange() const;
528 bool mustInvalidateFillLayersPaintOnWidthChange(const FillLayer&) const; 536 bool mustInvalidateFillLayersPaintOnWidthChange(const FillLayer&) const;
529 bool mustInvalidateFillLayersPaintOnHeightChange(const FillLayer&) const; 537 bool mustInvalidateFillLayersPaintOnHeightChange(const FillLayer&) const;
530 bool hasBackground() const { return style()->hasBackground(); } 538 bool hasBackground() const { return style()->hasBackground(); }
531 bool hasEntirelyFixedBackground() const; 539 bool hasEntirelyFixedBackground() const;
532 540
541 bool needsLayoutBecauseOfChildren() const { return needsLayout() && !selfNee dsLayout() && !needsPositionedMovementLayout() && !needsSimplifiedNormalFlowLayo ut(); }
542
533 bool needsLayout() const 543 bool needsLayout() const
534 { 544 {
535 return m_bitfields.selfNeedsLayout() || m_bitfields.normalChildNeedsLayo ut() || m_bitfields.posChildNeedsLayout() 545 return m_bitfields.selfNeedsLayout() || m_bitfields.normalChildNeedsLayo ut() || m_bitfields.posChildNeedsLayout()
536 || m_bitfields.needsSimplifiedNormalFlowLayout() || m_bitfields.need sPositionedMovementLayout(); 546 || m_bitfields.needsSimplifiedNormalFlowLayout() || m_bitfields.need sPositionedMovementLayout();
537 } 547 }
538 548
539 bool selfNeedsLayout() const { return m_bitfields.selfNeedsLayout(); } 549 bool selfNeedsLayout() const { return m_bitfields.selfNeedsLayout(); }
540 bool needsPositionedMovementLayout() const { return m_bitfields.needsPositio nedMovementLayout(); } 550 bool needsPositionedMovementLayout() const { return m_bitfields.needsPositio nedMovementLayout(); }
541 bool needsPositionedMovementLayoutOnly() const 551 bool needsPositionedMovementLayoutOnly() const
542 { 552 {
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 bool mayNeedPaintInvalidation() { return m_bitfields.mayNeedPaintInvalidatio n(); } 1014 bool mayNeedPaintInvalidation() { return m_bitfields.mayNeedPaintInvalidatio n(); }
1005 void setMayNeedPaintInvalidation(bool b) 1015 void setMayNeedPaintInvalidation(bool b)
1006 { 1016 {
1007 m_bitfields.setMayNeedPaintInvalidation(b); 1017 m_bitfields.setMayNeedPaintInvalidation(b);
1008 1018
1009 // Make sure our parent is marked as needing invalidation. 1019 // Make sure our parent is marked as needing invalidation.
1010 if (b && parent() && !parent()->mayNeedPaintInvalidation()) 1020 if (b && parent() && !parent()->mayNeedPaintInvalidation())
1011 parent()->setMayNeedPaintInvalidation(b); 1021 parent()->setMayNeedPaintInvalidation(b);
1012 } 1022 }
1013 1023
1024 bool neededLayoutBecauseOfChildren() const { return m_bitfields.neededLayout BecauseOfChildren(); }
1025 void setNeededLayoutBecauseOfChildren(bool b) { m_bitfields.setNeededLayoutB ecauseOfChildren(b); }
1026
1014 bool shouldCheckForPaintInvalidationAfterLayout() 1027 bool shouldCheckForPaintInvalidationAfterLayout()
1015 { 1028 {
1016 return layoutDidGetCalled() || mayNeedPaintInvalidation(); 1029 return layoutDidGetCalled() || mayNeedPaintInvalidation();
1017 } 1030 }
1018 1031
1019 bool supportsLayoutStateCachedOffsets() const { return !hasColumns() && !has Transform() && !hasReflection() && !style()->isFlippedBlocksWritingMode(); } 1032 bool supportsLayoutStateCachedOffsets() const { return !hasColumns() && !has Transform() && !hasReflection() && !style()->isFlippedBlocksWritingMode(); }
1020 1033
1021 void setNeedsOverflowRecalcAfterStyleChange(); 1034 void setNeedsOverflowRecalcAfterStyleChange();
1022 void markContainingBlocksForOverflowRecalc(); 1035 void markContainingBlocksForOverflowRecalc();
1023 1036
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 // the layout bits beforeissing paint invalidations when doing inval idateTreeAfterLayout. 1151 // the layout bits beforeissing paint invalidations when doing inval idateTreeAfterLayout.
1139 // Holding the layout bits until after paint invalidation would remo ve the need 1152 // Holding the layout bits until after paint invalidation would remo ve the need
1140 // for this flag. 1153 // for this flag.
1141 , m_shouldDoFullPaintInvalidationAfterLayout(false) 1154 , m_shouldDoFullPaintInvalidationAfterLayout(false)
1142 , m_shouldInvalidateOverflowForPaint(false) 1155 , m_shouldInvalidateOverflowForPaint(false)
1143 , m_shouldDoFullPaintInvalidationIfSelfPaintingLayer(false) 1156 , m_shouldDoFullPaintInvalidationIfSelfPaintingLayer(false)
1144 // FIXME: We should remove mayNeedPaintInvalidation once we are able to 1157 // FIXME: We should remove mayNeedPaintInvalidation once we are able to
1145 // use the other layout flags to detect the same cases. crbug.com/37 0118 1158 // use the other layout flags to detect the same cases. crbug.com/37 0118
1146 , m_mayNeedPaintInvalidation(false) 1159 , m_mayNeedPaintInvalidation(false)
1147 , m_onlyNeededPositionedMovementLayout(false) 1160 , m_onlyNeededPositionedMovementLayout(false)
1161 , m_neededLayoutBecauseOfChildren(false)
1148 , m_needsPositionedMovementLayout(false) 1162 , m_needsPositionedMovementLayout(false)
1149 , m_normalChildNeedsLayout(false) 1163 , m_normalChildNeedsLayout(false)
1150 , m_posChildNeedsLayout(false) 1164 , m_posChildNeedsLayout(false)
1151 , m_needsSimplifiedNormalFlowLayout(false) 1165 , m_needsSimplifiedNormalFlowLayout(false)
1152 , m_preferredLogicalWidthsDirty(false) 1166 , m_preferredLogicalWidthsDirty(false)
1153 , m_floating(false) 1167 , m_floating(false)
1154 , m_selfNeedsOverflowRecalcAfterStyleChange(false) 1168 , m_selfNeedsOverflowRecalcAfterStyleChange(false)
1155 , m_childNeedsOverflowRecalcAfterStyleChange(false) 1169 , m_childNeedsOverflowRecalcAfterStyleChange(false)
1156 , m_isAnonymous(!node) 1170 , m_isAnonymous(!node)
1157 , m_isText(false) 1171 , m_isText(false)
(...skipping 20 matching lines...) Expand all
1178 { 1192 {
1179 } 1193 }
1180 1194
1181 // 32 bits have been used in the first word, and 6 in the second. 1195 // 32 bits have been used in the first word, and 6 in the second.
1182 ADD_BOOLEAN_BITFIELD(selfNeedsLayout, SelfNeedsLayout); 1196 ADD_BOOLEAN_BITFIELD(selfNeedsLayout, SelfNeedsLayout);
1183 ADD_BOOLEAN_BITFIELD(shouldDoFullPaintInvalidationAfterLayout, ShouldDoF ullPaintInvalidationAfterLayout); 1197 ADD_BOOLEAN_BITFIELD(shouldDoFullPaintInvalidationAfterLayout, ShouldDoF ullPaintInvalidationAfterLayout);
1184 ADD_BOOLEAN_BITFIELD(shouldInvalidateOverflowForPaint, ShouldInvalidateO verflowForPaint); 1198 ADD_BOOLEAN_BITFIELD(shouldInvalidateOverflowForPaint, ShouldInvalidateO verflowForPaint);
1185 ADD_BOOLEAN_BITFIELD(shouldDoFullPaintInvalidationIfSelfPaintingLayer, S houldDoFullPaintInvalidationIfSelfPaintingLayer); 1199 ADD_BOOLEAN_BITFIELD(shouldDoFullPaintInvalidationIfSelfPaintingLayer, S houldDoFullPaintInvalidationIfSelfPaintingLayer);
1186 ADD_BOOLEAN_BITFIELD(mayNeedPaintInvalidation, MayNeedPaintInvalidation) ; 1200 ADD_BOOLEAN_BITFIELD(mayNeedPaintInvalidation, MayNeedPaintInvalidation) ;
1187 ADD_BOOLEAN_BITFIELD(onlyNeededPositionedMovementLayout, OnlyNeededPosit ionedMovementLayout); 1201 ADD_BOOLEAN_BITFIELD(onlyNeededPositionedMovementLayout, OnlyNeededPosit ionedMovementLayout);
1202 ADD_BOOLEAN_BITFIELD(neededLayoutBecauseOfChildren, NeededLayoutBecauseO fChildren);
1188 ADD_BOOLEAN_BITFIELD(needsPositionedMovementLayout, NeedsPositionedMovem entLayout); 1203 ADD_BOOLEAN_BITFIELD(needsPositionedMovementLayout, NeedsPositionedMovem entLayout);
1189 ADD_BOOLEAN_BITFIELD(normalChildNeedsLayout, NormalChildNeedsLayout); 1204 ADD_BOOLEAN_BITFIELD(normalChildNeedsLayout, NormalChildNeedsLayout);
1190 ADD_BOOLEAN_BITFIELD(posChildNeedsLayout, PosChildNeedsLayout); 1205 ADD_BOOLEAN_BITFIELD(posChildNeedsLayout, PosChildNeedsLayout);
1191 ADD_BOOLEAN_BITFIELD(needsSimplifiedNormalFlowLayout, NeedsSimplifiedNor malFlowLayout); 1206 ADD_BOOLEAN_BITFIELD(needsSimplifiedNormalFlowLayout, NeedsSimplifiedNor malFlowLayout);
1192 ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, PreferredLogicalWidths Dirty); 1207 ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, PreferredLogicalWidths Dirty);
1193 ADD_BOOLEAN_BITFIELD(floating, Floating); 1208 ADD_BOOLEAN_BITFIELD(floating, Floating);
1194 ADD_BOOLEAN_BITFIELD(selfNeedsOverflowRecalcAfterStyleChange, SelfNeedsO verflowRecalcAfterStyleChange); 1209 ADD_BOOLEAN_BITFIELD(selfNeedsOverflowRecalcAfterStyleChange, SelfNeedsO verflowRecalcAfterStyleChange);
1195 ADD_BOOLEAN_BITFIELD(childNeedsOverflowRecalcAfterStyleChange, ChildNeed sOverflowRecalcAfterStyleChange); 1210 ADD_BOOLEAN_BITFIELD(childNeedsOverflowRecalcAfterStyleChange, ChildNeed sOverflowRecalcAfterStyleChange);
1196 1211
1197 ADD_BOOLEAN_BITFIELD(isAnonymous, IsAnonymous); 1212 ADD_BOOLEAN_BITFIELD(isAnonymous, IsAnonymous);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 } 1349 }
1335 1350
1336 inline void RenderObject::setNeedsLayoutAndFullPaintInvalidation(MarkingBehavior markParents, SubtreeLayoutScope* layouter) 1351 inline void RenderObject::setNeedsLayoutAndFullPaintInvalidation(MarkingBehavior markParents, SubtreeLayoutScope* layouter)
1337 { 1352 {
1338 setNeedsLayout(markParents, layouter); 1353 setNeedsLayout(markParents, layouter);
1339 setShouldDoFullPaintInvalidationAfterLayout(true); 1354 setShouldDoFullPaintInvalidationAfterLayout(true);
1340 } 1355 }
1341 1356
1342 inline void RenderObject::clearNeedsLayout() 1357 inline void RenderObject::clearNeedsLayout()
1343 { 1358 {
1344 if (needsPositionedMovementLayoutOnly()) 1359 setOnlyNeededPositionedMovementLayout(needsPositionedMovementLayoutOnly());
1345 setOnlyNeededPositionedMovementLayout(true); 1360 setNeededLayoutBecauseOfChildren(needsLayoutBecauseOfChildren());
1346 setLayoutDidGetCalled(true); 1361 setLayoutDidGetCalled(true);
1347 setSelfNeedsLayout(false); 1362 setSelfNeedsLayout(false);
1348 setEverHadLayout(true); 1363 setEverHadLayout(true);
1349 setPosChildNeedsLayout(false); 1364 setPosChildNeedsLayout(false);
1350 setNeedsSimplifiedNormalFlowLayout(false); 1365 setNeedsSimplifiedNormalFlowLayout(false);
1351 setNormalChildNeedsLayout(false); 1366 setNormalChildNeedsLayout(false);
1352 setNeedsPositionedMovementLayout(false); 1367 setNeedsPositionedMovementLayout(false);
1353 setAncestorLineBoxDirty(false); 1368 setAncestorLineBoxDirty(false);
1354 #ifndef NDEBUG 1369 #ifndef NDEBUG
1355 checkBlockPositionedObjectsNeedLayout(); 1370 checkBlockPositionedObjectsNeedLayout();
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 void showTree(const WebCore::RenderObject*); 1492 void showTree(const WebCore::RenderObject*);
1478 void showLineTree(const WebCore::RenderObject*); 1493 void showLineTree(const WebCore::RenderObject*);
1479 void showRenderTree(const WebCore::RenderObject* object1); 1494 void showRenderTree(const WebCore::RenderObject* object1);
1480 // We don't make object2 an optional parameter so that showRenderTree 1495 // We don't make object2 an optional parameter so that showRenderTree
1481 // can be called from gdb easily. 1496 // can be called from gdb easily.
1482 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2); 1497 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2);
1483 1498
1484 #endif 1499 #endif
1485 1500
1486 #endif // RenderObject_h 1501 #endif // RenderObject_h
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBox.cpp ('k') | Source/core/rendering/RenderObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698