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

Unified Diff: Source/core/paint/DeprecatedPaintLayerClipper.cpp

Issue 1184303003: Ignore overflow clip on root layer if HitTestRequest::IgnoreClipping is set. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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: Source/core/paint/DeprecatedPaintLayerClipper.cpp
diff --git a/Source/core/paint/DeprecatedPaintLayerClipper.cpp b/Source/core/paint/DeprecatedPaintLayerClipper.cpp
index fa3a00b857a1562cf5f94499d269c157f1a1b779..2fd415cb4019d3956f72c40bedc8d0f8a2603ec2 100644
--- a/Source/core/paint/DeprecatedPaintLayerClipper.cpp
+++ b/Source/core/paint/DeprecatedPaintLayerClipper.cpp
@@ -234,7 +234,7 @@ void DeprecatedPaintLayerClipper::calculateRects(const ClipRectsContext& context
// Update the clip rects that will be passed to child layers.
if (m_layoutObject.hasOverflowClip()) {
// This layer establishes a clip of some kind.
- if (!isClippingRoot || context.respectOverflowClip == RespectOverflowClip) {
+ if (shouldRespectOverflowClip(context)) {
foregroundRect.intersect(toLayoutBox(m_layoutObject).overflowClipRect(offset, context.scrollbarRelevancy));
if (m_layoutObject.style()->hasBorderRadius())
foregroundRect.setHasRadius(true);
@@ -251,12 +251,12 @@ void DeprecatedPaintLayerClipper::calculateRects(const ClipRectsContext& context
LayoutRect layerBoundsWithVisualOverflow = toLayoutBox(m_layoutObject).visualOverflowRect();
toLayoutBox(m_layoutObject).flipForWritingMode(layerBoundsWithVisualOverflow); // DeprecatedPaintLayer are in physical coordinates, so the overflow has to be flipped.
layerBoundsWithVisualOverflow.moveBy(offset);
- if (!isClippingRoot || context.respectOverflowClip == RespectOverflowClip)
+ if (shouldRespectOverflowClip(context))
backgroundRect.intersect(layerBoundsWithVisualOverflow);
} else {
LayoutRect bounds = toLayoutBox(m_layoutObject).borderBoxRect();
bounds.moveBy(offset);
- if (!isClippingRoot || context.respectOverflowClip == RespectOverflowClip)
+ if (shouldRespectOverflowClip(context))
backgroundRect.intersect(bounds);
}
}
@@ -300,7 +300,7 @@ void DeprecatedPaintLayerClipper::calculateClipRects(const ClipRectsContext& con
adjustClipRectsForChildren(m_layoutObject, clipRects);
- if ((m_layoutObject.hasOverflowClip() && (context.respectOverflowClip == RespectOverflowClip || !isClippingRoot)) || m_layoutObject.hasClip()) {
+ if ((m_layoutObject.hasOverflowClip() && shouldRespectOverflowClip(context)) || m_layoutObject.hasClip()) {
// This offset cannot use convertToLayerCoords, because sometimes our rootLayer may be across
// some transformed layer boundary, for example, in the DeprecatedPaintLayerCompositor overlapMap, where
// clipRects are needed in view space.
@@ -371,4 +371,19 @@ DeprecatedPaintLayer* DeprecatedPaintLayerClipper::clippingRootForPainting() con
return 0;
}
+bool DeprecatedPaintLayerClipper::shouldRespectOverflowClip(const ClipRectsContext& context) const
+{
+ DeprecatedPaintLayer* layer = m_layoutObject.layer();
+ if (layer != context.rootLayer)
+ return true;
+
+ if (context.respectOverflowClip == IgnoreOverflowClip)
+ return false;
+
+ if (layer->isRootLayer() && context.respectOverflowClipForViewport == IgnoreOverflowClip)
+ return false;
+
+ return true;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698