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

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

Issue 203463007: Recompute overflow after transform changes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 6 years, 8 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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 return m_bitfields.needsPositionedMovementLayout() && !m_bitfields.selfN eedsLayout() && !m_bitfields.normalChildNeedsLayout() 558 return m_bitfields.needsPositionedMovementLayout() && !m_bitfields.selfN eedsLayout() && !m_bitfields.normalChildNeedsLayout()
559 && !m_bitfields.posChildNeedsLayout() && !m_bitfields.needsSimplifie dNormalFlowLayout(); 559 && !m_bitfields.posChildNeedsLayout() && !m_bitfields.needsSimplifie dNormalFlowLayout();
560 } 560 }
561 561
562 bool posChildNeedsLayout() const { return m_bitfields.posChildNeedsLayout(); } 562 bool posChildNeedsLayout() const { return m_bitfields.posChildNeedsLayout(); }
563 bool needsSimplifiedNormalFlowLayout() const { return m_bitfields.needsSimpl ifiedNormalFlowLayout(); } 563 bool needsSimplifiedNormalFlowLayout() const { return m_bitfields.needsSimpl ifiedNormalFlowLayout(); }
564 bool normalChildNeedsLayout() const { return m_bitfields.normalChildNeedsLay out(); } 564 bool normalChildNeedsLayout() const { return m_bitfields.normalChildNeedsLay out(); }
565 565
566 bool preferredLogicalWidthsDirty() const { return m_bitfields.preferredLogic alWidthsDirty(); } 566 bool preferredLogicalWidthsDirty() const { return m_bitfields.preferredLogic alWidthsDirty(); }
567 567
568 bool needsOverflowRecalcAfterStyleChange() const { return m_bitfields.selfNe edsOverflowRecalcAfterStyleChange() || m_bitfields.childNeedsOverflowRecalcAfter StyleChange(); }
569 bool selfNeedsOverflowRecalcAfterStyleChange() const { return m_bitfields.se lfNeedsOverflowRecalcAfterStyleChange(); }
570 bool childNeedsOverflowRecalcAfterStyleChange() const { return m_bitfields.c hildNeedsOverflowRecalcAfterStyleChange(); }
571
568 bool isSelectionBorder() const; 572 bool isSelectionBorder() const;
569 573
570 bool hasClip() const { return isOutOfFlowPositioned() && style()->hasClip(); } 574 bool hasClip() const { return isOutOfFlowPositioned() && style()->hasClip(); }
571 bool hasOverflowClip() const { return m_bitfields.hasOverflowClip(); } 575 bool hasOverflowClip() const { return m_bitfields.hasOverflowClip(); }
572 bool hasClipOrOverflowClip() const { return hasClip() || hasOverflowClip(); } 576 bool hasClipOrOverflowClip() const { return hasClip() || hasOverflowClip(); }
573 577
574 bool hasTransform() const { return m_bitfields.hasTransform(); } 578 bool hasTransform() const { return m_bitfields.hasTransform(); }
575 bool hasMask() const { return style() && style()->hasMask(); } 579 bool hasMask() const { return style() && style()->hasMask(); }
576 bool hasClipPath() const { return style() && style()->clipPath(); } 580 bool hasClipPath() const { return style() && style()->clipPath(); }
577 bool hasHiddenBackface() const { return style() && style()->backfaceVisibili ty() == BackfaceVisibilityHidden; } 581 bool hasHiddenBackface() const { return style() && style()->backfaceVisibili ty() == BackfaceVisibilityHidden; }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 631
628 virtual RenderObject* hoverAncestor() const { return parent(); } 632 virtual RenderObject* hoverAncestor() const { return parent(); }
629 633
630 Element* offsetParent() const; 634 Element* offsetParent() const;
631 635
632 void markContainingBlocksForLayout(bool scheduleRelayout = true, RenderObjec t* newRoot = 0, SubtreeLayoutScope* = 0); 636 void markContainingBlocksForLayout(bool scheduleRelayout = true, RenderObjec t* newRoot = 0, SubtreeLayoutScope* = 0);
633 void setNeedsLayout(MarkingBehavior = MarkContainingBlockChain, SubtreeLayou tScope* = 0); 637 void setNeedsLayout(MarkingBehavior = MarkContainingBlockChain, SubtreeLayou tScope* = 0);
634 void clearNeedsLayout(); 638 void clearNeedsLayout();
635 void setChildNeedsLayout(MarkingBehavior = MarkContainingBlockChain, Subtree LayoutScope* = 0); 639 void setChildNeedsLayout(MarkingBehavior = MarkContainingBlockChain, Subtree LayoutScope* = 0);
636 void setNeedsPositionedMovementLayout(); 640 void setNeedsPositionedMovementLayout();
637 void setNeedsSimplifiedNormalFlowLayout();
638 void setPreferredLogicalWidthsDirty(MarkingBehavior = MarkContainingBlockCha in); 641 void setPreferredLogicalWidthsDirty(MarkingBehavior = MarkContainingBlockCha in);
639 void clearPreferredLogicalWidthsDirty(); 642 void clearPreferredLogicalWidthsDirty();
640 void invalidateContainerPreferredLogicalWidths(); 643 void invalidateContainerPreferredLogicalWidths();
641 644
642 void setNeedsLayoutAndPrefWidthsRecalc() 645 void setNeedsLayoutAndPrefWidthsRecalc()
643 { 646 {
644 setNeedsLayout(); 647 setNeedsLayout();
645 setPreferredLogicalWidthsDirty(); 648 setPreferredLogicalWidthsDirty();
646 } 649 }
647 650
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 1007
1005 void clearRepaintState(); 1008 void clearRepaintState();
1006 1009
1007 // layoutDidGetCalled indicates whether this render object was re-laid-out 1010 // layoutDidGetCalled indicates whether this render object was re-laid-out
1008 // since the last call to setLayoutDidGetCalled(false) on this object. 1011 // since the last call to setLayoutDidGetCalled(false) on this object.
1009 bool layoutDidGetCalled() { return m_bitfields.layoutDidGetCalled(); } 1012 bool layoutDidGetCalled() { return m_bitfields.layoutDidGetCalled(); }
1010 void setLayoutDidGetCalled(bool b) { m_bitfields.setLayoutDidGetCalled(b); } 1013 void setLayoutDidGetCalled(bool b) { m_bitfields.setLayoutDidGetCalled(b); }
1011 1014
1012 bool shouldDisableLayoutState() const { return hasColumns() || hasTransform( ) || hasReflection() || style()->isFlippedBlocksWritingMode(); } 1015 bool shouldDisableLayoutState() const { return hasColumns() || hasTransform( ) || hasReflection() || style()->isFlippedBlocksWritingMode(); }
1013 1016
1017 void setNeedsOverflowRecalcAfterStyleChange();
1018 void markContainingBlocksForOverflowRecalc();
1019
1014 protected: 1020 protected:
1015 inline bool layerCreationAllowedForSubtree() const; 1021 inline bool layerCreationAllowedForSubtree() const;
1016 1022
1017 // Overrides should call the superclass at the end. m_style will be 0 the fi rst time 1023 // Overrides should call the superclass at the end. m_style will be 0 the fi rst time
1018 // this function will be called. 1024 // this function will be called.
1019 virtual void styleWillChange(StyleDifference, const RenderStyle& newStyle); 1025 virtual void styleWillChange(StyleDifference, const RenderStyle& newStyle);
1020 // Overrides should call the superclass at the start. |oldStyle| will be 0 t he first 1026 // Overrides should call the superclass at the start. |oldStyle| will be 0 t he first
1021 // time this function is called. 1027 // time this function is called.
1022 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); 1028 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
1023 void propagateStyleToAnonymousChildren(bool blockChildrenOnly = false); 1029 void propagateStyleToAnonymousChildren(bool blockChildrenOnly = false);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 , m_shouldDoFullRepaintAfterLayout(false) 1127 , m_shouldDoFullRepaintAfterLayout(false)
1122 , m_shouldRepaintOverflow(false) 1128 , m_shouldRepaintOverflow(false)
1123 , m_shouldDoFullRepaintIfSelfPaintingLayer(false) 1129 , m_shouldDoFullRepaintIfSelfPaintingLayer(false)
1124 , m_onlyNeededPositionedMovementLayout(false) 1130 , m_onlyNeededPositionedMovementLayout(false)
1125 , m_needsPositionedMovementLayout(false) 1131 , m_needsPositionedMovementLayout(false)
1126 , m_normalChildNeedsLayout(false) 1132 , m_normalChildNeedsLayout(false)
1127 , m_posChildNeedsLayout(false) 1133 , m_posChildNeedsLayout(false)
1128 , m_needsSimplifiedNormalFlowLayout(false) 1134 , m_needsSimplifiedNormalFlowLayout(false)
1129 , m_preferredLogicalWidthsDirty(false) 1135 , m_preferredLogicalWidthsDirty(false)
1130 , m_floating(false) 1136 , m_floating(false)
1137 , m_selfNeedsOverflowRecalcAfterStyleChange(false)
1138 , m_childNeedsOverflowRecalcAfterStyleChange(false)
1131 , m_isAnonymous(!node) 1139 , m_isAnonymous(!node)
1132 , m_isText(false) 1140 , m_isText(false)
1133 , m_isBox(false) 1141 , m_isBox(false)
1134 , m_isInline(true) 1142 , m_isInline(true)
1135 , m_isReplaced(false) 1143 , m_isReplaced(false)
1136 , m_horizontalWritingMode(true) 1144 , m_horizontalWritingMode(true)
1137 , m_isDragging(false) 1145 , m_isDragging(false)
1138 , m_hasLayer(false) 1146 , m_hasLayer(false)
1139 , m_hasOverflowClip(false) 1147 , m_hasOverflowClip(false)
1140 , m_hasTransform(false) 1148 , m_hasTransform(false)
(...skipping 17 matching lines...) Expand all
1158 ADD_BOOLEAN_BITFIELD(shouldDoFullRepaintAfterLayout, ShouldDoFullRepaint AfterLayout); 1166 ADD_BOOLEAN_BITFIELD(shouldDoFullRepaintAfterLayout, ShouldDoFullRepaint AfterLayout);
1159 ADD_BOOLEAN_BITFIELD(shouldRepaintOverflow, ShouldRepaintOverflow); 1167 ADD_BOOLEAN_BITFIELD(shouldRepaintOverflow, ShouldRepaintOverflow);
1160 ADD_BOOLEAN_BITFIELD(shouldDoFullRepaintIfSelfPaintingLayer, ShouldDoFul lRepaintIfSelfPaintingLayer); 1168 ADD_BOOLEAN_BITFIELD(shouldDoFullRepaintIfSelfPaintingLayer, ShouldDoFul lRepaintIfSelfPaintingLayer);
1161 ADD_BOOLEAN_BITFIELD(onlyNeededPositionedMovementLayout, OnlyNeededPosit ionedMovementLayout); 1169 ADD_BOOLEAN_BITFIELD(onlyNeededPositionedMovementLayout, OnlyNeededPosit ionedMovementLayout);
1162 ADD_BOOLEAN_BITFIELD(needsPositionedMovementLayout, NeedsPositionedMovem entLayout); 1170 ADD_BOOLEAN_BITFIELD(needsPositionedMovementLayout, NeedsPositionedMovem entLayout);
1163 ADD_BOOLEAN_BITFIELD(normalChildNeedsLayout, NormalChildNeedsLayout); 1171 ADD_BOOLEAN_BITFIELD(normalChildNeedsLayout, NormalChildNeedsLayout);
1164 ADD_BOOLEAN_BITFIELD(posChildNeedsLayout, PosChildNeedsLayout); 1172 ADD_BOOLEAN_BITFIELD(posChildNeedsLayout, PosChildNeedsLayout);
1165 ADD_BOOLEAN_BITFIELD(needsSimplifiedNormalFlowLayout, NeedsSimplifiedNor malFlowLayout); 1173 ADD_BOOLEAN_BITFIELD(needsSimplifiedNormalFlowLayout, NeedsSimplifiedNor malFlowLayout);
1166 ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, PreferredLogicalWidths Dirty); 1174 ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, PreferredLogicalWidths Dirty);
1167 ADD_BOOLEAN_BITFIELD(floating, Floating); 1175 ADD_BOOLEAN_BITFIELD(floating, Floating);
1176 ADD_BOOLEAN_BITFIELD(selfNeedsOverflowRecalcAfterStyleChange, SelfNeedsO verflowRecalcAfterStyleChange);
1177 ADD_BOOLEAN_BITFIELD(childNeedsOverflowRecalcAfterStyleChange, ChildNeed sOverflowRecalcAfterStyleChange);
1168 1178
1169 ADD_BOOLEAN_BITFIELD(isAnonymous, IsAnonymous); 1179 ADD_BOOLEAN_BITFIELD(isAnonymous, IsAnonymous);
1170 ADD_BOOLEAN_BITFIELD(isText, IsText); 1180 ADD_BOOLEAN_BITFIELD(isText, IsText);
1171 ADD_BOOLEAN_BITFIELD(isBox, IsBox); 1181 ADD_BOOLEAN_BITFIELD(isBox, IsBox);
1172 ADD_BOOLEAN_BITFIELD(isInline, IsInline); 1182 ADD_BOOLEAN_BITFIELD(isInline, IsInline);
1173 ADD_BOOLEAN_BITFIELD(isReplaced, IsReplaced); 1183 ADD_BOOLEAN_BITFIELD(isReplaced, IsReplaced);
1174 ADD_BOOLEAN_BITFIELD(horizontalWritingMode, HorizontalWritingMode); 1184 ADD_BOOLEAN_BITFIELD(horizontalWritingMode, HorizontalWritingMode);
1175 ADD_BOOLEAN_BITFIELD(isDragging, IsDragging); 1185 ADD_BOOLEAN_BITFIELD(isDragging, IsDragging);
1176 1186
1177 ADD_BOOLEAN_BITFIELD(hasLayer, HasLayer); 1187 ADD_BOOLEAN_BITFIELD(hasLayer, HasLayer);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1222 }; 1232 };
1223 1233
1224 #undef ADD_BOOLEAN_BITFIELD 1234 #undef ADD_BOOLEAN_BITFIELD
1225 1235
1226 RenderObjectBitfields m_bitfields; 1236 RenderObjectBitfields m_bitfields;
1227 1237
1228 void setSelfNeedsLayout(bool b) { m_bitfields.setSelfNeedsLayout(b); } 1238 void setSelfNeedsLayout(bool b) { m_bitfields.setSelfNeedsLayout(b); }
1229 void setNeedsPositionedMovementLayout(bool b) { m_bitfields.setNeedsPosition edMovementLayout(b); } 1239 void setNeedsPositionedMovementLayout(bool b) { m_bitfields.setNeedsPosition edMovementLayout(b); }
1230 void setNormalChildNeedsLayout(bool b) { m_bitfields.setNormalChildNeedsLayo ut(b); } 1240 void setNormalChildNeedsLayout(bool b) { m_bitfields.setNormalChildNeedsLayo ut(b); }
1231 void setPosChildNeedsLayout(bool b) { m_bitfields.setPosChildNeedsLayout(b); } 1241 void setPosChildNeedsLayout(bool b) { m_bitfields.setPosChildNeedsLayout(b); }
1232 void setNeedsSimplifiedNormalFlowLayout(bool b) { m_bitfields.setNeedsSimpli fiedNormalFlowLayout(b); } 1242 void setNeedsSimplifiedNormalFlowLayout(bool b) { m_bitfields.setNeedsSimpli fiedNormalFlowLayout(b); }
ojan 2014/04/19 02:19:30 Can you delete this as well? And of course all the
trchen 2014/04/19 05:08:21 It still serves a purpose to indicate that "some R
1233 void setIsDragging(bool b) { m_bitfields.setIsDragging(b); } 1243 void setIsDragging(bool b) { m_bitfields.setIsDragging(b); }
1234 void setEverHadLayout(bool b) { m_bitfields.setEverHadLayout(b); } 1244 void setEverHadLayout(bool b) { m_bitfields.setEverHadLayout(b); }
1235 void setShouldRepaintOverflow(bool b) { m_bitfields.setShouldRepaintOverflow (b); } 1245 void setShouldRepaintOverflow(bool b) { m_bitfields.setShouldRepaintOverflow (b); }
1246 void setSelfNeedsOverflowRecalcAfterStyleChange(bool b) { m_bitfields.setSel fNeedsOverflowRecalcAfterStyleChange(b); }
1247 void setChildNeedsOverflowRecalcAfterStyleChange(bool b) { m_bitfields.setCh ildNeedsOverflowRecalcAfterStyleChange(b); }
1236 1248
1237 private: 1249 private:
1238 // Store state between styleWillChange and styleDidChange 1250 // Store state between styleWillChange and styleDidChange
1239 static bool s_affectsParentBlock; 1251 static bool s_affectsParentBlock;
1240 1252
1241 // This stores the repaint rect from the previous layout. 1253 // This stores the repaint rect from the previous layout.
1242 LayoutRect m_previousRepaintRect; 1254 LayoutRect m_previousRepaintRect;
1243 }; 1255 };
1244 1256
1245 // Allow equality comparisons of RenderObject's by reference or pointer, interch angeably. 1257 // Allow equality comparisons of RenderObject's by reference or pointer, interch angeably.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 bool alreadyNeededLayout = needsPositionedMovementLayout(); 1339 bool alreadyNeededLayout = needsPositionedMovementLayout();
1328 setNeedsPositionedMovementLayout(true); 1340 setNeedsPositionedMovementLayout(true);
1329 ASSERT(!isSetNeedsLayoutForbidden()); 1341 ASSERT(!isSetNeedsLayoutForbidden());
1330 if (!alreadyNeededLayout) { 1342 if (!alreadyNeededLayout) {
1331 markContainingBlocksForLayout(); 1343 markContainingBlocksForLayout();
1332 if (hasLayer()) 1344 if (hasLayer())
1333 setLayerNeedsFullRepaintForPositionedMovementLayout(); 1345 setLayerNeedsFullRepaintForPositionedMovementLayout();
1334 } 1346 }
1335 } 1347 }
1336 1348
1337 inline void RenderObject::setNeedsSimplifiedNormalFlowLayout()
1338 {
1339 bool alreadyNeededLayout = needsSimplifiedNormalFlowLayout();
1340 setNeedsSimplifiedNormalFlowLayout(true);
1341 ASSERT(!isSetNeedsLayoutForbidden());
1342 if (!alreadyNeededLayout) {
1343 markContainingBlocksForLayout();
1344 if (hasLayer())
1345 setLayerNeedsFullRepaint();
1346 }
1347 }
1348
1349 inline bool RenderObject::preservesNewline() const 1349 inline bool RenderObject::preservesNewline() const
1350 { 1350 {
1351 if (isSVGInlineText()) 1351 if (isSVGInlineText())
1352 return false; 1352 return false;
1353 1353
1354 return style()->preserveNewline(); 1354 return style()->preserveNewline();
1355 } 1355 }
1356 1356
1357 inline bool RenderObject::layerCreationAllowedForSubtree() const 1357 inline bool RenderObject::layerCreationAllowedForSubtree() const
1358 { 1358 {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 void showTree(const WebCore::RenderObject*); 1442 void showTree(const WebCore::RenderObject*);
1443 void showLineTree(const WebCore::RenderObject*); 1443 void showLineTree(const WebCore::RenderObject*);
1444 void showRenderTree(const WebCore::RenderObject* object1); 1444 void showRenderTree(const WebCore::RenderObject* object1);
1445 // We don't make object2 an optional parameter so that showRenderTree 1445 // We don't make object2 an optional parameter so that showRenderTree
1446 // can be called from gdb easily. 1446 // can be called from gdb easily.
1447 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2); 1447 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2);
1448 1448
1449 #endif 1449 #endif
1450 1450
1451 #endif // RenderObject_h 1451 #endif // RenderObject_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698