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

Unified Diff: third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp

Issue 2791883002: Optimize ClipRects in the PrePaintTreeWalk (Closed)
Patch Set: none Created 3 years, 9 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
« no previous file with comments | « third_party/WebKit/Source/core/paint/PrePaintTreeWalk.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp
diff --git a/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp b/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp
index 3cc8cc1208933e5c5ff79ece7e85c47243cfdc71..437b5da1aa9519cc9ebf85d81a7d4af4219d4fab 100644
--- a/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp
+++ b/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp
@@ -111,29 +111,12 @@ static void updateAuxiliaryObjectProperties(const LayoutObject& object,
context.ancestorOverflowPaintLayer = paintLayer;
}
-// Returns whether |a| is an ancestor of or equal to |b|.
-static bool isAncestorOfOrEqualTo(const ClipPaintPropertyNode* a,
- const ClipPaintPropertyNode* b) {
- while (b && b != a) {
- b = b->parent();
- }
- return b == a;
-}
-
void PrePaintTreeWalk::computeClipRectForContext(
const PaintPropertyTreeBuilderContext::ContainingBlockContext& context,
const EffectPaintPropertyNode* effect,
const PropertyTreeState& ancestorState,
const LayoutPoint& ancestorPaintOffset,
- bool& hasClip,
FloatClipRect& clipRect) {
- // Only return a non-infinite clip if clips differ, or the "ancestor" state is
- // actually an ancestor clip. This ensures no accuracy issues due to
- // transforms applied to infinite rects.
- if (isAncestorOfOrEqualTo(context.clip, ancestorState.clip()))
- clipRect = FloatClipRect();
-
- hasClip = true;
PropertyTreeState localState(context.transform, context.clip, effect);
clipRect =
@@ -178,7 +161,6 @@ void PrePaintTreeWalk::invalidatePaintLayerOptimizationsIfNeeded(
respectOverflowClip, LayoutSize());
#endif
- bool hasClip = false;
RefPtr<ClipRects> clipRects = ClipRects::create();
const LayoutPoint& ancestorPaintOffset =
context.ancestorTransformedOrRootPaintLayer->layoutObject().paintOffset();
@@ -187,30 +169,27 @@ void PrePaintTreeWalk::invalidatePaintLayerOptimizationsIfNeeded(
const EffectPaintPropertyNode* effect =
context.treeBuilderContext->currentEffect;
computeClipRectForContext(context.treeBuilderContext->current, effect,
- ancestorState, ancestorPaintOffset, hasClip,
- clipRect);
+ ancestorState, ancestorPaintOffset, clipRect);
clipRects->setOverflowClipRect(clipRect);
#ifdef CHECK_CLIP_RECTS
- CHECK(!hasClip ||
- clipRects->overflowClipRect() == oldClipRects.overflowClipRect())
+ CHECK(clipRects->overflowClipRect() == oldClipRects.overflowClipRect())
<< "rect= " << clipRects->overflowClipRect().toString();
#endif
computeClipRectForContext(context.treeBuilderContext->fixedPosition, effect,
- ancestorState, ancestorPaintOffset, hasClip,
- clipRect);
+ ancestorState, ancestorPaintOffset, clipRect);
clipRects->setFixedClipRect(clipRect);
#ifdef CHECK_CLIP_RECTS
- CHECK(hasClip || clipRects->fixedClipRect() == oldClipRects.fixedClipRect())
+ CHECK(clipRects->fixedClipRect() == oldClipRects.fixedClipRect())
<< " fixed=" << clipRects->fixedClipRect().toString();
#endif
computeClipRectForContext(context.treeBuilderContext->absolutePosition,
- effect, ancestorState, ancestorPaintOffset, hasClip,
+ effect, ancestorState, ancestorPaintOffset,
clipRect);
clipRects->setPosClipRect(clipRect);
#ifdef CHECK_CLIP_RECTS
- CHECK(!hasClip || clipRects->posClipRect() == oldClipRects.posClipRect())
+ CHECK(clipRects->posClipRect() == oldClipRects.posClipRect())
<< " abs=" << clipRects->posClipRect().toString();
#endif
« no previous file with comments | « third_party/WebKit/Source/core/paint/PrePaintTreeWalk.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698