Chromium Code Reviews| Index: third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp |
| diff --git a/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp b/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp |
| index af5149f80469b94eaac9903df786c583cf5a18c7..889e54d93222911689ad9d36b26e604ebce5cb0c 100644 |
| --- a/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp |
| +++ b/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp |
| @@ -210,23 +210,27 @@ LayoutRect PaintLayerClipper::localClipRect( |
| const PaintLayer* clippingRootLayer) const { |
| ClipRectsContext context(clippingRootLayer, PaintingClipRects); |
| if (m_geometryMapper) { |
| - ClipRect clipRect = applyOverflowClipToBackgroundRectWithGeometryMapper( |
| - context, clipRectWithGeometryMapper(context, false)); |
| + LayoutRect premappedRect = |
| + applyOverflowClipToBackgroundRectWithGeometryMapper( |
| + context, clipRectWithGeometryMapper(context, false)) |
| + .rect(); |
| // The rect now needs to be transformed to the local space of this |
| - // PaintLayer. |
| + // PaintLayer.4 |
|
wkorman
2017/01/12 22:37:35
nit: '4' typo end of line
chrishtr
2017/01/13 00:24:03
Fixed.
|
| bool success = false; |
| + premappedRect.moveBy(context.rootLayer->layoutObject()->paintOffset()); |
| FloatRect clippedRectInLocalSpace = |
| m_geometryMapper->mapRectToDestinationSpace( |
| - FloatRect(clipRect.rect()), *clippingRootLayer->layoutObject() |
| - ->paintProperties() |
| - ->localBorderBoxProperties(), |
| + FloatRect(premappedRect), *clippingRootLayer->layoutObject() |
| + ->paintProperties() |
| + ->localBorderBoxProperties(), |
| *m_layer.layoutObject() |
| ->paintProperties() |
| ->localBorderBoxProperties(), |
| success); |
| DCHECK(success); |
| - |
| + clippedRectInLocalSpace.moveBy( |
| + -FloatPoint(m_layer.layoutObject()->paintOffset())); |
| return LayoutRect(clippedRectInLocalSpace); |
| } |
| @@ -255,21 +259,22 @@ LayoutRect PaintLayerClipper::localClipRect( |
| void PaintLayerClipper::mapLocalToRootWithGeometryMapper( |
| const ClipRectsContext& context, |
| - LayoutRect& layoutRect) const { |
| + LayoutRect& rectToMap) const { |
| DCHECK(m_geometryMapper); |
| bool success; |
| const auto* layerBorderBoxProperties = |
| m_layer.layoutObject()->paintProperties()->localBorderBoxProperties(); |
| - FloatRect localRect(layoutRect); |
| + FloatRect localRect(rectToMap); |
| localRect.moveBy(FloatPoint(m_layer.layoutObject()->paintOffset())); |
| - layoutRect = LayoutRect(m_geometryMapper->mapRectToDestinationSpace( |
| + rectToMap = LayoutRect(m_geometryMapper->mapRectToDestinationSpace( |
| localRect, *layerBorderBoxProperties, *context.rootLayer->layoutObject() |
| ->paintProperties() |
| ->localBorderBoxProperties(), |
| success)); |
| DCHECK(success); |
| + rectToMap.moveBy(-context.rootLayer->layoutObject()->paintOffset()); |
| } |
| void PaintLayerClipper::calculateRectsWithGeometryMapper( |
| @@ -437,25 +442,40 @@ ClipRect PaintLayerClipper::clipRectWithGeometryMapper( |
| bool success = false; |
| const auto* properties = m_layer.layoutObject()->paintProperties(); |
| DCHECK(properties && properties->localBorderBoxProperties()); |
| - PropertyTreeState propertyTreeState = *properties->localBorderBoxProperties(); |
| - |
| - if (isForeground && shouldClipOverflow(context) && properties->overflowClip()) |
| - propertyTreeState.setClip(properties->overflowClip()); |
| + PropertyTreeState propertyTreeState = *properties->localBorderBoxProperties(); |
| const auto* ancestorProperties = |
| context.rootLayer->layoutObject()->paintProperties(); |
| DCHECK(ancestorProperties && ancestorProperties->localBorderBoxProperties()); |
| PropertyTreeState destinationPropertyTreeState = |
| *ancestorProperties->localBorderBoxProperties(); |
| - if (!context.rootLayer->clipper().shouldRespectOverflowClip(context)) { |
| - if (ancestorProperties->overflowClip()) |
| + |
| + if (&m_layer == context.rootLayer) { |
| + // Set the overflow clip for |propertyTreeState| so that it differs from |
| + // destinationPropertyTreeState| in its clip. |
|
wkorman
2017/01/12 22:37:35
nit: missing '|' prefix on destinationPropertyTree
|
| + if (isForeground && context.respectOverflowClip == RespectOverflowClip && |
| + properties->overflowClip()) |
| + propertyTreeState.setClip(properties->overflowClip()); |
| + } else { |
| + // Set the clip of |destinationPropertyTreeState| to be inside the |
| + // ancestor's overflow clip, so that that clip is not applied. |
| + if (context.respectOverflowClip == IgnoreOverflowClip && |
| + ancestorProperties->overflowClip()) |
| destinationPropertyTreeState.setClip(ancestorProperties->overflowClip()); |
| + |
| + // Set the overflow clip for |propertyTreeState| so that it differs from |
| + // destinationPropertyTreeState| in its clip. |
| + if (isForeground && properties->overflowClip()) |
| + propertyTreeState.setClip(properties->overflowClip()); |
| } |
| + |
| FloatRect clippedRectInRootLayerSpace = |
| m_geometryMapper->mapToVisualRectInDestinationSpace( |
| FloatRect(source), propertyTreeState, destinationPropertyTreeState, |
| success); |
| DCHECK(success); |
| + clippedRectInRootLayerSpace.moveBy( |
| + -FloatPoint(context.rootLayer->layoutObject()->paintOffset())); |
| return ClipRect(LayoutRect(clippedRectInRootLayerSpace)); |
| } |