Chromium Code Reviews| Index: third_party/WebKit/Source/core/paint/PaintLayer.cpp |
| diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.cpp b/third_party/WebKit/Source/core/paint/PaintLayer.cpp |
| index 786449fb35c9431719650de6bd0a451cddff4080..6a5712e254c9447361c49242962e7727baeb508a 100644 |
| --- a/third_party/WebKit/Source/core/paint/PaintLayer.cpp |
| +++ b/third_party/WebKit/Source/core/paint/PaintLayer.cpp |
| @@ -280,7 +280,7 @@ void PaintLayer::updateLayerPositionsAfterLayout() { |
| TRACE_EVENT0("blink,benchmark", |
| "PaintLayer::updateLayerPositionsAfterLayout"); |
| - clipper().clearClipRectsIncludingDescendants(); |
| + clipper(false).clearClipRectsIncludingDescendants(); |
| updateLayerPositionRecursive(); |
| { |
| @@ -368,7 +368,7 @@ bool PaintLayer::scrollsWithRespectTo(const PaintLayer* other) const { |
| } |
| void PaintLayer::updateLayerPositionsAfterOverflowScroll() { |
| - clipper().clearClipRectsIncludingDescendants(); |
| + clipper(false).clearClipRectsIncludingDescendants(); |
| updateLayerPositionRecursive(); |
| } |
| @@ -405,9 +405,9 @@ void PaintLayer::updateTransform(const ComputedStyle* oldStyle, |
| // PaintLayers with transforms act as clip rects roots, so clear the cached |
| // clip rects here. |
| - clipper().clearClipRectsIncludingDescendants(); |
| + clipper(false).clearClipRectsIncludingDescendants(); |
| } else if (hasTransform) { |
| - clipper().clearClipRectsIncludingDescendants(AbsoluteClipRects); |
| + clipper(false).clearClipRectsIncludingDescendants(AbsoluteClipRects); |
| } |
| updateTransformationMatrix(); |
| @@ -1329,7 +1329,7 @@ void PaintLayer::removeOnlyThisLayerAfterStyleChange() { |
| enclosingSelfPaintingLayer->mergeNeedsPaintPhaseFlagsFrom(*this); |
| } |
| - clipper().clearClipRectsIncludingDescendants(); |
| + clipper(false).clearClipRectsIncludingDescendants(); |
| PaintLayer* nextSib = nextSibling(); |
| @@ -1393,7 +1393,7 @@ void PaintLayer::insertOnlyThisLayerAfterStyleChange() { |
| } |
| // Clear out all the clip rects. |
| - clipper().clearClipRectsIncludingDescendants(); |
| + clipper(false).clearClipRectsIncludingDescendants(); |
| } |
| // Returns the layer reached on the walk up towards the ancestor. |
| @@ -1516,6 +1516,7 @@ void PaintLayer::appendSingleFragmentIgnoringPagination( |
| const PaintLayer* rootLayer, |
| const LayoutRect& dirtyRect, |
| ClipRectsCacheSlot clipRectsCacheSlot, |
| + bool useGeometryMapper, |
| OverlayScrollbarClipBehavior overlayScrollbarClipBehavior, |
| ShouldRespectOverflowClipType respectOverflowClip, |
| const LayoutPoint* offsetFromRoot, |
| @@ -1526,9 +1527,10 @@ void PaintLayer::appendSingleFragmentIgnoringPagination( |
| subPixelAccumulation); |
| if (respectOverflowClip == IgnoreOverflowClip) |
| clipRectsContext.setIgnoreOverflowClip(); |
| - clipper().calculateRects(clipRectsContext, dirtyRect, fragment.layerBounds, |
| - fragment.backgroundRect, fragment.foregroundRect, |
| - offsetFromRoot); |
| + clipper(useGeometryMapper) |
| + .calculateRects(clipRectsContext, dirtyRect, fragment.layerBounds, |
| + fragment.backgroundRect, fragment.foregroundRect, |
| + offsetFromRoot); |
| fragments.push_back(fragment); |
| } |
| @@ -1544,6 +1546,7 @@ void PaintLayer::collectFragments( |
| const PaintLayer* rootLayer, |
| const LayoutRect& dirtyRect, |
| ClipRectsCacheSlot clipRectsCacheSlot, |
| + bool useGeometryMapper, |
| OverlayScrollbarClipBehavior overlayScrollbarClipBehavior, |
| ShouldRespectOverflowClipType respectOverflowClip, |
| const LayoutPoint* offsetFromRoot, |
| @@ -1552,7 +1555,7 @@ void PaintLayer::collectFragments( |
| if (!enclosingPaginationLayer()) { |
| // For unpaginated layers, there is only one fragment. |
| appendSingleFragmentIgnoringPagination( |
| - fragments, rootLayer, dirtyRect, clipRectsCacheSlot, |
| + fragments, rootLayer, dirtyRect, clipRectsCacheSlot, useGeometryMapper, |
| overlayScrollbarClipBehavior, respectOverflowClip, offsetFromRoot, |
| subPixelAccumulation); |
| return; |
| @@ -1560,7 +1563,7 @@ void PaintLayer::collectFragments( |
| if (!shouldFragmentCompositedBounds(rootLayer)) { |
| appendSingleFragmentIgnoringPagination( |
| - fragments, rootLayer, dirtyRect, clipRectsCacheSlot, |
| + fragments, rootLayer, dirtyRect, clipRectsCacheSlot, useGeometryMapper, |
| overlayScrollbarClipBehavior, respectOverflowClip, offsetFromRoot, |
| subPixelAccumulation); |
| return; |
| @@ -1582,10 +1585,11 @@ void PaintLayer::collectFragments( |
| LayoutRect layerBoundsInFlowThread; |
| ClipRect backgroundRectInFlowThread; |
| ClipRect foregroundRectInFlowThread; |
| - clipper().calculateRects( |
| - paginationClipRectsContext, LayoutRect(LayoutRect::infiniteIntRect()), |
| - layerBoundsInFlowThread, backgroundRectInFlowThread, |
| - foregroundRectInFlowThread, &offsetWithinPaginatedLayer); |
| + clipper(useGeometryMapper) |
| + .calculateRects(paginationClipRectsContext, |
| + LayoutRect(LayoutRect::infiniteIntRect()), |
| + layerBoundsInFlowThread, backgroundRectInFlowThread, |
| + foregroundRectInFlowThread, &offsetWithinPaginatedLayer); |
| // Take our bounding box within the flow thread and clip it. |
| LayoutRect layerBoundingBoxInFlowThread = |
| @@ -1636,8 +1640,9 @@ void PaintLayer::collectFragments( |
| overlayScrollbarClipBehavior); |
| if (respectOverflowClip == IgnoreOverflowClip) |
| clipRectsContext.setIgnoreOverflowClip(); |
| - ancestorClipRect = enclosingPaginationLayer()->clipper().backgroundClipRect( |
| - clipRectsContext); |
| + ancestorClipRect = enclosingPaginationLayer() |
| + ->clipper(useGeometryMapper) |
| + .backgroundClipRect(clipRectsContext); |
| if (rootLayerIsInsidePaginationLayer) |
| ancestorClipRect.moveBy( |
| -rootLayer->visualOffsetFromAncestor(ancestorLayer)); |
| @@ -1888,7 +1893,7 @@ PaintLayer* PaintLayer::hitTestLayer( |
| // Make sure the parent's clip rects have been calculated. |
| if (parent()) { |
| - ClipRect clipRect = clipper().backgroundClipRect( |
| + ClipRect clipRect = clipper(false).backgroundClipRect( |
| ClipRectsContext(rootLayer, clipRectsCacheSlot, |
| ExcludeOverlayScrollbarSizeForHitTesting)); |
| // Go ahead and test the enclosing clip now. |
| @@ -1993,11 +1998,11 @@ PaintLayer* PaintLayer::hitTestLayer( |
| PaintLayerFragments layerFragments; |
| if (appliedTransform) |
| appendSingleFragmentIgnoringPagination( |
| - layerFragments, rootLayer, hitTestRect, clipRectsCacheSlot, |
| + layerFragments, rootLayer, hitTestRect, clipRectsCacheSlot, false, |
| ExcludeOverlayScrollbarSizeForHitTesting); |
| else |
| collectFragments(layerFragments, rootLayer, hitTestRect, clipRectsCacheSlot, |
| - ExcludeOverlayScrollbarSizeForHitTesting); |
| + false, ExcludeOverlayScrollbarSizeForHitTesting); |
| if (m_scrollableArea && |
| m_scrollableArea->hitTestResizerInFragments(layerFragments, |
| @@ -2112,7 +2117,7 @@ PaintLayer* PaintLayer::hitTestTransformedLayerInFragments( |
| PaintLayer::RootOfTransparencyClipBox, LayoutSize()); |
| enclosingPaginationLayer()->collectFragments( |
| enclosingPaginationFragments, rootLayer, hitTestRect, clipRectsCacheSlot, |
| - ExcludeOverlayScrollbarSizeForHitTesting, RespectOverflowClip, |
| + false, ExcludeOverlayScrollbarSizeForHitTesting, RespectOverflowClip, |
| &offsetOfPaginationLayerFromRoot, LayoutSize(), &transformedExtent); |
| for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) { |
| @@ -2127,7 +2132,7 @@ PaintLayer* PaintLayer::hitTestTransformedLayerInFragments( |
| enclosingPaginationLayer()->convertToLayerCoords( |
| rootLayer, offsetOfPaginationLayerFromRoot); |
| LayoutRect parentClipRect = |
| - clipper() |
| + clipper(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) |
| .backgroundClipRect(ClipRectsContext( |
| enclosingPaginationLayer(), clipRectsCacheSlot, |
| ExcludeOverlayScrollbarSizeForHitTesting)) |
| @@ -2511,7 +2516,7 @@ LayoutRect PaintLayer::boundingBoxForCompositingInternal( |
| // If there is a clip applied by an ancestor to this PaintLayer but below or |
| // equal to |ancestorLayer|, apply that clip. |
| - LayoutRect result = clipper().localClipRect(compositedLayer); |
| + LayoutRect result = clipper(false).localClipRect(compositedLayer); |
| result.intersect(physicalBoundingBox(LayoutPoint())); |
| @@ -2945,6 +2950,16 @@ void PaintLayer::styleDidChange(StyleDifference diff, |
| layoutObject()->setNeedsPaintPropertyUpdate(); |
| } |
| +PaintLayerClipper PaintLayer::clipper(bool useGeometryMapper) const { |
|
pdr.
2017/02/10 20:51:07
Can you add an enum for UseGeometryMapper to make
chrishtr
2017/02/10 22:56:36
Done.
|
| + GeometryMapper* geometryMapper = nullptr; |
| + if (useGeometryMapper) { |
| + DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); |
| + if (FrameView* frameView = m_layoutObject->document().view()) |
| + geometryMapper = frameView->geometryMapper(); |
| + } |
| + return PaintLayerClipper(*this, geometryMapper); |
| +} |
| + |
| bool PaintLayer::scrollsOverflow() const { |
| if (PaintLayerScrollableArea* scrollableArea = this->getScrollableArea()) |
| return scrollableArea->scrollsOverflow(); |