Changeset 180948 in webkit
- Timestamp:
- Mar 3, 2015, 12:12:54 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
rendering/RenderLayer.cpp (modified) (4 diffs)
-
rendering/RenderLayer.h (modified) (3 diffs)
-
rendering/RenderLayerBacking.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r180946 r180948 1 2015-03-03 Simon Fraser <simon.fraser@apple.com> 2 3 Avoid applying the clip-path when painting, if a layer also has a shape layer mask 4 https://bugs.webkit.org/show_bug.cgi?id=142212 5 6 Reviewed by Zalan Bujtas. 7 8 After r180882 we translate clip-path into a composited shape mask when the layer 9 is composited. However, we were also still applying the clip-path when painting 10 the layer contents. 11 12 Now, we set the GraphicsLayer bits GraphicsLayerPaintClipPath and GraphicsLayerPaintMask 13 only for the m_maskLayer's painting. This translate into setting PaintLayerPaintingCompositingMaskPhase 14 and PaintLayerPaintingCompositingClipPathPhase only when painting that same mask layer, 15 rather than always. To ensure that masks and clip-path get applied for software paints, 16 add shouldPaintMask() and shouldApplyClipPath() that return true for non-composited layers, 17 and when doing a flattening paint. 18 19 * rendering/RenderLayer.cpp: 20 (WebCore::RenderLayer::paintLayerContents): Use shouldApplyClipPath(). 21 Pull three chunks of code under a single "if (shouldPaintContent && !selectionOnly)" condition. 22 The condition for paintChildClippingMaskForFragments() is changed slightly; we need to call this 23 only when painting the clip-path/mask layer contents, but also only when there is no mask to fill 24 the clipped area for us. 25 (WebCore::RenderLayer::calculateClipRects): 26 (WebCore::RenderLayer::paintsWithClipPath): Deleted. 27 * rendering/RenderLayer.h: 28 * rendering/RenderLayerBacking.cpp: 29 (WebCore::RenderLayerBacking::updateMaskingLayer): Be sure to set the GraphicsLayerPaintClipPath bit 30 when having a mask forces us onto the painting path. 31 1 32 2015-03-03 Anders Carlsson <andersca@apple.com> 2 33 -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r180882 r180948 4024 4024 } 4025 4025 4026 bool RenderLayer::paintsWithClipPath() const4027 {4028 return renderer().style().clipPath() && !isComposited();4029 }4030 4031 4026 Path RenderLayer::computeClipPath(const LayoutSize& offsetFromRoot, LayoutRect& rootRelativeBounds, WindRule& windRule) const 4032 4027 { … … 4240 4235 4241 4236 bool hasClipPath = false; 4242 if ( paintsWithClipPath() || (localPaintFlags & PaintLayerPaintingCompositingClipPathPhase) || (localPaintFlags & PaintLayerPaintingCompositingMaskPhase))4237 if (shouldApplyClipPath(paintingInfo.paintBehavior, localPaintFlags)) 4243 4238 hasClipPath = setupClipPath(context, paintingInfo, columnAwareOffsetFromRoot, rootRelativeBounds, rootRelativeBoundsComputed); 4244 4239 … … 4337 4332 ASSERT(transparencyLayerContext == context); 4338 4333 4339 if ((localPaintFlags & PaintLayerPaintingCompositingMaskPhase) && shouldPaintContent && renderer().hasMask() && !selectionOnly) { 4340 // Paint the mask for the fragments. 4341 paintMaskForFragments(layerFragments, context, localPaintingInfo, subtreePaintRootForRenderer); 4342 } 4343 4344 if ((localPaintFlags & PaintLayerPaintingCompositingClipPathPhase) && shouldPaintContent && !selectionOnly) { 4345 // Re-use paintChildClippingMaskForFragments to paint black for the compositing clipping mask. 4346 paintChildClippingMaskForFragments(layerFragments, context, localPaintingInfo, subtreePaintRootForRenderer); 4347 } 4348 4349 if ((localPaintFlags & PaintLayerPaintingChildClippingMaskPhase) && shouldPaintContent && !selectionOnly) { 4350 // Paint the border radius mask for the fragments. 4351 paintChildClippingMaskForFragments(layerFragments, context, localPaintingInfo, subtreePaintRootForRenderer); 4334 if (shouldPaintContent && !selectionOnly) { 4335 if (shouldPaintMask(paintingInfo.paintBehavior, localPaintFlags)) { 4336 // Paint the mask for the fragments. 4337 paintMaskForFragments(layerFragments, context, localPaintingInfo, subtreePaintRootForRenderer); 4338 } 4339 4340 if (!(paintFlags & PaintLayerPaintingCompositingMaskPhase) && (paintFlags & PaintLayerPaintingCompositingClipPathPhase)) { 4341 // Re-use paintChildClippingMaskForFragments to paint black for the compositing clipping mask. 4342 paintChildClippingMaskForFragments(layerFragments, context, localPaintingInfo, subtreePaintRootForRenderer); 4343 } 4344 4345 if ((localPaintFlags & PaintLayerPaintingChildClippingMaskPhase)) { 4346 // Paint the border radius mask for the fragments. 4347 paintChildClippingMaskForFragments(layerFragments, context, localPaintingInfo, subtreePaintRootForRenderer); 4348 } 4352 4349 } 4353 4350 … … 6063 6060 } 6064 6061 6062 bool RenderLayer::shouldPaintMask(PaintBehavior paintBehavior, PaintLayerFlags paintFlags) const 6063 { 6064 if (!renderer().hasMask()) 6065 return false; 6066 6067 bool paintsToWindow = !isComposited() || backing()->paintsIntoWindow(); 6068 if (paintsToWindow || (paintBehavior & PaintBehaviorFlattenCompositingLayers)) 6069 return true; 6070 6071 return (paintFlags & PaintLayerPaintingCompositingMaskPhase); 6072 } 6073 6074 bool RenderLayer::shouldApplyClipPath(PaintBehavior paintBehavior, PaintLayerFlags paintFlags) const 6075 { 6076 if (!renderer().hasClipPath()) 6077 return false; 6078 6079 bool paintsToWindow = !isComposited() || backing()->paintsIntoWindow(); 6080 if (paintsToWindow || (paintBehavior & PaintBehaviorFlattenCompositingLayers)) 6081 return true; 6082 6083 return (paintFlags & PaintLayerPaintingCompositingClipPathPhase); 6084 } 6085 6065 6086 bool RenderLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const 6066 6087 { -
trunk/Source/WebCore/rendering/RenderLayer.h
r180882 r180948 443 443 PaintLayerPaintingSkipRootBackground = 1 << 12, 444 444 PaintLayerPaintingChildClippingMaskPhase = 1 << 13, 445 PaintLayerPaintingCompositingAllPhases = PaintLayerPaintingCompositingBackgroundPhase | PaintLayerPaintingCompositingForegroundPhase | PaintLayerPaintingCompositingMaskPhase445 PaintLayerPaintingCompositingAllPhases = PaintLayerPaintingCompositingBackgroundPhase | PaintLayerPaintingCompositingForegroundPhase 446 446 }; 447 447 … … 606 606 607 607 bool paintsWithTransform(PaintBehavior) const; 608 bool shouldPaintMask(PaintBehavior, PaintLayerFlags) const; 609 bool shouldApplyClipPath(PaintBehavior, PaintLayerFlags) const; 608 610 609 611 // Returns true if background phase is painted opaque in the given rect. … … 754 756 755 757 bool setupFontSubpixelQuantization(GraphicsContext*, bool& didQuantizeFonts); 756 757 bool paintsWithClipPath() const;758 758 759 759 Path computeClipPath(const LayoutSize& offsetFromRoot, LayoutRect& rootRelativeBounds, WindRule&) const; -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r180882 r180948 1439 1439 1440 1440 if (hasClipPath) { 1441 bool clipNeedsPainting = renderer().style().clipPath()->type() == ClipPathOperation::Reference;1442 if ( clipNeedsPainting|| !GraphicsLayer::supportsLayerType(GraphicsLayer::Type::Shape))1441 // If we have a mask, we need to paint the combined clip-path and mask into the mask layer. 1442 if (hasMask || renderer().style().clipPath()->type() == ClipPathOperation::Reference || !GraphicsLayer::supportsLayerType(GraphicsLayer::Type::Shape)) 1443 1443 maskPhases |= GraphicsLayerPaintClipPath; 1444 1444 }
Note:
See TracChangeset
for help on using the changeset viewer.