Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/PaintInvalidationState.h |
| diff --git a/third_party/WebKit/Source/core/layout/PaintInvalidationState.h b/third_party/WebKit/Source/core/layout/PaintInvalidationState.h |
| index c65acfb8a8e1b4b7809770ce6a0de0e285ee1594..82b7a6f2140c65cf9f05708dd6617b1646417669 100644 |
| --- a/third_party/WebKit/Source/core/layout/PaintInvalidationState.h |
| +++ b/third_party/WebKit/Source/core/layout/PaintInvalidationState.h |
| @@ -37,28 +37,15 @@ public: |
| // the one we find during tree walk. Remove this after we fix the issue with tree walk in DOM-order. |
| PaintInvalidationState(const PaintInvalidationState& parentState, const LayoutBoxModelObject&, const LayoutBoxModelObject& paintInvalidationContainer); |
| - // For root LayoutView. |
| - PaintInvalidationState(const LayoutView& layoutView, Vector<LayoutObject*>& pendingDelayedPaintInvalidations) |
| - : PaintInvalidationState(layoutView, pendingDelayedPaintInvalidations, nullptr) { } |
| - // For LayoutView in a sub-frame. |
| - PaintInvalidationState(const LayoutView& layoutView, const PaintInvalidationState& ownerPaintInvalidationState) |
| - : PaintInvalidationState(layoutView, ownerPaintInvalidationState.m_pendingDelayedPaintInvalidations, &ownerPaintInvalidationState) { } |
| - |
| - // When a PaintInvalidationState is constructed, it just updates paintInvalidationContainer and |
| - // copy cached paintOffset and clip from the parent PaintInvalidationContainer. |
| - // This PaintInvalidationContainer can be used to invalidate the current object. |
| - // |
| - // After invalidation of the current object, before invalidation of the subtrees, |
| - // this method must be called to make this PaintInvalidationState suitable for |
| - // paint invalidation of children. |
| - void updatePaintOffsetAndClipForChildren(); |
| - |
| - const LayoutRect& clipRect() const { return m_clipRect; } |
| - const LayoutSize& paintOffset() const { return m_paintOffset; } |
| - const AffineTransform& svgTransform() const { return m_svgTransform; } |
| + // For root LayoutView, or when sub-frame LayoutView's invalidateTreeIfNeeded() is called directly from |
| + // FrameView::invalidateTreeIfNeededRecursive() instead of the owner LayoutPart. |
| + // TODO(wangxianzhu): Eliminate the latter case. |
| + PaintInvalidationState(const LayoutView&, Vector<LayoutObject*>& pendingDelayedPaintInvalidations); |
| - bool cachedOffsetsEnabled() const { return m_cachedOffsetsEnabled; } |
| - bool isClipped() const { return m_clipped; } |
| + // When a PaintInvalidationState is constructed, it's for paint invalidation of the current object. |
| + // After invalidation of the current object, before invalidation of the subtrees, this method must |
| + // be called to make this PaintInvalidationState suitable for paint invalidation of children. |
| + void updateForChildren(); |
|
pdr.
2016/03/25 01:08:01
There's quite a bit of logic to enforce the orderi
trchen
2016/03/25 01:20:22
I can see why we need the complexity here, because
Xianzhu
2016/03/25 16:35:54
I see the benefits like shorter code at call sites
|
| bool forcedSubtreeInvalidationWithinContainer() const { return m_forcedSubtreeInvalidationWithinContainer; } |
| void setForceSubtreeInvalidationWithinContainer() { m_forcedSubtreeInvalidationWithinContainer = true; } |
| @@ -68,27 +55,31 @@ public: |
| const LayoutBoxModelObject& paintInvalidationContainer() const { return m_paintInvalidationContainer; } |
| - bool canMapToAncestor(const LayoutBoxModelObject* ancestor) const |
| - { |
| - return m_cachedOffsetsEnabled && ancestor == &m_paintInvalidationContainer; |
| - } |
| - void mapObjectRectToAncestor(const LayoutObject&, const LayoutBoxModelObject* ancestor, LayoutRect&) const; |
| + // Computes the position of the current object ((0,0) in the space of the object) |
| + // in the space of paint invalidation backing. |
| + // The result will be the same as the location of computePaintInvalidaitonRectInBacking() |
| + // if the object doesn't have overflow at top/left or transformation. |
|
chrishtr
2016/03/24 00:53:52
How is it affected by clips?
Xianzhu
2016/03/25 16:35:54
It's also affected by clips.
I think the first se
|
| + LayoutPoint computePositionFromPaintInvalidationBacking() const; |
| + |
| + // Returns the rect bounds needed to invalidate paint of this object, |
| + // in the space of paint invalidation backing. |
| + LayoutRect computePaintInvalidationRectInBacking() const; |
| + |
| + void mapLocalRectToPaintInvalidationBacking(LayoutRect&) const; |
| // Records |obj| as needing paint invalidation on the next frame. See the definition of PaintInvalidationDelayedFull for more details. |
| void pushDelayedPaintInvalidationTarget(LayoutObject& obj) const { m_pendingDelayedPaintInvalidations.append(&obj); } |
| Vector<LayoutObject*>& pendingDelayedPaintInvalidationTargets() const { return m_pendingDelayedPaintInvalidations; } |
| - // Disable view clipping and scroll offset adjustment for paint invalidation of FrameView scrollbars. |
| - // TODO(wangxianzhu): Remove this when root-layer-scrolls launches. |
| - bool viewClippingAndScrollOffsetDisabled() const { return m_viewClippingAndScrollOffsetDisabled; } |
| - void setViewClippingAndScrollOffsetDisabled(bool b) { m_viewClippingAndScrollOffsetDisabled = b; } |
| - |
| PaintLayer& enclosingSelfPaintingLayer(const LayoutObject&) const; |
| +#if ENABLE(ASSERT) |
| + const LayoutObject& currentObject() const { return m_currentObject; } |
| +#endif |
| + |
| private: |
| - PaintInvalidationState(const LayoutView&, Vector<LayoutObject*>& pendingDelayedPaintInvalidations, const PaintInvalidationState* ownerPaintInvalidationState); |
| + LayoutRect computePaintInvalidationRectInBackingForSVG() const; |
| - void applyClipIfNeeded(); |
| void addClipRectRelativeToPaintOffset(const LayoutSize& clipSize); |
| friend class ForceHorriblySlowRectMapping; |
| @@ -99,7 +90,6 @@ private: |
| mutable bool m_cachedOffsetsEnabled; |
| bool m_forcedSubtreeInvalidationWithinContainer; |
| bool m_forcedSubtreeInvalidationRectUpdateWithinContainer; |
| - bool m_viewClippingAndScrollOffsetDisabled; |
| LayoutRect m_clipRect; |
| @@ -121,7 +111,7 @@ private: |
| PaintLayer& m_enclosingSelfPaintingLayer; |
| #if ENABLE(ASSERT) |
| - bool m_didUpdatePaintOffsetAndClipForChildren; |
| + bool m_didUpdateForChildren; |
| #endif |
| }; |
| @@ -135,7 +125,7 @@ class ForceHorriblySlowRectMapping { |
| public: |
| ForceHorriblySlowRectMapping(const PaintInvalidationState* paintInvalidationState) |
| : m_paintInvalidationState(paintInvalidationState) |
| - , m_didDisable(m_paintInvalidationState && m_paintInvalidationState->cachedOffsetsEnabled()) |
| + , m_didDisable(m_paintInvalidationState && m_paintInvalidationState->m_cachedOffsetsEnabled) |
| { |
| if (m_paintInvalidationState) |
| m_paintInvalidationState->m_cachedOffsetsEnabled = false; |