Chromium Code Reviews| Index: Source/core/layout/LayoutObject.h |
| diff --git a/Source/core/layout/LayoutObject.h b/Source/core/layout/LayoutObject.h |
| index 9208d7479ee856c0071f1609586bf5d3e7055fb6..28eefe558a80ecd79856f6e6612830d49bf72a0b 100644 |
| --- a/Source/core/layout/LayoutObject.h |
| +++ b/Source/core/layout/LayoutObject.h |
| @@ -126,11 +126,12 @@ public: |
| // Base class for all layout tree objects. |
| class CORE_EXPORT LayoutObject : public ImageResourceClient { |
| + // For layout tree hierarchy mutation methods, e.g. setParent. |
| friend class LayoutBlock; |
| - friend class LayoutBlockFlow; |
| - friend class DeprecatedPaintLayerReflectionInfo; // For setParent |
| - friend class DeprecatedPaintLayerScrollableArea; // For setParent. |
| + friend class DeprecatedPaintLayerReflectionInfo; |
| + friend class DeprecatedPaintLayerScrollableArea; |
| friend class LayoutObjectChildList; |
| + |
| WTF_MAKE_NONCOPYABLE(LayoutObject); |
| public: |
| // Anonymous objects should pass the document as their node, and they will then automatically be |
| @@ -1026,19 +1027,11 @@ public: |
| virtual void clearPaintInvalidationState(const PaintInvalidationState&); |
| - // Indicates whether this layout object was re-laid-out since the last frame. |
| - // The flag will be cleared during invalidateTreeIfNeeded. |
| - bool layoutDidGetCalledSinceLastFrame() const { return m_bitfields.layoutDidGetCalledSinceLastFrame(); } |
| - |
| bool mayNeedPaintInvalidation() const { return m_bitfields.mayNeedPaintInvalidation(); } |
| void setMayNeedPaintInvalidation(); |
| bool shouldInvalidateSelection() const { return m_bitfields.shouldInvalidateSelection(); } |
| void setShouldInvalidateSelection(); |
| - void clearShouldInvalidateSelection() { m_bitfields.setShouldInvalidateSelection(false); } |
| - |
| - bool neededLayoutBecauseOfChildren() const { return m_bitfields.neededLayoutBecauseOfChildren(); } |
| - void setNeededLayoutBecauseOfChildren(bool b) { m_bitfields.setNeededLayoutBecauseOfChildren(b); } |
| bool shouldCheckForPaintInvalidation(const PaintInvalidationState& paintInvalidationState) const |
| { |
| @@ -1050,7 +1043,7 @@ public: |
| bool shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState() const |
| { |
| - return layoutDidGetCalledSinceLastFrame() || mayNeedPaintInvalidation() || shouldDoFullPaintInvalidation() || shouldInvalidateSelection(); |
| + return mayNeedPaintInvalidation() || shouldDoFullPaintInvalidation() || shouldInvalidateSelection() || m_bitfields.childShouldCheckForPaintInvalidation(); |
| } |
| virtual bool supportsPaintInvalidationStateCachedOffsets() const { return !hasTransformRelatedProperty() && !hasReflection() && !style()->isFlippedBlocksWritingMode(); } |
| @@ -1161,8 +1154,6 @@ protected: |
| virtual void updateAnonymousChildStyle(const LayoutObject& child, ComputedStyle& style) const { } |
| protected: |
| - void setSelfMayNeedPaintInvalidation(); |
| - |
| virtual void willBeDestroyed(); |
| virtual void insertedIntoTree(); |
| @@ -1195,7 +1186,7 @@ protected: |
| #if ENABLE(ASSERT) |
| virtual bool paintInvalidationStateIsDirty() const |
| { |
| - return neededLayoutBecauseOfChildren() || shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState(); |
| + return m_bitfields.neededLayoutBecauseOfChildren() || shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState(); |
| } |
| #endif |
| @@ -1212,6 +1203,12 @@ protected: |
| void setIsSlowRepaintObject(bool); |
| + void clearSelfNeedsOverflowRecalcAfterStyleChange() { m_bitfields.setSelfNeedsOverflowRecalcAfterStyleChange(false); } |
| + void clearChildNeedsOverflowRecalcAfterStyleChange() { m_bitfields.setChildNeedsOverflowRecalcAfterStyleChange(false); } |
| + |
| + void setShouldInvalidateOverflowForPaint() { m_bitfields.setShouldInvalidateOverflowForPaint(true); } |
| + void setEverHadLayout() { m_bitfields.setEverHadLayout(true); } |
| + |
| private: |
| const LayoutRect& previousPaintInvalidationRect() const { return m_previousPaintInvalidationRect; } |
| @@ -1246,11 +1243,6 @@ private: |
| inline void invalidateContainerPreferredLogicalWidths(); |
| - void clearMayNeedPaintInvalidation(); |
| - |
| - void setLayoutDidGetCalledSinceLastFrame(); |
| - void clearLayoutDidGetCalledSinceLastFrame() { m_bitfields.setLayoutDidGetCalledSinceLastFrame(false); } |
| - |
| void invalidatePaintIncludingNonCompositingDescendantsInternal(const LayoutBoxModelObject& repaintContainer); |
| LayoutRect previousSelectionRectForPaintInvalidation() const; |
| @@ -1315,8 +1307,7 @@ private: |
| LayoutObjectBitfields(Node* node) |
| : m_selfNeedsLayout(false) |
| , m_shouldInvalidateOverflowForPaint(false) |
| - // FIXME: We should remove mayNeedPaintInvalidation once we are able to |
| - // use the other layout flags to detect the same cases. crbug.com/370118 |
| + , m_childShouldCheckForPaintInvalidation(false) |
| , m_mayNeedPaintInvalidation(false) |
| , m_shouldInvalidateSelection(false) |
| , m_neededLayoutBecauseOfChildren(false) |
| @@ -1342,7 +1333,6 @@ private: |
| , m_hasCounterNodeMap(false) |
| , m_everHadLayout(false) |
| , m_ancestorLineBoxDirty(false) |
| - , m_layoutDidGetCalledSinceLastFrame(false) |
| , m_hasPendingResourceUpdate(false) |
| , m_isInsideFlowThread(false) |
| , m_subtreeChangeListenerRegistered(false) |
| @@ -1363,10 +1353,11 @@ private: |
| // 32 bits have been used in the first word, and 18 in the second. |
| ADD_BOOLEAN_BITFIELD(selfNeedsLayout, SelfNeedsLayout); |
| - ADD_BOOLEAN_BITFIELD(shouldInvalidateOverflowForPaint, ShouldInvalidateOverflowForPaint); |
| + ADD_BOOLEAN_BITFIELD(shouldInvalidateOverflowForPaint, ShouldInvalidateOverflowForPaint); // TODO: Remove for slimming paint v2. |
|
leviw_travelin_and_unemployed
2015/08/20 22:52:02
Nit: TODO's should have your username.
|
| + ADD_BOOLEAN_BITFIELD(childShouldCheckForPaintInvalidation, ChildShouldCheckForPaintInvalidation); |
| ADD_BOOLEAN_BITFIELD(mayNeedPaintInvalidation, MayNeedPaintInvalidation); |
| - ADD_BOOLEAN_BITFIELD(shouldInvalidateSelection, ShouldInvalidateSelection); |
| - ADD_BOOLEAN_BITFIELD(neededLayoutBecauseOfChildren, NeededLayoutBecauseOfChildren); |
| + ADD_BOOLEAN_BITFIELD(shouldInvalidateSelection, ShouldInvalidateSelection); // TODO: Remove for slimming paint v2. |
| + ADD_BOOLEAN_BITFIELD(neededLayoutBecauseOfChildren, NeededLayoutBecauseOfChildren); // TODO: Remove for slimming paint v2. |
| ADD_BOOLEAN_BITFIELD(needsPositionedMovementLayout, NeedsPositionedMovementLayout); |
| ADD_BOOLEAN_BITFIELD(normalChildNeedsLayout, NormalChildNeedsLayout); |
| ADD_BOOLEAN_BITFIELD(posChildNeedsLayout, PosChildNeedsLayout); |
| @@ -1393,8 +1384,6 @@ private: |
| ADD_BOOLEAN_BITFIELD(everHadLayout, EverHadLayout); |
| ADD_BOOLEAN_BITFIELD(ancestorLineBoxDirty, AncestorLineBoxDirty); |
| - ADD_BOOLEAN_BITFIELD(layoutDidGetCalledSinceLastFrame, LayoutDidGetCalledSinceLastFrame); |
| - |
| ADD_BOOLEAN_BITFIELD(hasPendingResourceUpdate, HasPendingResourceUpdate); |
| ADD_BOOLEAN_BITFIELD(isInsideFlowThread, IsInsideFlowThread); |
| @@ -1454,17 +1443,6 @@ private: |
| LayoutObjectBitfields m_bitfields; |
| - void setSelfNeedsLayout(bool b) { m_bitfields.setSelfNeedsLayout(b); } |
| - void setNeedsPositionedMovementLayout(bool b) { m_bitfields.setNeedsPositionedMovementLayout(b); } |
| - void setNormalChildNeedsLayout(bool b) { m_bitfields.setNormalChildNeedsLayout(b); } |
| - void setPosChildNeedsLayout(bool b) { m_bitfields.setPosChildNeedsLayout(b); } |
| - void setNeedsSimplifiedNormalFlowLayout(bool b) { m_bitfields.setNeedsSimplifiedNormalFlowLayout(b); } |
| - void setIsDragging(bool b) { m_bitfields.setIsDragging(b); } |
| - void setEverHadLayout(bool b) { m_bitfields.setEverHadLayout(b); } |
| - void setShouldInvalidateOverflowForPaint(bool b) { m_bitfields.setShouldInvalidateOverflowForPaint(b); } |
| - void setSelfNeedsOverflowRecalcAfterStyleChange(bool b) { m_bitfields.setSelfNeedsOverflowRecalcAfterStyleChange(b); } |
| - void setChildNeedsOverflowRecalcAfterStyleChange(bool b) { m_bitfields.setChildNeedsOverflowRecalcAfterStyleChange(b); } |
| - |
| private: |
| // Store state between styleWillChange and styleDidChange |
| static bool s_affectsParentBlock; |
| @@ -1540,7 +1518,7 @@ inline void LayoutObject::setNeedsLayout(LayoutInvalidationReasonForTracing reas |
| { |
| ASSERT(!isSetNeedsLayoutForbidden()); |
| bool alreadyNeededLayout = m_bitfields.selfNeedsLayout(); |
| - setSelfNeedsLayout(true); |
| + m_bitfields.setSelfNeedsLayout(true); |
| if (!alreadyNeededLayout) { |
| TRACE_EVENT_INSTANT1( |
| TRACE_DISABLED_BY_DEFAULT("devtools.timeline.invalidationTracking"), |
| @@ -1561,14 +1539,14 @@ inline void LayoutObject::setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidat |
| inline void LayoutObject::clearNeedsLayout() |
| { |
| - setNeededLayoutBecauseOfChildren(needsLayoutBecauseOfChildren()); |
| - setLayoutDidGetCalledSinceLastFrame(); |
| - setSelfNeedsLayout(false); |
| - setEverHadLayout(true); |
| - setPosChildNeedsLayout(false); |
| - setNeedsSimplifiedNormalFlowLayout(false); |
| - setNormalChildNeedsLayout(false); |
| - setNeedsPositionedMovementLayout(false); |
| + m_bitfields.setNeededLayoutBecauseOfChildren(needsLayoutBecauseOfChildren()); |
| + m_bitfields.setSelfNeedsLayout(false); |
| + m_bitfields.setPosChildNeedsLayout(false); |
| + m_bitfields.setNeedsSimplifiedNormalFlowLayout(false); |
| + m_bitfields.setNormalChildNeedsLayout(false); |
| + m_bitfields.setNeedsPositionedMovementLayout(false); |
| + setMayNeedPaintInvalidation(); |
| + setEverHadLayout(); |
| setAncestorLineBoxDirty(false); |
| #if ENABLE(ASSERT) |
| checkBlockPositionedObjectsNeedLayout(); |
| @@ -1579,7 +1557,7 @@ inline void LayoutObject::setChildNeedsLayout(MarkingBehavior markParents, Subtr |
| { |
| ASSERT(!isSetNeedsLayoutForbidden()); |
| bool alreadyNeededLayout = normalChildNeedsLayout(); |
| - setNormalChildNeedsLayout(true); |
| + m_bitfields.setNormalChildNeedsLayout(true); |
| // FIXME: Replace MarkOnlyThis with the SubtreeLayoutScope code path and remove the MarkingBehavior argument entirely. |
| if (!alreadyNeededLayout && markParents == MarkContainerChain && (!layouter || layouter->root() != this)) |
| markContainerChainForLayout(true, layouter); |
| @@ -1588,7 +1566,7 @@ inline void LayoutObject::setChildNeedsLayout(MarkingBehavior markParents, Subtr |
| inline void LayoutObject::setNeedsPositionedMovementLayout() |
| { |
| bool alreadyNeededLayout = needsPositionedMovementLayout(); |
| - setNeedsPositionedMovementLayout(true); |
| + m_bitfields.setNeedsPositionedMovementLayout(true); |
| ASSERT(!isSetNeedsLayoutForbidden()); |
| if (!alreadyNeededLayout) |
| markContainerChainForLayout(); |