<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[180882] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/180882">180882</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2015-03-01 22:35:20 -0800 (Sun, 01 Mar 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>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.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsLayercpp">trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsLayerh">trunk/Source/WebCore/platform/graphics/GraphicsLayer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsLayerClienth">trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsPathh">trunk/Source/WebCore/platform/graphics/Path.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscaGraphicsLayerCAcpp">trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscaGraphicsLayerCAh">trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscaPlatformCALayerh">trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscamacPlatformCALayerMach">trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscamacPlatformCALayerMacmm">trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscawinPlatformCALayerWincpp">trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscawinPlatformCALayerWinh">trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscgPathCGcpp">trunk/Source/WebCore/platform/graphics/cg/PathCG.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayercpp">trunk/Source/WebCore/rendering/RenderLayer.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerh">trunk/Source/WebCore/rendering/RenderLayer.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerBackingcpp">trunk/Source/WebCore/rendering/RenderLayerBacking.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerBackingh">trunk/Source/WebCore/rendering/RenderLayerBacking.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedWebCoreArgumentCoderscpp">trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedWebCoreArgumentCodersh">trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h</a></li>
<li><a href="#trunkSourceWebKit2SharedmacRemoteLayerTreePropertyAppliermm">trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm</a></li>
<li><a href="#trunkSourceWebKit2SharedmacRemoteLayerTreeTransactionh">trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h</a></li>
<li><a href="#trunkSourceWebKit2SharedmacRemoteLayerTreeTransactionmm">trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacPlatformCALayerRemotecpp">trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacPlatformCALayerRemoteh">trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestscompositingmaskscompositingclippathandmaskexpectedhtml">trunk/LayoutTests/compositing/masks/compositing-clip-path-and-mask-expected.html</a></li>
<li><a href="#trunkLayoutTestscompositingmaskscompositingclippathandmaskhtml">trunk/LayoutTests/compositing/masks/compositing-clip-path-and-mask.html</a></li>
<li><a href="#trunkLayoutTestscompositingmaskscompositingclippathexpectedhtml">trunk/LayoutTests/compositing/masks/compositing-clip-path-expected.html</a></li>
<li><a href="#trunkLayoutTestscompositingmaskscompositingclippathmaskchangeexpectedhtml">trunk/LayoutTests/compositing/masks/compositing-clip-path-mask-change-expected.html</a></li>
<li><a href="#trunkLayoutTestscompositingmaskscompositingclippathmaskchangehtml">trunk/LayoutTests/compositing/masks/compositing-clip-path-mask-change.html</a></li>
<li><a href="#trunkLayoutTestscompositingmaskscompositingclippathhtml">trunk/LayoutTests/compositing/masks/compositing-clip-path.html</a></li>
<li><a href="#trunkLayoutTestscompositingmasksreferenceclippathoncompositedexpectedhtml">trunk/LayoutTests/compositing/masks/reference-clip-path-on-composited-expected.html</a></li>
<li><a href="#trunkLayoutTestscompositingmasksreferenceclippathoncompositedhtml">trunk/LayoutTests/compositing/masks/reference-clip-path-on-composited.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (180881 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-03-02 04:33:06 UTC (rev 180881)
+++ trunk/LayoutTests/ChangeLog        2015-03-02 06:35:20 UTC (rev 180882)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2015-03-01 Simon Fraser <simon.fraser@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.
+
</ins><span class="cx"> 2015-03-01 Gyuyoung Kim <gyuyoung.kim@samsung.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed EFL gardening. Mark crash tests of webgl to CRASH.
</span></span></pre></div>
<a id="trunkLayoutTestscompositingmaskscompositingclippathandmaskexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/masks/compositing-clip-path-and-mask-expected.html (0 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+<!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>
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingmaskscompositingclippathandmaskhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/masks/compositing-clip-path-and-mask.html (0 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+<!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>
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingmaskscompositingclippathexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/masks/compositing-clip-path-expected.html (0 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+<!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>
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingmaskscompositingclippathmaskchangeexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/masks/compositing-clip-path-mask-change-expected.html (0 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+<!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>
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingmaskscompositingclippathmaskchangehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/masks/compositing-clip-path-mask-change.html (0 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+<!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>
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingmaskscompositingclippathhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/masks/compositing-clip-path.html (0 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+<!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>
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingmasksreferenceclippathoncompositedexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/masks/reference-clip-path-on-composited-expected.html (0 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+<!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>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscompositingmasksreferenceclippathoncompositedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/masks/reference-clip-path-on-composited.html (0 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+<!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>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (180881 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,142 @@
</span><ins>+2015-03-01 Simon Fraser <simon.fraser@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:
+
</ins><span class="cx"> 2015-03-01 Hunseop Jeong <hs85.jeong@samsung.com>
</span><span class="cx">
</span><span class="cx"> [Cairo] Implement Path::addEllipse
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (180881 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -71,7 +71,40 @@
</span><span class="cx"> m_values.append(WTF::move(value));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-GraphicsLayer::GraphicsLayer(Type, GraphicsLayerClient& client)
</del><ins>+#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)
</ins><span class="cx"> : m_client(client)
</span><span class="cx"> , m_anchorPoint(0.5f, 0.5f, 0)
</span><span class="cx"> , m_opacity(1)
</span><span class="lines">@@ -79,6 +112,7 @@
</span><span class="cx"> #if ENABLE(CSS_COMPOSITING)
</span><span class="cx"> , m_blendMode(BlendModeNormal)
</span><span class="cx"> #endif
</span><ins>+ , m_type(type)
</ins><span class="cx"> , m_contentsOpaque(false)
</span><span class="cx"> , m_preserves3D(false)
</span><span class="cx"> , m_backfaceVisibility(true)
</span><span class="lines">@@ -274,6 +308,42 @@
</span><span class="cx"> m_maskLayer = layer;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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
+}
+
</ins><span class="cx"> void GraphicsLayer::noteDeviceOrPageScaleFactorChangedIncludingDescendants()
</span><span class="cx"> {
</span><span class="cx"> deviceOrPageScaleFactorChanged();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsLayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (180881 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -35,8 +35,10 @@
</span><span class="cx"> #include "FloatSize.h"
</span><span class="cx"> #include "GraphicsLayerClient.h"
</span><span class="cx"> #include "IntRect.h"
</span><ins>+#include "Path.h"
</ins><span class="cx"> #include "PlatformLayer.h"
</span><span class="cx"> #include "TransformOperations.h"
</span><ins>+#include "WindRule.h"
</ins><span class="cx"> #include <wtf/TypeCasts.h>
</span><span class="cx">
</span><span class="cx"> #if ENABLE(CSS_COMPOSITING)
</span><span class="lines">@@ -198,12 +200,15 @@
</span><span class="cx"> enum class Type {
</span><span class="cx"> Normal,
</span><span class="cx"> PageTiledBacking,
</span><del>- Scrolling
</del><ins>+ Scrolling,
+ Shape
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT static std::unique_ptr<GraphicsLayer> create(GraphicsLayerFactory*, GraphicsLayerClient&, Type = Type::Normal);
</span><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT virtual ~GraphicsLayer();
</span><ins>+
+ Type type() const { return m_type; }
</ins><span class="cx">
</span><span class="cx"> virtual void initialize(Type) { }
</span><span class="cx">
</span><span class="lines">@@ -381,6 +386,12 @@
</span><span class="cx"> FloatRoundedRect maskToBoundsRect() const { return m_masksToBoundsRect; };
</span><span class="cx"> virtual bool setMasksToBoundsRect(const FloatRoundedRect& roundedRect) { m_masksToBoundsRect = roundedRect; return false; }
</span><span class="cx">
</span><ins>+ Path shapeLayerPath() const;
+ virtual void setShapeLayerPath(const Path&);
+
+ WindRule shapeLayerWindRule() const;
+ virtual void setShapeLayerWindRule(WindRule);
+
</ins><span class="cx"> // Transitions are identified by a special animation name that cannot clash with a keyframe identifier.
</span><span class="cx"> static String animationNameForTransition(AnimatedPropertyID);
</span><span class="cx">
</span><span class="lines">@@ -480,24 +491,9 @@
</span><span class="cx"> void resetTrackedRepaints();
</span><span class="cx"> void addRepaintRect(const FloatRect&);
</span><span class="cx">
</span><del>- static bool supportsBackgroundColorContent()
- {
-#if USE(CA) || USE(TEXTURE_MAPPER)
- return true;
-#else
- return false;
-#endif
- }
-
-#if USE(COORDINATED_GRAPHICS)
</del><ins>+ static bool supportsBackgroundColorContent();
+ static bool supportsLayerType(Type);
</ins><span class="cx"> static bool supportsContentsTiling();
</span><del>-#else
- static bool supportsContentsTiling()
- {
- // FIXME: Enable the feature on different ports.
- return false;
- }
-#endif
</del><span class="cx">
</span><span class="cx"> void updateDebugIndicators();
</span><span class="cx">
</span><span class="lines">@@ -507,8 +503,6 @@
</span><span class="cx"> virtual bool isGraphicsLayerCARemote() const { return false; }
</span><span class="cx"> virtual bool isGraphicsLayerTextureMapper() const { return false; }
</span><span class="cx">
</span><del>- virtual bool needsClippingMaskLayer() { return true; };
-
</del><span class="cx"> protected:
</span><span class="cx"> WEBCORE_EXPORT explicit GraphicsLayer(Type, GraphicsLayerClient&);
</span><span class="cx">
</span><span class="lines">@@ -570,6 +564,8 @@
</span><span class="cx"> BlendMode m_blendMode;
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+ const Type m_type;
+
</ins><span class="cx"> bool m_contentsOpaque : 1;
</span><span class="cx"> bool m_preserves3D: 1;
</span><span class="cx"> bool m_backfaceVisibility : 1;
</span><span class="lines">@@ -604,6 +600,11 @@
</span><span class="cx">
</span><span class="cx"> int m_repaintCount;
</span><span class="cx"> CustomAppearance m_customAppearance;
</span><ins>+
+#if USE(CA)
+ Path m_shapeLayerPath;
+ WindRule m_shapeLayerWindRule { RULE_NONZERO };
+#endif
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsLayerClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h (180881 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -39,13 +39,14 @@
</span><span class="cx"> class TransformationMatrix;
</span><span class="cx">
</span><span class="cx"> enum GraphicsLayerPaintingPhaseFlags {
</span><del>- GraphicsLayerPaintBackground = (1 << 0),
- GraphicsLayerPaintForeground = (1 << 1),
- GraphicsLayerPaintMask = (1 << 2),
- GraphicsLayerPaintOverflowContents = (1 << 3),
- GraphicsLayerPaintCompositedScroll = (1 << 4),
- GraphicsLayerPaintChildClippingMask = (1 << 5),
- GraphicsLayerPaintAllWithOverflowClip = (GraphicsLayerPaintBackground | GraphicsLayerPaintForeground | GraphicsLayerPaintMask)
</del><ins>+ GraphicsLayerPaintBackground = 1 << 0,
+ GraphicsLayerPaintForeground = 1 << 1,
+ GraphicsLayerPaintMask = 1 << 2,
+ GraphicsLayerPaintClipPath = 1 << 3,
+ GraphicsLayerPaintOverflowContents = 1 << 4,
+ GraphicsLayerPaintCompositedScroll = 1 << 5,
+ GraphicsLayerPaintChildClippingMask = 1 << 6,
+ GraphicsLayerPaintAllWithOverflowClip = GraphicsLayerPaintBackground | GraphicsLayerPaintForeground
</ins><span class="cx"> };
</span><span class="cx"> typedef unsigned GraphicsLayerPaintingPhase;
</span><span class="cx">
</span><span class="lines">@@ -58,14 +59,14 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> enum LayerTreeAsTextBehaviorFlags {
</span><del>- 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,
</del><ins>+ 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,
</ins><span class="cx"> };
</span><span class="cx"> typedef unsigned LayerTreeAsTextBehavior;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsPathh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/Path.h (180881 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -90,8 +90,8 @@
</span><span class="cx"> #endif
</span><span class="cx"> WEBCORE_EXPORT ~Path();
</span><span class="cx">
</span><del>- Path(const Path&);
- Path& operator=(const Path&);
</del><ins>+ WEBCORE_EXPORT Path(const Path&);
+ WEBCORE_EXPORT Path& operator=(const Path&);
</ins><span class="cx">
</span><span class="cx"> bool contains(const FloatPoint&, WindRule rule = RULE_NONZERO) const;
</span><span class="cx"> bool strokeContains(StrokeStyleApplier*, const FloatPoint&) const;
</span><span class="lines">@@ -105,7 +105,7 @@
</span><span class="cx"> FloatPoint pointAtLength(float length, bool& ok) const;
</span><span class="cx"> float normalAngleAtLength(float length, bool& ok) const;
</span><span class="cx">
</span><del>- void clear();
</del><ins>+ WEBCORE_EXPORT void clear();
</ins><span class="cx"> bool isNull() const { return !m_path; }
</span><span class="cx"> bool isEmpty() const;
</span><span class="cx"> // Gets the current point of the current path, which is conceptually the final point reached by the path so far.
</span><span class="lines">@@ -113,12 +113,12 @@
</span><span class="cx"> bool hasCurrentPoint() const;
</span><span class="cx"> FloatPoint currentPoint() const;
</span><span class="cx">
</span><del>- 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);
</del><ins>+ 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);
</ins><span class="cx"> void addArcTo(const FloatPoint&, const FloatPoint&, float radius);
</span><del>- void closeSubpath();
</del><ins>+ WEBCORE_EXPORT void closeSubpath();
</ins><span class="cx">
</span><span class="cx"> void addArc(const FloatPoint&, float radius, float startAngle, float endAngle, bool anticlockwise);
</span><span class="cx"> void addRect(const FloatRect&);
</span><span class="lines">@@ -144,7 +144,7 @@
</span><span class="cx"> // ensurePlatformPath() will allocate a PlatformPath if it has not yet been and will never return null.
</span><span class="cx"> PlatformPathPtr ensurePlatformPath();
</span><span class="cx">
</span><del>- void apply(void* info, PathApplierFunction) const;
</del><ins>+ WEBCORE_EXPORT void apply(void* info, PathApplierFunction) const;
</ins><span class="cx"> void transform(const AffineTransform&);
</span><span class="cx">
</span><span class="cx"> void addBeziersForRoundedRect(const FloatRect&, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscaGraphicsLayerCAcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (180881 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -276,6 +276,30 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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;
+}
+
</ins><span class="cx"> std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient& client, Type layerType)
</span><span class="cx"> {
</span><span class="cx"> std::unique_ptr<GraphicsLayer> graphicsLayer;
</span><span class="lines">@@ -351,6 +375,9 @@
</span><span class="cx"> case Type::Scrolling:
</span><span class="cx"> platformLayerType = PlatformCALayer::LayerType::LayerTypeScrollingLayer;
</span><span class="cx"> break;
</span><ins>+ case Type::Shape:
+ platformLayerType = PlatformCALayer::LayerType::LayerTypeShapeLayer;
+ break;
</ins><span class="cx"> }
</span><span class="cx"> m_layer = createPlatformCALayer(platformLayerType, this);
</span><span class="cx"> noteLayerPropertyChanged(ContentsScaleChanged);
</span><span class="lines">@@ -807,6 +834,22 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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);
+}
+
</ins><span class="cx"> bool GraphicsLayerCA::shouldRepaintOnSizeChange() const
</span><span class="cx"> {
</span><span class="cx"> return drawsContent() && !tiledBacking();
</span><span class="lines">@@ -1371,6 +1414,12 @@
</span><span class="cx"> updateBlendMode();
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+ if (m_uncommittedChanges & ShapeChanged)
+ updateShape();
+
+ if (m_uncommittedChanges & WindRuleChanged)
+ updateWindRule();
+
</ins><span class="cx"> if (m_uncommittedChanges & AnimationChanged)
</span><span class="cx"> updateAnimations();
</span><span class="cx">
</span><span class="lines">@@ -1730,6 +1779,16 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+void GraphicsLayerCA::updateShape()
+{
+ m_layer->setShapePath(m_shapeLayerPath);
+}
+
+void GraphicsLayerCA::updateWindRule()
+{
+ m_layer->setShapeWindRule(m_shapeLayerWindRule);
+}
+
</ins><span class="cx"> void GraphicsLayerCA::updateStructuralLayer()
</span><span class="cx"> {
</span><span class="cx"> ensureStructuralLayer(structuralLayerPurpose());
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscaGraphicsLayerCAh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (180881 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -120,6 +120,9 @@
</span><span class="cx"> WEBCORE_EXPORT virtual void setContentsClippingRect(const FloatRoundedRect&) override;
</span><span class="cx"> WEBCORE_EXPORT virtual bool setMasksToBoundsRect(const FloatRoundedRect&) override;
</span><span class="cx">
</span><ins>+ WEBCORE_EXPORT virtual void setShapeLayerPath(const Path&);
+ WEBCORE_EXPORT virtual void setShapeLayerWindRule(WindRule);
+
</ins><span class="cx"> WEBCORE_EXPORT virtual void suspendAnimations(double time) override;
</span><span class="cx"> WEBCORE_EXPORT virtual void resumeAnimations() override;
</span><span class="cx">
</span><span class="lines">@@ -203,14 +206,7 @@
</span><span class="cx"> WEBCORE_EXPORT virtual bool shouldRepaintOnSizeChange() const override;
</span><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT void layerDidDisplay(PlatformCALayer*);
</span><del>- void updateOpacityOnLayer();
- void updateFilters();
- void updateBackdropFilters();
</del><span class="cx">
</span><del>-#if ENABLE(CSS_COMPOSITING)
- void updateBlendMode();
-#endif
-
</del><span class="cx"> virtual PassRefPtr<PlatformCALayer> createPlatformCALayer(PlatformCALayer::LayerType, PlatformCALayerClient* owner);
</span><span class="cx"> virtual PassRefPtr<PlatformCALayer> createPlatformCALayer(PlatformLayer*, PlatformCALayerClient* owner);
</span><span class="cx"> virtual PassRefPtr<PlatformCAAnimation> createPlatformCAAnimation(PlatformCAAnimation::AnimationType, const String& keyPath);
</span><span class="lines">@@ -384,6 +380,17 @@
</span><span class="cx"> void updateContentsScale(float pageScaleFactor);
</span><span class="cx"> void updateCustomAppearance();
</span><span class="cx">
</span><ins>+ void updateOpacityOnLayer();
+ void updateFilters();
+ void updateBackdropFilters();
+
+#if ENABLE(CSS_COMPOSITING)
+ void updateBlendMode();
+#endif
+
+ void updateShape();
+ void updateWindRule();
+
</ins><span class="cx"> enum StructuralLayerPurpose {
</span><span class="cx"> NoStructuralLayer = 0,
</span><span class="cx"> StructuralLayerForPreserves3D,
</span><span class="lines">@@ -448,6 +455,8 @@
</span><span class="cx"> DebugIndicatorsChanged = 1LLU << 31,
</span><span class="cx"> CustomAppearanceChanged = 1LLU << 32,
</span><span class="cx"> BlendModeChanged = 1LLU << 33,
</span><ins>+ ShapeChanged = 1LLU << 34,
+ WindRuleChanged = 1LLU << 35,
</ins><span class="cx"> };
</span><span class="cx"> typedef uint64_t LayerChangeFlags;
</span><span class="cx"> enum ScheduleFlushOrNot { ScheduleFlush, DontScheduleFlush };
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscaPlatformCALayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h (180881 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -210,6 +210,13 @@
</span><span class="cx"> // Only used by LayerTypeShapeLayer.
</span><span class="cx"> virtual FloatRoundedRect shapeRoundedRect() const = 0;
</span><span class="cx"> virtual void setShapeRoundedRect(const FloatRoundedRect&) = 0;
</span><ins>+
+ // 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;
</ins><span class="cx">
</span><span class="cx"> virtual GraphicsLayer::CustomAppearance customAppearance() const = 0;
</span><span class="cx"> virtual void updateCustomAppearance(GraphicsLayer::CustomAppearance) = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscamacPlatformCALayerMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h (180881 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -142,6 +142,12 @@
</span><span class="cx"> virtual FloatRoundedRect shapeRoundedRect() const override;
</span><span class="cx"> virtual void setShapeRoundedRect(const FloatRoundedRect&) override;
</span><span class="cx">
</span><ins>+ virtual Path shapePath() const override;
+ virtual void setShapePath(const Path&) override;
+
+ virtual WindRule shapeWindRule() const override;
+ virtual void setShapeWindRule(WindRule) override;
+
</ins><span class="cx"> virtual GraphicsLayer::CustomAppearance customAppearance() const override { return m_customAppearance; }
</span><span class="cx"> virtual void updateCustomAppearance(GraphicsLayer::CustomAppearance) override;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscamacPlatformCALayerMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm (180881 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -349,7 +349,7 @@
</span><span class="cx">
</span><span class="cx"> PlatformCALayerMac::~PlatformCALayerMac()
</span><span class="cx"> {
</span><del>- [m_layer.get() setValue:nil forKey:platformCALayerPointer];
</del><ins>+ [m_layer setValue:nil forKey:platformCALayerPointer];
</ins><span class="cx">
</span><span class="cx"> // Remove the owner pointer from the delegate in case there is a pending animationStarted event.
</span><span class="cx"> [static_cast<WebAnimationDelegate*>(m_delegate.get()) setOwner:nil];
</span><span class="lines">@@ -373,14 +373,14 @@
</span><span class="cx"> void PlatformCALayerMac::setNeedsDisplay()
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setNeedsDisplay];
</del><ins>+ [m_layer setNeedsDisplay];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerMac::setNeedsDisplayInRect(const FloatRect& dirtyRect)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setNeedsDisplayInRect:dirtyRect];
</del><ins>+ [m_layer setNeedsDisplayInRect:dirtyRect];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -403,7 +403,7 @@
</span><span class="cx"> void PlatformCALayerMac::removeFromSuperlayer()
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() removeFromSuperlayer];
</del><ins>+ [m_layer removeFromSuperlayer];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -420,7 +420,7 @@
</span><span class="cx"> for (size_t i = 0; i < list.size(); ++i)
</span><span class="cx"> [sublayers addObject:list[i]->m_layer.get()];
</span><span class="cx">
</span><del>- [m_layer.get() setSublayers:sublayers];
</del><ins>+ [m_layer setSublayers:sublayers];
</ins><span class="cx"> [sublayers release];
</span><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="lines">@@ -428,7 +428,7 @@
</span><span class="cx"> void PlatformCALayerMac::removeAllSublayers()
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setSublayers:nil];
</del><ins>+ [m_layer setSublayers:nil];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -436,7 +436,7 @@
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> ASSERT(m_layer != layer.m_layer);
</span><del>- [m_layer.get() addSublayer:layer.m_layer.get()];
</del><ins>+ [m_layer addSublayer:layer.m_layer.get()];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -444,7 +444,7 @@
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> ASSERT(m_layer != layer.m_layer);
</span><del>- [m_layer.get() insertSublayer:layer.m_layer.get() atIndex:index];
</del><ins>+ [m_layer insertSublayer:layer.m_layer.get() atIndex:index];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -452,14 +452,14 @@
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> ASSERT(m_layer != layer.m_layer);
</span><del>- [m_layer.get() replaceSublayer:reference.m_layer.get() with:layer.m_layer.get()];
</del><ins>+ [m_layer replaceSublayer:reference.m_layer.get() with:layer.m_layer.get()];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerMac::adoptSublayers(PlatformCALayer& source)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setSublayers:[source.m_layer.get() sublayers]];
</del><ins>+ [m_layer setSublayers:[source.m_layer.get() sublayers]];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -477,20 +477,20 @@
</span><span class="cx"> [propertyAnimation setDelegate:static_cast<id>(m_delegate.get())];
</span><span class="cx">
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() addAnimation:propertyAnimation forKey:key];
</del><ins>+ [m_layer addAnimation:propertyAnimation forKey:key];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerMac::removeAnimationForKey(const String& key)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() removeAnimationForKey:key];
</del><ins>+ [m_layer removeAnimationForKey:key];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> PassRefPtr<PlatformCAAnimation> PlatformCALayerMac::animationForKey(const String& key)
</span><span class="cx"> {
</span><del>- CAPropertyAnimation* propertyAnimation = static_cast<CAPropertyAnimation*>([m_layer.get() animationForKey:key]);
</del><ins>+ CAPropertyAnimation* propertyAnimation = static_cast<CAPropertyAnimation*>([m_layer animationForKey:key]);
</ins><span class="cx"> if (!propertyAnimation)
</span><span class="cx"> return 0;
</span><span class="cx"> return PlatformCAAnimationMac::create(propertyAnimation);
</span><span class="lines">@@ -499,31 +499,31 @@
</span><span class="cx"> void PlatformCALayerMac::setMask(PlatformCALayer* layer)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setMask:layer ? layer->platformLayer() : nil];
</del><ins>+ [m_layer setMask:layer ? layer->platformLayer() : nil];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool PlatformCALayerMac::isOpaque() const
</span><span class="cx"> {
</span><del>- return [m_layer.get() isOpaque];
</del><ins>+ return [m_layer isOpaque];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerMac::setOpaque(bool value)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setOpaque:value];
</del><ins>+ [m_layer setOpaque:value];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> FloatRect PlatformCALayerMac::bounds() const
</span><span class="cx"> {
</span><del>- return [m_layer.get() bounds];
</del><ins>+ return [m_layer bounds];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerMac::setBounds(const FloatRect& value)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setBounds:value];
</del><ins>+ [m_layer setBounds:value];
</ins><span class="cx">
</span><span class="cx"> if (requiresCustomAppearanceUpdateOnBoundsChange())
</span><span class="cx"> updateCustomAppearance(m_customAppearance);
</span><span class="lines">@@ -533,144 +533,144 @@
</span><span class="cx">
</span><span class="cx"> FloatPoint3D PlatformCALayerMac::position() const
</span><span class="cx"> {
</span><del>- CGPoint point = [m_layer.get() position];
- return FloatPoint3D(point.x, point.y, [m_layer.get() zPosition]);
</del><ins>+ CGPoint point = [m_layer position];
+ return FloatPoint3D(point.x, point.y, [m_layer zPosition]);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerMac::setPosition(const FloatPoint3D& value)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setPosition:CGPointMake(value.x(), value.y())];
- [m_layer.get() setZPosition:value.z()];
</del><ins>+ [m_layer setPosition:CGPointMake(value.x(), value.y())];
+ [m_layer setZPosition:value.z()];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> FloatPoint3D PlatformCALayerMac::anchorPoint() const
</span><span class="cx"> {
</span><del>- CGPoint point = [m_layer.get() anchorPoint];
</del><ins>+ CGPoint point = [m_layer anchorPoint];
</ins><span class="cx"> float z = 0;
</span><del>- z = [m_layer.get() anchorPointZ];
</del><ins>+ z = [m_layer anchorPointZ];
</ins><span class="cx"> return FloatPoint3D(point.x, point.y, z);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerMac::setAnchorPoint(const FloatPoint3D& value)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setAnchorPoint:CGPointMake(value.x(), value.y())];
- [m_layer.get() setAnchorPointZ:value.z()];
</del><ins>+ [m_layer setAnchorPoint:CGPointMake(value.x(), value.y())];
+ [m_layer setAnchorPointZ:value.z()];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TransformationMatrix PlatformCALayerMac::transform() const
</span><span class="cx"> {
</span><del>- return [m_layer.get() transform];
</del><ins>+ return [m_layer transform];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerMac::setTransform(const TransformationMatrix& value)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setTransform:value];
</del><ins>+ [m_layer setTransform:value];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TransformationMatrix PlatformCALayerMac::sublayerTransform() const
</span><span class="cx"> {
</span><del>- return [m_layer.get() sublayerTransform];
</del><ins>+ return [m_layer sublayerTransform];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerMac::setSublayerTransform(const TransformationMatrix& value)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setSublayerTransform:value];
</del><ins>+ [m_layer setSublayerTransform:value];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerMac::setHidden(bool value)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setHidden:value];
</del><ins>+ [m_layer setHidden:value];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerMac::setGeometryFlipped(bool value)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setGeometryFlipped:value];
</del><ins>+ [m_layer setGeometryFlipped:value];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool PlatformCALayerMac::isDoubleSided() const
</span><span class="cx"> {
</span><del>- return [m_layer.get() isDoubleSided];
</del><ins>+ return [m_layer isDoubleSided];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerMac::setDoubleSided(bool value)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setDoubleSided:value];
</del><ins>+ [m_layer setDoubleSided:value];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool PlatformCALayerMac::masksToBounds() const
</span><span class="cx"> {
</span><del>- return [m_layer.get() masksToBounds];
</del><ins>+ return [m_layer masksToBounds];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerMac::setMasksToBounds(bool value)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setMasksToBounds:value];
</del><ins>+ [m_layer setMasksToBounds:value];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool PlatformCALayerMac::acceleratesDrawing() const
</span><span class="cx"> {
</span><del>- return [m_layer.get() acceleratesDrawing];
</del><ins>+ return [m_layer acceleratesDrawing];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerMac::setAcceleratesDrawing(bool acceleratesDrawing)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setAcceleratesDrawing:acceleratesDrawing];
</del><ins>+ [m_layer setAcceleratesDrawing:acceleratesDrawing];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> CFTypeRef PlatformCALayerMac::contents() const
</span><span class="cx"> {
</span><del>- return [m_layer.get() contents];
</del><ins>+ return [m_layer contents];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerMac::setContents(CFTypeRef value)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setContents:static_cast<id>(const_cast<void*>(value))];
</del><ins>+ [m_layer setContents:static_cast<id>(const_cast<void*>(value))];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerMac::setContentsRect(const FloatRect& value)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setContentsRect:value];
</del><ins>+ [m_layer setContentsRect:value];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerMac::setMinificationFilter(FilterType value)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setMinificationFilter:toCAFilterType(value)];
</del><ins>+ [m_layer setMinificationFilter:toCAFilterType(value)];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerMac::setMagnificationFilter(FilterType value)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setMagnificationFilter:toCAFilterType(value)];
</del><ins>+ [m_layer setMagnificationFilter:toCAFilterType(value)];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Color PlatformCALayerMac::backgroundColor() const
</span><span class="cx"> {
</span><del>- return [m_layer.get() backgroundColor];
</del><ins>+ return [m_layer backgroundColor];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerMac::setBackgroundColor(const Color& value)
</span><span class="lines">@@ -682,14 +682,14 @@
</span><span class="cx"> RetainPtr<CGColorRef> color = adoptCF(CGColorCreate(colorSpace.get(), components));
</span><span class="cx">
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setBackgroundColor:color.get()];
</del><ins>+ [m_layer setBackgroundColor:color.get()];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerMac::setBorderWidth(float value)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setBorderWidth:value];
</del><ins>+ [m_layer setBorderWidth:value];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -703,24 +703,24 @@
</span><span class="cx"> RetainPtr<CGColorRef> color = adoptCF(CGColorCreate(colorSpace.get(), components));
</span><span class="cx">
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setBorderColor:color.get()];
</del><ins>+ [m_layer setBorderColor:color.get()];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> } else {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setBorderColor:nil];
</del><ins>+ [m_layer setBorderColor:nil];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> float PlatformCALayerMac::opacity() const
</span><span class="cx"> {
</span><del>- return [m_layer.get() opacity];
</del><ins>+ return [m_layer opacity];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerMac::setOpacity(float value)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setOpacity:value];
</del><ins>+ [m_layer setOpacity:value];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -732,7 +732,7 @@
</span><span class="cx"> void PlatformCALayerMac::copyFiltersFrom(const PlatformCALayer& sourceLayer)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setFilters:[sourceLayer.platformLayer() filters]];
</del><ins>+ [m_layer setFilters:[sourceLayer.platformLayer() filters]];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -770,41 +770,41 @@
</span><span class="cx"> void PlatformCALayerMac::setName(const String& value)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setName:value];
</del><ins>+ [m_layer setName:value];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerMac::setSpeed(float value)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setSpeed:value];
</del><ins>+ [m_layer setSpeed:value];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerMac::setTimeOffset(CFTimeInterval value)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setTimeOffset:value];
</del><ins>+ [m_layer setTimeOffset:value];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> float PlatformCALayerMac::contentsScale() const
</span><span class="cx"> {
</span><del>- return [m_layer.get() contentsScale];
</del><ins>+ return [m_layer contentsScale];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerMac::setContentsScale(float value)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setContentsScale:value];
</del><ins>+ [m_layer setContentsScale:value];
</ins><span class="cx"> #if PLATFORM(IOS)
</span><del>- [m_layer.get() setRasterizationScale:value];
</del><ins>+ [m_layer setRasterizationScale:value];
</ins><span class="cx">
</span><span class="cx"> if (m_layerType == LayerTypeWebTiledLayer) {
</span><span class="cx"> // This will invalidate all the tiles so we won't end up with stale tiles with the wrong scale in the wrong place,
</span><span class="cx"> // see <rdar://problem/9434765> for more information.
</span><span class="cx"> static NSDictionary *optionsDictionary = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithBool:YES], kCATiledLayerRemoveImmediately, nil];
</span><del>- [(CATiledLayer *)m_layer.get() setNeedsDisplayInRect:[m_layer.get() bounds] levelOfDetail:0 options:optionsDictionary];
</del><ins>+ [(CATiledLayer *)m_layer.get() setNeedsDisplayInRect:[m_layer bounds] levelOfDetail:0 options:optionsDictionary];
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="lines">@@ -812,20 +812,20 @@
</span><span class="cx">
</span><span class="cx"> float PlatformCALayerMac::cornerRadius() const
</span><span class="cx"> {
</span><del>- return [m_layer.get() cornerRadius];
</del><ins>+ return [m_layer cornerRadius];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerMac::setCornerRadius(float value)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setCornerRadius:value];
</del><ins>+ [m_layer setCornerRadius:value];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerMac::setEdgeAntialiasingMask(unsigned mask)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- [m_layer.get() setEdgeAntialiasingMask:mask];
</del><ins>+ [m_layer setEdgeAntialiasingMask:mask];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -850,6 +850,49 @@
</span><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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
+}
+
</ins><span class="cx"> bool PlatformCALayerMac::requiresCustomAppearanceUpdateOnBoundsChange() const
</span><span class="cx"> {
</span><span class="cx"> return m_customAppearance == GraphicsLayer::ScrollingShadow;
</span><span class="lines">@@ -892,7 +935,7 @@
</span><span class="cx"> {
</span><span class="cx"> BOOL result = NO;
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>- result = [m_layer.get() isKindOfClass:[WebLayer self]];
</del><ins>+ result = [m_layer isKindOfClass:[WebLayer self]];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> return result;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscawinPlatformCALayerWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp (180881 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -601,6 +601,28 @@
</span><span class="cx"> // FIXME: implement.
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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.
+}
+
</ins><span class="cx"> #ifndef NDEBUG
</span><span class="cx"> static void printIndent(int indent)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscawinPlatformCALayerWinh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h (180881 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -128,6 +128,12 @@
</span><span class="cx"> virtual FloatRoundedRect shapeRoundedRect() const override;
</span><span class="cx"> virtual void setShapeRoundedRect(const FloatRoundedRect&) override;
</span><span class="cx">
</span><ins>+ virtual Path shapePath() const override;
+ virtual void setShapePath(const Path&) override;
+
+ virtual WindRule shapeWindRule() const override;
+ virtual void setShapeWindRule(WindRule) override;
+
</ins><span class="cx"> virtual void setEdgeAntialiasingMask(unsigned) override;
</span><span class="cx">
</span><span class="cx"> virtual GraphicsLayer::CustomAppearance customAppearance() const override { return m_customAppearance; }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscgPathCGcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cg/PathCG.cpp (180881 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -74,7 +74,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Path::Path()
</span><del>- : m_path(0)
</del><ins>+ : m_path(nullptr)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (180881 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -4023,35 +4023,54 @@
</span><span class="cx"> return referenceBox;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool RenderLayer::setupClipPath(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, const LayoutSize& offsetFromRoot, LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed)
</del><ins>+bool RenderLayer::paintsWithClipPath() const
</ins><span class="cx"> {
</span><del>- if (!renderer().hasClipPath() || context->paintingDisabled())
- return false;
</del><ins>+ return renderer().style().clipPath() && !isComposited();
+}
</ins><span class="cx">
</span><del>- if (!rootRelativeBoundsComputed) {
- rootRelativeBounds = calculateLayerBounds(paintingInfo.rootLayer, offsetFromRoot, 0);
- rootRelativeBoundsComputed = true;
- }
</del><ins>+Path RenderLayer::computeClipPath(const LayoutSize& offsetFromRoot, LayoutRect& rootRelativeBounds, WindRule& windRule) const
+{
+ const RenderStyle& style = renderer().style();
</ins><span class="cx">
</span><del>- RenderStyle& style = renderer().style();
- ASSERT(style.clipPath());
</del><span class="cx"> if (is<ShapeClipPathOperation>(*style.clipPath())) {
</span><span class="cx"> auto& clipPath = downcast<ShapeClipPathOperation>(*style.clipPath());
</span><ins>+ LayoutRect referenceBox = computeReferenceBox(renderer(), clipPath, offsetFromRoot, rootRelativeBounds);
</ins><span class="cx">
</span><del>- LayoutRect referenceBox = computeReferenceBox(renderer(), clipPath, offsetFromRoot, rootRelativeBounds);
- context->save();
- context->clipPath(clipPath.pathForReferenceRect(referenceBox), clipPath.windRule());
- return true;
</del><ins>+ windRule = clipPath.windRule();
+ return clipPath.pathForReferenceRect(referenceBox);
</ins><span class="cx"> }
</span><ins>+
+ if (is<BoxClipPathOperation>(*style.clipPath()) && is<RenderBox>(renderer())) {
</ins><span class="cx">
</span><del>- if (is<BoxClipPathOperation>(*style.clipPath()) && is<RenderBox>(renderer())) {
</del><span class="cx"> auto& clipPath = downcast<BoxClipPathOperation>(*style.clipPath());
</span><span class="cx">
</span><span class="cx"> RoundedRect shapeRect = computeRoundedRectForBoxShape(clipPath.referenceBox(), downcast<RenderBox>(renderer()));
</span><span class="cx"> shapeRect.move(offsetFromRoot);
</span><span class="cx">
</span><ins>+ 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);
</ins><span class="cx"> context->save();
</span><del>- context->clipPath(clipPath.pathForReferenceRect(shapeRect), RULE_NONZERO);
</del><ins>+ context->clipPath(path, windRule);
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4218,8 +4237,11 @@
</span><span class="cx"> LayoutSize columnAwareOffsetFromRoot = offsetFromRoot;
</span><span class="cx"> if (renderer().flowThreadContainingBlock() && (renderer().hasClipPath() || hasFilterThatIsPainting(context, paintFlags)))
</span><span class="cx"> columnAwareOffsetFromRoot = toLayoutSize(convertToLayerCoords(paintingInfo.rootLayer, LayoutPoint(), AdjustForColumns));
</span><del>- bool hasClipPath = setupClipPath(context, paintingInfo, columnAwareOffsetFromRoot, rootRelativeBounds, rootRelativeBoundsComputed);
</del><span class="cx">
</span><ins>+ bool hasClipPath = false;
+ if (paintsWithClipPath() || (localPaintFlags & PaintLayerPaintingCompositingClipPathPhase) || (localPaintFlags & PaintLayerPaintingCompositingMaskPhase))
+ hasClipPath = setupClipPath(context, paintingInfo, columnAwareOffsetFromRoot, rootRelativeBounds, rootRelativeBoundsComputed);
+
</ins><span class="cx"> LayerPaintingInfo localPaintingInfo(paintingInfo);
</span><span class="cx">
</span><span class="cx"> GraphicsContext* transparencyLayerContext = context;
</span><span class="lines">@@ -4319,6 +4341,11 @@
</span><span class="cx"> paintMaskForFragments(layerFragments, context, localPaintingInfo, subtreePaintRootForRenderer);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if ((localPaintFlags & PaintLayerPaintingCompositingClipPathPhase) && shouldPaintContent && !selectionOnly) {
+ // Re-use paintChildClippingMaskForFragments to paint black for the compositing clipping mask.
+ paintChildClippingMaskForFragments(layerFragments, context, localPaintingInfo, subtreePaintRootForRenderer);
+ }
+
</ins><span class="cx"> if ((localPaintFlags & PaintLayerPaintingChildClippingMaskPhase) && shouldPaintContent && !selectionOnly) {
</span><span class="cx"> // Paint the border radius mask for the fragments.
</span><span class="cx"> paintChildClippingMaskForFragments(layerFragments, context, localPaintingInfo, subtreePaintRootForRenderer);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.h (180881 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -428,20 +428,21 @@
</span><span class="cx"> int zIndex() const { return renderer().style().zIndex(); }
</span><span class="cx">
</span><span class="cx"> enum PaintLayerFlag {
</span><del>- 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)
</del><ins>+ 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
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> typedef unsigned PaintLayerFlags;
</span><span class="lines">@@ -752,6 +753,11 @@
</span><span class="cx"> void updateCompositingAndLayerListsIfNeeded();
</span><span class="cx">
</span><span class="cx"> bool setupFontSubpixelQuantization(GraphicsContext*, bool& didQuantizeFonts);
</span><ins>+
+ bool paintsWithClipPath() const;
+
+ Path computeClipPath(const LayoutSize& offsetFromRoot, LayoutRect& rootRelativeBounds, WindRule&) const;
+
</ins><span class="cx"> bool setupClipPath(GraphicsContext*, const LayerPaintingInfo&, const LayoutSize& offsetFromRoot, LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed);
</span><span class="cx">
</span><span class="cx"> bool hasFilterThatIsPainting(GraphicsContext*, PaintLayerFlags) const;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerBackingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (180881 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -149,7 +149,7 @@
</span><span class="cx"> updateOverflowControlsLayers(false, false, false);
</span><span class="cx"> updateForegroundLayer(false);
</span><span class="cx"> updateBackgroundLayer(false);
</span><del>- updateMaskLayer(false);
</del><ins>+ updateMaskingLayer(false, false);
</ins><span class="cx"> updateScrollingLayers(false);
</span><span class="cx"> detachFromScrollingCoordinator();
</span><span class="cx"> destroyGraphicsLayers();
</span><span class="lines">@@ -570,7 +570,7 @@
</span><span class="cx"> m_graphicsLayer->addChild(flatteningLayer);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- updateMaskLayer(renderer().hasMask());
</del><ins>+ updateMaskingLayer(renderer().hasMask(), renderer().hasClipPath());
</ins><span class="cx">
</span><span class="cx"> updateChildClippingStrategy(needsDescendantsClippingLayer);
</span><span class="cx">
</span><span class="lines">@@ -827,11 +827,8 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (m_maskLayer) {
- m_maskLayer->setSize(m_graphicsLayer->size());
- m_maskLayer->setPosition(FloatPoint());
- m_maskLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer());
- }
</del><ins>+ if (m_maskLayer)
+ updateMaskingLayerGeometry();
</ins><span class="cx">
</span><span class="cx"> if (m_owningLayer.renderer().hasTransformRelatedProperty()) {
</span><span class="cx"> // Update properties that depend on layer dimensions.
</span><span class="lines">@@ -1005,6 +1002,28 @@
</span><span class="cx"> m_graphicsLayer->setContentsVisible(m_owningLayer.hasVisibleContent() || isPaintDestinationForDescendantLayers());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// 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);
+ }
+ }
+}
+
</ins><span class="cx"> void RenderLayerBacking::adjustAncestorCompositingBoundsForFlowThread(LayoutRect& ancestorCompositingBounds, const RenderLayer* compositingAncestor) const
</span><span class="cx"> {
</span><span class="cx"> if (!m_owningLayer.isInsideFlowThread())
</span><span class="lines">@@ -1409,14 +1428,33 @@
</span><span class="cx"> return layerChanged;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void RenderLayerBacking::updateMaskLayer(bool needsMaskLayer)
</del><ins>+// Masking layer is used for masks or clip-path.
+void RenderLayerBacking::updateMaskingLayer(bool hasMask, bool hasClipPath)
</ins><span class="cx"> {
</span><span class="cx"> bool layerChanged = false;
</span><del>- if (needsMaskLayer) {
</del><ins>+ 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;
+ }
+
</ins><span class="cx"> if (!m_maskLayer) {
</span><del>- m_maskLayer = createGraphicsLayer("Mask");
- m_maskLayer->setDrawsContent(true);
- m_maskLayer->setPaintingPhase(GraphicsLayerPaintMask);
</del><ins>+ m_maskLayer = createGraphicsLayer("Mask", requiredLayerType);
+ m_maskLayer->setDrawsContent(paintsContent);
+ m_maskLayer->setPaintingPhase(maskPhases);
</ins><span class="cx"> layerChanged = true;
</span><span class="cx"> m_graphicsLayer->setMaskLayer(m_maskLayer.get());
</span><span class="cx"> }
</span><span class="lines">@@ -1527,8 +1565,6 @@
</span><span class="cx"> phase |= GraphicsLayerPaintBackground;
</span><span class="cx"> if (!m_foregroundLayer)
</span><span class="cx"> phase |= GraphicsLayerPaintForeground;
</span><del>- if (!m_maskLayer)
- phase |= GraphicsLayerPaintMask;
</del><span class="cx">
</span><span class="cx"> if (m_scrollingContentsLayer) {
</span><span class="cx"> phase &= ~GraphicsLayerPaintForeground;
</span><span class="lines">@@ -2192,6 +2228,8 @@
</span><span class="cx"> paintFlags |= RenderLayer::PaintLayerPaintingCompositingForegroundPhase;
</span><span class="cx"> if (paintingPhase & GraphicsLayerPaintMask)
</span><span class="cx"> paintFlags |= RenderLayer::PaintLayerPaintingCompositingMaskPhase;
</span><ins>+ if (paintingPhase & GraphicsLayerPaintClipPath)
+ paintFlags |= RenderLayer::PaintLayerPaintingCompositingClipPathPhase;
</ins><span class="cx"> if (paintingPhase & GraphicsLayerPaintChildClippingMask)
</span><span class="cx"> paintFlags |= RenderLayer::PaintLayerPaintingChildClippingMaskPhase;
</span><span class="cx"> if (paintingPhase & GraphicsLayerPaintOverflowContents)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerBackingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (180881 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -266,13 +266,15 @@
</span><span class="cx"> bool updateOverflowControlsLayers(bool needsHorizontalScrollbarLayer, bool needsVerticalScrollbarLayer, bool needsScrollCornerLayer);
</span><span class="cx"> bool updateForegroundLayer(bool needsForegroundLayer);
</span><span class="cx"> bool updateBackgroundLayer(bool needsBackgroundLayer);
</span><del>- void updateMaskLayer(bool needsMaskLayer);
</del><ins>+ void updateMaskingLayer(bool hasMask, bool hasClipPath);
</ins><span class="cx"> bool requiresHorizontalScrollbarLayer() const;
</span><span class="cx"> bool requiresVerticalScrollbarLayer() const;
</span><span class="cx"> bool requiresScrollCornerLayer() const;
</span><span class="cx"> bool updateScrollingLayers(bool scrollingLayers);
</span><span class="cx"> void updateDrawsContent(bool isSimpleContainer);
</span><span class="cx"> void updateChildClippingStrategy(bool needsDescendantsClippingLayer);
</span><ins>+
+ void updateMaskingLayerGeometry();
</ins><span class="cx">
</span><span class="cx"> void updateRootLayerConfiguration();
</span><span class="cx">
</span><span class="lines">@@ -339,7 +341,7 @@
</span><span class="cx"> std::unique_ptr<GraphicsLayer> m_foregroundLayer; // Only used in cases where we need to draw the foreground separately.
</span><span class="cx"> std::unique_ptr<GraphicsLayer> m_backgroundLayer; // Only used in cases where we need to draw the background separately.
</span><span class="cx"> 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.
</span><del>- std::unique_ptr<GraphicsLayer> m_maskLayer; // Only used if we have a mask.
</del><ins>+ std::unique_ptr<GraphicsLayer> m_maskLayer; // Only used if we have a mask and/or clip-path.
</ins><span class="cx"> std::unique_ptr<GraphicsLayer> m_childClippingMaskLayer; // Only used if we have to clip child layers or accelerated contents with border radius or clip-path.
</span><span class="cx">
</span><span class="cx"> std::unique_ptr<GraphicsLayer> m_layerForHorizontalScrollbar;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (180881 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2015-03-01 Simon Fraser <simon.fraser@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:
+
</ins><span class="cx"> 2015-03-01 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> Make NotificationCenter / Notification suspendable
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebCoreArgumentCoderscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp (180881 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -49,6 +49,7 @@
</span><span class="cx"> #include <WebCore/IDBKeyRangeData.h>
</span><span class="cx"> #include <WebCore/Image.h>
</span><span class="cx"> #include <WebCore/Length.h>
</span><ins>+#include <WebCore/Path.h>
</ins><span class="cx"> #include <WebCore/PluginData.h>
</span><span class="cx"> #include <WebCore/ProtectionSpace.h>
</span><span class="cx"> #include <WebCore/Region.h>
</span><span class="lines">@@ -364,6 +365,115 @@
</span><span class="cx"> return SimpleArgumentCoder<IntSize>::decode(decoder, intSize);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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;
+}
+
</ins><span class="cx"> template<> struct ArgumentCoder<Region::Span> {
</span><span class="cx"> static void encode(ArgumentEncoder&, const Region::Span&);
</span><span class="cx"> static bool decode(ArgumentDecoder&, Region::Span&);
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebCoreArgumentCodersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h (180881 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -54,6 +54,7 @@
</span><span class="cx"> class KeyframeValueList;
</span><span class="cx"> class LinearTimingFunction;
</span><span class="cx"> class Notification;
</span><ins>+class Path;
</ins><span class="cx"> class ProtectionSpace;
</span><span class="cx"> class Region;
</span><span class="cx"> class ResourceError;
</span><span class="lines">@@ -198,6 +199,11 @@
</span><span class="cx"> static bool decode(ArgumentDecoder&, WebCore::IntSize&);
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+template<> struct ArgumentCoder<WebCore::Path> {
+ static void encode(ArgumentEncoder&, const WebCore::Path&);
+ static bool decode(ArgumentDecoder&, WebCore::Path&);
+};
+
</ins><span class="cx"> template<> struct ArgumentCoder<WebCore::Region> {
</span><span class="cx"> static void encode(ArgumentEncoder&, const WebCore::Region&);
</span><span class="cx"> static bool decode(ArgumentDecoder&, WebCore::Region&);
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacRemoteLayerTreePropertyAppliermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm (180881 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -197,6 +197,11 @@
</span><span class="cx"> [(CAShapeLayer *)layer setPath:path.platformPath()];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (properties.changedProperties & RemoteLayerTreeTransaction::ShapePathChanged) {
+ ASSERT([layer isKindOfClass:[CAShapeLayer class]]);
+ [(CAShapeLayer *)layer setPath:properties.shapePath.platformPath()];
+ }
+
</ins><span class="cx"> if (properties.changedProperties & RemoteLayerTreeTransaction::MinificationFilterChanged)
</span><span class="cx"> layer.minificationFilter = toCAFilterType(properties.minificationFilter);
</span><span class="cx">
</span><span class="lines">@@ -206,6 +211,19 @@
</span><span class="cx"> if (properties.changedProperties & RemoteLayerTreeTransaction::BlendModeChanged)
</span><span class="cx"> PlatformCAFilters::setBlendingFiltersOnLayer(layer, properties.blendMode);
</span><span class="cx">
</span><ins>+ 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;
+ }
+ }
+
</ins><span class="cx"> if (properties.changedProperties & RemoteLayerTreeTransaction::SpeedChanged)
</span><span class="cx"> layer.speed = properties.speed;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacRemoteLayerTreeTransactionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h (180881 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -73,16 +73,18 @@
</span><span class="cx"> ContentsScaleChanged = 1LLU << 20,
</span><span class="cx"> CornerRadiusChanged = 1LLU << 21,
</span><span class="cx"> ShapeRoundedRectChanged = 1LLU << 22,
</span><del>- 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
</del><ins>+ 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
</ins><span class="cx"> };
</span><span class="cx"> typedef uint64_t LayerChange;
</span><span class="cx">
</span><span class="lines">@@ -136,6 +138,7 @@
</span><span class="cx"> WebCore::FloatRect contentsRect;
</span><span class="cx"> std::unique_ptr<RemoteLayerBackingStore> backingStore;
</span><span class="cx"> std::unique_ptr<WebCore::FilterOperations> filters;
</span><ins>+ WebCore::Path shapePath;
</ins><span class="cx"> WebCore::GraphicsLayer::PlatformLayerID maskLayerID;
</span><span class="cx"> WebCore::GraphicsLayer::PlatformLayerID clonedLayerID;
</span><span class="cx"> double timeOffset;
</span><span class="lines">@@ -151,6 +154,7 @@
</span><span class="cx"> WebCore::PlatformCALayer::FilterType minificationFilter;
</span><span class="cx"> WebCore::PlatformCALayer::FilterType magnificationFilter;
</span><span class="cx"> WebCore::BlendMode blendMode;
</span><ins>+ WebCore::WindRule windRule;
</ins><span class="cx"> bool hidden;
</span><span class="cx"> bool geometryFlipped;
</span><span class="cx"> bool doubleSided;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacRemoteLayerTreeTransactionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm (180881 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -96,6 +96,7 @@
</span><span class="cx"> , minificationFilter(PlatformCALayer::FilterType::Linear)
</span><span class="cx"> , magnificationFilter(PlatformCALayer::FilterType::Linear)
</span><span class="cx"> , blendMode(BlendModeNormal)
</span><ins>+ , windRule(RULE_NONZERO)
</ins><span class="cx"> , hidden(false)
</span><span class="cx"> , geometryFlipped(false)
</span><span class="cx"> , doubleSided(true)
</span><span class="lines">@@ -115,6 +116,7 @@
</span><span class="cx"> , anchorPoint(other.anchorPoint)
</span><span class="cx"> , bounds(other.bounds)
</span><span class="cx"> , contentsRect(other.contentsRect)
</span><ins>+ , shapePath(other.shapePath)
</ins><span class="cx"> , maskLayerID(other.maskLayerID)
</span><span class="cx"> , clonedLayerID(other.clonedLayerID)
</span><span class="cx"> , timeOffset(other.timeOffset)
</span><span class="lines">@@ -130,6 +132,7 @@
</span><span class="cx"> , minificationFilter(other.minificationFilter)
</span><span class="cx"> , magnificationFilter(other.magnificationFilter)
</span><span class="cx"> , blendMode(other.blendMode)
</span><ins>+ , windRule(other.windRule)
</ins><span class="cx"> , hidden(other.hidden)
</span><span class="cx"> , geometryFlipped(other.geometryFlipped)
</span><span class="cx"> , doubleSided(other.doubleSided)
</span><span class="lines">@@ -224,6 +227,9 @@
</span><span class="cx"> if (changedProperties & ShapeRoundedRectChanged)
</span><span class="cx"> encoder << *shapeRoundedRect;
</span><span class="cx">
</span><ins>+ if (changedProperties & ShapePathChanged)
+ encoder << shapePath;
+
</ins><span class="cx"> if (changedProperties & MinificationFilterChanged)
</span><span class="cx"> encoder.encodeEnum(minificationFilter);
</span><span class="cx">
</span><span class="lines">@@ -233,6 +239,9 @@
</span><span class="cx"> if (changedProperties & BlendModeChanged)
</span><span class="cx"> encoder.encodeEnum(blendMode);
</span><span class="cx">
</span><ins>+ if (changedProperties & WindRuleChanged)
+ encoder.encodeEnum(windRule);
+
</ins><span class="cx"> if (changedProperties & SpeedChanged)
</span><span class="cx"> encoder << speed;
</span><span class="cx">
</span><span class="lines">@@ -393,6 +402,14 @@
</span><span class="cx"> result.shapeRoundedRect = std::make_unique<FloatRoundedRect>(roundedRect);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (result.changedProperties & ShapePathChanged) {
+ Path path;
+ if (!decoder.decode(path))
+ return false;
+
+ result.shapePath = WTF::move(path);
+ }
+
</ins><span class="cx"> if (result.changedProperties & MinificationFilterChanged) {
</span><span class="cx"> if (!decoder.decodeEnum(result.minificationFilter))
</span><span class="cx"> return false;
</span><span class="lines">@@ -408,6 +425,11 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (result.changedProperties & WindRuleChanged) {
+ if (!decoder.decodeEnum(result.windRule))
+ return false;
+ }
+
</ins><span class="cx"> if (result.changedProperties & SpeedChanged) {
</span><span class="cx"> if (!decoder.decode(result.speed))
</span><span class="cx"> return false;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacPlatformCALayerRemotecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp (180881 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -705,6 +705,32 @@
</span><span class="cx"> m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ShapeRoundedRectChanged);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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);
+}
+
</ins><span class="cx"> bool PlatformCALayerRemote::requiresCustomAppearanceUpdateOnBoundsChange() const
</span><span class="cx"> {
</span><span class="cx"> return m_properties.customAppearance == GraphicsLayer::ScrollingShadow;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacPlatformCALayerRemoteh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h (180881 => 180882)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -144,9 +144,16 @@
</span><span class="cx">
</span><span class="cx"> virtual void setEdgeAntialiasingMask(unsigned) override;
</span><span class="cx">
</span><ins>+ // FIXME: Having both shapeRoundedRect and shapePath is redundant. We could use shapePath for everything.
</ins><span class="cx"> virtual WebCore::FloatRoundedRect shapeRoundedRect() const override;
</span><span class="cx"> virtual void setShapeRoundedRect(const WebCore::FloatRoundedRect&) override;
</span><span class="cx">
</span><ins>+ 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;
+
</ins><span class="cx"> virtual WebCore::GraphicsLayer::CustomAppearance customAppearance() const override;
</span><span class="cx"> virtual void updateCustomAppearance(WebCore::GraphicsLayer::CustomAppearance) override;
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>