Remove PaintLayerPaintingOverflowContents.
It was added for compositing overflow:scroll, which we don't do.
This also means that only the RespectOverflowClip enum value is
used. And PaintingClipRectsIgnoringOverflowClip is unused.
R=eseidel@chromium.org
Review URL: https://codereview.chromium.org/778753002
diff --git a/sky/engine/core/rendering/ClipRectsCache.h b/sky/engine/core/rendering/ClipRectsCache.h
index d3ca511..b7a2280 100644
--- a/sky/engine/core/rendering/ClipRectsCache.h
+++ b/sky/engine/core/rendering/ClipRectsCache.h
@@ -18,7 +18,6 @@
// Relative to painting ancestor. Used for painting.
PaintingClipRects,
- PaintingClipRectsIgnoringOverflowClip,
NumberOfClipRectsCacheSlots,
UncachedClipRects,
diff --git a/sky/engine/core/rendering/LayerPaintingInfo.h b/sky/engine/core/rendering/LayerPaintingInfo.h
index 0b10f11..108f572 100644
--- a/sky/engine/core/rendering/LayerPaintingInfo.h
+++ b/sky/engine/core/rendering/LayerPaintingInfo.h
@@ -61,7 +61,6 @@
PaintLayerPaintingCompositingForegroundPhase = 1 << 6,
PaintLayerPaintingCompositingMaskPhase = 1 << 7,
PaintLayerPaintingCompositingScrollingPhase = 1 << 8,
- PaintLayerPaintingOverflowContents = 1 << 9,
PaintLayerPaintingCompositingAllPhases = (PaintLayerPaintingCompositingBackgroundPhase | PaintLayerPaintingCompositingForegroundPhase | PaintLayerPaintingCompositingMaskPhase)
};
diff --git a/sky/engine/core/rendering/RenderLayer.cpp b/sky/engine/core/rendering/RenderLayer.cpp
index 45bc9cc..73cd995 100644
--- a/sky/engine/core/rendering/RenderLayer.cpp
+++ b/sky/engine/core/rendering/RenderLayer.cpp
@@ -946,11 +946,6 @@
return false;
}
-static ShouldRespectOverflowClip shouldRespectOverflowClip(PaintLayerFlags paintFlags, const RenderObject* renderer)
-{
- return (paintFlags & PaintLayerPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip;
-}
-
void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
{
// Non self-painting leaf layers don't need to be painted as their renderer() should properly paint itself.
@@ -986,8 +981,6 @@
ClipRect clipRect = paintingInfo.paintDirtyRect;
if (parent()) {
ClipRectsContext clipRectsContext(paintingInfo.rootLayer, (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects);
- if (shouldRespectOverflowClip(paintFlags, renderer()) == IgnoreOverflowClip)
- clipRectsContext.setIgnoreOverflowClip();
clipRect = clipper().backgroundClipRect(clipRectsContext);
clipRect.intersect(paintingInfo.paintDirtyRect);
@@ -1025,7 +1018,6 @@
bool isPaintingScrollingContent = paintFlags & PaintLayerPaintingCompositingScrollingPhase;
bool isPaintingCompositedForeground = paintFlags & PaintLayerPaintingCompositingForegroundPhase;
bool isPaintingCompositedBackground = paintFlags & PaintLayerPaintingCompositingBackgroundPhase;
- bool isPaintingOverflowContents = paintFlags & PaintLayerPaintingOverflowContents;
// Outline always needs to be painted even if we have no visible content. Also,
// the outline is painted in the background phase during composited scrolling.
// If it were painted in the foreground phase, it would move with the scrolled
@@ -1085,7 +1077,7 @@
// fragment should paint.
collectFragments(layerFragments, localPaintingInfo.rootLayer, localPaintingInfo.paintDirtyRect,
(paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects,
- shouldRespectOverflowClip(paintFlags, renderer()), &offsetFromRoot, localPaintingInfo.subPixelAccumulation);
+ &offsetFromRoot, localPaintingInfo.subPixelAccumulation);
updatePaintingInfoForFragments(layerFragments, localPaintingInfo, paintFlags, shouldPaintContent, &offsetFromRoot);
}
@@ -1147,7 +1139,7 @@
ASSERT(!(localPaintingInfo.paintBehavior & PaintBehaviorForceBlackText));
bool shouldPaintBackground = isPaintingCompositedBackground && shouldPaintContent;
- bool shouldPaintNegZOrderList = (isPaintingScrollingContent && isPaintingOverflowContents) || (!isPaintingScrollingContent && isPaintingCompositedBackground);
+ bool shouldPaintNegZOrderList = !isPaintingScrollingContent && isPaintingCompositedBackground;
bool shouldPaintOwnContents = isPaintingCompositedForeground && shouldPaintContent;
bool shouldPaintNormalFlowAndPosZOrderLists = isPaintingCompositedForeground;
bool shouldPaintOverlayScrollbars = isPaintingOverlayScrollbars;
@@ -1244,14 +1236,12 @@
}
void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer* rootLayer, const LayoutRect& dirtyRect,
- ClipRectsCacheSlot clipRectsCacheSlot, ShouldRespectOverflowClip respectOverflowClip, const LayoutPoint* offsetFromRoot,
+ ClipRectsCacheSlot clipRectsCacheSlot, const LayoutPoint* offsetFromRoot,
const LayoutSize& subPixelAccumulation, const LayoutRect* layerBoundingBox)
{
// For unpaginated layers, there is only one fragment.
LayerFragment fragment;
ClipRectsContext clipRectsContext(rootLayer, clipRectsCacheSlot, subPixelAccumulation);
- if (respectOverflowClip == IgnoreOverflowClip)
- clipRectsContext.setIgnoreOverflowClip();
clipper().calculateRects(clipRectsContext, dirtyRect, fragment.layerBounds, fragment.backgroundRect, fragment.foregroundRect, fragment.outlineRect, offsetFromRoot);
fragments.append(fragment);
}
@@ -1262,11 +1252,8 @@
ASSERT(offsetFromRoot);
for (size_t i = 0; i < fragments.size(); ++i) {
LayerFragment& fragment = fragments.at(i);
- fragment.shouldPaintContent = shouldPaintContent;
- if (this != localPaintingInfo.rootLayer || !(localPaintFlags & PaintLayerPaintingOverflowContents)) {
- LayoutPoint newOffsetFromRoot = *offsetFromRoot;
- fragment.shouldPaintContent &= intersectsDamageRect(fragment.layerBounds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer, &newOffsetFromRoot);
- }
+ LayoutPoint newOffsetFromRoot = *offsetFromRoot;
+ fragment.shouldPaintContent = shouldPaintContent && intersectsDamageRect(fragment.layerBounds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer, &newOffsetFromRoot);
}
}
diff --git a/sky/engine/core/rendering/RenderLayer.h b/sky/engine/core/rendering/RenderLayer.h
index 1104777..3d6324c 100644
--- a/sky/engine/core/rendering/RenderLayer.h
+++ b/sky/engine/core/rendering/RenderLayer.h
@@ -466,7 +466,7 @@
void paintChildren(unsigned childrenToVisit, GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags);
void collectFragments(LayerFragments&, const RenderLayer* rootLayer, const LayoutRect& dirtyRect,
- ClipRectsCacheSlot, ShouldRespectOverflowClip = RespectOverflowClip, const LayoutPoint* offsetFromRoot = 0,
+ ClipRectsCacheSlot, const LayoutPoint* offsetFromRoot = 0,
const LayoutSize& subPixelAccumulation = LayoutSize(), const LayoutRect* layerBoundingBox = 0);
void updatePaintingInfoForFragments(LayerFragments&, const LayerPaintingInfo&, PaintLayerFlags, bool shouldPaintContent, const LayoutPoint* offsetFromRoot);
void paintBackgroundForFragments(const LayerFragments&, GraphicsContext*, GraphicsContext* transparencyLayerContext,
diff --git a/sky/engine/core/rendering/RenderLayerClipper.cpp b/sky/engine/core/rendering/RenderLayerClipper.cpp
index f327844..e3ec780 100644
--- a/sky/engine/core/rendering/RenderLayerClipper.cpp
+++ b/sky/engine/core/rendering/RenderLayerClipper.cpp
@@ -216,12 +216,9 @@
// Update the clip rects that will be passed to child layers.
if (m_renderer.hasOverflowClip()) {
- // This layer establishes a clip of some kind.
- if (!isClippingRoot || context.respectOverflowClip == RespectOverflowClip) {
- foregroundRect.intersect(toRenderBox(m_renderer).overflowClipRect(offset));
- if (m_renderer.style()->hasBorderRadius())
- foregroundRect.setHasRadius(true);
- }
+ foregroundRect.intersect(toRenderBox(m_renderer).overflowClipRect(offset));
+ if (m_renderer.style()->hasBorderRadius())
+ foregroundRect.setHasRadius(true);
// If we establish an overflow clip at all, then go ahead and make sure our background
// rect is intersected with our layer's bounds including our visual overflow,
@@ -233,13 +230,11 @@
// individual region boxes as overflow.
LayoutRect layerBoundsWithVisualOverflow = toRenderBox(m_renderer).visualOverflowRect();
layerBoundsWithVisualOverflow.moveBy(offset);
- if (!isClippingRoot || context.respectOverflowClip == RespectOverflowClip)
- backgroundRect.intersect(layerBoundsWithVisualOverflow);
+ backgroundRect.intersect(layerBoundsWithVisualOverflow);
} else {
LayoutRect bounds = toRenderBox(m_renderer).borderBoxRect();
bounds.moveBy(offset);
- if (!isClippingRoot || context.respectOverflowClip == RespectOverflowClip)
- backgroundRect.intersect(bounds);
+ backgroundRect.intersect(bounds);
}
}
@@ -281,8 +276,7 @@
adjustClipRectsForChildren(m_renderer, clipRects);
- // FIXME: This logic looks wrong. We'll apply overflow clip rects even if we were told to IgnoreOverflowClip if m_renderer.hasClip().
- if ((m_renderer.hasOverflowClip() && (context.respectOverflowClip == RespectOverflowClip || !isClippingRoot)) || m_renderer.hasClip()) {
+ if (m_renderer.hasOverflowClip()) {
// This offset cannot use convertToLayerCoords, because sometimes our rootLayer may be across
// some transformed layer boundary, for example, in the RenderLayerCompositor overlapMap, where
// clipRects are needed in view space.
diff --git a/sky/engine/core/rendering/RenderLayerClipper.h b/sky/engine/core/rendering/RenderLayerClipper.h
index ddf6129..06dc066 100644
--- a/sky/engine/core/rendering/RenderLayerClipper.h
+++ b/sky/engine/core/rendering/RenderLayerClipper.h
@@ -52,30 +52,15 @@
class RenderLayer;
-enum ShouldRespectOverflowClip {
- IgnoreOverflowClip,
- RespectOverflowClip
-};
-
class ClipRectsContext {
public:
ClipRectsContext(const RenderLayer* root, ClipRectsCacheSlot slot, const LayoutSize& accumulation = LayoutSize())
: rootLayer(root)
, cacheSlot(slot)
, subPixelAccumulation(accumulation)
- , respectOverflowClip(slot == PaintingClipRectsIgnoringOverflowClip ? IgnoreOverflowClip : RespectOverflowClip)
{
}
- void setIgnoreOverflowClip()
- {
- ASSERT(!usesCache() || cacheSlot == PaintingClipRects);
- ASSERT(respectOverflowClip == RespectOverflowClip);
- if (usesCache())
- cacheSlot = PaintingClipRectsIgnoringOverflowClip;
- respectOverflowClip = IgnoreOverflowClip;
- }
-
bool usesCache() const
{
return cacheSlot != UncachedClipRects;
@@ -88,7 +73,6 @@
ClipRectsCacheSlot cacheSlot;
LayoutSize subPixelAccumulation;
- ShouldRespectOverflowClip respectOverflowClip;
};
class RenderLayerClipper {