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

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: Rebaselined and updated awesomeness! Created 6 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 | Annotate | Revision Log
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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 } 245 }
246 246
247 void assertSubtreeIsLaidOut() const 247 void assertSubtreeIsLaidOut() const
248 { 248 {
249 for (const RenderObject* renderer = this; renderer; renderer = renderer- >nextInPreOrder()) 249 for (const RenderObject* renderer = this; renderer; renderer = renderer- >nextInPreOrder())
250 renderer->assertRendererLaidOut(); 250 renderer->assertRendererLaidOut();
251 } 251 }
252 252
253 #endif 253 #endif
254 254
255 bool skipInvalidationWhenLaidOutChildren() const;
256
257 // FIXME: This could be used when changing the size of a renderer without ch ildren to skip some invalidations.
258 bool rendererHasNoBoxEffect() const
259 {
260 return !style()->hasVisualOverflowingEffect() && !style()->hasBorder() & & !style()->hasBackground();
261 }
262
255 // Obtains the nearest enclosing block (including this block) that contribut es a first-line style to our inline 263 // Obtains the nearest enclosing block (including this block) that contribut es a first-line style to our inline
256 // children. 264 // children.
257 virtual RenderBlock* firstLineBlock() const; 265 virtual RenderBlock* firstLineBlock() const;
258 266
259 // Called when an object that was floating or positioned becomes a normal fl ow object 267 // Called when an object that was floating or positioned becomes a normal fl ow object
260 // again. We have to make sure the render tree updates as needed to accommo date the new 268 // again. We have to make sure the render tree updates as needed to accommo date the new
261 // normal flow object. 269 // normal flow object.
262 void handleDynamicFloatPositionChange(); 270 void handleDynamicFloatPositionChange();
263 271
264 // RenderObject tree manipulation 272 // RenderObject tree manipulation
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 bool hasBoxDecorations() const { return m_bitfields.boxDecorationState() != NoBoxDecorations; } 534 bool hasBoxDecorations() const { return m_bitfields.boxDecorationState() != NoBoxDecorations; }
527 bool backgroundIsKnownToBeObscured(); 535 bool backgroundIsKnownToBeObscured();
528 bool canRenderBorderImage() const; 536 bool canRenderBorderImage() const;
529 bool mustInvalidateBackgroundOrBorderPaintOnWidthChange() const; 537 bool mustInvalidateBackgroundOrBorderPaintOnWidthChange() const;
530 bool mustInvalidateBackgroundOrBorderPaintOnHeightChange() const; 538 bool mustInvalidateBackgroundOrBorderPaintOnHeightChange() const;
531 bool mustInvalidateFillLayersPaintOnWidthChange(const FillLayer&) const; 539 bool mustInvalidateFillLayersPaintOnWidthChange(const FillLayer&) const;
532 bool mustInvalidateFillLayersPaintOnHeightChange(const FillLayer&) const; 540 bool mustInvalidateFillLayersPaintOnHeightChange(const FillLayer&) const;
533 bool hasBackground() const { return style()->hasBackground(); } 541 bool hasBackground() const { return style()->hasBackground(); }
534 bool hasEntirelyFixedBackground() const; 542 bool hasEntirelyFixedBackground() const;
535 543
544 bool needsLayoutBecauseOfChildren() const { return needsLayout() && !selfNee dsLayout() && !needsPositionedMovementLayout() && !needsSimplifiedNormalFlowLayo ut(); }
545
536 bool needsLayout() const 546 bool needsLayout() const
537 { 547 {
538 return m_bitfields.selfNeedsLayout() || m_bitfields.normalChildNeedsLayo ut() || m_bitfields.posChildNeedsLayout() 548 return m_bitfields.selfNeedsLayout() || m_bitfields.normalChildNeedsLayo ut() || m_bitfields.posChildNeedsLayout()
539 || m_bitfields.needsSimplifiedNormalFlowLayout() || m_bitfields.need sPositionedMovementLayout(); 549 || m_bitfields.needsSimplifiedNormalFlowLayout() || m_bitfields.need sPositionedMovementLayout();
540 } 550 }
541 551
542 bool selfNeedsLayout() const { return m_bitfields.selfNeedsLayout(); } 552 bool selfNeedsLayout() const { return m_bitfields.selfNeedsLayout(); }
543 bool needsPositionedMovementLayout() const { return m_bitfields.needsPositio nedMovementLayout(); } 553 bool needsPositionedMovementLayout() const { return m_bitfields.needsPositio nedMovementLayout(); }
544 bool needsPositionedMovementLayoutOnly() const 554 bool needsPositionedMovementLayoutOnly() const
545 { 555 {
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 bool mayNeedPaintInvalidation() { return m_bitfields.mayNeedPaintInvalidatio n(); } 1023 bool mayNeedPaintInvalidation() { return m_bitfields.mayNeedPaintInvalidatio n(); }
1014 void setMayNeedPaintInvalidation(bool b) 1024 void setMayNeedPaintInvalidation(bool b)
1015 { 1025 {
1016 m_bitfields.setMayNeedPaintInvalidation(b); 1026 m_bitfields.setMayNeedPaintInvalidation(b);
1017 1027
1018 // Make sure our parent is marked as needing invalidation. 1028 // Make sure our parent is marked as needing invalidation.
1019 if (b && parent() && !parent()->mayNeedPaintInvalidation()) 1029 if (b && parent() && !parent()->mayNeedPaintInvalidation())
1020 parent()->setMayNeedPaintInvalidation(b); 1030 parent()->setMayNeedPaintInvalidation(b);
1021 } 1031 }
1022 1032
1033 bool neededLayoutBecauseOfChildren() const { return m_bitfields.neededLayout BecauseOfChildren(); }
1034 void setNeededLayoutBecauseOfChildren(bool b) { m_bitfields.setNeededLayoutB ecauseOfChildren(b); }
1035
1023 bool shouldCheckForPaintInvalidationAfterLayout() 1036 bool shouldCheckForPaintInvalidationAfterLayout()
1024 { 1037 {
1025 return layoutDidGetCalled() || mayNeedPaintInvalidation(); 1038 return layoutDidGetCalled() || mayNeedPaintInvalidation();
1026 } 1039 }
1027 1040
1028 bool shouldDisableLayoutState() const { return hasColumns() || hasTransform( ) || hasReflection() || style()->isFlippedBlocksWritingMode(); } 1041 bool shouldDisableLayoutState() const { return hasColumns() || hasTransform( ) || hasReflection() || style()->isFlippedBlocksWritingMode(); }
1029 1042
1030 void setNeedsOverflowRecalcAfterStyleChange(); 1043 void setNeedsOverflowRecalcAfterStyleChange();
1031 void markContainingBlocksForOverflowRecalc(); 1044 void markContainingBlocksForOverflowRecalc();
1032 1045
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 // the layout bits beforeissing paint invalidations when doing inval idateTreeAfterLayout. 1153 // the layout bits beforeissing paint invalidations when doing inval idateTreeAfterLayout.
1141 // Holding the layout bits until after paint invalidation would remo ve the need 1154 // Holding the layout bits until after paint invalidation would remo ve the need
1142 // for this flag. 1155 // for this flag.
1143 , m_shouldDoFullPaintInvalidationAfterLayout(false) 1156 , m_shouldDoFullPaintInvalidationAfterLayout(false)
1144 , m_shouldInvalidateOverflowForPaint(false) 1157 , m_shouldInvalidateOverflowForPaint(false)
1145 , m_shouldDoFullPaintInvalidationIfSelfPaintingLayer(false) 1158 , m_shouldDoFullPaintInvalidationIfSelfPaintingLayer(false)
1146 // FIXME: We should remove mayNeedPaintInvalidation once we are able to 1159 // FIXME: We should remove mayNeedPaintInvalidation once we are able to
1147 // use the other layout flags to detect the same cases. crbug.com/37 0118 1160 // use the other layout flags to detect the same cases. crbug.com/37 0118
1148 , m_mayNeedPaintInvalidation(false) 1161 , m_mayNeedPaintInvalidation(false)
1149 , m_onlyNeededPositionedMovementLayout(false) 1162 , m_onlyNeededPositionedMovementLayout(false)
1163 , m_neededLayoutBecauseOfChildren(false)
1150 , m_needsPositionedMovementLayout(false) 1164 , m_needsPositionedMovementLayout(false)
1151 , m_normalChildNeedsLayout(false) 1165 , m_normalChildNeedsLayout(false)
1152 , m_posChildNeedsLayout(false) 1166 , m_posChildNeedsLayout(false)
1153 , m_needsSimplifiedNormalFlowLayout(false) 1167 , m_needsSimplifiedNormalFlowLayout(false)
1154 , m_preferredLogicalWidthsDirty(false) 1168 , m_preferredLogicalWidthsDirty(false)
1155 , m_floating(false) 1169 , m_floating(false)
1156 , m_selfNeedsOverflowRecalcAfterStyleChange(false) 1170 , m_selfNeedsOverflowRecalcAfterStyleChange(false)
1157 , m_childNeedsOverflowRecalcAfterStyleChange(false) 1171 , m_childNeedsOverflowRecalcAfterStyleChange(false)
1158 , m_isAnonymous(!node) 1172 , m_isAnonymous(!node)
1159 , m_isText(false) 1173 , m_isText(false)
(...skipping 20 matching lines...) Expand all
1180 { 1194 {
1181 } 1195 }
1182 1196
1183 // 32 bits have been used in the first word, and 6 in the second. 1197 // 32 bits have been used in the first word, and 6 in the second.
1184 ADD_BOOLEAN_BITFIELD(selfNeedsLayout, SelfNeedsLayout); 1198 ADD_BOOLEAN_BITFIELD(selfNeedsLayout, SelfNeedsLayout);
1185 ADD_BOOLEAN_BITFIELD(shouldDoFullPaintInvalidationAfterLayout, ShouldDoF ullPaintInvalidationAfterLayout); 1199 ADD_BOOLEAN_BITFIELD(shouldDoFullPaintInvalidationAfterLayout, ShouldDoF ullPaintInvalidationAfterLayout);
1186 ADD_BOOLEAN_BITFIELD(shouldInvalidateOverflowForPaint, ShouldInvalidateO verflowForPaint); 1200 ADD_BOOLEAN_BITFIELD(shouldInvalidateOverflowForPaint, ShouldInvalidateO verflowForPaint);
1187 ADD_BOOLEAN_BITFIELD(shouldDoFullPaintInvalidationIfSelfPaintingLayer, S houldDoFullPaintInvalidationIfSelfPaintingLayer); 1201 ADD_BOOLEAN_BITFIELD(shouldDoFullPaintInvalidationIfSelfPaintingLayer, S houldDoFullPaintInvalidationIfSelfPaintingLayer);
1188 ADD_BOOLEAN_BITFIELD(mayNeedPaintInvalidation, MayNeedPaintInvalidation) ; 1202 ADD_BOOLEAN_BITFIELD(mayNeedPaintInvalidation, MayNeedPaintInvalidation) ;
1189 ADD_BOOLEAN_BITFIELD(onlyNeededPositionedMovementLayout, OnlyNeededPosit ionedMovementLayout); 1203 ADD_BOOLEAN_BITFIELD(onlyNeededPositionedMovementLayout, OnlyNeededPosit ionedMovementLayout);
1204 ADD_BOOLEAN_BITFIELD(neededLayoutBecauseOfChildren, NeededLayoutBecauseO fChildren);
1190 ADD_BOOLEAN_BITFIELD(needsPositionedMovementLayout, NeedsPositionedMovem entLayout); 1205 ADD_BOOLEAN_BITFIELD(needsPositionedMovementLayout, NeedsPositionedMovem entLayout);
1191 ADD_BOOLEAN_BITFIELD(normalChildNeedsLayout, NormalChildNeedsLayout); 1206 ADD_BOOLEAN_BITFIELD(normalChildNeedsLayout, NormalChildNeedsLayout);
1192 ADD_BOOLEAN_BITFIELD(posChildNeedsLayout, PosChildNeedsLayout); 1207 ADD_BOOLEAN_BITFIELD(posChildNeedsLayout, PosChildNeedsLayout);
1193 ADD_BOOLEAN_BITFIELD(needsSimplifiedNormalFlowLayout, NeedsSimplifiedNor malFlowLayout); 1208 ADD_BOOLEAN_BITFIELD(needsSimplifiedNormalFlowLayout, NeedsSimplifiedNor malFlowLayout);
1194 ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, PreferredLogicalWidths Dirty); 1209 ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, PreferredLogicalWidths Dirty);
1195 ADD_BOOLEAN_BITFIELD(floating, Floating); 1210 ADD_BOOLEAN_BITFIELD(floating, Floating);
1196 ADD_BOOLEAN_BITFIELD(selfNeedsOverflowRecalcAfterStyleChange, SelfNeedsO verflowRecalcAfterStyleChange); 1211 ADD_BOOLEAN_BITFIELD(selfNeedsOverflowRecalcAfterStyleChange, SelfNeedsO verflowRecalcAfterStyleChange);
1197 ADD_BOOLEAN_BITFIELD(childNeedsOverflowRecalcAfterStyleChange, ChildNeed sOverflowRecalcAfterStyleChange); 1212 ADD_BOOLEAN_BITFIELD(childNeedsOverflowRecalcAfterStyleChange, ChildNeed sOverflowRecalcAfterStyleChange);
1198 1213
1199 ADD_BOOLEAN_BITFIELD(isAnonymous, IsAnonymous); 1214 ADD_BOOLEAN_BITFIELD(isAnonymous, IsAnonymous);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 } 1352 }
1338 1353
1339 inline void RenderObject::setNeedsLayoutAndFullPaintInvalidation(MarkingBehavior markParents, SubtreeLayoutScope* layouter) 1354 inline void RenderObject::setNeedsLayoutAndFullPaintInvalidation(MarkingBehavior markParents, SubtreeLayoutScope* layouter)
1340 { 1355 {
1341 setNeedsLayout(markParents, layouter); 1356 setNeedsLayout(markParents, layouter);
1342 setShouldDoFullPaintInvalidationAfterLayout(true); 1357 setShouldDoFullPaintInvalidationAfterLayout(true);
1343 } 1358 }
1344 1359
1345 inline void RenderObject::clearNeedsLayout() 1360 inline void RenderObject::clearNeedsLayout()
1346 { 1361 {
1362 // FIXME: Branch?
leviw_travelin_and_unemployed 2014/06/13 00:03:42 Can you be a *little* more descriptive here? Are y
Julien - ping for review 2014/06/30 22:36:29 This wasn't meant for public consumption but I for
1347 if (needsPositionedMovementLayoutOnly()) 1363 if (needsPositionedMovementLayoutOnly())
1348 setOnlyNeededPositionedMovementLayout(true); 1364 setOnlyNeededPositionedMovementLayout(true);
1349 setLayoutDidGetCalled(true); 1365 setLayoutDidGetCalled(true);
1366 setNeededLayoutBecauseOfChildren(needsLayoutBecauseOfChildren());
1350 setSelfNeedsLayout(false); 1367 setSelfNeedsLayout(false);
1351 setEverHadLayout(true); 1368 setEverHadLayout(true);
1352 setPosChildNeedsLayout(false); 1369 setPosChildNeedsLayout(false);
1353 setNeedsSimplifiedNormalFlowLayout(false); 1370 setNeedsSimplifiedNormalFlowLayout(false);
1354 setNormalChildNeedsLayout(false); 1371 setNormalChildNeedsLayout(false);
1355 setNeedsPositionedMovementLayout(false); 1372 setNeedsPositionedMovementLayout(false);
1356 setAncestorLineBoxDirty(false); 1373 setAncestorLineBoxDirty(false);
1357 #ifndef NDEBUG 1374 #ifndef NDEBUG
1358 checkBlockPositionedObjectsNeedLayout(); 1375 checkBlockPositionedObjectsNeedLayout();
1359 #endif 1376 #endif
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 void showTree(const WebCore::RenderObject*); 1500 void showTree(const WebCore::RenderObject*);
1484 void showLineTree(const WebCore::RenderObject*); 1501 void showLineTree(const WebCore::RenderObject*);
1485 void showRenderTree(const WebCore::RenderObject* object1); 1502 void showRenderTree(const WebCore::RenderObject* object1);
1486 // We don't make object2 an optional parameter so that showRenderTree 1503 // We don't make object2 an optional parameter so that showRenderTree
1487 // can be called from gdb easily. 1504 // can be called from gdb easily.
1488 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2); 1505 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2);
1489 1506
1490 #endif 1507 #endif
1491 1508
1492 #endif // RenderObject_h 1509 #endif // RenderObject_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698