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

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

Issue 197283038: Add RenderObject::needsResizeLayout (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rename internal setNeedsResizeLayout Created 6 years, 9 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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 bool hasBoxDecorations() const { return m_bitfields.boxDecorationState() != NoBoxDecorations; } 523 bool hasBoxDecorations() const { return m_bitfields.boxDecorationState() != NoBoxDecorations; }
524 bool backgroundIsKnownToBeObscured(); 524 bool backgroundIsKnownToBeObscured();
525 bool borderImageIsLoadedAndCanBeRendered() const; 525 bool borderImageIsLoadedAndCanBeRendered() const;
526 bool mustRepaintBackgroundOrBorder() const; 526 bool mustRepaintBackgroundOrBorder() const;
527 bool hasBackground() const { return style()->hasBackground(); } 527 bool hasBackground() const { return style()->hasBackground(); }
528 bool hasEntirelyFixedBackground() const; 528 bool hasEntirelyFixedBackground() const;
529 529
530 bool needsLayout() const 530 bool needsLayout() const
531 { 531 {
532 return m_bitfields.selfNeedsLayout() || m_bitfields.normalChildNeedsLayo ut() || m_bitfields.posChildNeedsLayout() 532 return m_bitfields.selfNeedsLayout() || m_bitfields.normalChildNeedsLayo ut() || m_bitfields.posChildNeedsLayout()
533 || m_bitfields.needsSimplifiedNormalFlowLayout() || m_bitfields.need sPositionedMovementLayout(); 533 || m_bitfields.needsSimplifiedNormalFlowLayout() || m_bitfields.need sPositionedMovementLayout() || m_bitfields.needsResizeLayout();
534 } 534 }
535 535
536 bool selfNeedsLayout() const { return m_bitfields.selfNeedsLayout(); } 536 bool selfNeedsLayout() const { return m_bitfields.selfNeedsLayout(); }
537 bool needsPositionedMovementLayout() const { return m_bitfields.needsPositio nedMovementLayout(); } 537 bool needsPositionedMovementLayout() const { return m_bitfields.needsPositio nedMovementLayout(); }
538 bool needsPositionedMovementLayoutOnly() const 538 bool needsPositionedMovementLayoutOnly() const
539 { 539 {
540 return m_bitfields.needsPositionedMovementLayout() && !m_bitfields.selfN eedsLayout() && !m_bitfields.normalChildNeedsLayout() 540 return m_bitfields.needsPositionedMovementLayout() && !m_bitfields.selfN eedsLayout() && !m_bitfields.normalChildNeedsLayout()
541 && !m_bitfields.posChildNeedsLayout() && !m_bitfields.needsSimplifie dNormalFlowLayout(); 541 && !m_bitfields.posChildNeedsLayout() && !m_bitfields.needsSimplifie dNormalFlowLayout() && !m_bitfields.needsResizeLayout();
542 } 542 }
543 543
544 bool posChildNeedsLayout() const { return m_bitfields.posChildNeedsLayout(); } 544 bool posChildNeedsLayout() const { return m_bitfields.posChildNeedsLayout(); }
545 bool needsSimplifiedNormalFlowLayout() const { return m_bitfields.needsSimpl ifiedNormalFlowLayout(); } 545 bool needsSimplifiedNormalFlowLayout() const { return m_bitfields.needsSimpl ifiedNormalFlowLayout(); }
546 bool normalChildNeedsLayout() const { return m_bitfields.normalChildNeedsLay out(); } 546 bool normalChildNeedsLayout() const { return m_bitfields.normalChildNeedsLay out(); }
547 547
548 bool needsResizeLayout() const { return m_bitfields.needsResizeLayout(); }
549 bool needsResizeLayoutOnly() const
550 {
551 return m_bitfields.needsResizeLayout() && !m_bitfields.selfNeedsLayout() && !m_bitfields.normalChildNeedsLayout()
552 && !m_bitfields.posChildNeedsLayout() && !m_bitfields.needsSimplifie dNormalFlowLayout() && !m_bitfields.needsPositionedMovementLayout();
esprehn 2014/03/24 22:40:04 Can you put one check per line?
Xianzhu 2014/03/24 23:53:24 Done.
553 }
554
548 bool preferredLogicalWidthsDirty() const { return m_bitfields.preferredLogic alWidthsDirty(); } 555 bool preferredLogicalWidthsDirty() const { return m_bitfields.preferredLogic alWidthsDirty(); }
549 556
550 bool isSelectionBorder() const; 557 bool isSelectionBorder() const;
551 558
552 bool hasClip() const { return isOutOfFlowPositioned() && style()->hasClip(); } 559 bool hasClip() const { return isOutOfFlowPositioned() && style()->hasClip(); }
553 bool hasOverflowClip() const { return m_bitfields.hasOverflowClip(); } 560 bool hasOverflowClip() const { return m_bitfields.hasOverflowClip(); }
554 bool hasClipOrOverflowClip() const { return hasClip() || hasOverflowClip(); } 561 bool hasClipOrOverflowClip() const { return hasClip() || hasOverflowClip(); }
555 562
556 bool hasTransform() const { return m_bitfields.hasTransform(); } 563 bool hasTransform() const { return m_bitfields.hasTransform(); }
557 bool hasMask() const { return style() && style()->hasMask(); } 564 bool hasMask() const { return style() && style()->hasMask(); }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 virtual RenderObject* hoverAncestor() const { return parent(); } 616 virtual RenderObject* hoverAncestor() const { return parent(); }
610 617
611 Element* offsetParent() const; 618 Element* offsetParent() const;
612 619
613 void markContainingBlocksForLayout(bool scheduleRelayout = true, RenderObjec t* newRoot = 0, SubtreeLayoutScope* = 0); 620 void markContainingBlocksForLayout(bool scheduleRelayout = true, RenderObjec t* newRoot = 0, SubtreeLayoutScope* = 0);
614 void setNeedsLayout(MarkingBehavior = MarkContainingBlockChain, SubtreeLayou tScope* = 0); 621 void setNeedsLayout(MarkingBehavior = MarkContainingBlockChain, SubtreeLayou tScope* = 0);
615 void clearNeedsLayout(); 622 void clearNeedsLayout();
616 void setChildNeedsLayout(MarkingBehavior = MarkContainingBlockChain, Subtree LayoutScope* = 0); 623 void setChildNeedsLayout(MarkingBehavior = MarkContainingBlockChain, Subtree LayoutScope* = 0);
617 void setNeedsPositionedMovementLayout(); 624 void setNeedsPositionedMovementLayout();
618 void setNeedsSimplifiedNormalFlowLayout(); 625 void setNeedsSimplifiedNormalFlowLayout();
626 void setNeedsResizeLayout();
619 void setPreferredLogicalWidthsDirty(MarkingBehavior = MarkContainingBlockCha in); 627 void setPreferredLogicalWidthsDirty(MarkingBehavior = MarkContainingBlockCha in);
620 void clearPreferredLogicalWidthsDirty(); 628 void clearPreferredLogicalWidthsDirty();
621 void invalidateContainerPreferredLogicalWidths(); 629 void invalidateContainerPreferredLogicalWidths();
622 630
623 void setNeedsLayoutAndPrefWidthsRecalc() 631 void setNeedsLayoutAndPrefWidthsRecalc()
624 { 632 {
625 setNeedsLayout(); 633 setNeedsLayout();
626 setPreferredLogicalWidthsDirty(); 634 setPreferredLogicalWidthsDirty();
627 } 635 }
628 636
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 // Holding the layout bits until after repaint would remove the need 1116 // Holding the layout bits until after repaint would remove the need
1109 // for this flag. 1117 // for this flag.
1110 , m_shouldDoFullRepaintAfterLayout(false) 1118 , m_shouldDoFullRepaintAfterLayout(false)
1111 , m_shouldRepaintOverflow(false) 1119 , m_shouldRepaintOverflow(false)
1112 , m_shouldDoFullRepaintIfSelfPaintingLayer(false) 1120 , m_shouldDoFullRepaintIfSelfPaintingLayer(false)
1113 , m_onlyNeededPositionedMovementLayout(false) 1121 , m_onlyNeededPositionedMovementLayout(false)
1114 , m_needsPositionedMovementLayout(false) 1122 , m_needsPositionedMovementLayout(false)
1115 , m_normalChildNeedsLayout(false) 1123 , m_normalChildNeedsLayout(false)
1116 , m_posChildNeedsLayout(false) 1124 , m_posChildNeedsLayout(false)
1117 , m_needsSimplifiedNormalFlowLayout(false) 1125 , m_needsSimplifiedNormalFlowLayout(false)
1126 , m_needsResizeLayout(false)
1118 , m_preferredLogicalWidthsDirty(false) 1127 , m_preferredLogicalWidthsDirty(false)
1119 , m_floating(false) 1128 , m_floating(false)
1120 , m_isAnonymous(!node) 1129 , m_isAnonymous(!node)
1121 , m_isText(false) 1130 , m_isText(false)
1122 , m_isBox(false) 1131 , m_isBox(false)
1123 , m_isInline(true) 1132 , m_isInline(true)
1124 , m_isReplaced(false) 1133 , m_isReplaced(false)
1125 , m_horizontalWritingMode(true) 1134 , m_horizontalWritingMode(true)
1126 , m_isDragging(false) 1135 , m_isDragging(false)
1127 , m_hasLayer(false) 1136 , m_hasLayer(false)
(...skipping 17 matching lines...) Expand all
1145 // 32 bits have been used in the first word, and 5 in the second. 1154 // 32 bits have been used in the first word, and 5 in the second.
1146 ADD_BOOLEAN_BITFIELD(selfNeedsLayout, SelfNeedsLayout); 1155 ADD_BOOLEAN_BITFIELD(selfNeedsLayout, SelfNeedsLayout);
1147 ADD_BOOLEAN_BITFIELD(shouldDoFullRepaintAfterLayout, ShouldDoFullRepaint AfterLayout); 1156 ADD_BOOLEAN_BITFIELD(shouldDoFullRepaintAfterLayout, ShouldDoFullRepaint AfterLayout);
1148 ADD_BOOLEAN_BITFIELD(shouldRepaintOverflow, ShouldRepaintOverflow); 1157 ADD_BOOLEAN_BITFIELD(shouldRepaintOverflow, ShouldRepaintOverflow);
1149 ADD_BOOLEAN_BITFIELD(shouldDoFullRepaintIfSelfPaintingLayer, ShouldDoFul lRepaintIfSelfPaintingLayer); 1158 ADD_BOOLEAN_BITFIELD(shouldDoFullRepaintIfSelfPaintingLayer, ShouldDoFul lRepaintIfSelfPaintingLayer);
1150 ADD_BOOLEAN_BITFIELD(onlyNeededPositionedMovementLayout, OnlyNeededPosit ionedMovementLayout); 1159 ADD_BOOLEAN_BITFIELD(onlyNeededPositionedMovementLayout, OnlyNeededPosit ionedMovementLayout);
1151 ADD_BOOLEAN_BITFIELD(needsPositionedMovementLayout, NeedsPositionedMovem entLayout); 1160 ADD_BOOLEAN_BITFIELD(needsPositionedMovementLayout, NeedsPositionedMovem entLayout);
1152 ADD_BOOLEAN_BITFIELD(normalChildNeedsLayout, NormalChildNeedsLayout); 1161 ADD_BOOLEAN_BITFIELD(normalChildNeedsLayout, NormalChildNeedsLayout);
1153 ADD_BOOLEAN_BITFIELD(posChildNeedsLayout, PosChildNeedsLayout); 1162 ADD_BOOLEAN_BITFIELD(posChildNeedsLayout, PosChildNeedsLayout);
1154 ADD_BOOLEAN_BITFIELD(needsSimplifiedNormalFlowLayout, NeedsSimplifiedNor malFlowLayout); 1163 ADD_BOOLEAN_BITFIELD(needsSimplifiedNormalFlowLayout, NeedsSimplifiedNor malFlowLayout);
1164 ADD_BOOLEAN_BITFIELD(needsResizeLayout, NeedsResizeLayout);
1155 ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, PreferredLogicalWidths Dirty); 1165 ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, PreferredLogicalWidths Dirty);
1156 ADD_BOOLEAN_BITFIELD(floating, Floating); 1166 ADD_BOOLEAN_BITFIELD(floating, Floating);
1157 1167
1158 ADD_BOOLEAN_BITFIELD(isAnonymous, IsAnonymous); 1168 ADD_BOOLEAN_BITFIELD(isAnonymous, IsAnonymous);
1159 ADD_BOOLEAN_BITFIELD(isText, IsText); 1169 ADD_BOOLEAN_BITFIELD(isText, IsText);
1160 ADD_BOOLEAN_BITFIELD(isBox, IsBox); 1170 ADD_BOOLEAN_BITFIELD(isBox, IsBox);
1161 ADD_BOOLEAN_BITFIELD(isInline, IsInline); 1171 ADD_BOOLEAN_BITFIELD(isInline, IsInline);
1162 ADD_BOOLEAN_BITFIELD(isReplaced, IsReplaced); 1172 ADD_BOOLEAN_BITFIELD(isReplaced, IsReplaced);
1163 ADD_BOOLEAN_BITFIELD(horizontalWritingMode, HorizontalWritingMode); 1173 ADD_BOOLEAN_BITFIELD(horizontalWritingMode, HorizontalWritingMode);
1164 ADD_BOOLEAN_BITFIELD(isDragging, IsDragging); 1174 ADD_BOOLEAN_BITFIELD(isDragging, IsDragging);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 1222
1213 #undef ADD_BOOLEAN_BITFIELD 1223 #undef ADD_BOOLEAN_BITFIELD
1214 1224
1215 RenderObjectBitfields m_bitfields; 1225 RenderObjectBitfields m_bitfields;
1216 1226
1217 void setSelfNeedsLayout(bool b) { m_bitfields.setSelfNeedsLayout(b); } 1227 void setSelfNeedsLayout(bool b) { m_bitfields.setSelfNeedsLayout(b); }
1218 void setNeedsPositionedMovementLayout(bool b) { m_bitfields.setNeedsPosition edMovementLayout(b); } 1228 void setNeedsPositionedMovementLayout(bool b) { m_bitfields.setNeedsPosition edMovementLayout(b); }
1219 void setNormalChildNeedsLayout(bool b) { m_bitfields.setNormalChildNeedsLayo ut(b); } 1229 void setNormalChildNeedsLayout(bool b) { m_bitfields.setNormalChildNeedsLayo ut(b); }
1220 void setPosChildNeedsLayout(bool b) { m_bitfields.setPosChildNeedsLayout(b); } 1230 void setPosChildNeedsLayout(bool b) { m_bitfields.setPosChildNeedsLayout(b); }
1221 void setNeedsSimplifiedNormalFlowLayout(bool b) { m_bitfields.setNeedsSimpli fiedNormalFlowLayout(b); } 1231 void setNeedsSimplifiedNormalFlowLayout(bool b) { m_bitfields.setNeedsSimpli fiedNormalFlowLayout(b); }
1232 void setNeedsResizeLayoutInternal(bool b) { m_bitfields.setNeedsResizeLayout (b); }
1222 void setIsDragging(bool b) { m_bitfields.setIsDragging(b); } 1233 void setIsDragging(bool b) { m_bitfields.setIsDragging(b); }
1223 void setEverHadLayout(bool b) { m_bitfields.setEverHadLayout(b); } 1234 void setEverHadLayout(bool b) { m_bitfields.setEverHadLayout(b); }
1224 void setShouldRepaintOverflow(bool b) { m_bitfields.setShouldRepaintOverflow (b); } 1235 void setShouldRepaintOverflow(bool b) { m_bitfields.setShouldRepaintOverflow (b); }
1225 1236
1226 private: 1237 private:
1227 // Store state between styleWillChange and styleDidChange 1238 // Store state between styleWillChange and styleDidChange
1228 static bool s_affectsParentBlock; 1239 static bool s_affectsParentBlock;
1229 1240
1230 LayoutRect m_oldRepaintRect; 1241 LayoutRect m_oldRepaintRect;
1231 LayoutRect m_newRepaintRect; 1242 LayoutRect m_newRepaintRect;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 } 1294 }
1284 1295
1285 inline void RenderObject::clearNeedsLayout() 1296 inline void RenderObject::clearNeedsLayout()
1286 { 1297 {
1287 setSelfNeedsLayout(false); 1298 setSelfNeedsLayout(false);
1288 setEverHadLayout(true); 1299 setEverHadLayout(true);
1289 setPosChildNeedsLayout(false); 1300 setPosChildNeedsLayout(false);
1290 setNeedsSimplifiedNormalFlowLayout(false); 1301 setNeedsSimplifiedNormalFlowLayout(false);
1291 setNormalChildNeedsLayout(false); 1302 setNormalChildNeedsLayout(false);
1292 setNeedsPositionedMovementLayout(false); 1303 setNeedsPositionedMovementLayout(false);
1304 setNeedsResizeLayoutInternal(false);
1293 setAncestorLineBoxDirty(false); 1305 setAncestorLineBoxDirty(false);
1294 #ifndef NDEBUG 1306 #ifndef NDEBUG
1295 checkBlockPositionedObjectsNeedLayout(); 1307 checkBlockPositionedObjectsNeedLayout();
1296 #endif 1308 #endif
1297 } 1309 }
1298 1310
1299 inline void RenderObject::setChildNeedsLayout(MarkingBehavior markParents, Subtr eeLayoutScope* layouter) 1311 inline void RenderObject::setChildNeedsLayout(MarkingBehavior markParents, Subtr eeLayoutScope* layouter)
1300 { 1312 {
1301 ASSERT(!isSetNeedsLayoutForbidden()); 1313 ASSERT(!isSetNeedsLayoutForbidden());
1302 bool alreadyNeededLayout = normalChildNeedsLayout(); 1314 bool alreadyNeededLayout = normalChildNeedsLayout();
(...skipping 20 matching lines...) Expand all
1323 bool alreadyNeededLayout = needsSimplifiedNormalFlowLayout(); 1335 bool alreadyNeededLayout = needsSimplifiedNormalFlowLayout();
1324 setNeedsSimplifiedNormalFlowLayout(true); 1336 setNeedsSimplifiedNormalFlowLayout(true);
1325 ASSERT(!isSetNeedsLayoutForbidden()); 1337 ASSERT(!isSetNeedsLayoutForbidden());
1326 if (!alreadyNeededLayout) { 1338 if (!alreadyNeededLayout) {
1327 markContainingBlocksForLayout(); 1339 markContainingBlocksForLayout();
1328 if (hasLayer()) 1340 if (hasLayer())
1329 setLayerNeedsFullRepaint(); 1341 setLayerNeedsFullRepaint();
1330 } 1342 }
1331 } 1343 }
1332 1344
1345 inline void RenderObject::setNeedsResizeLayout()
esprehn 2014/03/24 22:40:04 This doesn't need to be inline.
1346 {
1347 // FIXME: needsResizeLayout is for RenderView for now, but will be applied
1348 // to other RenderObjects in later changes.
1349 ASSERT(isRenderView());
esprehn 2014/03/24 22:40:04 These methods should be on RenderView.
Xianzhu 2014/03/24 23:53:24 Moved this method to RenderView, but kept others t
1350 ASSERT(!isSetNeedsLayoutForbidden());
1351 setNeedsResizeLayoutInternal(true);
1352 }
1353
1333 inline bool RenderObject::preservesNewline() const 1354 inline bool RenderObject::preservesNewline() const
1334 { 1355 {
1335 if (isSVGInlineText()) 1356 if (isSVGInlineText())
1336 return false; 1357 return false;
1337 1358
1338 return style()->preserveNewline(); 1359 return style()->preserveNewline();
1339 } 1360 }
1340 1361
1341 inline bool RenderObject::layerCreationAllowedForSubtree() const 1362 inline bool RenderObject::layerCreationAllowedForSubtree() const
1342 { 1363 {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 void showTree(const WebCore::RenderObject*); 1447 void showTree(const WebCore::RenderObject*);
1427 void showLineTree(const WebCore::RenderObject*); 1448 void showLineTree(const WebCore::RenderObject*);
1428 void showRenderTree(const WebCore::RenderObject* object1); 1449 void showRenderTree(const WebCore::RenderObject* object1);
1429 // We don't make object2 an optional parameter so that showRenderTree 1450 // We don't make object2 an optional parameter so that showRenderTree
1430 // can be called from gdb easily. 1451 // can be called from gdb easily.
1431 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2); 1452 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2);
1432 1453
1433 #endif 1454 #endif
1434 1455
1435 #endif // RenderObject_h 1456 #endif // RenderObject_h
OLDNEW
« Source/core/rendering/RenderBox.h ('K') | « Source/core/rendering/RenderBox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698