Index: Source/core/layout/LayoutObject.h |
diff --git a/Source/core/layout/LayoutObject.h b/Source/core/layout/LayoutObject.h |
index 664972db44458dbf1ea5aed3de27ae1833c31be8..2d81421b8924988680396f8ab29249fd9e1d8fc7 100644 |
--- a/Source/core/layout/LayoutObject.h |
+++ b/Source/core/layout/LayoutObject.h |
@@ -117,6 +117,15 @@ typedef WTF::HashMap<const DeprecatedPaintLayer*, Vector<LayoutRect>> LayerHitTe |
const int showTreeCharacterOffset = 39; |
#endif |
+class NonLayoutObjectDisplayItemClientWrapper : public DisplayItemClientWrapper { |
pdr.
2015/08/20 22:45:05
I'd prefer not to add this, but it may be needed.
Xianzhu
2015/08/21 00:31:38
In next steps, I'll try to decouple setting of rep
trchen
2015/08/21 00:37:29
It doesn't seem that it is used in this CL. Shall
Xianzhu
2015/08/21 04:54:51
Currently non-LayoutObject clients depend on Displ
|
+public: |
+ template <typename T> |
+ NonLayoutObjectDisplayItemClientWrapper(const T& client) |
+ : DisplayItemClientWrapper(client) { } |
+ |
+ NonLayoutObjectDisplayItemClientWrapper(const LayoutObject&) = delete; |
+}; |
+ |
// Base class for all layout tree objects. |
class CORE_EXPORT LayoutObject : public ImageResourceClient { |
friend class LayoutBlock; |
@@ -857,8 +866,8 @@ public: |
void invalidatePaintUsingContainer(const LayoutBoxModelObject& paintInvalidationContainer, const LayoutRect&, PaintInvalidationReason) const; |
// Invalidate the paint of a specific subrectangle within a given object. The rect |r| is in the object's coordinate space. |
- void invalidatePaintRectangle(const LayoutRect&) const; |
- void invalidatePaintRectangleNotInvalidatingDisplayItemClients(const LayoutRect& r) const { invalidatePaintRectangleInternal(r); } |
+ void invalidatePaintRectangle(const LayoutRect&); |
+ void invalidatePaintRectangleNotInvalidatingDisplayItemClients(const LayoutRect& r) { invalidatePaintRectangleInternal(r); } |
// Walk the tree after layout issuing paint invalidations for layoutObjects that have changed or moved, updating bounds that have changed, and clearing paint invalidation state. |
virtual void invalidateTreeIfNeeded(PaintInvalidationState&); |
@@ -1051,15 +1060,24 @@ public: |
DisplayItemClient displayItemClient() const { return toDisplayItemClient(this); } |
- void invalidateDisplayItemClient(const DisplayItemClientWrapper&) const; |
- void invalidateDisplayItemClientForNonCompositingDescendants() const { invalidateDisplayItemClientForNonCompositingDescendantsOf(*this); } |
+ void invalidateDisplayItemClient(const NonLayoutObjectDisplayItemClientWrapper&); |
+ void invalidateDisplayItemClient(LayoutObject&); |
+ void invalidateDisplayItemClientForNonCompositingDescendants() { invalidateDisplayItemClientForNonCompositingDescendantsOf(*this); } |
// A normal object should use invalidateDisplayItemClientForNonCompositingDescendants() |
// to invalidate its descendants which are painted on the same backing. However, for |
// an object (e.g. LayoutScrollbarPart, custom scroll corner, custom resizer) which is |
// not hooked up in the layout tree and not able to find its paint backing, it should |
// let its owning layout object call the following function. |
// FIXME: should we hook up scrollbar parts in the layout tree? crbug.com/484263. |
- void invalidateDisplayItemClientForNonCompositingDescendantsOf(const LayoutObject&) const; |
+ void invalidateDisplayItemClientForNonCompositingDescendantsOf(LayoutObject&); |
+ |
+ bool selfNeedsRepaint() const { return m_bitfields.selfNeedsRepaint(); } |
pdr.
2015/08/20 22:45:05
Can you add a comment here explaining this a bit?
Xianzhu
2015/08/21 00:31:38
Done.
|
+ void setNeedsRepaint(); |
+ bool childNeedsRepaint() const { return m_bitfields.childNeedsRepaint(); } |
+ bool shouldCheckForRepaint() const { return selfNeedsRepaint() || childNeedsRepaint(); } |
+ |
+ // Returns true if all repaint flags of the subtree are cleared. |
+ bool clearRepaintFlagsRecursively(); |
trchen
2015/08/21 00:37:29
In this CL it seems the return value will always b
Xianzhu
2015/08/21 04:54:51
Will remove the return value first.
Xianzhu
2015/08/21 05:52:45
Done.
|
protected: |
enum LayoutObjectType { |
@@ -1189,7 +1207,9 @@ protected: |
// owned by this object, including the object itself, LayoutText/LayoutInline line boxes, etc., |
// not including children which will be invalidated normally during invalidateTreeIfNeeded() and |
// parts which are invalidated separately (e.g. scrollbars). |
- virtual void invalidateDisplayItemClients(const LayoutBoxModelObject& paintInvalidationContainer) const; |
+ virtual void invalidateDisplayItemClients(const LayoutBoxModelObject& paintInvalidationContainer); |
+ |
+ virtual bool clearRepaintFlagsOfSubtrees(); |
void setIsSlowRepaintObject(bool); |
@@ -1220,6 +1240,9 @@ private: |
inline void markContainerChainForPaintInvalidation(); |
+ void markContainerChainForRepaint(); |
+ void setChildNeedsRepaint(); |
+ |
inline void invalidateSelectionIfNeeded(const LayoutBoxModelObject&, PaintInvalidationReason); |
inline void invalidateContainerPreferredLogicalWidths(); |
@@ -1255,7 +1278,9 @@ private: |
static bool isAllowedToModifyLayoutTreeStructure(Document&); |
- const LayoutBoxModelObject* invalidatePaintRectangleInternal(const LayoutRect&) const; |
+ const LayoutBoxModelObject* invalidatePaintRectangleInternal(const LayoutRect&); |
+ |
+ void invalidateDisplayItemClientInternal(const DisplayItemClientWrapper&); |
RefPtr<ComputedStyle> m_style; |
@@ -1328,6 +1353,8 @@ private: |
, m_alwaysCreateLineBoxesForLayoutInline(false) |
, m_lastBoxDecorationBackgroundObscured(false) |
, m_isSlowRepaintObject(false) |
+ , m_selfNeedsRepaint(false) |
+ , m_childNeedsRepaint(false) |
, m_positionedState(IsStaticallyPositioned) |
, m_selectionState(SelectionNone) |
, m_boxDecorationBackgroundState(NoBoxDecorationBackground) |
@@ -1335,7 +1362,7 @@ private: |
{ |
} |
- // 32 bits have been used in the first word, and 16 in the second. |
+ // 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(mayNeedPaintInvalidation, MayNeedPaintInvalidation); |
@@ -1388,6 +1415,12 @@ private: |
ADD_BOOLEAN_BITFIELD(isSlowRepaintObject, IsSlowRepaintObject); |
+ // For slimming-paint v2. |
+ // TODO(wangxianzhu): Combine repaint flags with paint invalidation flags when we remove |
+ // old paint invalidation code. |
+ ADD_BOOLEAN_BITFIELD(selfNeedsRepaint, SelfNeedsRepaint); |
+ ADD_BOOLEAN_BITFIELD(childNeedsRepaint, ChildNeedsRepaint); |
+ |
private: |
unsigned m_positionedState : 2; // PositionedState |
unsigned m_selectionState : 3; // SelectionState |