Title: [180882] trunk
Revision
180882
Author
simon.fra...@apple.com
Date
2015-03-01 22:35:20 -0800 (Sun, 01 Mar 2015)

Log Message

Make clip-path work on <video>, <canvas> etc.
https://bugs.webkit.org/show_bug.cgi?id=138684

Reviewed by Darin Adler.

Source/WebCore:

clip-path only worked in compositing layers on the painted contents of the layer,
and failed to clip children. Fix this by translating the clip path into a Path
which is set on a CA shape layer (for Mac and iOS), or painted into the
RenderLayerBacking's mask layer. There are two code paths:

1. clip-path which is a <basic-shape> or <geometry-box>, and no mask.
    Here we can use the optimal code path of converting the clip into a path
    that is put onto a CAShapeLayer, which is then used as a mask. There is no
    additional backing store.
2. clip-path with an SVG reference, or clip-path combined with -webkit-mask:
    Here we have to allocate backing store for the mask layer, and paint the
    clip path (possibly with the mask).

We add GraphicsLayer::Type::Shape, and add a getter for the layer type.

Tests: compositing/masks/compositing-clip-path-and-mask.html
       compositing/masks/compositing-clip-path-mask-change.html
       compositing/masks/compositing-clip-path.html
       compositing/masks/reference-clip-path-on-composited.html

* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::GraphicsLayer): Store the type in the layer so the getter can return it.
(WebCore::GraphicsLayer::shapeLayerPath): Get and set the shape layer path.
(WebCore::GraphicsLayer::setShapeLayerPath): Ditto.
(WebCore::GraphicsLayer::shapeLayerWindRule): Get and set the shape layer wind rule.
(WebCore::GraphicsLayer::setShapeLayerWindRule): Ditto.
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::type): Expose the type.
(WebCore::GraphicsLayer::supportsLayerType): Allow the cross-platform code to use
shape layers when it knows they are available.
(WebCore::GraphicsLayer::needsClippingMaskLayer): Deleted. This was never used.
* platform/graphics/GraphicsLayerClient.h: Align the bits (helps avoid typos). Add a
GraphicsLayerPaintClipPath phase.
* platform/graphics/Path.h: Some exports since WK2 needs to encode Paths now.
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::initialize): Make shape layers.
(WebCore::GraphicsLayerCA::setShapeLayerPath): Setter for the shape path. Sadly we
can't early return on unchanged paths yet.
(WebCore::GraphicsLayerCA::setShapeLayerWindRule):
(WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers): Updates for shape path
and wind rule.
(WebCore::GraphicsLayerCA::updateShape):
(WebCore::GraphicsLayerCA::updateWindRule):
* platform/graphics/ca/GraphicsLayerCA.h: Some new dirty bits for shape path and wind rule.
* platform/graphics/ca/PlatformCALayer.h:
* platform/graphics/ca/mac/PlatformCALayerMac.h:
* platform/graphics/ca/mac/PlatformCALayerMac.mm: Got rid of lots of m_layer.get().
(PlatformCALayerMac::~PlatformCALayerMac):
(PlatformCALayerMac::setNeedsDisplay):
(PlatformCALayerMac::setNeedsDisplayInRect):
(PlatformCALayerMac::removeFromSuperlayer):
(PlatformCALayerMac::setSublayers):
(PlatformCALayerMac::removeAllSublayers):
(PlatformCALayerMac::appendSublayer):
(PlatformCALayerMac::insertSublayer):
(PlatformCALayerMac::replaceSublayer):
(PlatformCALayerMac::adoptSublayers):
(PlatformCALayerMac::addAnimationForKey):
(PlatformCALayerMac::removeAnimationForKey):
(PlatformCALayerMac::animationForKey):
(PlatformCALayerMac::setMask):
(PlatformCALayerMac::isOpaque):
(PlatformCALayerMac::setOpaque):
(PlatformCALayerMac::bounds):
(PlatformCALayerMac::setBounds):
(PlatformCALayerMac::position):
(PlatformCALayerMac::setPosition):
(PlatformCALayerMac::anchorPoint):
(PlatformCALayerMac::setAnchorPoint):
(PlatformCALayerMac::transform):
(PlatformCALayerMac::setTransform):
(PlatformCALayerMac::sublayerTransform):
(PlatformCALayerMac::setSublayerTransform):
(PlatformCALayerMac::setHidden):
(PlatformCALayerMac::setGeometryFlipped):
(PlatformCALayerMac::isDoubleSided):
(PlatformCALayerMac::setDoubleSided):
(PlatformCALayerMac::masksToBounds):
(PlatformCALayerMac::setMasksToBounds):
(PlatformCALayerMac::acceleratesDrawing):
(PlatformCALayerMac::setAcceleratesDrawing):
(PlatformCALayerMac::contents):
(PlatformCALayerMac::setContents):
(PlatformCALayerMac::setContentsRect):
(PlatformCALayerMac::setMinificationFilter):
(PlatformCALayerMac::setMagnificationFilter):
(PlatformCALayerMac::backgroundColor):
(PlatformCALayerMac::setBackgroundColor):
(PlatformCALayerMac::setBorderWidth):
(PlatformCALayerMac::setBorderColor):
(PlatformCALayerMac::opacity):
(PlatformCALayerMac::setOpacity):
(PlatformCALayerMac::copyFiltersFrom):
(PlatformCALayerMac::setName):
(PlatformCALayerMac::setSpeed):
(PlatformCALayerMac::setTimeOffset):
(PlatformCALayerMac::contentsScale):
(PlatformCALayerMac::setContentsScale):
(PlatformCALayerMac::cornerRadius):
(PlatformCALayerMac::setCornerRadius):
(PlatformCALayerMac::setEdgeAntialiasingMask):
(PlatformCALayerMac::shapeWindRule): New function.
(PlatformCALayerMac::setShapeWindRule): Ditto.
(PlatformCALayerMac::shapePath): Ditto.
(PlatformCALayerMac::setShapePath): Ditto.
(PlatformCALayer::isWebLayer):
* platform/graphics/cg/PathCG.cpp:
(WebCore::Path::Path): nullptr.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paintsWithClipPath): Return true if the clip path is painted.
(WebCore::RenderLayer::computeClipPath): Factor code that computes the clip path into this
function, so we can call it from RenderLayerBacking too.
(WebCore::RenderLayer::setupClipPath):
(WebCore::RenderLayer::paintLayerContents): We only want to apply the clip path
for painting when we're either painting a non-composited layer, or we're painting the
mask layer of a composited layer. We in the latter case, we just want to fill the clip
path with black, so re-use the paintChildClippingMaskForFragments() which does this.
* rendering/RenderLayer.h: Align the bits, add PaintLayerPaintingCompositingClipPathPhase.
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::~RenderLayerBacking):
(WebCore::RenderLayerBacking::updateConfiguration):
(WebCore::RenderLayerBacking::updateGeometry): Move mask updating into its own function.
(WebCore::RenderLayerBacking::updateMaskingLayerGeometry): If we're using the shape layer
code path, compute the Path and set it and the wind rule on the mask layer.
(WebCore::RenderLayerBacking::updateMaskingLayer): This is now more complex, as it has
to deal with combinations of clip-path and mask, some of which allow for the shape layer
mask, and we handle dynamic changes between these and painted masks.
(WebCore::RenderLayerBacking::paintingPhaseForPrimaryLayer): Include the GraphicsLayerPaintClipPath phase.
(WebCore::RenderLayerBacking::paintIntoLayer): Map GraphicsLayerPaintClipPath to PaintLayerPaintingCompositingClipPathPhase.
(WebCore::RenderLayerBacking::updateMaskLayer): Deleted.
* rendering/RenderLayerBacking.h:

Source/WebKit2:

Support encode/decode for WebCore Path objects, which is done by traversing
the path.

* Shared/WebCoreArgumentCoders.cpp:
(IPC::pathPointCountApplierFunction):
(IPC::pathEncodeApplierFunction):
(IPC::ArgumentCoder<Path>::encode):
(IPC::ArgumentCoder<Path>::decode):
* Shared/WebCoreArgumentCoders.h:
* Shared/mac/RemoteLayerTreePropertyApplier.mm:
(WebKit::applyPropertiesToLayer): Actually apply the path and wind rule to the shape layer.
* Shared/mac/RemoteLayerTreeTransaction.h: Include path and wind rule in the layer properties.
* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::encode): Encode shape and wind rule.
(WebKit::RemoteLayerTreeTransaction::LayerProperties::decode): Decode shape and wind rule.
* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::shapePath):
(WebKit::PlatformCALayerRemote::setShapePath):
(WebKit::PlatformCALayerRemote::shapeWindRule):
(WebKit::PlatformCALayerRemote::setShapeWindRule):
* WebProcess/WebPage/mac/PlatformCALayerRemote.h:

LayoutTests:

Tests for various combinations of clip-path and mask, and dynamic changes
thereof.

* compositing/masks/compositing-clip-path-and-mask-expected.html: Added.
* compositing/masks/compositing-clip-path-and-mask.html: Added.
* compositing/masks/compositing-clip-path-expected.html: Added.
* compositing/masks/compositing-clip-path-mask-change-expected.html: Added.
* compositing/masks/compositing-clip-path-mask-change.html: Added.
* compositing/masks/compositing-clip-path.html: Added.
* compositing/masks/reference-clip-path-on-composited-expected.html: Added.
* compositing/masks/reference-clip-path-on-composited.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (180881 => 180882)


--- trunk/LayoutTests/ChangeLog	2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/LayoutTests/ChangeLog	2015-03-02 06:35:20 UTC (rev 180882)
@@ -1,3 +1,22 @@
+2015-03-01  Simon Fraser  <simon.fra...@apple.com>
+
+        Make clip-path work on <video>, <canvas> etc.
+        https://bugs.webkit.org/show_bug.cgi?id=138684
+
+        Reviewed by Darin Adler.
+        
+        Tests for various combinations of clip-path and mask, and dynamic changes
+        thereof.
+
+        * compositing/masks/compositing-clip-path-and-mask-expected.html: Added.
+        * compositing/masks/compositing-clip-path-and-mask.html: Added.
+        * compositing/masks/compositing-clip-path-expected.html: Added.
+        * compositing/masks/compositing-clip-path-mask-change-expected.html: Added.
+        * compositing/masks/compositing-clip-path-mask-change.html: Added.
+        * compositing/masks/compositing-clip-path.html: Added.
+        * compositing/masks/reference-clip-path-on-composited-expected.html: Added.
+        * compositing/masks/reference-clip-path-on-composited.html: Added.
+
 2015-03-01  Gyuyoung Kim  <gyuyoung....@samsung.com>
 
         Unreviewed EFL gardening. Mark crash tests of webgl to CRASH.

Added: trunk/LayoutTests/compositing/masks/compositing-clip-path-and-mask-expected.html (0 => 180882)


--- trunk/LayoutTests/compositing/masks/compositing-clip-path-and-mask-expected.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/masks/compositing-clip-path-and-mask-expected.html	2015-03-02 06:35:20 UTC (rev 180882)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        .box {
+          width: 300px;
+          height: 300px;
+          background-color: blue;
+        }
+        
+        .clipped {
+            -webkit-clip-path: inset(0 50px);
+            -webkit-mask: linear-gradient(transparent, black);
+        }
+    </style>
+</head>
+<body>
+    <div class="clipped box"></div>
+</body>
+</html>

Added: trunk/LayoutTests/compositing/masks/compositing-clip-path-and-mask.html (0 => 180882)


--- trunk/LayoutTests/compositing/masks/compositing-clip-path-and-mask.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/masks/compositing-clip-path-and-mask.html	2015-03-02 06:35:20 UTC (rev 180882)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        .box {
+          width: 300px;
+          height: 300px;
+          background-color: blue;
+        }
+        
+        .composited {
+          -webkit-transform: translateZ(0);
+        }
+        
+        .clipped {
+            -webkit-clip-path: inset(0 50px);
+            -webkit-mask: linear-gradient(transparent, black);
+        }
+    </style>
+</head>
+<body>
+    <div class="clipped composited box">asdf</div>
+</body>
+</html>

Added: trunk/LayoutTests/compositing/masks/compositing-clip-path-expected.html (0 => 180882)


--- trunk/LayoutTests/compositing/masks/compositing-clip-path-expected.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/masks/compositing-clip-path-expected.html	2015-03-02 06:35:20 UTC (rev 180882)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        .box {
+          width: 300px;
+          height: 300px;
+          background-color: blue;
+        }
+        
+        .clipped {
+            -webkit-clip-path: inset(0 50px);
+        }
+    </style>
+</head>
+<body>
+    <div class="clipped box"></div>
+</body>
+</html>

Added: trunk/LayoutTests/compositing/masks/compositing-clip-path-mask-change-expected.html (0 => 180882)


--- trunk/LayoutTests/compositing/masks/compositing-clip-path-mask-change-expected.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/masks/compositing-clip-path-mask-change-expected.html	2015-03-02 06:35:20 UTC (rev 180882)
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        .box {
+          width: 200px;
+          height: 200px;
+          margin: 10px;
+          background-color: blue;
+        }
+        
+        .composited {
+          -webkit-transform: translateZ(0);
+        }
+        
+        .clipped {
+            -webkit-clip-path: inset(0 30px);
+        }
+        
+        .masked {
+            -webkit-mask: linear-gradient(transparent, black);
+        }
+        
+    </style>
+</head>
+<body>
+
+<div id="gain-mask" class="masked clipped composited box"></div>
+<div id="lose-mask" class="clipped composited box"></div>
+
+</body>
+</html>

Added: trunk/LayoutTests/compositing/masks/compositing-clip-path-mask-change.html (0 => 180882)


--- trunk/LayoutTests/compositing/masks/compositing-clip-path-mask-change.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/masks/compositing-clip-path-mask-change.html	2015-03-02 06:35:20 UTC (rev 180882)
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        .box {
+          width: 200px;
+          height: 200px;
+          margin: 10px;
+          background-color: blue;
+        }
+        
+        .composited {
+          -webkit-transform: translateZ(0);
+        }
+        
+        .clipped {
+            -webkit-clip-path: inset(0 30px);
+        }
+        
+        .masked {
+            -webkit-mask: linear-gradient(transparent, black);
+        }
+        
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.waitUntilDone();
+
+        function doTest()
+        {
+            window.setTimeout(function() {
+                document.getElementById('gain-mask').classList.add('masked');
+                document.getElementById('lose-mask').classList.remove('masked');
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            }, 0);
+        }
+        
+        window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+
+<div id="gain-mask" class="clipped composited box"></div>
+<div id="lose-mask" class="masked clipped composited box"></div>
+
+</body>
+</html>

Added: trunk/LayoutTests/compositing/masks/compositing-clip-path.html (0 => 180882)


--- trunk/LayoutTests/compositing/masks/compositing-clip-path.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/masks/compositing-clip-path.html	2015-03-02 06:35:20 UTC (rev 180882)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        .box {
+          width: 300px;
+          height: 300px;
+          background-color: blue;
+        }
+        
+        .composited {
+          -webkit-transform: translateZ(0);
+        }
+        
+        .clipped {
+            -webkit-clip-path: inset(0 50px);
+        }
+    </style>
+</head>
+<body>
+    <div class="clipped composited box"></div>
+</body>
+</html>

Added: trunk/LayoutTests/compositing/masks/reference-clip-path-on-composited-expected.html (0 => 180882)


--- trunk/LayoutTests/compositing/masks/reference-clip-path-on-composited-expected.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/masks/reference-clip-path-on-composited-expected.html	2015-03-02 06:35:20 UTC (rev 180882)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<style>
+    .container {
+        width: 200px;
+        height: 200px;
+        border: 1px solid black;
+    }
+    .clipped {
+        width: 180px;
+        height: 180px;
+        margin: 10px;
+        background-color: green;
+        -webkit-clip-path: url(#clipper);
+    }
+</style>
+</head>
+<body>
+
+<div class="container">
+    <div class="clipped box"></div>
+</div>
+
+<svg height="0">
+    <clipPath id="clipper" clipPathUnits="objectBoundingBox">
+        <rect x="0.25" y="0.25" width="0.5" height="0.5"/>
+    </clipPath>
+</svg>
+
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/compositing/masks/reference-clip-path-on-composited.html (0 => 180882)


--- trunk/LayoutTests/compositing/masks/reference-clip-path-on-composited.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/masks/reference-clip-path-on-composited.html	2015-03-02 06:35:20 UTC (rev 180882)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<style>
+    .container {
+        width: 200px;
+        height: 200px;
+        border: 1px solid black;
+    }
+    .clipped {
+        width: 180px;
+        height: 180px;
+        margin: 10px;
+        background-color: green;
+        -webkit-clip-path: url(#clipper);
+    }
+    
+    .composited {
+      -webkit-transform: translateZ(0);
+    }
+    
+</style>
+</head>
+<body>
+
+<div class="container">
+    <div class="clipped composited box"></div>
+</div>
+
+<svg height="0">
+    <clipPath id="clipper" clipPathUnits="objectBoundingBox">
+        <rect x="0.25" y="0.25" width="0.5" height="0.5"/>
+    </clipPath>
+</svg>
+
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (180881 => 180882)


--- trunk/Source/WebCore/ChangeLog	2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/Source/WebCore/ChangeLog	2015-03-02 06:35:20 UTC (rev 180882)
@@ -1,3 +1,142 @@
+2015-03-01  Simon Fraser  <simon.fra...@apple.com>
+
+        Make clip-path work on <video>, <canvas> etc.
+        https://bugs.webkit.org/show_bug.cgi?id=138684
+
+        Reviewed by Darin Adler.
+        
+        clip-path only worked in compositing layers on the painted contents of the layer,
+        and failed to clip children. Fix this by translating the clip path into a Path
+        which is set on a CA shape layer (for Mac and iOS), or painted into the
+        RenderLayerBacking's mask layer. There are two code paths:
+
+        1. clip-path which is a <basic-shape> or <geometry-box>, and no mask.
+            Here we can use the optimal code path of converting the clip into a path
+            that is put onto a CAShapeLayer, which is then used as a mask. There is no
+            additional backing store.
+        2. clip-path with an SVG reference, or clip-path combined with -webkit-mask:
+            Here we have to allocate backing store for the mask layer, and paint the
+            clip path (possibly with the mask).
+        
+        We add GraphicsLayer::Type::Shape, and add a getter for the layer type.
+
+        Tests: compositing/masks/compositing-clip-path-and-mask.html
+               compositing/masks/compositing-clip-path-mask-change.html
+               compositing/masks/compositing-clip-path.html
+               compositing/masks/reference-clip-path-on-composited.html
+
+        * platform/graphics/GraphicsLayer.cpp:
+        (WebCore::GraphicsLayer::GraphicsLayer): Store the type in the layer so the getter can return it.
+        (WebCore::GraphicsLayer::shapeLayerPath): Get and set the shape layer path.
+        (WebCore::GraphicsLayer::setShapeLayerPath): Ditto.
+        (WebCore::GraphicsLayer::shapeLayerWindRule): Get and set the shape layer wind rule.
+        (WebCore::GraphicsLayer::setShapeLayerWindRule): Ditto.
+        * platform/graphics/GraphicsLayer.h:
+        (WebCore::GraphicsLayer::type): Expose the type.
+        (WebCore::GraphicsLayer::supportsLayerType): Allow the cross-platform code to use
+        shape layers when it knows they are available.
+        (WebCore::GraphicsLayer::needsClippingMaskLayer): Deleted. This was never used.
+        * platform/graphics/GraphicsLayerClient.h: Align the bits (helps avoid typos). Add a
+        GraphicsLayerPaintClipPath phase.
+        * platform/graphics/Path.h: Some exports since WK2 needs to encode Paths now.
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::initialize): Make shape layers.
+        (WebCore::GraphicsLayerCA::setShapeLayerPath): Setter for the shape path. Sadly we
+        can't early return on unchanged paths yet.
+        (WebCore::GraphicsLayerCA::setShapeLayerWindRule):
+        (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers): Updates for shape path
+        and wind rule.
+        (WebCore::GraphicsLayerCA::updateShape):
+        (WebCore::GraphicsLayerCA::updateWindRule):
+        * platform/graphics/ca/GraphicsLayerCA.h: Some new dirty bits for shape path and wind rule.
+        * platform/graphics/ca/PlatformCALayer.h:
+        * platform/graphics/ca/mac/PlatformCALayerMac.h:
+        * platform/graphics/ca/mac/PlatformCALayerMac.mm: Got rid of lots of m_layer.get().
+        (PlatformCALayerMac::~PlatformCALayerMac):
+        (PlatformCALayerMac::setNeedsDisplay):
+        (PlatformCALayerMac::setNeedsDisplayInRect):
+        (PlatformCALayerMac::removeFromSuperlayer):
+        (PlatformCALayerMac::setSublayers):
+        (PlatformCALayerMac::removeAllSublayers):
+        (PlatformCALayerMac::appendSublayer):
+        (PlatformCALayerMac::insertSublayer):
+        (PlatformCALayerMac::replaceSublayer):
+        (PlatformCALayerMac::adoptSublayers):
+        (PlatformCALayerMac::addAnimationForKey):
+        (PlatformCALayerMac::removeAnimationForKey):
+        (PlatformCALayerMac::animationForKey):
+        (PlatformCALayerMac::setMask):
+        (PlatformCALayerMac::isOpaque):
+        (PlatformCALayerMac::setOpaque):
+        (PlatformCALayerMac::bounds):
+        (PlatformCALayerMac::setBounds):
+        (PlatformCALayerMac::position):
+        (PlatformCALayerMac::setPosition):
+        (PlatformCALayerMac::anchorPoint):
+        (PlatformCALayerMac::setAnchorPoint):
+        (PlatformCALayerMac::transform):
+        (PlatformCALayerMac::setTransform):
+        (PlatformCALayerMac::sublayerTransform):
+        (PlatformCALayerMac::setSublayerTransform):
+        (PlatformCALayerMac::setHidden):
+        (PlatformCALayerMac::setGeometryFlipped):
+        (PlatformCALayerMac::isDoubleSided):
+        (PlatformCALayerMac::setDoubleSided):
+        (PlatformCALayerMac::masksToBounds):
+        (PlatformCALayerMac::setMasksToBounds):
+        (PlatformCALayerMac::acceleratesDrawing):
+        (PlatformCALayerMac::setAcceleratesDrawing):
+        (PlatformCALayerMac::contents):
+        (PlatformCALayerMac::setContents):
+        (PlatformCALayerMac::setContentsRect):
+        (PlatformCALayerMac::setMinificationFilter):
+        (PlatformCALayerMac::setMagnificationFilter):
+        (PlatformCALayerMac::backgroundColor):
+        (PlatformCALayerMac::setBackgroundColor):
+        (PlatformCALayerMac::setBorderWidth):
+        (PlatformCALayerMac::setBorderColor):
+        (PlatformCALayerMac::opacity):
+        (PlatformCALayerMac::setOpacity):
+        (PlatformCALayerMac::copyFiltersFrom):
+        (PlatformCALayerMac::setName):
+        (PlatformCALayerMac::setSpeed):
+        (PlatformCALayerMac::setTimeOffset):
+        (PlatformCALayerMac::contentsScale):
+        (PlatformCALayerMac::setContentsScale):
+        (PlatformCALayerMac::cornerRadius):
+        (PlatformCALayerMac::setCornerRadius):
+        (PlatformCALayerMac::setEdgeAntialiasingMask):
+        (PlatformCALayerMac::shapeWindRule): New function.
+        (PlatformCALayerMac::setShapeWindRule): Ditto.
+        (PlatformCALayerMac::shapePath): Ditto.
+        (PlatformCALayerMac::setShapePath): Ditto.
+        (PlatformCALayer::isWebLayer):
+        * platform/graphics/cg/PathCG.cpp:
+        (WebCore::Path::Path): nullptr.
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::paintsWithClipPath): Return true if the clip path is painted.
+        (WebCore::RenderLayer::computeClipPath): Factor code that computes the clip path into this
+        function, so we can call it from RenderLayerBacking too.
+        (WebCore::RenderLayer::setupClipPath):
+        (WebCore::RenderLayer::paintLayerContents): We only want to apply the clip path
+        for painting when we're either painting a non-composited layer, or we're painting the
+        mask layer of a composited layer. We in the latter case, we just want to fill the clip
+        path with black, so re-use the paintChildClippingMaskForFragments() which does this.
+        * rendering/RenderLayer.h: Align the bits, add PaintLayerPaintingCompositingClipPathPhase.
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::~RenderLayerBacking):
+        (WebCore::RenderLayerBacking::updateConfiguration):
+        (WebCore::RenderLayerBacking::updateGeometry): Move mask updating into its own function.
+        (WebCore::RenderLayerBacking::updateMaskingLayerGeometry): If we're using the shape layer
+        code path, compute the Path and set it and the wind rule on the mask layer.
+        (WebCore::RenderLayerBacking::updateMaskingLayer): This is now more complex, as it has
+        to deal with combinations of clip-path and mask, some of which allow for the shape layer
+        mask, and we handle dynamic changes between these and painted masks.
+        (WebCore::RenderLayerBacking::paintingPhaseForPrimaryLayer): Include the GraphicsLayerPaintClipPath phase.
+        (WebCore::RenderLayerBacking::paintIntoLayer): Map GraphicsLayerPaintClipPath to PaintLayerPaintingCompositingClipPathPhase.
+        (WebCore::RenderLayerBacking::updateMaskLayer): Deleted.
+        * rendering/RenderLayerBacking.h:
+
 2015-03-01  Hunseop Jeong  <hs85.je...@samsung.com>
 
         [Cairo] Implement Path::addEllipse 

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (180881 => 180882)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2015-03-02 06:35:20 UTC (rev 180882)
@@ -71,7 +71,40 @@
     m_values.append(WTF::move(value));
 }
 
-GraphicsLayer::GraphicsLayer(Type, GraphicsLayerClient& client)
+#if !USE(CA)
+bool GraphicsLayer::supportsLayerType(Type type)
+{
+    switch (type) {
+    case Type::Normal:
+    case Type::PageTiledBacking:
+    case Type::Scrolling:
+        return true;
+    case Type::Shape:
+        return false;
+    }
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
+bool GraphicsLayer::supportsBackgroundColorContent()
+{
+#if USE(TEXTURE_MAPPER)
+    return true;
+#else
+    return false;
+#endif
+}
+#endif
+
+#if !USE(COORDINATED_GRAPHICS)
+bool GraphicsLayer::supportsContentsTiling()
+{
+    // FIXME: Enable the feature on different ports.
+    return false;
+}
+#endif
+
+GraphicsLayer::GraphicsLayer(Type type, GraphicsLayerClient& client)
     : m_client(client)
     , m_anchorPoint(0.5f, 0.5f, 0)
     , m_opacity(1)
@@ -79,6 +112,7 @@
 #if ENABLE(CSS_COMPOSITING)
     , m_blendMode(BlendModeNormal)
 #endif
+    , m_type(type)
     , m_contentsOpaque(false)
     , m_preserves3D(false)
     , m_backfaceVisibility(true)
@@ -274,6 +308,42 @@
     m_maskLayer = layer;
 }
 
+Path GraphicsLayer::shapeLayerPath() const
+{
+#if USE(CA)
+    return m_shapeLayerPath;
+#else
+    return Path();
+#endif
+}
+
+void GraphicsLayer::setShapeLayerPath(const Path& path)
+{
+#if USE(CA)
+    m_shapeLayerPath = path;
+#else
+    UNUSED_PARAM(path);
+#endif
+}
+
+WindRule GraphicsLayer::shapeLayerWindRule() const
+{
+#if USE(CA)
+    return m_shapeLayerWindRule;
+#else
+    return RULE_NONZERO;
+#endif
+}
+
+void GraphicsLayer::setShapeLayerWindRule(WindRule windRule)
+{
+#if USE(CA)
+    m_shapeLayerWindRule = windRule;
+#else
+    UNUSED_PARAM(windRule);
+#endif
+}
+
 void GraphicsLayer::noteDeviceOrPageScaleFactorChangedIncludingDescendants()
 {
     deviceOrPageScaleFactorChanged();

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (180881 => 180882)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2015-03-02 06:35:20 UTC (rev 180882)
@@ -35,8 +35,10 @@
 #include "FloatSize.h"
 #include "GraphicsLayerClient.h"
 #include "IntRect.h"
+#include "Path.h"
 #include "PlatformLayer.h"
 #include "TransformOperations.h"
+#include "WindRule.h"
 #include <wtf/TypeCasts.h>
 
 #if ENABLE(CSS_COMPOSITING)
@@ -198,12 +200,15 @@
     enum class Type {
         Normal,
         PageTiledBacking,
-        Scrolling
+        Scrolling,
+        Shape
     };
     
     WEBCORE_EXPORT static std::unique_ptr<GraphicsLayer> create(GraphicsLayerFactory*, GraphicsLayerClient&, Type = Type::Normal);
     
     WEBCORE_EXPORT virtual ~GraphicsLayer();
+    
+    Type type() const { return m_type; }
 
     virtual void initialize(Type) { }
 
@@ -381,6 +386,12 @@
     FloatRoundedRect maskToBoundsRect() const { return m_masksToBoundsRect; };
     virtual bool setMasksToBoundsRect(const FloatRoundedRect& roundedRect) { m_masksToBoundsRect = roundedRect; return false; }
 
+    Path shapeLayerPath() const;
+    virtual void setShapeLayerPath(const Path&);
+
+    WindRule shapeLayerWindRule() const;
+    virtual void setShapeLayerWindRule(WindRule);
+
     // Transitions are identified by a special animation name that cannot clash with a keyframe identifier.
     static String animationNameForTransition(AnimatedPropertyID);
     
@@ -480,24 +491,9 @@
     void resetTrackedRepaints();
     void addRepaintRect(const FloatRect&);
 
-    static bool supportsBackgroundColorContent()
-    {
-#if USE(CA) || USE(TEXTURE_MAPPER)
-        return true;
-#else
-        return false;
-#endif
-    }
-
-#if USE(COORDINATED_GRAPHICS)
+    static bool supportsBackgroundColorContent();
+    static bool supportsLayerType(Type);
     static bool supportsContentsTiling();
-#else
-    static bool supportsContentsTiling()
-    {
-        // FIXME: Enable the feature on different ports.
-        return false;
-    }
-#endif
 
     void updateDebugIndicators();
 
@@ -507,8 +503,6 @@
     virtual bool isGraphicsLayerCARemote() const { return false; }
     virtual bool isGraphicsLayerTextureMapper() const { return false; }
 
-    virtual bool needsClippingMaskLayer() { return true; };
-
 protected:
     WEBCORE_EXPORT explicit GraphicsLayer(Type, GraphicsLayerClient&);
 
@@ -570,6 +564,8 @@
     BlendMode m_blendMode;
 #endif
 
+    const Type m_type;
+
     bool m_contentsOpaque : 1;
     bool m_preserves3D: 1;
     bool m_backfaceVisibility : 1;
@@ -604,6 +600,11 @@
 
     int m_repaintCount;
     CustomAppearance m_customAppearance;
+
+#if USE(CA)
+    Path m_shapeLayerPath;
+    WindRule m_shapeLayerWindRule { RULE_NONZERO };
+#endif
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h (180881 => 180882)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h	2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h	2015-03-02 06:35:20 UTC (rev 180882)
@@ -39,13 +39,14 @@
 class TransformationMatrix;
 
 enum GraphicsLayerPaintingPhaseFlags {
-    GraphicsLayerPaintBackground = (1 << 0),
-    GraphicsLayerPaintForeground = (1 << 1),
-    GraphicsLayerPaintMask = (1 << 2),
-    GraphicsLayerPaintOverflowContents = (1 << 3),
-    GraphicsLayerPaintCompositedScroll = (1 << 4),
-    GraphicsLayerPaintChildClippingMask = (1 << 5),
-    GraphicsLayerPaintAllWithOverflowClip = (GraphicsLayerPaintBackground | GraphicsLayerPaintForeground | GraphicsLayerPaintMask)
+    GraphicsLayerPaintBackground            = 1 << 0,
+    GraphicsLayerPaintForeground            = 1 << 1,
+    GraphicsLayerPaintMask                  = 1 << 2,
+    GraphicsLayerPaintClipPath              = 1 << 3,
+    GraphicsLayerPaintOverflowContents      = 1 << 4,
+    GraphicsLayerPaintCompositedScroll      = 1 << 5,
+    GraphicsLayerPaintChildClippingMask     = 1 << 6,
+    GraphicsLayerPaintAllWithOverflowClip   = GraphicsLayerPaintBackground | GraphicsLayerPaintForeground
 };
 typedef unsigned GraphicsLayerPaintingPhase;
 
@@ -58,14 +59,14 @@
 };
 
 enum LayerTreeAsTextBehaviorFlags {
-    LayerTreeAsTextBehaviorNormal = 0,
-    LayerTreeAsTextDebug = 1 << 0, // Dump extra debugging info like layer addresses.
-    LayerTreeAsTextIncludeVisibleRects = 1 << 1,
-    LayerTreeAsTextIncludeTileCaches = 1 << 2,
-    LayerTreeAsTextIncludeRepaintRects = 1 << 3,
-    LayerTreeAsTextIncludePaintingPhases = 1 << 4,
-    LayerTreeAsTextIncludeContentLayers = 1 << 5,
-    LayerTreeAsTextIncludePageOverlayLayers = 1 << 6,
+    LayerTreeAsTextBehaviorNormal               = 0,
+    LayerTreeAsTextDebug                        = 1 << 0, // Dump extra debugging info like layer addresses.
+    LayerTreeAsTextIncludeVisibleRects          = 1 << 1,
+    LayerTreeAsTextIncludeTileCaches            = 1 << 2,
+    LayerTreeAsTextIncludeRepaintRects          = 1 << 3,
+    LayerTreeAsTextIncludePaintingPhases        = 1 << 4,
+    LayerTreeAsTextIncludeContentLayers         = 1 << 5,
+    LayerTreeAsTextIncludePageOverlayLayers     = 1 << 6,
 };
 typedef unsigned LayerTreeAsTextBehavior;
 

Modified: trunk/Source/WebCore/platform/graphics/Path.h (180881 => 180882)


--- trunk/Source/WebCore/platform/graphics/Path.h	2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/Source/WebCore/platform/graphics/Path.h	2015-03-02 06:35:20 UTC (rev 180882)
@@ -90,8 +90,8 @@
 #endif
         WEBCORE_EXPORT ~Path();
 
-        Path(const Path&);
-        Path& operator=(const Path&);
+        WEBCORE_EXPORT Path(const Path&);
+        WEBCORE_EXPORT Path& operator=(const Path&);
 
         bool contains(const FloatPoint&, WindRule rule = RULE_NONZERO) const;
         bool strokeContains(StrokeStyleApplier*, const FloatPoint&) const;
@@ -105,7 +105,7 @@
         FloatPoint pointAtLength(float length, bool& ok) const;
         float normalAngleAtLength(float length, bool& ok) const;
 
-        void clear();
+        WEBCORE_EXPORT void clear();
         bool isNull() const { return !m_path; }
         bool isEmpty() const;
         // Gets the current point of the current path, which is conceptually the final point reached by the path so far.
@@ -113,12 +113,12 @@
         bool hasCurrentPoint() const;
         FloatPoint currentPoint() const;
 
-        void moveTo(const FloatPoint&);
-        void addLineTo(const FloatPoint&);
-        void addQuadCurveTo(const FloatPoint& controlPoint, const FloatPoint& endPoint);
-        void addBezierCurveTo(const FloatPoint& controlPoint1, const FloatPoint& controlPoint2, const FloatPoint& endPoint);
+        WEBCORE_EXPORT void moveTo(const FloatPoint&);
+        WEBCORE_EXPORT void addLineTo(const FloatPoint&);
+        WEBCORE_EXPORT void addQuadCurveTo(const FloatPoint& controlPoint, const FloatPoint& endPoint);
+        WEBCORE_EXPORT void addBezierCurveTo(const FloatPoint& controlPoint1, const FloatPoint& controlPoint2, const FloatPoint& endPoint);
         void addArcTo(const FloatPoint&, const FloatPoint&, float radius);
-        void closeSubpath();
+        WEBCORE_EXPORT void closeSubpath();
 
         void addArc(const FloatPoint&, float radius, float startAngle, float endAngle, bool anticlockwise);
         void addRect(const FloatRect&);
@@ -144,7 +144,7 @@
         // ensurePlatformPath() will allocate a PlatformPath if it has not yet been and will never return null.
         PlatformPathPtr ensurePlatformPath();
 
-        void apply(void* info, PathApplierFunction) const;
+        WEBCORE_EXPORT void apply(void* info, PathApplierFunction) const;
         void transform(const AffineTransform&);
 
         void addBeziersForRoundedRect(const FloatRect&, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius);

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (180881 => 180882)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2015-03-02 06:35:20 UTC (rev 180882)
@@ -276,6 +276,30 @@
 #endif
 }
 
+bool GraphicsLayer::supportsLayerType(Type type)
+{
+    switch (type) {
+    case Type::Normal:
+    case Type::PageTiledBacking:
+    case Type::Scrolling:
+        return true;
+    case Type::Shape:
+#if PLATFORM(COCOA)
+        // FIXME: we can use shaper layers on Windows when PlatformCALayerMac::setShapePath() etc are implemented.
+        return true;
+#else
+        return false;
+#endif
+    }
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
+bool GraphicsLayer::supportsBackgroundColorContent()
+{
+    return true;
+}
+
 std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient& client, Type layerType)
 {
     std::unique_ptr<GraphicsLayer> graphicsLayer;
@@ -351,6 +375,9 @@
     case Type::Scrolling:
         platformLayerType = PlatformCALayer::LayerType::LayerTypeScrollingLayer;
         break;
+    case Type::Shape:
+        platformLayerType = PlatformCALayer::LayerType::LayerTypeShapeLayer;
+        break;
     }
     m_layer = createPlatformCALayer(platformLayerType, this);
     noteLayerPropertyChanged(ContentsScaleChanged);
@@ -807,6 +834,22 @@
     return true;
 }
 
+void GraphicsLayerCA::setShapeLayerPath(const Path& path)
+{
+    // FIXME: need to check for path equality. No bool Path::operator==(const Path&)!.
+    GraphicsLayer::setShapeLayerPath(path);
+    noteLayerPropertyChanged(ShapeChanged);
+}
+
+void GraphicsLayerCA::setShapeLayerWindRule(WindRule windRule)
+{
+    if (windRule == m_shapeLayerWindRule)
+        return;
+
+    GraphicsLayer::setShapeLayerWindRule(windRule);
+    noteLayerPropertyChanged(WindRuleChanged);
+}
+
 bool GraphicsLayerCA::shouldRepaintOnSizeChange() const
 {
     return drawsContent() && !tiledBacking();
@@ -1371,6 +1414,12 @@
         updateBlendMode();
 #endif
 
+    if (m_uncommittedChanges & ShapeChanged)
+        updateShape();
+
+    if (m_uncommittedChanges & WindRuleChanged)
+        updateWindRule();
+
     if (m_uncommittedChanges & AnimationChanged)
         updateAnimations();
 
@@ -1730,6 +1779,16 @@
 }
 #endif
 
+void GraphicsLayerCA::updateShape()
+{
+    m_layer->setShapePath(m_shapeLayerPath);
+}
+
+void GraphicsLayerCA::updateWindRule()
+{
+    m_layer->setShapeWindRule(m_shapeLayerWindRule);
+}
+
 void GraphicsLayerCA::updateStructuralLayer()
 {
     ensureStructuralLayer(structuralLayerPurpose());

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (180881 => 180882)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2015-03-02 06:35:20 UTC (rev 180882)
@@ -120,6 +120,9 @@
     WEBCORE_EXPORT virtual void setContentsClippingRect(const FloatRoundedRect&) override;
     WEBCORE_EXPORT virtual bool setMasksToBoundsRect(const FloatRoundedRect&) override;
 
+    WEBCORE_EXPORT virtual void setShapeLayerPath(const Path&);
+    WEBCORE_EXPORT virtual void setShapeLayerWindRule(WindRule);
+
     WEBCORE_EXPORT virtual void suspendAnimations(double time) override;
     WEBCORE_EXPORT virtual void resumeAnimations() override;
 
@@ -203,14 +206,7 @@
     WEBCORE_EXPORT virtual bool shouldRepaintOnSizeChange() const override;
 
     WEBCORE_EXPORT void layerDidDisplay(PlatformCALayer*);
-    void updateOpacityOnLayer();
-    void updateFilters();
-    void updateBackdropFilters();
 
-#if ENABLE(CSS_COMPOSITING)
-    void updateBlendMode();
-#endif
-
     virtual PassRefPtr<PlatformCALayer> createPlatformCALayer(PlatformCALayer::LayerType, PlatformCALayerClient* owner);
     virtual PassRefPtr<PlatformCALayer> createPlatformCALayer(PlatformLayer*, PlatformCALayerClient* owner);
     virtual PassRefPtr<PlatformCAAnimation> createPlatformCAAnimation(PlatformCAAnimation::AnimationType, const String& keyPath);
@@ -384,6 +380,17 @@
     void updateContentsScale(float pageScaleFactor);
     void updateCustomAppearance();
 
+    void updateOpacityOnLayer();
+    void updateFilters();
+    void updateBackdropFilters();
+
+#if ENABLE(CSS_COMPOSITING)
+    void updateBlendMode();
+#endif
+
+    void updateShape();
+    void updateWindRule();
+
     enum StructuralLayerPurpose {
         NoStructuralLayer = 0,
         StructuralLayerForPreserves3D,
@@ -448,6 +455,8 @@
         DebugIndicatorsChanged =        1LLU << 31,
         CustomAppearanceChanged =       1LLU << 32,
         BlendModeChanged =              1LLU << 33,
+        ShapeChanged =                  1LLU << 34,
+        WindRuleChanged =               1LLU << 35,
     };
     typedef uint64_t LayerChangeFlags;
     enum ScheduleFlushOrNot { ScheduleFlush, DontScheduleFlush };

Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h (180881 => 180882)


--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h	2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h	2015-03-02 06:35:20 UTC (rev 180882)
@@ -210,6 +210,13 @@
     // Only used by LayerTypeShapeLayer.
     virtual FloatRoundedRect shapeRoundedRect() const = 0;
     virtual void setShapeRoundedRect(const FloatRoundedRect&) = 0;
+
+    // Only used by LayerTypeShapeLayer.
+    virtual Path shapePath() const = 0;
+    virtual void setShapePath(const Path&) = 0;
+
+    virtual WindRule shapeWindRule() const = 0;
+    virtual void setShapeWindRule(WindRule) = 0;
     
     virtual GraphicsLayer::CustomAppearance customAppearance() const = 0;
     virtual void updateCustomAppearance(GraphicsLayer::CustomAppearance) = 0;

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h (180881 => 180882)


--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h	2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h	2015-03-02 06:35:20 UTC (rev 180882)
@@ -142,6 +142,12 @@
     virtual FloatRoundedRect shapeRoundedRect() const override;
     virtual void setShapeRoundedRect(const FloatRoundedRect&) override;
 
+    virtual Path shapePath() const override;
+    virtual void setShapePath(const Path&) override;
+
+    virtual WindRule shapeWindRule() const override;
+    virtual void setShapeWindRule(WindRule) override;
+
     virtual GraphicsLayer::CustomAppearance customAppearance() const override { return m_customAppearance; }
     virtual void updateCustomAppearance(GraphicsLayer::CustomAppearance) override;
 

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm (180881 => 180882)


--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm	2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm	2015-03-02 06:35:20 UTC (rev 180882)
@@ -349,7 +349,7 @@
 
 PlatformCALayerMac::~PlatformCALayerMac()
 {
-    [m_layer.get() setValue:nil forKey:platformCALayerPointer];
+    [m_layer setValue:nil forKey:platformCALayerPointer];
     
     // Remove the owner pointer from the delegate in case there is a pending animationStarted event.
     [static_cast<WebAnimationDelegate*>(m_delegate.get()) setOwner:nil];
@@ -373,14 +373,14 @@
 void PlatformCALayerMac::setNeedsDisplay()
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setNeedsDisplay];
+    [m_layer setNeedsDisplay];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
 void PlatformCALayerMac::setNeedsDisplayInRect(const FloatRect& dirtyRect)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setNeedsDisplayInRect:dirtyRect];
+    [m_layer setNeedsDisplayInRect:dirtyRect];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
@@ -403,7 +403,7 @@
 void PlatformCALayerMac::removeFromSuperlayer()
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() removeFromSuperlayer];
+    [m_layer removeFromSuperlayer];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
@@ -420,7 +420,7 @@
     for (size_t i = 0; i < list.size(); ++i)
         [sublayers addObject:list[i]->m_layer.get()];
 
-    [m_layer.get() setSublayers:sublayers];
+    [m_layer setSublayers:sublayers];
     [sublayers release];
     END_BLOCK_OBJC_EXCEPTIONS
 }
@@ -428,7 +428,7 @@
 void PlatformCALayerMac::removeAllSublayers()
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setSublayers:nil];
+    [m_layer setSublayers:nil];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
@@ -436,7 +436,7 @@
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
     ASSERT(m_layer != layer.m_layer);
-    [m_layer.get() addSublayer:layer.m_layer.get()];
+    [m_layer addSublayer:layer.m_layer.get()];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
@@ -444,7 +444,7 @@
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
     ASSERT(m_layer != layer.m_layer);
-    [m_layer.get() insertSublayer:layer.m_layer.get() atIndex:index];
+    [m_layer insertSublayer:layer.m_layer.get() atIndex:index];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
@@ -452,14 +452,14 @@
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
     ASSERT(m_layer != layer.m_layer);
-    [m_layer.get() replaceSublayer:reference.m_layer.get() with:layer.m_layer.get()];
+    [m_layer replaceSublayer:reference.m_layer.get() with:layer.m_layer.get()];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
 void PlatformCALayerMac::adoptSublayers(PlatformCALayer& source)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setSublayers:[source.m_layer.get() sublayers]];
+    [m_layer setSublayers:[source.m_layer.get() sublayers]];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
@@ -477,20 +477,20 @@
         [propertyAnimation setDelegate:static_cast<id>(m_delegate.get())];
      
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() addAnimation:propertyAnimation forKey:key];
+    [m_layer addAnimation:propertyAnimation forKey:key];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
 void PlatformCALayerMac::removeAnimationForKey(const String& key)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() removeAnimationForKey:key];
+    [m_layer removeAnimationForKey:key];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
 PassRefPtr<PlatformCAAnimation> PlatformCALayerMac::animationForKey(const String& key)
 {
-    CAPropertyAnimation* propertyAnimation = static_cast<CAPropertyAnimation*>([m_layer.get() animationForKey:key]);
+    CAPropertyAnimation* propertyAnimation = static_cast<CAPropertyAnimation*>([m_layer animationForKey:key]);
     if (!propertyAnimation)
         return 0;
     return PlatformCAAnimationMac::create(propertyAnimation);
@@ -499,31 +499,31 @@
 void PlatformCALayerMac::setMask(PlatformCALayer* layer)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setMask:layer ? layer->platformLayer() : nil];
+    [m_layer setMask:layer ? layer->platformLayer() : nil];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
 bool PlatformCALayerMac::isOpaque() const
 {
-    return [m_layer.get() isOpaque];
+    return [m_layer isOpaque];
 }
 
 void PlatformCALayerMac::setOpaque(bool value)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setOpaque:value];
+    [m_layer setOpaque:value];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
 FloatRect PlatformCALayerMac::bounds() const
 {
-    return [m_layer.get() bounds];
+    return [m_layer bounds];
 }
 
 void PlatformCALayerMac::setBounds(const FloatRect& value)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setBounds:value];
+    [m_layer setBounds:value];
     
     if (requiresCustomAppearanceUpdateOnBoundsChange())
         updateCustomAppearance(m_customAppearance);
@@ -533,144 +533,144 @@
 
 FloatPoint3D PlatformCALayerMac::position() const
 {
-    CGPoint point = [m_layer.get() position];
-    return FloatPoint3D(point.x, point.y, [m_layer.get() zPosition]);
+    CGPoint point = [m_layer position];
+    return FloatPoint3D(point.x, point.y, [m_layer zPosition]);
 }
 
 void PlatformCALayerMac::setPosition(const FloatPoint3D& value)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setPosition:CGPointMake(value.x(), value.y())];
-    [m_layer.get() setZPosition:value.z()];
+    [m_layer setPosition:CGPointMake(value.x(), value.y())];
+    [m_layer setZPosition:value.z()];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
 FloatPoint3D PlatformCALayerMac::anchorPoint() const
 {
-    CGPoint point = [m_layer.get() anchorPoint];
+    CGPoint point = [m_layer anchorPoint];
     float z = 0;
-    z = [m_layer.get() anchorPointZ];
+    z = [m_layer anchorPointZ];
     return FloatPoint3D(point.x, point.y, z);
 }
 
 void PlatformCALayerMac::setAnchorPoint(const FloatPoint3D& value)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setAnchorPoint:CGPointMake(value.x(), value.y())];
-    [m_layer.get() setAnchorPointZ:value.z()];
+    [m_layer setAnchorPoint:CGPointMake(value.x(), value.y())];
+    [m_layer setAnchorPointZ:value.z()];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
 TransformationMatrix PlatformCALayerMac::transform() const
 {
-    return [m_layer.get() transform];
+    return [m_layer transform];
 }
 
 void PlatformCALayerMac::setTransform(const TransformationMatrix& value)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setTransform:value];
+    [m_layer setTransform:value];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
 TransformationMatrix PlatformCALayerMac::sublayerTransform() const
 {
-    return [m_layer.get() sublayerTransform];
+    return [m_layer sublayerTransform];
 }
 
 void PlatformCALayerMac::setSublayerTransform(const TransformationMatrix& value)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setSublayerTransform:value];
+    [m_layer setSublayerTransform:value];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
 void PlatformCALayerMac::setHidden(bool value)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setHidden:value];
+    [m_layer setHidden:value];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
 void PlatformCALayerMac::setGeometryFlipped(bool value)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setGeometryFlipped:value];
+    [m_layer setGeometryFlipped:value];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
 bool PlatformCALayerMac::isDoubleSided() const
 {
-    return [m_layer.get() isDoubleSided];
+    return [m_layer isDoubleSided];
 }
 
 void PlatformCALayerMac::setDoubleSided(bool value)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setDoubleSided:value];
+    [m_layer setDoubleSided:value];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
 bool PlatformCALayerMac::masksToBounds() const
 {
-    return [m_layer.get() masksToBounds];
+    return [m_layer masksToBounds];
 }
 
 void PlatformCALayerMac::setMasksToBounds(bool value)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setMasksToBounds:value];
+    [m_layer setMasksToBounds:value];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
 bool PlatformCALayerMac::acceleratesDrawing() const
 {
-    return [m_layer.get() acceleratesDrawing];
+    return [m_layer acceleratesDrawing];
 }
 
 void PlatformCALayerMac::setAcceleratesDrawing(bool acceleratesDrawing)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setAcceleratesDrawing:acceleratesDrawing];
+    [m_layer setAcceleratesDrawing:acceleratesDrawing];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
 CFTypeRef PlatformCALayerMac::contents() const
 {
-    return [m_layer.get() contents];
+    return [m_layer contents];
 }
 
 void PlatformCALayerMac::setContents(CFTypeRef value)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setContents:static_cast<id>(const_cast<void*>(value))];
+    [m_layer setContents:static_cast<id>(const_cast<void*>(value))];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
 void PlatformCALayerMac::setContentsRect(const FloatRect& value)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setContentsRect:value];
+    [m_layer setContentsRect:value];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
 void PlatformCALayerMac::setMinificationFilter(FilterType value)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setMinificationFilter:toCAFilterType(value)];
+    [m_layer setMinificationFilter:toCAFilterType(value)];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
 void PlatformCALayerMac::setMagnificationFilter(FilterType value)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setMagnificationFilter:toCAFilterType(value)];
+    [m_layer setMagnificationFilter:toCAFilterType(value)];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
 Color PlatformCALayerMac::backgroundColor() const
 {
-    return [m_layer.get() backgroundColor];
+    return [m_layer backgroundColor];
 }
 
 void PlatformCALayerMac::setBackgroundColor(const Color& value)
@@ -682,14 +682,14 @@
     RetainPtr<CGColorRef> color = adoptCF(CGColorCreate(colorSpace.get(), components));
 
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setBackgroundColor:color.get()];
+    [m_layer setBackgroundColor:color.get()];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
 void PlatformCALayerMac::setBorderWidth(float value)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setBorderWidth:value];
+    [m_layer setBorderWidth:value];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
@@ -703,24 +703,24 @@
         RetainPtr<CGColorRef> color = adoptCF(CGColorCreate(colorSpace.get(), components));
 
         BEGIN_BLOCK_OBJC_EXCEPTIONS
-        [m_layer.get() setBorderColor:color.get()];
+        [m_layer setBorderColor:color.get()];
         END_BLOCK_OBJC_EXCEPTIONS
     } else {
         BEGIN_BLOCK_OBJC_EXCEPTIONS
-        [m_layer.get() setBorderColor:nil];
+        [m_layer setBorderColor:nil];
         END_BLOCK_OBJC_EXCEPTIONS
     }
 }
 
 float PlatformCALayerMac::opacity() const
 {
-    return [m_layer.get() opacity];
+    return [m_layer opacity];
 }
 
 void PlatformCALayerMac::setOpacity(float value)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setOpacity:value];
+    [m_layer setOpacity:value];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
@@ -732,7 +732,7 @@
 void PlatformCALayerMac::copyFiltersFrom(const PlatformCALayer& sourceLayer)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setFilters:[sourceLayer.platformLayer() filters]];
+    [m_layer setFilters:[sourceLayer.platformLayer() filters]];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
@@ -770,41 +770,41 @@
 void PlatformCALayerMac::setName(const String& value)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setName:value];
+    [m_layer setName:value];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
 void PlatformCALayerMac::setSpeed(float value)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setSpeed:value];
+    [m_layer setSpeed:value];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
 void PlatformCALayerMac::setTimeOffset(CFTimeInterval value)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setTimeOffset:value];
+    [m_layer setTimeOffset:value];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
 float PlatformCALayerMac::contentsScale() const
 {
-    return [m_layer.get() contentsScale];
+    return [m_layer contentsScale];
 }
 
 void PlatformCALayerMac::setContentsScale(float value)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setContentsScale:value];
+    [m_layer setContentsScale:value];
 #if PLATFORM(IOS)
-    [m_layer.get() setRasterizationScale:value];
+    [m_layer setRasterizationScale:value];
 
     if (m_layerType == LayerTypeWebTiledLayer) {
         // This will invalidate all the tiles so we won't end up with stale tiles with the wrong scale in the wrong place,
         // see <rdar://problem/9434765> for more information.
         static NSDictionary *optionsDictionary = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithBool:YES], kCATiledLayerRemoveImmediately, nil];
-        [(CATiledLayer *)m_layer.get() setNeedsDisplayInRect:[m_layer.get() bounds] levelOfDetail:0 options:optionsDictionary];
+        [(CATiledLayer *)m_layer.get() setNeedsDisplayInRect:[m_layer bounds] levelOfDetail:0 options:optionsDictionary];
     }
 #endif
     END_BLOCK_OBJC_EXCEPTIONS
@@ -812,20 +812,20 @@
 
 float PlatformCALayerMac::cornerRadius() const
 {
-    return [m_layer.get() cornerRadius];
+    return [m_layer cornerRadius];
 }
 
 void PlatformCALayerMac::setCornerRadius(float value)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setCornerRadius:value];
+    [m_layer setCornerRadius:value];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
 void PlatformCALayerMac::setEdgeAntialiasingMask(unsigned mask)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setEdgeAntialiasingMask:mask];
+    [m_layer setEdgeAntialiasingMask:mask];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
@@ -850,6 +850,49 @@
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
+WindRule PlatformCALayerMac::shapeWindRule() const
+{
+    ASSERT(m_layerType == LayerTypeShapeLayer);
+
+    NSString *fillRule = [(CAShapeLayer *)m_layer fillRule];
+    if ([fillRule isEqualToString:@"even-odd"])
+        return RULE_EVENODD;
+
+    return RULE_NONZERO;
+}
+
+void PlatformCALayerMac::setShapeWindRule(WindRule windRule)
+{
+    ASSERT(m_layerType == LayerTypeShapeLayer);
+
+    switch (windRule) {
+    case RULE_NONZERO:
+        [(CAShapeLayer *)m_layer setFillRule:@"non-zero"];
+        break;
+    case RULE_EVENODD:
+        [(CAShapeLayer *)m_layer setFillRule:@"even-odd"];
+        break;
+    }
+}
+
+Path PlatformCALayerMac::shapePath() const
+{
+    ASSERT(m_layerType == LayerTypeShapeLayer);
+
+    BEGIN_BLOCK_OBJC_EXCEPTIONS
+    return Path(CGPathCreateMutableCopy([(CAShapeLayer *)m_layer path]));
+    END_BLOCK_OBJC_EXCEPTIONS
+}
+
+void PlatformCALayerMac::setShapePath(const Path& path)
+{
+    ASSERT(m_layerType == LayerTypeShapeLayer);
+
+    BEGIN_BLOCK_OBJC_EXCEPTIONS
+    [(CAShapeLayer *)m_layer setPath:path.platformPath()];
+    END_BLOCK_OBJC_EXCEPTIONS
+}
+
 bool PlatformCALayerMac::requiresCustomAppearanceUpdateOnBoundsChange() const
 {
     return m_customAppearance == GraphicsLayer::ScrollingShadow;
@@ -892,7 +935,7 @@
 {
     BOOL result = NO;
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    result = [m_layer.get() isKindOfClass:[WebLayer self]];
+    result = [m_layer isKindOfClass:[WebLayer self]];
     END_BLOCK_OBJC_EXCEPTIONS
     return result;
 }

Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp (180881 => 180882)


--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp	2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp	2015-03-02 06:35:20 UTC (rev 180882)
@@ -601,6 +601,28 @@
     // FIXME: implement.
 }
 
+WindRule PlatformCALayerWin::shapeWindRule() const
+{
+    // FIXME: implement.
+    return RULE_NONZERO;
+}
+
+void PlatformCALayerWin::setShapeWindRule(WindRule)
+{
+    // FIXME: implement.
+}
+
+Path PlatformCALayerWin::shapePath() const
+{
+    // FIXME: implement.
+    return Path();
+}
+
+void PlatformCALayerWin::setShapePath(const Path&)
+{
+    // FIXME: implement.
+}
+
 #ifndef NDEBUG
 static void printIndent(int indent)
 {

Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h (180881 => 180882)


--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h	2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h	2015-03-02 06:35:20 UTC (rev 180882)
@@ -128,6 +128,12 @@
     virtual FloatRoundedRect shapeRoundedRect() const override;
     virtual void setShapeRoundedRect(const FloatRoundedRect&) override;
 
+    virtual Path shapePath() const override;
+    virtual void setShapePath(const Path&) override;
+
+    virtual WindRule shapeWindRule() const override;
+    virtual void setShapeWindRule(WindRule) override;
+
     virtual void setEdgeAntialiasingMask(unsigned) override;
 
     virtual GraphicsLayer::CustomAppearance customAppearance() const override { return m_customAppearance; }

Modified: trunk/Source/WebCore/platform/graphics/cg/PathCG.cpp (180881 => 180882)


--- trunk/Source/WebCore/platform/graphics/cg/PathCG.cpp	2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/Source/WebCore/platform/graphics/cg/PathCG.cpp	2015-03-02 06:35:20 UTC (rev 180882)
@@ -74,7 +74,7 @@
 }
 
 Path::Path()
-    : m_path(0)
+    : m_path(nullptr)
 {
 }
 

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (180881 => 180882)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2015-03-02 06:35:20 UTC (rev 180882)
@@ -4023,35 +4023,54 @@
     return referenceBox;
 }
 
-bool RenderLayer::setupClipPath(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, const LayoutSize& offsetFromRoot, LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed)
+bool RenderLayer::paintsWithClipPath() const
 {
-    if (!renderer().hasClipPath() || context->paintingDisabled())
-        return false;
+    return renderer().style().clipPath() && !isComposited();
+}
 
-    if (!rootRelativeBoundsComputed) {
-        rootRelativeBounds = calculateLayerBounds(paintingInfo.rootLayer, offsetFromRoot, 0);
-        rootRelativeBoundsComputed = true;
-    }
+Path RenderLayer::computeClipPath(const LayoutSize& offsetFromRoot, LayoutRect& rootRelativeBounds, WindRule& windRule) const
+{
+    const RenderStyle& style = renderer().style();
 
-    RenderStyle& style = renderer().style();
-    ASSERT(style.clipPath());
     if (is<ShapeClipPathOperation>(*style.clipPath())) {
         auto& clipPath = downcast<ShapeClipPathOperation>(*style.clipPath());
+        LayoutRect referenceBox = computeReferenceBox(renderer(), clipPath, offsetFromRoot, rootRelativeBounds);
 
-        LayoutRect referenceBox = computeReferenceBox(renderer(), clipPath, offsetFromRoot, rootRelativeBounds);
-        context->save();
-        context->clipPath(clipPath.pathForReferenceRect(referenceBox), clipPath.windRule());
-        return true;
+        windRule = clipPath.windRule();
+        return clipPath.pathForReferenceRect(referenceBox);
     }
+    
+    if (is<BoxClipPathOperation>(*style.clipPath()) && is<RenderBox>(renderer())) {
 
-    if (is<BoxClipPathOperation>(*style.clipPath()) && is<RenderBox>(renderer())) {
         auto& clipPath = downcast<BoxClipPathOperation>(*style.clipPath());
 
         RoundedRect shapeRect = computeRoundedRectForBoxShape(clipPath.referenceBox(), downcast<RenderBox>(renderer()));
         shapeRect.move(offsetFromRoot);
 
+        windRule = RULE_NONZERO;
+        return clipPath.pathForReferenceRect(shapeRect);
+    }
+    
+    return Path();
+}
+
+bool RenderLayer::setupClipPath(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, const LayoutSize& offsetFromRoot, LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed)
+{
+    if (!renderer().hasClipPath() || context->paintingDisabled())
+        return false;
+
+    if (!rootRelativeBoundsComputed) {
+        rootRelativeBounds = calculateLayerBounds(paintingInfo.rootLayer, offsetFromRoot, 0);
+        rootRelativeBoundsComputed = true;
+    }
+
+    RenderStyle& style = renderer().style();
+    ASSERT(style.clipPath());
+    if (is<ShapeClipPathOperation>(*style.clipPath()) || (is<BoxClipPathOperation>(*style.clipPath()) && is<RenderBox>(renderer()))) {
+        WindRule windRule;
+        Path path = computeClipPath(offsetFromRoot, rootRelativeBounds, windRule);
         context->save();
-        context->clipPath(clipPath.pathForReferenceRect(shapeRect), RULE_NONZERO);
+        context->clipPath(path, windRule);
         return true;
     }
 
@@ -4218,8 +4237,11 @@
     LayoutSize columnAwareOffsetFromRoot = offsetFromRoot;
     if (renderer().flowThreadContainingBlock() && (renderer().hasClipPath() || hasFilterThatIsPainting(context, paintFlags)))
         columnAwareOffsetFromRoot = toLayoutSize(convertToLayerCoords(paintingInfo.rootLayer, LayoutPoint(), AdjustForColumns));
-    bool hasClipPath = setupClipPath(context, paintingInfo, columnAwareOffsetFromRoot, rootRelativeBounds, rootRelativeBoundsComputed);
 
+    bool hasClipPath = false;
+    if (paintsWithClipPath() || (localPaintFlags & PaintLayerPaintingCompositingClipPathPhase) || (localPaintFlags & PaintLayerPaintingCompositingMaskPhase))
+        hasClipPath = setupClipPath(context, paintingInfo, columnAwareOffsetFromRoot, rootRelativeBounds, rootRelativeBoundsComputed);
+
     LayerPaintingInfo localPaintingInfo(paintingInfo);
 
     GraphicsContext* transparencyLayerContext = context;
@@ -4319,6 +4341,11 @@
         paintMaskForFragments(layerFragments, context, localPaintingInfo, subtreePaintRootForRenderer);
     }
 
+    if ((localPaintFlags & PaintLayerPaintingCompositingClipPathPhase) && shouldPaintContent && !selectionOnly) {
+        // Re-use paintChildClippingMaskForFragments to paint black for the compositing clipping mask.
+        paintChildClippingMaskForFragments(layerFragments, context, localPaintingInfo, subtreePaintRootForRenderer);
+    }
+    
     if ((localPaintFlags & PaintLayerPaintingChildClippingMaskPhase) && shouldPaintContent && !selectionOnly) {
         // Paint the border radius mask for the fragments.
         paintChildClippingMaskForFragments(layerFragments, context, localPaintingInfo, subtreePaintRootForRenderer);

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (180881 => 180882)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2015-03-02 06:35:20 UTC (rev 180882)
@@ -428,20 +428,21 @@
     int zIndex() const { return renderer().style().zIndex(); }
 
     enum PaintLayerFlag {
-        PaintLayerHaveTransparency = 1,
-        PaintLayerAppliedTransform = 1 << 1,
-        PaintLayerTemporaryClipRects = 1 << 2,
-        PaintLayerPaintingReflection = 1 << 3,
-        PaintLayerPaintingOverlayScrollbars = 1 << 4,
-        PaintLayerPaintingCompositingBackgroundPhase = 1 << 5,
-        PaintLayerPaintingCompositingForegroundPhase = 1 << 6,
-        PaintLayerPaintingCompositingMaskPhase = 1 << 7,
-        PaintLayerPaintingCompositingScrollingPhase = 1 << 8,
-        PaintLayerPaintingOverflowContents = 1 << 9,
-        PaintLayerPaintingRootBackgroundOnly = 1 << 10,
-        PaintLayerPaintingSkipRootBackground = 1 << 11,
-        PaintLayerPaintingChildClippingMaskPhase = 1 << 12,
-        PaintLayerPaintingCompositingAllPhases = (PaintLayerPaintingCompositingBackgroundPhase | PaintLayerPaintingCompositingForegroundPhase | PaintLayerPaintingCompositingMaskPhase)
+        PaintLayerHaveTransparency                      = 1 << 0,
+        PaintLayerAppliedTransform                      = 1 << 1,
+        PaintLayerTemporaryClipRects                    = 1 << 2,
+        PaintLayerPaintingReflection                    = 1 << 3,
+        PaintLayerPaintingOverlayScrollbars             = 1 << 4,
+        PaintLayerPaintingCompositingBackgroundPhase    = 1 << 5,
+        PaintLayerPaintingCompositingForegroundPhase    = 1 << 6,
+        PaintLayerPaintingCompositingMaskPhase          = 1 << 7,
+        PaintLayerPaintingCompositingClipPathPhase      = 1 << 8,
+        PaintLayerPaintingCompositingScrollingPhase     = 1 << 9,
+        PaintLayerPaintingOverflowContents              = 1 << 10,
+        PaintLayerPaintingRootBackgroundOnly            = 1 << 11,
+        PaintLayerPaintingSkipRootBackground            = 1 << 12,
+        PaintLayerPaintingChildClippingMaskPhase        = 1 << 13,
+        PaintLayerPaintingCompositingAllPhases          = PaintLayerPaintingCompositingBackgroundPhase | PaintLayerPaintingCompositingForegroundPhase | PaintLayerPaintingCompositingMaskPhase
     };
     
     typedef unsigned PaintLayerFlags;
@@ -752,6 +753,11 @@
     void updateCompositingAndLayerListsIfNeeded();
 
     bool setupFontSubpixelQuantization(GraphicsContext*, bool& didQuantizeFonts);
+
+    bool paintsWithClipPath() const;
+
+    Path computeClipPath(const LayoutSize& offsetFromRoot, LayoutRect& rootRelativeBounds, WindRule&) const;
+
     bool setupClipPath(GraphicsContext*, const LayerPaintingInfo&, const LayoutSize& offsetFromRoot, LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed);
 
     bool hasFilterThatIsPainting(GraphicsContext*, PaintLayerFlags) const;

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (180881 => 180882)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2015-03-02 06:35:20 UTC (rev 180882)
@@ -149,7 +149,7 @@
     updateOverflowControlsLayers(false, false, false);
     updateForegroundLayer(false);
     updateBackgroundLayer(false);
-    updateMaskLayer(false);
+    updateMaskingLayer(false, false);
     updateScrollingLayers(false);
     detachFromScrollingCoordinator();
     destroyGraphicsLayers();
@@ -570,7 +570,7 @@
             m_graphicsLayer->addChild(flatteningLayer);
     }
 
-    updateMaskLayer(renderer().hasMask());
+    updateMaskingLayer(renderer().hasMask(), renderer().hasClipPath());
 
     updateChildClippingStrategy(needsDescendantsClippingLayer);
 
@@ -827,11 +827,8 @@
         }
     }
     
-    if (m_maskLayer) {
-        m_maskLayer->setSize(m_graphicsLayer->size());
-        m_maskLayer->setPosition(FloatPoint());
-        m_maskLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer());
-    }
+    if (m_maskLayer)
+        updateMaskingLayerGeometry();
     
     if (m_owningLayer.renderer().hasTransformRelatedProperty()) {
         // Update properties that depend on layer dimensions.
@@ -1005,6 +1002,28 @@
     m_graphicsLayer->setContentsVisible(m_owningLayer.hasVisibleContent() || isPaintDestinationForDescendantLayers());
 }
 
+// FIXME: Avoid repaints when clip path changes.
+void RenderLayerBacking::updateMaskingLayerGeometry()
+{
+    m_maskLayer->setSize(m_graphicsLayer->size());
+    m_maskLayer->setPosition(FloatPoint());
+    m_maskLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer());
+    
+    if (!m_maskLayer->drawsContent()) {
+        if (renderer().hasClipPath()) {
+            ASSERT(renderer().style().clipPath()->type() != ClipPathOperation::Reference);
+
+            WindRule windRule;
+            // FIXME: Use correct reference box for inlines: https://bugs.webkit.org/show_bug.cgi?id=129047
+            LayoutRect referenceBoxForClippedInline = m_owningLayer.boundingBox(&m_owningLayer);
+            Path clipPath = m_owningLayer.computeClipPath(LayoutSize(), referenceBoxForClippedInline, windRule);
+
+            m_maskLayer->setShapeLayerPath(clipPath);
+            m_maskLayer->setShapeLayerWindRule(windRule);
+        }
+    }
+}
+
 void RenderLayerBacking::adjustAncestorCompositingBoundsForFlowThread(LayoutRect& ancestorCompositingBounds, const RenderLayer* compositingAncestor) const
 {
     if (!m_owningLayer.isInsideFlowThread())
@@ -1409,14 +1428,33 @@
     return layerChanged;
 }
 
-void RenderLayerBacking::updateMaskLayer(bool needsMaskLayer)
+// Masking layer is used for masks or clip-path.
+void RenderLayerBacking::updateMaskingLayer(bool hasMask, bool hasClipPath)
 {
     bool layerChanged = false;
-    if (needsMaskLayer) {
+    if (hasMask || hasClipPath) {
+        GraphicsLayerPaintingPhase maskPhases = 0;
+        if (hasMask)
+            maskPhases = GraphicsLayerPaintMask;
+        
+        if (hasClipPath) {
+            bool clipNeedsPainting = renderer().style().clipPath()->type() == ClipPathOperation::Reference;
+            if (clipNeedsPainting || !GraphicsLayer::supportsLayerType(GraphicsLayer::Type::Shape))
+                maskPhases |= GraphicsLayerPaintClipPath;
+        }
+
+        bool paintsContent = maskPhases;
+        GraphicsLayer::Type requiredLayerType = paintsContent ? GraphicsLayer::Type::Normal : GraphicsLayer::Type::Shape;
+        if (m_maskLayer && m_maskLayer->type() != requiredLayerType) {
+            m_graphicsLayer->setMaskLayer(nullptr);
+            willDestroyLayer(m_maskLayer.get());
+            m_maskLayer = nullptr;
+        }
+
         if (!m_maskLayer) {
-            m_maskLayer = createGraphicsLayer("Mask");
-            m_maskLayer->setDrawsContent(true);
-            m_maskLayer->setPaintingPhase(GraphicsLayerPaintMask);
+            m_maskLayer = createGraphicsLayer("Mask", requiredLayerType);
+            m_maskLayer->setDrawsContent(paintsContent);
+            m_maskLayer->setPaintingPhase(maskPhases);
             layerChanged = true;
             m_graphicsLayer->setMaskLayer(m_maskLayer.get());
         }
@@ -1527,8 +1565,6 @@
         phase |= GraphicsLayerPaintBackground;
     if (!m_foregroundLayer)
         phase |= GraphicsLayerPaintForeground;
-    if (!m_maskLayer)
-        phase |= GraphicsLayerPaintMask;
 
     if (m_scrollingContentsLayer) {
         phase &= ~GraphicsLayerPaintForeground;
@@ -2192,6 +2228,8 @@
         paintFlags |= RenderLayer::PaintLayerPaintingCompositingForegroundPhase;
     if (paintingPhase & GraphicsLayerPaintMask)
         paintFlags |= RenderLayer::PaintLayerPaintingCompositingMaskPhase;
+    if (paintingPhase & GraphicsLayerPaintClipPath)
+        paintFlags |= RenderLayer::PaintLayerPaintingCompositingClipPathPhase;
     if (paintingPhase & GraphicsLayerPaintChildClippingMask)
         paintFlags |= RenderLayer::PaintLayerPaintingChildClippingMaskPhase;
     if (paintingPhase & GraphicsLayerPaintOverflowContents)

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (180881 => 180882)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.h	2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h	2015-03-02 06:35:20 UTC (rev 180882)
@@ -266,13 +266,15 @@
     bool updateOverflowControlsLayers(bool needsHorizontalScrollbarLayer, bool needsVerticalScrollbarLayer, bool needsScrollCornerLayer);
     bool updateForegroundLayer(bool needsForegroundLayer);
     bool updateBackgroundLayer(bool needsBackgroundLayer);
-    void updateMaskLayer(bool needsMaskLayer);
+    void updateMaskingLayer(bool hasMask, bool hasClipPath);
     bool requiresHorizontalScrollbarLayer() const;
     bool requiresVerticalScrollbarLayer() const;
     bool requiresScrollCornerLayer() const;
     bool updateScrollingLayers(bool scrollingLayers);
     void updateDrawsContent(bool isSimpleContainer);
     void updateChildClippingStrategy(bool needsDescendantsClippingLayer);
+
+    void updateMaskingLayerGeometry();
     
     void updateRootLayerConfiguration();
 
@@ -339,7 +341,7 @@
     std::unique_ptr<GraphicsLayer> m_foregroundLayer; // Only used in cases where we need to draw the foreground separately.
     std::unique_ptr<GraphicsLayer> m_backgroundLayer; // Only used in cases where we need to draw the background separately.
     std::unique_ptr<GraphicsLayer> m_childContainmentLayer; // Only used if we have clipping on a stacking context with compositing children, or if the layer has a tile cache.
-    std::unique_ptr<GraphicsLayer> m_maskLayer; // Only used if we have a mask.
+    std::unique_ptr<GraphicsLayer> m_maskLayer; // Only used if we have a mask and/or clip-path.
     std::unique_ptr<GraphicsLayer> m_childClippingMaskLayer; // Only used if we have to clip child layers or accelerated contents with border radius or clip-path.
 
     std::unique_ptr<GraphicsLayer> m_layerForHorizontalScrollbar;

Modified: trunk/Source/WebKit2/ChangeLog (180881 => 180882)


--- trunk/Source/WebKit2/ChangeLog	2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/Source/WebKit2/ChangeLog	2015-03-02 06:35:20 UTC (rev 180882)
@@ -1,3 +1,33 @@
+2015-03-01  Simon Fraser  <simon.fra...@apple.com>
+
+        Make clip-path work on <video>, <canvas> etc.
+        https://bugs.webkit.org/show_bug.cgi?id=138684
+
+        Reviewed by Darin Adler.
+        
+        Support encode/decode for WebCore Path objects, which is done by traversing
+        the path.
+
+        * Shared/WebCoreArgumentCoders.cpp:
+        (IPC::pathPointCountApplierFunction):
+        (IPC::pathEncodeApplierFunction):
+        (IPC::ArgumentCoder<Path>::encode):
+        (IPC::ArgumentCoder<Path>::decode):
+        * Shared/WebCoreArgumentCoders.h:
+        * Shared/mac/RemoteLayerTreePropertyApplier.mm:
+        (WebKit::applyPropertiesToLayer): Actually apply the path and wind rule to the shape layer.
+        * Shared/mac/RemoteLayerTreeTransaction.h: Include path and wind rule in the layer properties.
+        * Shared/mac/RemoteLayerTreeTransaction.mm:
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode): Encode shape and wind rule.
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode): Decode shape and wind rule.
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+        (WebKit::PlatformCALayerRemote::shapePath):
+        (WebKit::PlatformCALayerRemote::setShapePath):
+        (WebKit::PlatformCALayerRemote::shapeWindRule):
+        (WebKit::PlatformCALayerRemote::setShapeWindRule):
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
+
 2015-03-01  Chris Dumez  <cdu...@apple.com>
 
         Make NotificationCenter / Notification suspendable

Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp (180881 => 180882)


--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp	2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp	2015-03-02 06:35:20 UTC (rev 180882)
@@ -49,6 +49,7 @@
 #include <WebCore/IDBKeyRangeData.h>
 #include <WebCore/Image.h>
 #include <WebCore/Length.h>
+#include <WebCore/Path.h>
 #include <WebCore/PluginData.h>
 #include <WebCore/ProtectionSpace.h>
 #include <WebCore/Region.h>
@@ -364,6 +365,115 @@
     return SimpleArgumentCoder<IntSize>::decode(decoder, intSize);
 }
 
+static void pathPointCountApplierFunction(void* info, const PathElement* element)
+{
+    uint64_t* pointCount = static_cast<uint64_t*>(info);
+    ++*pointCount;
+}
+
+static void pathEncodeApplierFunction(void* info, const PathElement* element)
+{
+    ArgumentEncoder& encoder = *static_cast<ArgumentEncoder*>(info);
+
+    encoder.encodeEnum(element->type);
+
+    switch (element->type) {
+    case PathElementMoveToPoint: // The points member will contain 1 value.
+        encoder << element->points[0];
+        break;
+    case PathElementAddLineToPoint: // The points member will contain 1 value.
+        encoder << element->points[0];
+        break;
+    case PathElementAddQuadCurveToPoint: // The points member will contain 2 values.
+        encoder << element->points[0];
+        encoder << element->points[1];
+        break;
+    case PathElementAddCurveToPoint: // The points member will contain 3 values.
+        encoder << element->points[0];
+        encoder << element->points[1];
+        encoder << element->points[2];
+        break;
+    case PathElementCloseSubpath: // The points member will contain no values.
+        break;
+    }
+}
+
+void ArgumentCoder<Path>::encode(ArgumentEncoder& encoder, const Path& path)
+{
+    uint64_t numPoints = 0;
+    path.apply(&numPoints, pathPointCountApplierFunction);
+
+    encoder << numPoints;
+
+    path.apply(&encoder, pathEncodeApplierFunction);
+}
+
+bool ArgumentCoder<Path>::decode(ArgumentDecoder& decoder, Path& path)
+{
+    uint64_t numPoints;
+    if (!decoder.decode(numPoints))
+        return false;
+    
+    path.clear();
+
+    for (uint64_t i = 0; i < numPoints; ++i) {
+    
+        PathElementType elementType;
+        if (!decoder.decodeEnum(elementType))
+            return false;
+        
+        switch (elementType) {
+        case PathElementMoveToPoint: { // The points member will contain 1 value.
+            FloatPoint point;
+            if (!decoder.decode(point))
+                return false;
+            path.moveTo(point);
+            break;
+        }
+        case PathElementAddLineToPoint: { // The points member will contain 1 value.
+            FloatPoint point;
+            if (!decoder.decode(point))
+                return false;
+            path.addLineTo(point);
+            break;
+        }
+        case PathElementAddQuadCurveToPoint: { // The points member will contain 2 values.
+            FloatPoint controlPoint;
+            if (!decoder.decode(controlPoint))
+                return false;
+
+            FloatPoint endPoint;
+            if (!decoder.decode(endPoint))
+                return false;
+
+            path.addQuadCurveTo(controlPoint, endPoint);
+            break;
+        }
+        case PathElementAddCurveToPoint: { // The points member will contain 3 values.
+            FloatPoint controlPoint1;
+            if (!decoder.decode(controlPoint1))
+                return false;
+
+            FloatPoint controlPoint2;
+            if (!decoder.decode(controlPoint2))
+                return false;
+
+            FloatPoint endPoint;
+            if (!decoder.decode(endPoint))
+                return false;
+
+            path.addBezierCurveTo(controlPoint1, controlPoint2, endPoint);
+            break;
+        }
+        case PathElementCloseSubpath: // The points member will contain no values.
+            path.closeSubpath();
+            break;
+        }
+    }
+
+    return true;
+}
+
 template<> struct ArgumentCoder<Region::Span> {
     static void encode(ArgumentEncoder&, const Region::Span&);
     static bool decode(ArgumentDecoder&, Region::Span&);

Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h (180881 => 180882)


--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h	2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h	2015-03-02 06:35:20 UTC (rev 180882)
@@ -54,6 +54,7 @@
 class KeyframeValueList;
 class LinearTimingFunction;
 class Notification;
+class Path;
 class ProtectionSpace;
 class Region;
 class ResourceError;
@@ -198,6 +199,11 @@
     static bool decode(ArgumentDecoder&, WebCore::IntSize&);
 };
 
+template<> struct ArgumentCoder<WebCore::Path> {
+    static void encode(ArgumentEncoder&, const WebCore::Path&);
+    static bool decode(ArgumentDecoder&, WebCore::Path&);
+};
+
 template<> struct ArgumentCoder<WebCore::Region> {
     static void encode(ArgumentEncoder&, const WebCore::Region&);
     static bool decode(ArgumentDecoder&, WebCore::Region&);

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm (180881 => 180882)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm	2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm	2015-03-02 06:35:20 UTC (rev 180882)
@@ -197,6 +197,11 @@
         [(CAShapeLayer *)layer setPath:path.platformPath()];
     }
 
+    if (properties.changedProperties & RemoteLayerTreeTransaction::ShapePathChanged) {
+        ASSERT([layer isKindOfClass:[CAShapeLayer class]]);
+        [(CAShapeLayer *)layer setPath:properties.shapePath.platformPath()];
+    }
+
     if (properties.changedProperties & RemoteLayerTreeTransaction::MinificationFilterChanged)
         layer.minificationFilter = toCAFilterType(properties.minificationFilter);
 
@@ -206,6 +211,19 @@
     if (properties.changedProperties & RemoteLayerTreeTransaction::BlendModeChanged)
         PlatformCAFilters::setBlendingFiltersOnLayer(layer, properties.blendMode);
 
+    if (properties.changedProperties & RemoteLayerTreeTransaction::WindRuleChanged) {
+        ASSERT([layer isKindOfClass:[CAShapeLayer class]]);
+        CAShapeLayer *shapeLayer = (CAShapeLayer *)layer;
+        switch (properties.windRule) {
+        case RULE_NONZERO:
+            shapeLayer.fillRule = @"non-zero";
+            break;
+        case RULE_EVENODD:
+            shapeLayer.fillRule = @"even-odd";
+            break;
+        }
+    }
+
     if (properties.changedProperties & RemoteLayerTreeTransaction::SpeedChanged)
         layer.speed = properties.speed;
 

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h (180881 => 180882)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h	2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h	2015-03-02 06:35:20 UTC (rev 180882)
@@ -73,16 +73,18 @@
         ContentsScaleChanged            = 1LLU << 20,
         CornerRadiusChanged             = 1LLU << 21,
         ShapeRoundedRectChanged         = 1LLU << 22,
-        MinificationFilterChanged       = 1LLU << 23,
-        MagnificationFilterChanged      = 1LLU << 24,
-        BlendModeChanged                = 1LLU << 25,
-        SpeedChanged                    = 1LLU << 26,
-        TimeOffsetChanged               = 1LLU << 27,
-        BackingStoreChanged             = 1LLU << 28,
-        FiltersChanged                  = 1LLU << 29,
-        AnimationsChanged               = 1LLU << 30,
-        EdgeAntialiasingMaskChanged     = 1LLU << 31,
-        CustomAppearanceChanged         = 1LLU << 32
+        ShapePathChanged                = 1LLU << 23,
+        MinificationFilterChanged       = 1LLU << 24,
+        MagnificationFilterChanged      = 1LLU << 25,
+        BlendModeChanged                = 1LLU << 26,
+        WindRuleChanged                 = 1LLU << 27,
+        SpeedChanged                    = 1LLU << 28,
+        TimeOffsetChanged               = 1LLU << 29,
+        BackingStoreChanged             = 1LLU << 30,
+        FiltersChanged                  = 1LLU << 31,
+        AnimationsChanged               = 1LLU << 32,
+        EdgeAntialiasingMaskChanged     = 1LLU << 33,
+        CustomAppearanceChanged         = 1LLU << 34
     };
     typedef uint64_t LayerChange;
 
@@ -136,6 +138,7 @@
         WebCore::FloatRect contentsRect;
         std::unique_ptr<RemoteLayerBackingStore> backingStore;
         std::unique_ptr<WebCore::FilterOperations> filters;
+        WebCore::Path shapePath;
         WebCore::GraphicsLayer::PlatformLayerID maskLayerID;
         WebCore::GraphicsLayer::PlatformLayerID clonedLayerID;
         double timeOffset;
@@ -151,6 +154,7 @@
         WebCore::PlatformCALayer::FilterType minificationFilter;
         WebCore::PlatformCALayer::FilterType magnificationFilter;
         WebCore::BlendMode blendMode;
+        WebCore::WindRule windRule;
         bool hidden;
         bool geometryFlipped;
         bool doubleSided;

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm (180881 => 180882)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm	2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm	2015-03-02 06:35:20 UTC (rev 180882)
@@ -96,6 +96,7 @@
     , minificationFilter(PlatformCALayer::FilterType::Linear)
     , magnificationFilter(PlatformCALayer::FilterType::Linear)
     , blendMode(BlendModeNormal)
+    , windRule(RULE_NONZERO)
     , hidden(false)
     , geometryFlipped(false)
     , doubleSided(true)
@@ -115,6 +116,7 @@
     , anchorPoint(other.anchorPoint)
     , bounds(other.bounds)
     , contentsRect(other.contentsRect)
+    , shapePath(other.shapePath)
     , maskLayerID(other.maskLayerID)
     , clonedLayerID(other.clonedLayerID)
     , timeOffset(other.timeOffset)
@@ -130,6 +132,7 @@
     , minificationFilter(other.minificationFilter)
     , magnificationFilter(other.magnificationFilter)
     , blendMode(other.blendMode)
+    , windRule(other.windRule)
     , hidden(other.hidden)
     , geometryFlipped(other.geometryFlipped)
     , doubleSided(other.doubleSided)
@@ -224,6 +227,9 @@
     if (changedProperties & ShapeRoundedRectChanged)
         encoder << *shapeRoundedRect;
 
+    if (changedProperties & ShapePathChanged)
+        encoder << shapePath;
+
     if (changedProperties & MinificationFilterChanged)
         encoder.encodeEnum(minificationFilter);
 
@@ -233,6 +239,9 @@
     if (changedProperties & BlendModeChanged)
         encoder.encodeEnum(blendMode);
 
+    if (changedProperties & WindRuleChanged)
+        encoder.encodeEnum(windRule);
+
     if (changedProperties & SpeedChanged)
         encoder << speed;
 
@@ -393,6 +402,14 @@
         result.shapeRoundedRect = std::make_unique<FloatRoundedRect>(roundedRect);
     }
 
+    if (result.changedProperties & ShapePathChanged) {
+        Path path;
+        if (!decoder.decode(path))
+            return false;
+        
+        result.shapePath = WTF::move(path);
+    }
+
     if (result.changedProperties & MinificationFilterChanged) {
         if (!decoder.decodeEnum(result.minificationFilter))
             return false;
@@ -408,6 +425,11 @@
             return false;
     }
 
+    if (result.changedProperties & WindRuleChanged) {
+        if (!decoder.decodeEnum(result.windRule))
+            return false;
+    }
+
     if (result.changedProperties & SpeedChanged) {
         if (!decoder.decode(result.speed))
             return false;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp (180881 => 180882)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp	2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp	2015-03-02 06:35:20 UTC (rev 180882)
@@ -705,6 +705,32 @@
     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ShapeRoundedRectChanged);
 }
 
+Path PlatformCALayerRemote::shapePath() const
+{
+    ASSERT(m_layerType == LayerTypeShapeLayer);
+    return m_properties.shapePath;
+}
+
+void PlatformCALayerRemote::setShapePath(const Path& path)
+{
+    ASSERT(m_layerType == LayerTypeShapeLayer);
+    m_properties.shapePath = path;
+    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ShapePathChanged);
+}
+
+WindRule PlatformCALayerRemote::shapeWindRule() const
+{
+    ASSERT(m_layerType == LayerTypeShapeLayer);
+    return m_properties.windRule;
+}
+
+void PlatformCALayerRemote::setShapeWindRule(WindRule windRule)
+{
+    ASSERT(m_layerType == LayerTypeShapeLayer);
+    m_properties.windRule = windRule;
+    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::WindRuleChanged);
+}
+
 bool PlatformCALayerRemote::requiresCustomAppearanceUpdateOnBoundsChange() const
 {
     return m_properties.customAppearance == GraphicsLayer::ScrollingShadow;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h (180881 => 180882)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h	2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h	2015-03-02 06:35:20 UTC (rev 180882)
@@ -144,9 +144,16 @@
 
     virtual void setEdgeAntialiasingMask(unsigned) override;
 
+    // FIXME: Having both shapeRoundedRect and shapePath is redundant. We could use shapePath for everything.
     virtual WebCore::FloatRoundedRect shapeRoundedRect() const override;
     virtual void setShapeRoundedRect(const WebCore::FloatRoundedRect&) override;
 
+    virtual WebCore::Path shapePath() const override;
+    virtual void setShapePath(const WebCore::Path&) override;
+
+    virtual WebCore::WindRule shapeWindRule() const override;
+    virtual void setShapeWindRule(WebCore::WindRule) override;
+
     virtual WebCore::GraphicsLayer::CustomAppearance customAppearance() const override;
     virtual void updateCustomAppearance(WebCore::GraphicsLayer::CustomAppearance) override;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to