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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutObject.h

Issue 2208463003: First step of PaintInvalidator implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/LayoutObject.h
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.h b/third_party/WebKit/Source/core/layout/LayoutObject.h
index 24d0de5a637d374eb96825d9339f2475ed226889..8e84628dbd7e12b484001d25ee925081db45035f 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.h
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.h
@@ -68,6 +68,7 @@ class PseudoStyleRequest;
class TransformState;
struct PaintInfo;
+struct PaintInvalidatorContext;
enum CursorDirective {
SetCursorBasedOnStyle,
@@ -1306,16 +1307,8 @@ public:
void adjustPreviousPaintInvalidationForScrollIfNeeded(const DoubleSize& scrollDelta);
// The previous position of the top-left corner of the object in its previous paint backing.
- const LayoutPoint& previousPositionFromPaintInvalidationBacking() const
- {
- ASSERT(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled());
- return m_previousPositionFromPaintInvalidationBacking;
- }
- void setPreviousPositionFromPaintInvalidationBacking(const LayoutPoint& positionFromPaintInvalidationBacking)
- {
- ASSERT(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled());
- m_previousPositionFromPaintInvalidationBacking = positionFromPaintInvalidationBacking;
- }
+ const LayoutPoint& previousPositionFromPaintInvalidationBacking() const { return m_previousPositionFromPaintInvalidationBacking; }
+ void setPreviousPositionFromPaintInvalidationBacking(const LayoutPoint& positionFromPaintInvalidationBacking) { m_previousPositionFromPaintInvalidationBacking = positionFromPaintInvalidationBacking; }
bool paintOffsetChanged(const LayoutPoint& newPaintOffset) const
{
@@ -1333,7 +1326,7 @@ public:
void setShouldDoFullPaintInvalidation(PaintInvalidationReason = PaintInvalidationFull);
void clearShouldDoFullPaintInvalidation() { m_bitfields.setFullPaintInvalidationReason(PaintInvalidationNone); }
- virtual void clearPaintInvalidationFlags(const PaintInvalidationState&);
+ virtual void clearPaintInvalidationFlags();
bool mayNeedPaintInvalidation() const { return m_bitfields.mayNeedPaintInvalidation(); }
void setMayNeedPaintInvalidation();
@@ -1377,6 +1370,20 @@ public:
void invalidateDisplayItemClientsIncludingNonCompositingDescendants(PaintInvalidationReason) const;
+ // New version to replace the above old version.
+ virtual PaintInvalidationReason invalidatePaintIfNeeded(const PaintInvalidatorContext&) const;
+
+ // When this object is invalidated for paint, this method is called to invalidate any DisplayItemClients
+ // 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).
+ // The caller should ensure the painting layer has been setNeedsRepaint before calling this function.
+ virtual void invalidateDisplayItemClients(PaintInvalidationReason) const;
+
+ const LayoutRect& previousPaintInvalidationRect() const { return m_previousPaintInvalidationRect; }
+
+ virtual bool hasNonCompositedScrollbars() const { return false; }
+
// Called before anonymousChild.setStyle(). Override to set custom styles for the child.
virtual void updateAnonymousChildStyle(const LayoutObject& anonymousChild, ComputedStyle& style) const { }
@@ -1384,9 +1391,12 @@ public:
class MutableForPainting {
public:
void setPreviousPaintOffset(const LayoutPoint& paintOffset) { m_layoutObject.setPreviousPaintOffset(paintOffset); }
- PaintInvalidationReason invalidatePaintIfNeeded(const PaintInvalidationState& paintInvalidationState) { return m_layoutObject.invalidatePaintIfNeeded(paintInvalidationState); }
- void clearPaintInvalidationFlags(const PaintInvalidationState& paintInvalidationState) { m_layoutObject.clearPaintInvalidationFlags(paintInvalidationState); }
- void setShouldDoDelayedFullPaintInvalidation() { m_layoutObject.setShouldDoFullPaintInvalidation(PaintInvalidationDelayedFull); }
+ void clearPaintInvalidationFlags() { m_layoutObject.clearPaintInvalidationFlags(); }
+ void setShouldDoFullPaintInvalidation(PaintInvalidationReason reason) { m_layoutObject.setShouldDoFullPaintInvalidation(reason); }
+
+ void setPreviousPaintInvalidationRect(const LayoutRect& r) { m_layoutObject.setPreviousPaintInvalidationRect(r); }
+ void setPreviousPositionFromPaintInvalidationBacking(const LayoutPoint& p) { m_layoutObject.setPreviousPositionFromPaintInvalidationBacking(p); }
+ void setPreviousBoxDecorationBackgroundObscured(bool b) { m_layoutObject.setPreviousBoxDecorationBackgroundObscured(b); }
private:
friend class PaintPropertyTreeBuilder;
@@ -1410,6 +1420,9 @@ public:
bool compositedScrollsWithRespectTo(const LayoutBoxModelObject& paintInvalidationContainer) const;
IntSize scrollAdjustmentForPaintInvalidation(const LayoutBoxModelObject& paintInvalidationContainer) const;
+ bool previousBoxDecorationBackgroundObscured() const { return m_bitfields.previousBoxDecorationBackgroundObscured(); }
+ void setPreviousBoxDecorationBackgroundObscured(bool b) { m_bitfields.setPreviousBoxDecorationBackgroundObscured(b); }
+
protected:
enum LayoutObjectType {
LayoutObjectBr,
@@ -1530,25 +1543,6 @@ protected:
void setPreviousPaintInvalidationRect(const LayoutRect& rect) { m_previousPaintInvalidationRect = rect; }
- virtual PaintInvalidationReason getPaintInvalidationReason(const PaintInvalidationState&,
- const LayoutRect& oldPaintInvalidationRect, const LayoutPoint& oldPositionFromPaintInvalidationBacking,
- const LayoutRect& newPaintInvalidationRect, const LayoutPoint& newPositionFromPaintInvalidationBacking) const;
-
- // This function tries to minimize the amount of invalidation
- // generated by invalidating the "difference" between |oldBounds|
- // and |newBounds|. This means invalidating the union of the
- // previous rectangles but not their intersection.
- //
- // The use case is when an element only requires a paint
- // invalidation (which means that its content didn't change)
- // and its bounds changed but its location didn't.
- //
- // If we don't meet the criteria for an incremental paint, the
- // alternative is a full paint invalidation.
- virtual void incrementallyInvalidatePaint(const LayoutBoxModelObject& paintInvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds, const LayoutPoint& positionFromPaintInvalidationBacking);
-
- virtual bool hasNonCompositedScrollbars() const { return false; }
-
#if ENABLE(ASSERT)
virtual bool paintInvalidationStateIsDirty() const
{
@@ -1572,17 +1566,6 @@ protected:
// by invalidatePaintOfSubtreesIfNeeded.
virtual PaintInvalidationReason invalidatePaintIfNeeded(const PaintInvalidationState&);
- // When this object is invalidated for paint, this method is called to invalidate any DisplayItemClients
- // 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).
- // The caller should ensure the painting layer has been setNeedsRepaint before calling this function.
- virtual void invalidateDisplayItemClients(PaintInvalidationReason) const;
-
- // Sets painting layer needsRepaint, then calls invalidateDisplayItemClients().
- // Should use this version when PaintInvalidationState is available.
- void invalidateDisplayItemClientsWithPaintInvalidationState(const PaintInvalidationState&, PaintInvalidationReason) const;
-
void setIsBackgroundAttachmentFixedObject(bool);
void clearSelfNeedsOverflowRecalcAfterStyleChange() { m_bitfields.setSelfNeedsOverflowRecalcAfterStyleChange(false); }
@@ -1594,16 +1577,7 @@ protected:
bool containsInlineWithOutlineAndContinuation() const { return m_bitfields.containsInlineWithOutlineAndContinuation(); }
void setContainsInlineWithOutlineAndContinuation(bool b) { m_bitfields.setContainsInlineWithOutlineAndContinuation(b); }
- const LayoutRect& previousPaintInvalidationRect() const { return m_previousPaintInvalidationRect; }
-
private:
- // This function generates a full invalidation, which
- // means invalidating both |oldBounds| and |newBounds|.
- //
- // This is the default choice when generating an invalidation,
- // as it is always correct, albeit it may force some extra painting.
- void fullyInvalidatePaint(const LayoutBoxModelObject& paintInvalidationContainer, PaintInvalidationReason, const LayoutRect& oldBounds, const LayoutRect& newBounds);
-
// Adjusts a paint invalidation rect in the space of |m_previousPaintInvalidationRect| and |m_previousPositionFromPaintInvalidationBacking|
// to be in the space of the |paintInvalidationContainer|,
// if needed. They can be different only if |paintInvalidationContainer| is a composited scroller.
@@ -1629,8 +1603,6 @@ private:
inline void markAncestorsForPaintInvalidation();
- inline void invalidateSelectionIfNeeded(const LayoutBoxModelObject& paintInvalidationContainer, const PaintInvalidationState&, PaintInvalidationReason);
-
inline void invalidateContainerPreferredLogicalWidths();
void invalidatePaintIncludingNonSelfPaintingLayerDescendantsInternal(const LayoutBoxModelObject& paintInvalidationContainer);
@@ -1638,9 +1610,6 @@ private:
// The caller should ensure the painting layer has been setNeedsRepaint before calling this function.
void invalidatePaintOfPreviousPaintInvalidationRect(const LayoutBoxModelObject& paintInvalidationContainer, PaintInvalidationReason);
- LayoutRect previousSelectionRectForPaintInvalidation() const;
- void setPreviousSelectionRectForPaintInvalidation(const LayoutRect&);
-
LayoutObject* containerForAbsolutePosition(const LayoutBoxModelObject* ancestor = nullptr, bool* ancestorSkipped = nullptr, bool* filterOrReflectionSkipped = nullptr) const;
const LayoutBoxModelObject* enclosingCompositedContainer() const;
@@ -1757,7 +1726,7 @@ private:
, m_childrenInline(false)
, m_containsInlineWithOutlineAndContinuation(false)
, m_alwaysCreateLineBoxesForLayoutInline(false)
- , m_lastBoxDecorationBackgroundObscured(false)
+ , m_previousBoxDecorationBackgroundObscured(false)
, m_isBackgroundAttachmentFixedObject(false)
, m_isScrollAnchorObject(false)
, m_positionedState(IsStaticallyPositioned)
@@ -1892,7 +1861,7 @@ private:
ADD_BOOLEAN_BITFIELD(alwaysCreateLineBoxesForLayoutInline, AlwaysCreateLineBoxesForLayoutInline);
// For slimming-paint.
- ADD_BOOLEAN_BITFIELD(lastBoxDecorationBackgroundObscured, LastBoxDecorationBackgroundObscured);
+ ADD_BOOLEAN_BITFIELD(previousBoxDecorationBackgroundObscured, PreviousBoxDecorationBackgroundObscured);
ADD_BOOLEAN_BITFIELD(isBackgroundAttachmentFixedObject, IsBackgroundAttachmentFixedObject);
ADD_BOOLEAN_BITFIELD(isScrollAnchorObject, IsScrollAnchorObject);

Powered by Google App Engine
This is Rietveld 408576698