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

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: tests had been missing 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 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 return m_bitfields.needsPositionedMovementLayout() && !m_bitfields.selfN eedsLayout() && !m_bitfields.normalChildNeedsLayout() 541 return m_bitfields.needsPositionedMovementLayout() && !m_bitfields.selfN eedsLayout() && !m_bitfields.normalChildNeedsLayout()
542 && !m_bitfields.posChildNeedsLayout() && !m_bitfields.needsSimplifie dNormalFlowLayout(); 542 && !m_bitfields.posChildNeedsLayout() && !m_bitfields.needsSimplifie dNormalFlowLayout();
543 } 543 }
544 544
545 bool posChildNeedsLayout() const { return m_bitfields.posChildNeedsLayout(); } 545 bool posChildNeedsLayout() const { return m_bitfields.posChildNeedsLayout(); }
546 bool needsSimplifiedNormalFlowLayout() const { return m_bitfields.needsSimpl ifiedNormalFlowLayout(); } 546 bool needsSimplifiedNormalFlowLayout() const { return m_bitfields.needsSimpl ifiedNormalFlowLayout(); }
547 bool normalChildNeedsLayout() const { return m_bitfields.normalChildNeedsLay out(); } 547 bool normalChildNeedsLayout() const { return m_bitfields.normalChildNeedsLay out(); }
548 548
549 bool preferredLogicalWidthsDirty() const { return m_bitfields.preferredLogic alWidthsDirty(); } 549 bool preferredLogicalWidthsDirty() const { return m_bitfields.preferredLogic alWidthsDirty(); }
550 550
551 bool needsOverflowRecalcAfterStyleChange() const { return m_bitfields.selfNe edsOverflowRecalcAfterStyleChange() || m_bitfields.childNeedsOverflowRecalcAfter StyleChange(); }
552 bool selfNeedsOverflowRecalcAfterStyleChange() const { return m_bitfields.se lfNeedsOverflowRecalcAfterStyleChange(); }
553 bool childNeedsOverflowRecalcAfterStyleChange() const { return m_bitfields.c hildNeedsOverflowRecalcAfterStyleChange(); }
554
551 bool isSelectionBorder() const; 555 bool isSelectionBorder() const;
552 556
553 bool hasClip() const { return isOutOfFlowPositioned() && style()->hasClip(); } 557 bool hasClip() const { return isOutOfFlowPositioned() && style()->hasClip(); }
554 bool hasOverflowClip() const { return m_bitfields.hasOverflowClip(); } 558 bool hasOverflowClip() const { return m_bitfields.hasOverflowClip(); }
555 bool hasClipOrOverflowClip() const { return hasClip() || hasOverflowClip(); } 559 bool hasClipOrOverflowClip() const { return hasClip() || hasOverflowClip(); }
556 560
557 bool hasTransform() const { return m_bitfields.hasTransform(); } 561 bool hasTransform() const { return m_bitfields.hasTransform(); }
558 bool hasMask() const { return style() && style()->hasMask(); } 562 bool hasMask() const { return style() && style()->hasMask(); }
559 bool hasClipPath() const { return style() && style()->clipPath(); } 563 bool hasClipPath() const { return style() && style()->clipPath(); }
560 bool hasHiddenBackface() const { return style() && style()->backfaceVisibili ty() == BackfaceVisibilityHidden; } 564 bool hasHiddenBackface() const { return style() && style()->backfaceVisibili ty() == BackfaceVisibilityHidden; }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 613
610 virtual RenderObject* hoverAncestor() const { return parent(); } 614 virtual RenderObject* hoverAncestor() const { return parent(); }
611 615
612 Element* offsetParent() const; 616 Element* offsetParent() const;
613 617
614 void markContainingBlocksForLayout(bool scheduleRelayout = true, RenderObjec t* newRoot = 0, SubtreeLayoutScope* = 0); 618 void markContainingBlocksForLayout(bool scheduleRelayout = true, RenderObjec t* newRoot = 0, SubtreeLayoutScope* = 0);
615 void setNeedsLayout(MarkingBehavior = MarkContainingBlockChain, SubtreeLayou tScope* = 0); 619 void setNeedsLayout(MarkingBehavior = MarkContainingBlockChain, SubtreeLayou tScope* = 0);
616 void clearNeedsLayout(); 620 void clearNeedsLayout();
617 void setChildNeedsLayout(MarkingBehavior = MarkContainingBlockChain, Subtree LayoutScope* = 0); 621 void setChildNeedsLayout(MarkingBehavior = MarkContainingBlockChain, Subtree LayoutScope* = 0);
618 void setNeedsPositionedMovementLayout(); 622 void setNeedsPositionedMovementLayout();
619 void setNeedsSimplifiedNormalFlowLayout();
620 void setPreferredLogicalWidthsDirty(MarkingBehavior = MarkContainingBlockCha in); 623 void setPreferredLogicalWidthsDirty(MarkingBehavior = MarkContainingBlockCha in);
621 void clearPreferredLogicalWidthsDirty(); 624 void clearPreferredLogicalWidthsDirty();
622 void invalidateContainerPreferredLogicalWidths(); 625 void invalidateContainerPreferredLogicalWidths();
623 626
624 void setNeedsLayoutAndPrefWidthsRecalc() 627 void setNeedsLayoutAndPrefWidthsRecalc()
625 { 628 {
626 setNeedsLayout(); 629 setNeedsLayout();
627 setPreferredLogicalWidthsDirty(); 630 setPreferredLogicalWidthsDirty();
628 } 631 }
629 632
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 991
989 void clearRepaintState(); 992 void clearRepaintState();
990 993
991 // layoutDidGetCalled indicates whether this render object was re-laid-out 994 // layoutDidGetCalled indicates whether this render object was re-laid-out
992 // since the last call to setLayoutDidGetCalled(false) on this object. 995 // since the last call to setLayoutDidGetCalled(false) on this object.
993 bool layoutDidGetCalled() { return m_bitfields.layoutDidGetCalled(); } 996 bool layoutDidGetCalled() { return m_bitfields.layoutDidGetCalled(); }
994 void setLayoutDidGetCalled(bool b) { m_bitfields.setLayoutDidGetCalled(b); } 997 void setLayoutDidGetCalled(bool b) { m_bitfields.setLayoutDidGetCalled(b); }
995 998
996 bool shouldDisableLayoutState() const { return hasColumns() || hasTransform( ) || hasReflection() || style()->isFlippedBlocksWritingMode(); } 999 bool shouldDisableLayoutState() const { return hasColumns() || hasTransform( ) || hasReflection() || style()->isFlippedBlocksWritingMode(); }
997 1000
1001 void setNeedsOverflowRecalcAfterStyleChange();
1002 void markContainingBlocksForOverflowRecalc();
1003
998 protected: 1004 protected:
999 inline bool layerCreationAllowedForSubtree() const; 1005 inline bool layerCreationAllowedForSubtree() const;
1000 1006
1001 // Overrides should call the superclass at the end 1007 // Overrides should call the superclass at the end
1002 virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); 1008 virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
1003 // Overrides should call the superclass at the start 1009 // Overrides should call the superclass at the start
1004 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); 1010 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
1005 void propagateStyleToAnonymousChildren(bool blockChildrenOnly = false); 1011 void propagateStyleToAnonymousChildren(bool blockChildrenOnly = false);
1006 1012
1007 void drawLineForBoxSide(GraphicsContext*, int x1, int y1, int x2, int y2, Bo xSide, 1013 void drawLineForBoxSide(GraphicsContext*, int x1, int y1, int x2, int y2, Bo xSide,
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 , m_shouldDoFullRepaintAfterLayout(false) 1109 , m_shouldDoFullRepaintAfterLayout(false)
1104 , m_shouldRepaintOverflow(false) 1110 , m_shouldRepaintOverflow(false)
1105 , m_shouldDoFullRepaintIfSelfPaintingLayer(false) 1111 , m_shouldDoFullRepaintIfSelfPaintingLayer(false)
1106 , m_onlyNeededPositionedMovementLayout(false) 1112 , m_onlyNeededPositionedMovementLayout(false)
1107 , m_needsPositionedMovementLayout(false) 1113 , m_needsPositionedMovementLayout(false)
1108 , m_normalChildNeedsLayout(false) 1114 , m_normalChildNeedsLayout(false)
1109 , m_posChildNeedsLayout(false) 1115 , m_posChildNeedsLayout(false)
1110 , m_needsSimplifiedNormalFlowLayout(false) 1116 , m_needsSimplifiedNormalFlowLayout(false)
1111 , m_preferredLogicalWidthsDirty(false) 1117 , m_preferredLogicalWidthsDirty(false)
1112 , m_floating(false) 1118 , m_floating(false)
1119 , m_selfNeedsOverflowRecalcAfterStyleChange(false)
1120 , m_childNeedsOverflowRecalcAfterStyleChange(false)
1113 , m_isAnonymous(!node) 1121 , m_isAnonymous(!node)
1114 , m_isText(false) 1122 , m_isText(false)
1115 , m_isBox(false) 1123 , m_isBox(false)
1116 , m_isInline(true) 1124 , m_isInline(true)
1117 , m_isReplaced(false) 1125 , m_isReplaced(false)
1118 , m_horizontalWritingMode(true) 1126 , m_horizontalWritingMode(true)
1119 , m_isDragging(false) 1127 , m_isDragging(false)
1120 , m_hasLayer(false) 1128 , m_hasLayer(false)
1121 , m_hasOverflowClip(false) 1129 , m_hasOverflowClip(false)
1122 , m_hasTransform(false) 1130 , m_hasTransform(false)
(...skipping 17 matching lines...) Expand all
1140 ADD_BOOLEAN_BITFIELD(shouldDoFullRepaintAfterLayout, ShouldDoFullRepaint AfterLayout); 1148 ADD_BOOLEAN_BITFIELD(shouldDoFullRepaintAfterLayout, ShouldDoFullRepaint AfterLayout);
1141 ADD_BOOLEAN_BITFIELD(shouldRepaintOverflow, ShouldRepaintOverflow); 1149 ADD_BOOLEAN_BITFIELD(shouldRepaintOverflow, ShouldRepaintOverflow);
1142 ADD_BOOLEAN_BITFIELD(shouldDoFullRepaintIfSelfPaintingLayer, ShouldDoFul lRepaintIfSelfPaintingLayer); 1150 ADD_BOOLEAN_BITFIELD(shouldDoFullRepaintIfSelfPaintingLayer, ShouldDoFul lRepaintIfSelfPaintingLayer);
1143 ADD_BOOLEAN_BITFIELD(onlyNeededPositionedMovementLayout, OnlyNeededPosit ionedMovementLayout); 1151 ADD_BOOLEAN_BITFIELD(onlyNeededPositionedMovementLayout, OnlyNeededPosit ionedMovementLayout);
1144 ADD_BOOLEAN_BITFIELD(needsPositionedMovementLayout, NeedsPositionedMovem entLayout); 1152 ADD_BOOLEAN_BITFIELD(needsPositionedMovementLayout, NeedsPositionedMovem entLayout);
1145 ADD_BOOLEAN_BITFIELD(normalChildNeedsLayout, NormalChildNeedsLayout); 1153 ADD_BOOLEAN_BITFIELD(normalChildNeedsLayout, NormalChildNeedsLayout);
1146 ADD_BOOLEAN_BITFIELD(posChildNeedsLayout, PosChildNeedsLayout); 1154 ADD_BOOLEAN_BITFIELD(posChildNeedsLayout, PosChildNeedsLayout);
1147 ADD_BOOLEAN_BITFIELD(needsSimplifiedNormalFlowLayout, NeedsSimplifiedNor malFlowLayout); 1155 ADD_BOOLEAN_BITFIELD(needsSimplifiedNormalFlowLayout, NeedsSimplifiedNor malFlowLayout);
1148 ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, PreferredLogicalWidths Dirty); 1156 ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, PreferredLogicalWidths Dirty);
1149 ADD_BOOLEAN_BITFIELD(floating, Floating); 1157 ADD_BOOLEAN_BITFIELD(floating, Floating);
1158 ADD_BOOLEAN_BITFIELD(selfNeedsOverflowRecalcAfterStyleChange, SelfNeedsO verflowRecalcAfterStyleChange);
1159 ADD_BOOLEAN_BITFIELD(childNeedsOverflowRecalcAfterStyleChange, ChildNeed sOverflowRecalcAfterStyleChange);
1150 1160
1151 ADD_BOOLEAN_BITFIELD(isAnonymous, IsAnonymous); 1161 ADD_BOOLEAN_BITFIELD(isAnonymous, IsAnonymous);
1152 ADD_BOOLEAN_BITFIELD(isText, IsText); 1162 ADD_BOOLEAN_BITFIELD(isText, IsText);
1153 ADD_BOOLEAN_BITFIELD(isBox, IsBox); 1163 ADD_BOOLEAN_BITFIELD(isBox, IsBox);
1154 ADD_BOOLEAN_BITFIELD(isInline, IsInline); 1164 ADD_BOOLEAN_BITFIELD(isInline, IsInline);
1155 ADD_BOOLEAN_BITFIELD(isReplaced, IsReplaced); 1165 ADD_BOOLEAN_BITFIELD(isReplaced, IsReplaced);
1156 ADD_BOOLEAN_BITFIELD(horizontalWritingMode, HorizontalWritingMode); 1166 ADD_BOOLEAN_BITFIELD(horizontalWritingMode, HorizontalWritingMode);
1157 ADD_BOOLEAN_BITFIELD(isDragging, IsDragging); 1167 ADD_BOOLEAN_BITFIELD(isDragging, IsDragging);
1158 1168
1159 ADD_BOOLEAN_BITFIELD(hasLayer, HasLayer); 1169 ADD_BOOLEAN_BITFIELD(hasLayer, HasLayer);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 RenderObjectBitfields m_bitfields; 1218 RenderObjectBitfields m_bitfields;
1209 1219
1210 void setSelfNeedsLayout(bool b) { m_bitfields.setSelfNeedsLayout(b); } 1220 void setSelfNeedsLayout(bool b) { m_bitfields.setSelfNeedsLayout(b); }
1211 void setNeedsPositionedMovementLayout(bool b) { m_bitfields.setNeedsPosition edMovementLayout(b); } 1221 void setNeedsPositionedMovementLayout(bool b) { m_bitfields.setNeedsPosition edMovementLayout(b); }
1212 void setNormalChildNeedsLayout(bool b) { m_bitfields.setNormalChildNeedsLayo ut(b); } 1222 void setNormalChildNeedsLayout(bool b) { m_bitfields.setNormalChildNeedsLayo ut(b); }
1213 void setPosChildNeedsLayout(bool b) { m_bitfields.setPosChildNeedsLayout(b); } 1223 void setPosChildNeedsLayout(bool b) { m_bitfields.setPosChildNeedsLayout(b); }
1214 void setNeedsSimplifiedNormalFlowLayout(bool b) { m_bitfields.setNeedsSimpli fiedNormalFlowLayout(b); } 1224 void setNeedsSimplifiedNormalFlowLayout(bool b) { m_bitfields.setNeedsSimpli fiedNormalFlowLayout(b); }
1215 void setIsDragging(bool b) { m_bitfields.setIsDragging(b); } 1225 void setIsDragging(bool b) { m_bitfields.setIsDragging(b); }
1216 void setEverHadLayout(bool b) { m_bitfields.setEverHadLayout(b); } 1226 void setEverHadLayout(bool b) { m_bitfields.setEverHadLayout(b); }
1217 void setShouldRepaintOverflow(bool b) { m_bitfields.setShouldRepaintOverflow (b); } 1227 void setShouldRepaintOverflow(bool b) { m_bitfields.setShouldRepaintOverflow (b); }
1228 void setSelfNeedsOverflowRecalcAfterStyleChange(bool b) { m_bitfields.setSel fNeedsOverflowRecalcAfterStyleChange(b); }
1229 void setChildNeedsOverflowRecalcAfterStyleChange(bool b) { m_bitfields.setCh ildNeedsOverflowRecalcAfterStyleChange(b); }
1218 1230
1219 private: 1231 private:
1220 // Store state between styleWillChange and styleDidChange 1232 // Store state between styleWillChange and styleDidChange
1221 static bool s_affectsParentBlock; 1233 static bool s_affectsParentBlock;
1222 1234
1223 LayoutRect m_oldRepaintRect; 1235 LayoutRect m_oldRepaintRect;
1224 LayoutRect m_newRepaintRect; 1236 LayoutRect m_newRepaintRect;
1225 }; 1237 };
1226 1238
1227 // Allow equality comparisons of RenderObject's by reference or pointer, interch angeably. 1239 // Allow equality comparisons of RenderObject's by reference or pointer, interch angeably.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 bool alreadyNeededLayout = needsPositionedMovementLayout(); 1316 bool alreadyNeededLayout = needsPositionedMovementLayout();
1305 setNeedsPositionedMovementLayout(true); 1317 setNeedsPositionedMovementLayout(true);
1306 ASSERT(!isSetNeedsLayoutForbidden()); 1318 ASSERT(!isSetNeedsLayoutForbidden());
1307 if (!alreadyNeededLayout) { 1319 if (!alreadyNeededLayout) {
1308 markContainingBlocksForLayout(); 1320 markContainingBlocksForLayout();
1309 if (hasLayer()) 1321 if (hasLayer())
1310 setLayerNeedsFullRepaintForPositionedMovementLayout(); 1322 setLayerNeedsFullRepaintForPositionedMovementLayout();
1311 } 1323 }
1312 } 1324 }
1313 1325
1314 inline void RenderObject::setNeedsSimplifiedNormalFlowLayout()
1315 {
1316 bool alreadyNeededLayout = needsSimplifiedNormalFlowLayout();
1317 setNeedsSimplifiedNormalFlowLayout(true);
1318 ASSERT(!isSetNeedsLayoutForbidden());
1319 if (!alreadyNeededLayout) {
1320 markContainingBlocksForLayout();
1321 if (hasLayer())
1322 setLayerNeedsFullRepaint();
1323 }
1324 }
1325
1326 inline bool RenderObject::preservesNewline() const 1326 inline bool RenderObject::preservesNewline() const
1327 { 1327 {
1328 if (isSVGInlineText()) 1328 if (isSVGInlineText())
1329 return false; 1329 return false;
1330 1330
1331 return style()->preserveNewline(); 1331 return style()->preserveNewline();
1332 } 1332 }
1333 1333
1334 inline bool RenderObject::layerCreationAllowedForSubtree() const 1334 inline bool RenderObject::layerCreationAllowedForSubtree() const
1335 { 1335 {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 void showTree(const WebCore::RenderObject*); 1419 void showTree(const WebCore::RenderObject*);
1420 void showLineTree(const WebCore::RenderObject*); 1420 void showLineTree(const WebCore::RenderObject*);
1421 void showRenderTree(const WebCore::RenderObject* object1); 1421 void showRenderTree(const WebCore::RenderObject* object1);
1422 // We don't make object2 an optional parameter so that showRenderTree 1422 // We don't make object2 an optional parameter so that showRenderTree
1423 // can be called from gdb easily. 1423 // can be called from gdb easily.
1424 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2); 1424 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2);
1425 1425
1426 #endif 1426 #endif
1427 1427
1428 #endif // RenderObject_h 1428 #endif // RenderObject_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698