<!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>[175794] 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/175794">175794</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2014-11-09 11:42:17 -0800 (Sun, 09 Nov 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Implement round-rect clipping on video elements
https://bugs.webkit.org/show_bug.cgi?id=138537
rdar://problem/9534399
Reviewed by Darin Adler.
Source/WebCore:
Support border-radius on video and other layers with composited contents,
by pushing a FloatRoundedRect onto the GraphicsLayer as the contentsClippingRect,
and, on Mac, using layer corner-radius or a CAShapeLayer mask.
Test: compositing/video/video-border-radius.html
* WebCore.exp.in:
* platform/graphics/FloatRoundedRect.cpp:
(WebCore::FloatRoundedRect::Radii::isUniformCornerRadius): Returns true if all
corner radii are the same, and have equal widths and heights.
* platform/graphics/FloatRoundedRect.h: Allow construction without an explicit
rect.
* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::GraphicsLayer): nullptr goodness.
(showGraphicsLayerTree): Print contents layers when debugging.
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::contentsClippingRect): Make this take a FloatRoundedRect.
(WebCore::GraphicsLayer::setContentsClippingRect):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setContentsClippingRect):
(WebCore::GraphicsLayerCA::setContentsToSolidColor):
(WebCore::GraphicsLayerCA::setContentsToImage):
(WebCore::GraphicsLayerCA::setContentsToPlatformLayer):
(WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
(WebCore::GraphicsLayerCA::updateClippingStrategy): Determines whether we can simply
use corner-radius on the existing contentsClippingLayer, or whether we have to
create a shape layer to use as a mask.
(WebCore::GraphicsLayerCA::updateContentsRects): We have to add/remove the shape layer
based on the rounded rect radii. Calls updateClippingStrategy() on the clipping layer,
and also updates clones accordingly.
(WebCore::dumpInnerLayer):
(WebCore::GraphicsLayerCA::dumpAdditionalProperties): Dump all the inner layers
(requiring on test rebaseline), including the new shape and backdrop layers.
* platform/graphics/ca/GraphicsLayerCA.h:
* platform/graphics/ca/PlatformCALayer.h: Add a new shape layer type.
* platform/graphics/ca/mac/PlatformCALayerMac.h: Support for corner radius and
a rounded rect shape mask.
* platform/graphics/ca/mac/PlatformCALayerMac.mm:
(PlatformCALayerMac::PlatformCALayerMac):
(PlatformCALayerMac::clone):
(PlatformCALayerMac::setMask):
(PlatformCALayerMac::cornerRadius):
(PlatformCALayerMac::setCornerRadius):
(PlatformCALayerMac::shapeRoundedRect):
(PlatformCALayerMac::setShapeRoundedRect):
* platform/graphics/ca/win/PlatformCALayerWin.cpp:
(PlatformCALayerWin::cornerRadius):
(PlatformCALayerWin::setCornerRadius):
(PlatformCALayerWin::shapeRoundedRect):
(PlatformCALayerWin::setShapeRoundedRect):
* platform/graphics/ca/win/PlatformCALayerWin.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::resetContentsRect): Use getRoundedInnerBorderFor() to get
the rounded rect used to clip contents.
(WebCore::RenderLayerBacking::positionOverflowControlsLayers): Push a FloatRoundedRect for the contents clip,
(WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundColor): Ditto.
(WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundImage): Ditto.
(WebCore::RenderLayerBacking::updateImageContents): Get the rounded rect clip.
* rendering/RenderLayerBacking.h: nullptr.
Source/WebKit2:
Support border-radius on video and other layers with composited contents,
by pushing a FloatRoundedRect onto the GraphicsLayer as the contentsClippingRect,
and, on Mac, using layer corner-radius or a CAShapeLayer mask.
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<FloatRoundedRect>::encode):
(IPC::ArgumentCoder<FloatRoundedRect>::decode):
* Shared/WebCoreArgumentCoders.h:
* Shared/mac/RemoteLayerBackingStore.mm: New shape layer type.
(WebKit::RemoteLayerBackingStore::drawInContext):
* Shared/mac/RemoteLayerTreePropertyApplier.mm:
(WebKit::applyPropertiesToLayer): Apply corner-radius and shape path.
* Shared/mac/RemoteLayerTreeTransaction.h: Prettify the flags. Yes, I prefer this style.
* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
(WebKit::RemoteLayerTreeTextStream::operator<<):
(WebKit::dumpChangedLayers):
(WebKit::RemoteLayerTreeTransaction::description):
* UIProcess/ios/RemoteLayerTreeHostIOS.mm:
(+[WKShapeView layerClass]): Make UIViews with a CAShapeLayer layer class.
(WebKit::RemoteLayerTreeHost::createLayer):
* UIProcess/mac/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::createLayer):
* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::updateClonedLayerProperties):
(WebKit::isEquivalentLayer):
(WebKit::PlatformCALayerRemote::setMask):
(WebKit::PlatformCALayerRemote::setClonedLayer):
(WebKit::PlatformCALayerRemote::cornerRadius):
(WebKit::PlatformCALayerRemote::setCornerRadius):
(WebKit::PlatformCALayerRemote::shapeRoundedRect):
(WebKit::PlatformCALayerRemote::setShapeRoundedRect):
* WebProcess/WebPage/mac/PlatformCALayerRemote.h:
LayoutTests:
Test that uses clip() to compare a bit of rounded-rect video in the corner.
Rebaselined test that dumped contents layers.
* compositing/video/video-border-radius-expected.html: Added.
* compositing/video/video-border-radius.html: Added.
* platform/mac/compositing/reflections/direct-image-object-fit-reflected-expected.txt:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmaccompositingreflectionsdirectimageobjectfitreflectedexpectedtxt">trunk/LayoutTests/platform/mac/compositing/reflections/direct-image-object-fit-reflected-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsFloatRoundedRectcpp">trunk/Source/WebCore/platform/graphics/FloatRoundedRect.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsFloatRoundedRecth">trunk/Source/WebCore/platform/graphics/FloatRoundedRect.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsFloatSizeh">trunk/Source/WebCore/platform/graphics/FloatSize.h</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="#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="#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="#trunkSourceWebKit2SharedmacRemoteLayerBackingStoremm">trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm</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="#trunkSourceWebKit2UIProcessiosRemoteLayerTreeHostIOSmm">trunk/Source/WebKit2/UIProcess/ios/RemoteLayerTreeHostIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacRemoteLayerTreeHostmm">trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.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="#trunkLayoutTestscompositingvideovideoborderradiusexpectedhtml">trunk/LayoutTests/compositing/video/video-border-radius-expected.html</a></li>
<li><a href="#trunkLayoutTestscompositingvideovideoborderradiushtml">trunk/LayoutTests/compositing/video/video-border-radius.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/LayoutTests/ChangeLog        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-11-08 Simon Fraser <simon.fraser@apple.com>
+
+ Implement round-rect clipping on video elements
+ https://bugs.webkit.org/show_bug.cgi?id=138537
+ rdar://problem/9534399
+
+ Reviewed by Darin Adler.
+
+ Test that uses clip() to compare a bit of rounded-rect video in the corner.
+ Rebaselined test that dumped contents layers.
+
+ * compositing/video/video-border-radius-expected.html: Added.
+ * compositing/video/video-border-radius.html: Added.
+ * platform/mac/compositing/reflections/direct-image-object-fit-reflected-expected.txt:
+
</ins><span class="cx"> 2014-11-08 Alexey Proskuryakov <ap@apple.com>
</span><span class="cx">
</span><span class="cx"> http/tests/xmlhttprequest/cross-origin-cookie-storage.html fails with PPT.
</span></span></pre></div>
<a id="trunkLayoutTestscompositingvideovideoborderradiusexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/video/video-border-radius-expected.html (0 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/video/video-border-radius-expected.html         (rev 0)
+++ trunk/LayoutTests/compositing/video/video-border-radius-expected.html        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -0,0 +1,61 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<style>
+ .wrapper {
+ position: absolute;
+ clip: rect(0, 20px, 50px, 0);
+ background-color: gray;
+ width: 300px;
+ height: 250px;
+ margin: 5px;
+ border: 1px solid black;
+ -webkit-box-reflect: right 10px;
+ }
+
+ .wrapper.non-uniform {
+ clip: rect(0, 50px, 20px, 0);
+ }
+
+ .wrapper > .obscurer {
+ border-radius: 50%;
+ }
+ .non-uniform.wrapper > .obscurer {
+ border-top-left-radius: 300px 100px;
+ border-bottom-right-radius: 250px 10px;
+ }
+
+ .obscurer {
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ background-color: green;
+ }
+
+ .composited {
+ -webkit-transform: translateZ(0);
+ }
+
+ .box {
+ position: absolute;
+ top: 100px;
+ left: 100px;
+ width: 100px;
+ height: 100px;
+ background-color: blue;
+ }
+</style>
+</head>
+<body>
+
+ <div class="wrapper">
+ <div class="composited box"></div>
+ <div class="obscurer"></div>
+ </div>
+
+ <div class="wrapper non-uniform" style="top: 100px;">
+ <div class="composited box"></div>
+ <div class="obscurer"></div>
+ </div>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingvideovideoborderradiushtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/video/video-border-radius.html (0 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/video/video-border-radius.html         (rev 0)
+++ trunk/LayoutTests/compositing/video/video-border-radius.html        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -0,0 +1,84 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<style>
+ .wrapper {
+ position: absolute;
+ clip: rect(0, 20px, 50px, 0);
+ background-color: gray;
+ width: 300px;
+ height: 250px;
+ margin: 5px;
+ border: 1px solid black;
+ -webkit-box-reflect: right 10px;
+ }
+
+ .wrapper.non-uniform {
+ clip: rect(0, 50px, 20px, 0);
+ }
+
+ video {
+ position: absolute;
+ top: 1px; /* inset slightly to avoid antialiasing diffs */
+ left: 1px;
+ width: 298px;
+ height: 248px;
+ border-radius: 50%;
+ box-sizing: border-box;
+ }
+
+ .wrapper > * {
+ border-radius: 50%;
+ }
+
+ .non-uniform.wrapper > * {
+ border-radius: 50%;
+ border-top-left-radius: 300px 100px;
+ border-bottom-right-radius: 250px 10px;
+ }
+
+ .obscurer { /* This should cover the video */
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ background-color: green;
+ }
+</style>
+<script src="../../media/media-file.js"></script>
+<script>
+ if (window.testRunner)
+ testRunner.waitUntilDone();
+
+ function init()
+ {
+ setSrcByTagName("video", findMediaFile("video", "../../media/content/counting"));
+
+ var totalCount = document.getElementsByTagName('video').length;
+ var count = totalCount;
+ window.console.log('loading videos')
+ document.addEventListener("canplaythrough", function () {
+ window.console.log('loaded videos ' + count)
+ if (!--count) {
+ if (window.testRunner)
+ setTimeout(function() {
+ testRunner.notifyDone();
+ }, totalCount * 150);
+ }
+ }, true);
+ }
+</script>
+
+</head>
+<body onload="init();">
+
+ <div class="wrapper">
+ <video></video>
+ <div class="obscurer"></div>
+ </div>
+
+ <div class="wrapper non-uniform" style="top: 100px;">
+ <video></video>
+ <div class="obscurer"></div>
+ </div>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmaccompositingreflectionsdirectimageobjectfitreflectedexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/compositing/reflections/direct-image-object-fit-reflected-expected.txt (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/compositing/reflections/direct-image-object-fit-reflected-expected.txt        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/LayoutTests/platform/mac/compositing/reflections/direct-image-object-fit-reflected-expected.txt        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -16,6 +16,7 @@
</span><span class="cx"> (transform [1.00 0.00 0.00 0.00] [0.00 -1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 140.00 0.00 1.00])
</span><span class="cx"> (replicated layer)
</span><span class="cx"> )
</span><ins>+ (structural layer 128.00, 88.00 200.00 x 120.00)
</ins><span class="cx"> (contents clipping layer 0.00, 0.00 200.00 x 120.00)
</span><span class="cx"> (contents layer -20.00, 0.00 240.00 x 120.00)
</span><span class="cx"> )
</span><span class="lines">@@ -28,6 +29,7 @@
</span><span class="cx"> (transform [1.00 0.00 0.00 0.00] [0.00 -1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 140.00 0.00 1.00])
</span><span class="cx"> (replicated layer)
</span><span class="cx"> )
</span><ins>+ (structural layer 372.00, 88.00 200.00 x 120.00)
</ins><span class="cx"> (contents layer 0.00, 10.00 200.00 x 100.00)
</span><span class="cx"> )
</span><span class="cx"> (GraphicsLayer
</span><span class="lines">@@ -39,6 +41,7 @@
</span><span class="cx"> (transform [1.00 0.00 0.00 0.00] [0.00 -1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 140.00 0.00 1.00])
</span><span class="cx"> (replicated layer)
</span><span class="cx"> )
</span><ins>+ (structural layer 616.00, 88.00 200.00 x 120.00)
</ins><span class="cx"> (contents clipping layer 0.00, 0.00 200.00 x 120.00)
</span><span class="cx"> (contents layer -44.00, -12.00 288.00 x 144.00)
</span><span class="cx"> )
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebCore/ChangeLog        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -1,3 +1,71 @@
</span><ins>+2014-11-08 Simon Fraser <simon.fraser@apple.com>
+
+ Implement round-rect clipping on video elements
+ https://bugs.webkit.org/show_bug.cgi?id=138537
+ rdar://problem/9534399
+
+ Reviewed by Darin Adler.
+
+ Support border-radius on video and other layers with composited contents,
+ by pushing a FloatRoundedRect onto the GraphicsLayer as the contentsClippingRect,
+ and, on Mac, using layer corner-radius or a CAShapeLayer mask.
+
+ Test: compositing/video/video-border-radius.html
+
+ * WebCore.exp.in:
+ * platform/graphics/FloatRoundedRect.cpp:
+ (WebCore::FloatRoundedRect::Radii::isUniformCornerRadius): Returns true if all
+ corner radii are the same, and have equal widths and heights.
+ * platform/graphics/FloatRoundedRect.h: Allow construction without an explicit
+ rect.
+ * platform/graphics/GraphicsLayer.cpp:
+ (WebCore::GraphicsLayer::GraphicsLayer): nullptr goodness.
+ (showGraphicsLayerTree): Print contents layers when debugging.
+ * platform/graphics/GraphicsLayer.h:
+ (WebCore::GraphicsLayer::contentsClippingRect): Make this take a FloatRoundedRect.
+ (WebCore::GraphicsLayer::setContentsClippingRect):
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayerCA::setContentsClippingRect):
+ (WebCore::GraphicsLayerCA::setContentsToSolidColor):
+ (WebCore::GraphicsLayerCA::setContentsToImage):
+ (WebCore::GraphicsLayerCA::setContentsToPlatformLayer):
+ (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
+ (WebCore::GraphicsLayerCA::updateClippingStrategy): Determines whether we can simply
+ use corner-radius on the existing contentsClippingLayer, or whether we have to
+ create a shape layer to use as a mask.
+ (WebCore::GraphicsLayerCA::updateContentsRects): We have to add/remove the shape layer
+ based on the rounded rect radii. Calls updateClippingStrategy() on the clipping layer,
+ and also updates clones accordingly.
+ (WebCore::dumpInnerLayer):
+ (WebCore::GraphicsLayerCA::dumpAdditionalProperties): Dump all the inner layers
+ (requiring on test rebaseline), including the new shape and backdrop layers.
+ * platform/graphics/ca/GraphicsLayerCA.h:
+ * platform/graphics/ca/PlatformCALayer.h: Add a new shape layer type.
+ * platform/graphics/ca/mac/PlatformCALayerMac.h: Support for corner radius and
+ a rounded rect shape mask.
+ * platform/graphics/ca/mac/PlatformCALayerMac.mm:
+ (PlatformCALayerMac::PlatformCALayerMac):
+ (PlatformCALayerMac::clone):
+ (PlatformCALayerMac::setMask):
+ (PlatformCALayerMac::cornerRadius):
+ (PlatformCALayerMac::setCornerRadius):
+ (PlatformCALayerMac::shapeRoundedRect):
+ (PlatformCALayerMac::setShapeRoundedRect):
+ * platform/graphics/ca/win/PlatformCALayerWin.cpp:
+ (PlatformCALayerWin::cornerRadius):
+ (PlatformCALayerWin::setCornerRadius):
+ (PlatformCALayerWin::shapeRoundedRect):
+ (PlatformCALayerWin::setShapeRoundedRect):
+ * platform/graphics/ca/win/PlatformCALayerWin.h:
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::resetContentsRect): Use getRoundedInnerBorderFor() to get
+ the rounded rect used to clip contents.
+ (WebCore::RenderLayerBacking::positionOverflowControlsLayers): Push a FloatRoundedRect for the contents clip,
+ (WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundColor): Ditto.
+ (WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundImage): Ditto.
+ (WebCore::RenderLayerBacking::updateImageContents): Get the rounded rect clip.
+ * rendering/RenderLayerBacking.h: nullptr.
+
</ins><span class="cx"> 2014-11-09 Darin Adler <darin@apple.com>
</span><span class="cx">
</span><span class="cx"> Fix various cases of incorrect cross-thread capture of non-thread-safe RefCounted
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -594,7 +594,7 @@
</span><span class="cx"> __ZN7WebCore15GraphicsLayerCA21setBackfaceVisibilityEb
</span><span class="cx"> __ZN7WebCore15GraphicsLayerCA21setNeedsDisplayInRectERKNS_9FloatRectENS_13GraphicsLayer17ShouldClipToLayerE
</span><span class="cx"> __ZN7WebCore15GraphicsLayerCA21setShowRepaintCounterEb
</span><del>-__ZN7WebCore15GraphicsLayerCA23setContentsClippingRectERKNS_9FloatRectE
</del><ins>+__ZN7WebCore15GraphicsLayerCA23setContentsClippingRectERKNS_16FloatRoundedRectE
</ins><span class="cx"> __ZN7WebCore15GraphicsLayerCA23setContentsNeedsDisplayEv
</span><span class="cx"> __ZN7WebCore15GraphicsLayerCA23setContentsToSolidColorERKNS_5ColorE
</span><span class="cx"> __ZN7WebCore15GraphicsLayerCA23setDebugBackgroundColorERKNS_5ColorE
</span><span class="lines">@@ -687,6 +687,7 @@
</span><span class="cx"> __ZN7WebCore16DeviceMotionData6createEN3WTF10PassRefPtrINS0_12AccelerationEEES4_NS2_INS0_12RotationRateEEEbd
</span><span class="cx"> __ZN7WebCore16FilterOperationsC1Ev
</span><span class="cx"> __ZN7WebCore16FilterOperationsaSERKS0_
</span><ins>+__ZN7WebCore16FloatRoundedRectC1ERKNS_9FloatRectERKNS0_5RadiiE
</ins><span class="cx"> __ZN7WebCore16FontPlatformDataD1Ev
</span><span class="cx"> __ZN7WebCore16FrameLoadRequestC1EPNS_5FrameERKNS_15ResourceRequestERKNS_14SubstituteDataE
</span><span class="cx"> __ZN7WebCore16HTMLInputElement13setAutofilledEb
</span><span class="lines">@@ -1179,6 +1180,7 @@
</span><span class="cx"> __ZN7WebCore4Page9initGroupEv
</span><span class="cx"> __ZN7WebCore4PageC1ERNS0_11PageClientsE
</span><span class="cx"> __ZN7WebCore4PageD1Ev
</span><ins>+__ZN7WebCore4Path14addRoundedRectERKNS_16FloatRoundedRectENS0_19RoundedRectStrategyE
</ins><span class="cx"> __ZN7WebCore4Path14addRoundedRectERKNS_9FloatRectERKNS_9FloatSizeENS0_19RoundedRectStrategyE
</span><span class="cx"> __ZN7WebCore4PathC1Ev
</span><span class="cx"> __ZN7WebCore4PathD1Ev
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFloatRoundedRectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/FloatRoundedRect.cpp (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/FloatRoundedRect.cpp        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebCore/platform/graphics/FloatRoundedRect.cpp        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -62,6 +62,14 @@
</span><span class="cx"> return m_topLeft.isZero() && m_topRight.isZero() && m_bottomLeft.isZero() && m_bottomRight.isZero();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool FloatRoundedRect::Radii::isUniformCornerRadius() const
+{
+ return WTF::withinEpsilon(m_topLeft.width(), m_topLeft.height())
+ && withinEpsilon(m_topLeft, m_topRight)
+ && withinEpsilon(m_topLeft, m_bottomLeft)
+ && withinEpsilon(m_topLeft, m_bottomRight);
+}
+
</ins><span class="cx"> void FloatRoundedRect::Radii::scale(float factor)
</span><span class="cx"> {
</span><span class="cx"> scale(factor, factor);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFloatRoundedRecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/FloatRoundedRect.h (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/FloatRoundedRect.h        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebCore/platform/graphics/FloatRoundedRect.h        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -67,6 +67,7 @@
</span><span class="cx"> const FloatSize& bottomRight() const { return m_bottomRight; }
</span><span class="cx">
</span><span class="cx"> bool isZero() const;
</span><ins>+ bool isUniformCornerRadius() const; // Including no radius.
</ins><span class="cx">
</span><span class="cx"> void scale(float factor);
</span><span class="cx"> void scale(float horizontalFactor, float verticalFactor);
</span><span class="lines">@@ -82,7 +83,7 @@
</span><span class="cx"> FloatSize m_bottomRight;
</span><span class="cx"> };
</span><span class="cx">
</span><del>- explicit FloatRoundedRect(const FloatRect&, const Radii& = Radii());
</del><ins>+ explicit FloatRoundedRect(const FloatRect& = FloatRect(), const Radii& = Radii());
</ins><span class="cx"> explicit FloatRoundedRect(const RoundedRect&);
</span><span class="cx"> FloatRoundedRect(float x, float y, float width, float height);
</span><span class="cx"> FloatRoundedRect(const FloatRect&, const FloatSize& topLeft, const FloatSize& topRight, const FloatSize& bottomLeft, const FloatSize& bottomRight);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFloatSizeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/FloatSize.h (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/FloatSize.h        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebCore/platform/graphics/FloatSize.h        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -168,6 +168,11 @@
</span><span class="cx"> return a.width() == b.width() && a.height() == b.height();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+inline bool withinEpsilon(const FloatSize& a, const FloatSize& b)
+{
+ return WTF::withinEpsilon(a.width(), b.width()) && WTF::withinEpsilon(a.height(), b.height());
+}
+
</ins><span class="cx"> inline bool operator!=(const FloatSize& a, const FloatSize& b)
</span><span class="cx"> {
</span><span class="cx"> return a.width() != b.width() || a.height() != b.height();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -93,10 +93,10 @@
</span><span class="cx"> , m_isMaskLayer(false)
</span><span class="cx"> , m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip)
</span><span class="cx"> , m_contentsOrientation(CompositingCoordinatesTopDown)
</span><del>- , m_parent(0)
- , m_maskLayer(0)
- , m_replicaLayer(0)
- , m_replicatedLayer(0)
</del><ins>+ , m_parent(nullptr)
+ , m_maskLayer(nullptr)
+ , m_replicaLayer(nullptr)
+ , m_replicatedLayer(nullptr)
</ins><span class="cx"> , m_repaintCount(0)
</span><span class="cx"> , m_customAppearance(NoCustomAppearance)
</span><span class="cx"> , m_customBehavior(NoCustomBehavior)
</span><span class="lines">@@ -808,7 +808,7 @@
</span><span class="cx"> if (!layer)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- String output = layer->layerTreeAsText(WebCore::LayerTreeAsTextDebug | WebCore::LayerTreeAsTextIncludeVisibleRects | WebCore::LayerTreeAsTextIncludeTileCaches);
</del><ins>+ String output = layer->layerTreeAsText(WebCore::LayerTreeAsTextDebug | WebCore::LayerTreeAsTextIncludeVisibleRects | WebCore::LayerTreeAsTextIncludeTileCaches | WebCore::LayerTreeAsTextIncludeContentLayers);
</ins><span class="cx"> fprintf(stderr, "%s\n", output.utf8().data());
</span><span class="cx"> }
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsLayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx"> #include "FilterOperations.h"
</span><span class="cx"> #include "FloatPoint.h"
</span><span class="cx"> #include "FloatPoint3D.h"
</span><del>-#include "FloatRect.h"
</del><ins>+#include "FloatRoundedRect.h"
</ins><span class="cx"> #include "FloatSize.h"
</span><span class="cx"> #include "GraphicsLayerClient.h"
</span><span class="cx"> #include "IntRect.h"
</span><span class="lines">@@ -382,8 +382,8 @@
</span><span class="cx"> FloatRect contentsRect() const { return m_contentsRect; }
</span><span class="cx"> virtual void setContentsRect(const FloatRect& r) { m_contentsRect = r; }
</span><span class="cx">
</span><del>- FloatRect contentsClippingRect() const { return m_contentsClippingRect; }
- virtual void setContentsClippingRect(const FloatRect& r) { m_contentsClippingRect = r; }
</del><ins>+ FloatRoundedRect contentsClippingRect() const { return m_contentsClippingRect; }
+ virtual void setContentsClippingRect(const FloatRoundedRect& roundedRect) { m_contentsClippingRect = roundedRect; }
</ins><span class="cx">
</span><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="lines">@@ -602,7 +602,7 @@
</span><span class="cx"> FloatPoint m_replicatedLayerPosition; // For a replica layer, the position of the replica.
</span><span class="cx">
</span><span class="cx"> FloatRect m_contentsRect;
</span><del>- FloatRect m_contentsClippingRect;
</del><ins>+ FloatRoundedRect m_contentsClippingRect;
</ins><span class="cx"> FloatPoint m_contentsTilePhase;
</span><span class="cx"> FloatSize m_contentsTileSize;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscaGraphicsLayerCAcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -778,7 +778,7 @@
</span><span class="cx"> noteLayerPropertyChanged(ContentsRectsChanged);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void GraphicsLayerCA::setContentsClippingRect(const FloatRect& rect)
</del><ins>+void GraphicsLayerCA::setContentsClippingRect(const FloatRoundedRect& rect)
</ins><span class="cx"> {
</span><span class="cx"> if (rect == m_contentsClippingRect)
</span><span class="cx"> return;
</span><span class="lines">@@ -883,7 +883,7 @@
</span><span class="cx"> } else {
</span><span class="cx"> contentsLayerChanged = m_contentsLayer;
</span><span class="cx"> m_contentsLayerPurpose = NoContentsLayer;
</span><del>- m_contentsLayer = 0;
</del><ins>+ m_contentsLayer = nullptr;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (contentsLayerChanged)
</span><span class="lines">@@ -922,8 +922,8 @@
</span><span class="cx"> if (!m_contentsLayer)
</span><span class="cx"> noteSublayersChanged();
</span><span class="cx"> } else {
</span><del>- m_uncorrectedContentsImage = 0;
- m_pendingContentsImage = 0;
</del><ins>+ m_uncorrectedContentsImage = nullptr;
+ m_pendingContentsImage = nullptr;
</ins><span class="cx"> m_contentsLayerPurpose = NoContentsLayer;
</span><span class="cx"> if (m_contentsLayer)
</span><span class="cx"> noteSublayersChanged();
</span><span class="lines">@@ -945,7 +945,7 @@
</span><span class="cx"> // the creator of the raw layer is using it for some other purpose.
</span><span class="cx"> // For now we don't support such a case.
</span><span class="cx"> PlatformCALayer* platformCALayer = PlatformCALayer::platformCALayer(platformLayer);
</span><del>- m_contentsLayer = platformLayer ? (platformCALayer ? platformCALayer : createPlatformCALayer(platformLayer, this)) : 0;
</del><ins>+ m_contentsLayer = platformLayer ? (platformCALayer ? platformCALayer : createPlatformCALayer(platformLayer, this)) : nullptr;
</ins><span class="cx"> m_contentsLayerPurpose = platformLayer ? purpose : NoContentsLayer;
</span><span class="cx">
</span><span class="cx"> noteSublayersChanged();
</span><span class="lines">@@ -1355,7 +1355,7 @@
</span><span class="cx">
</span><span class="cx"> if (m_uncommittedChanges & VisibleRectChanged)
</span><span class="cx"> updateVisibleRect(oldVisibleRect);
</span><del>-
</del><ins>+
</ins><span class="cx"> if (m_uncommittedChanges & TilingAreaChanged) // Needs to happen after VisibleRectChanged, ContentsScaleChanged
</span><span class="cx"> updateTiles();
</span><span class="cx">
</span><span class="lines">@@ -1512,20 +1512,19 @@
</span><span class="cx"> m_structuralLayer->setAnchorPoint(m_anchorPoint);
</span><span class="cx">
</span><span class="cx"> if (LayerMap* layerCloneMap = m_structuralLayerClones.get()) {
</span><del>- LayerMap::const_iterator end = layerCloneMap->end();
- for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++it) {
- PlatformCALayer* clone = it->value.get();
</del><ins>+ for (auto& clone : *layerCloneMap) {
+ PlatformCALayer* cloneLayer = clone.value.get();
</ins><span class="cx"> FloatPoint clonePosition = layerPosition;
</span><span class="cx">
</span><del>- if (m_replicaLayer && isReplicatedRootClone(it->key)) {
</del><ins>+ if (m_replicaLayer && isReplicatedRootClone(clone.key)) {
</ins><span class="cx"> // Maintain the special-case position for the root of a clone subtree,
</span><span class="cx"> // which we set up in replicatedLayerRoot().
</span><span class="cx"> clonePosition = positionForCloneRootLayer();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- clone->setPosition(clonePosition);
- clone->setBounds(layerBounds);
- clone->setAnchorPoint(m_anchorPoint);
</del><ins>+ cloneLayer->setPosition(clonePosition);
+ cloneLayer->setBounds(layerBounds);
+ cloneLayer->setAnchorPoint(m_anchorPoint);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1549,20 +1548,19 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (LayerMap* layerCloneMap = m_layerClones.get()) {
</span><del>- LayerMap::const_iterator end = layerCloneMap->end();
- for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++it) {
- PlatformCALayer* clone = it->value.get();
</del><ins>+ for (auto& clone : *layerCloneMap) {
+ PlatformCALayer* cloneLayer = clone.value.get();
</ins><span class="cx"> FloatPoint clonePosition = adjustedPosition;
</span><span class="cx">
</span><del>- if (!m_structuralLayer && m_replicaLayer && isReplicatedRootClone(it->key)) {
</del><ins>+ if (!m_structuralLayer && m_replicaLayer && isReplicatedRootClone(clone.key)) {
</ins><span class="cx"> // Maintain the special-case position for the root of a clone subtree,
</span><span class="cx"> // which we set up in replicatedLayerRoot().
</span><span class="cx"> clonePosition = positionForCloneRootLayer();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- clone->setPosition(clonePosition);
- clone->setBounds(adjustedBounds);
- clone->setAnchorPoint(scaledAnchorPoint);
</del><ins>+ cloneLayer->setPosition(clonePosition);
+ cloneLayer->setBounds(adjustedBounds);
+ cloneLayer->setAnchorPoint(scaledAnchorPoint);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -1572,10 +1570,9 @@
</span><span class="cx"> primaryLayer()->setTransform(m_transform);
</span><span class="cx">
</span><span class="cx"> if (LayerMap* layerCloneMap = primaryLayerClones()) {
</span><del>- LayerMap::const_iterator end = layerCloneMap->end();
- for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++it) {
- PlatformCALayer* currLayer = it->value.get();
- if (m_replicaLayer && isReplicatedRootClone(it->key)) {
</del><ins>+ for (auto& clone : *layerCloneMap) {
+ PlatformCALayer* currLayer = clone.value.get();
+ if (m_replicaLayer && isReplicatedRootClone(clone.key)) {
</ins><span class="cx"> // Maintain the special-case transform for the root of a clone subtree,
</span><span class="cx"> // which we set up in replicatedLayerRoot().
</span><span class="cx"> currLayer->setTransform(TransformationMatrix());
</span><span class="lines">@@ -1590,9 +1587,8 @@
</span><span class="cx"> primaryLayer()->setSublayerTransform(m_childrenTransform);
</span><span class="cx">
</span><span class="cx"> if (LayerMap* layerCloneMap = primaryLayerClones()) {
</span><del>- LayerMap::const_iterator end = layerCloneMap->end();
- for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++it)
- it->value->setSublayerTransform(m_childrenTransform);
</del><ins>+ for (auto & layer : layerCloneMap->values())
+ layer->setSublayerTransform(m_childrenTransform);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1601,9 +1597,8 @@
</span><span class="cx"> m_layer->setMasksToBounds(m_masksToBounds);
</span><span class="cx">
</span><span class="cx"> if (LayerMap* layerCloneMap = m_layerClones.get()) {
</span><del>- LayerMap::const_iterator end = layerCloneMap->end();
- for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++it)
- it->value->setMasksToBounds(m_masksToBounds);
</del><ins>+ for (auto & layer : layerCloneMap->values())
+ layer->setMasksToBounds(m_masksToBounds);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1614,12 +1609,11 @@
</span><span class="cx"> if (m_drawsContent)
</span><span class="cx"> m_layer->setNeedsDisplay();
</span><span class="cx"> } else {
</span><del>- m_layer->setContents(0);
</del><ins>+ m_layer->setContents(nullptr);
</ins><span class="cx">
</span><span class="cx"> if (LayerMap* layerCloneMap = m_layerClones.get()) {
</span><del>- LayerMap::const_iterator end = layerCloneMap->end();
- for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++it)
- it->value->setContents(0);
</del><ins>+ for (auto & layer : layerCloneMap->values())
+ layer->setContents(nullptr);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -1636,9 +1630,8 @@
</span><span class="cx"> m_layer->setOpaque(contentsOpaque);
</span><span class="cx">
</span><span class="cx"> if (LayerMap* layerCloneMap = m_layerClones.get()) {
</span><del>- LayerMap::const_iterator end = layerCloneMap->end();
- for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++it)
- it->value->setOpaque(contentsOpaque);
</del><ins>+ for (auto & layer : layerCloneMap->values())
+ layer->setOpaque(contentsOpaque);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1648,18 +1641,16 @@
</span><span class="cx"> m_structuralLayer->setDoubleSided(m_backfaceVisibility);
</span><span class="cx">
</span><span class="cx"> if (LayerMap* layerCloneMap = m_structuralLayerClones.get()) {
</span><del>- LayerMap::const_iterator end = layerCloneMap->end();
- for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++it)
- it->value->setDoubleSided(m_backfaceVisibility);
</del><ins>+ for (auto& layer : layerCloneMap->values())
+ layer->setDoubleSided(m_backfaceVisibility);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> m_layer->setDoubleSided(m_backfaceVisibility);
</span><span class="cx">
</span><span class="cx"> if (LayerMap* layerCloneMap = m_layerClones.get()) {
</span><del>- LayerMap::const_iterator end = layerCloneMap->end();
- for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++it)
- it->value->setDoubleSided(m_backfaceVisibility);
</del><ins>+ for (auto& layer : layerCloneMap->values())
+ layer->setDoubleSided(m_backfaceVisibility);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1668,12 +1659,11 @@
</span><span class="cx"> m_layer->setFilters(m_filters);
</span><span class="cx">
</span><span class="cx"> if (LayerMap* layerCloneMap = m_layerClones.get()) {
</span><del>- LayerMap::const_iterator end = layerCloneMap->end();
- for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++it) {
- if (m_replicaLayer && isReplicatedRootClone(it->key))
</del><ins>+ for (auto& clone : *layerCloneMap) {
+ if (m_replicaLayer && isReplicatedRootClone(clone.key))
</ins><span class="cx"> continue;
</span><span class="cx">
</span><del>- it->value->setFilters(m_filters);
</del><ins>+ clone.value->setFilters(m_filters);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -1705,11 +1695,10 @@
</span><span class="cx"> primaryLayer()->setBlendMode(m_blendMode);
</span><span class="cx">
</span><span class="cx"> if (LayerMap* layerCloneMap = primaryLayerClones()) {
</span><del>- LayerMap::const_iterator end = layerCloneMap->end();
- for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++it) {
- if (m_replicaLayer && isReplicatedRootClone(it->key))
</del><ins>+ for (auto& clone : *layerCloneMap) {
+ if (m_replicaLayer && isReplicatedRootClone(clone.key))
</ins><span class="cx"> continue;
</span><del>- it->value->setBlendMode(m_blendMode);
</del><ins>+ clone.value->setBlendMode(m_blendMode);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -1995,6 +1984,36 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// The clipping strategy depends on whether the rounded rect has equal corner radii.
+void GraphicsLayerCA::updateClippingStrategy(PlatformCALayer& clippingLayer, RefPtr<PlatformCALayer>& shapeMaskLayer, const FloatRoundedRect& roundedRect)
+{
+ if (roundedRect.radii().isUniformCornerRadius()) {
+ clippingLayer.setMask(nullptr);
+ if (shapeMaskLayer) {
+ shapeMaskLayer->setOwner(nullptr);
+ shapeMaskLayer = nullptr;
+ }
+
+ clippingLayer.setMasksToBounds(true);
+ clippingLayer.setCornerRadius(roundedRect.radii().topLeft().width());
+ return;
+ }
+
+ if (!shapeMaskLayer) {
+ shapeMaskLayer = createPlatformCALayer(PlatformCALayer::LayerTypeShapeLayer, this);
+ shapeMaskLayer->setAnchorPoint(FloatPoint3D());
+ }
+
+ shapeMaskLayer->setPosition(FloatPoint());
+ shapeMaskLayer->setBounds(clippingLayer.bounds());
+
+ clippingLayer.setCornerRadius(0);
+ clippingLayer.setMask(shapeMaskLayer.get());
+
+ FloatRoundedRect offsetRoundedRect(clippingLayer.bounds(), roundedRect.radii());
+ shapeMaskLayer->setShapeRoundedRect(offsetRoundedRect);
+}
+
</ins><span class="cx"> void GraphicsLayerCA::updateContentsRects()
</span><span class="cx"> {
</span><span class="cx"> if (!m_contentsLayer)
</span><span class="lines">@@ -2003,44 +2022,47 @@
</span><span class="cx"> FloatPoint contentOrigin;
</span><span class="cx"> FloatRect contentBounds(0, 0, m_contentsRect.width(), m_contentsRect.height());
</span><span class="cx">
</span><del>- FloatPoint clippingOrigin;
- FloatRect clippingBounds;
</del><ins>+ FloatPoint clippingOrigin(m_contentsClippingRect.rect().location());
+ FloatRect clippingBounds(FloatPoint(), m_contentsClippingRect.rect().size());
</ins><span class="cx">
</span><span class="cx"> bool gainedOrLostClippingLayer = false;
</span><del>- if (!m_contentsClippingRect.contains(m_contentsRect)) {
</del><ins>+ if (m_contentsClippingRect.isRounded() || !m_contentsClippingRect.rect().contains(m_contentsRect)) {
</ins><span class="cx"> if (!m_contentsClippingLayer) {
</span><span class="cx"> m_contentsClippingLayer = createPlatformCALayer(PlatformCALayer::LayerTypeLayer, this);
</span><del>- m_contentsClippingLayer->setMasksToBounds(true);
</del><span class="cx"> m_contentsClippingLayer->setAnchorPoint(FloatPoint());
</span><span class="cx"> #ifndef NDEBUG
</span><span class="cx"> m_contentsClippingLayer->setName("Contents Clipping");
</span><span class="cx"> #endif
</span><del>- m_contentsLayer->removeFromSuperlayer();
- m_contentsClippingLayer->appendSublayer(*m_contentsLayer);
</del><span class="cx"> gainedOrLostClippingLayer = true;
</span><span class="cx"> }
</span><del>-
- clippingOrigin = m_contentsClippingRect.location();
- clippingBounds.setSize(m_contentsClippingRect.size());
</del><span class="cx">
</span><del>- contentOrigin = FloatPoint(m_contentsRect.location() - m_contentsClippingRect.location());
-
</del><span class="cx"> m_contentsClippingLayer->setPosition(clippingOrigin);
</span><span class="cx"> m_contentsClippingLayer->setBounds(clippingBounds);
</span><span class="cx">
</span><del>- m_contentsLayer->setPosition(contentOrigin);
- m_contentsLayer->setBounds(contentBounds);
</del><ins>+ updateClippingStrategy(*m_contentsClippingLayer, m_shapeMaskLayer, m_contentsClippingRect);
+
+ if (gainedOrLostClippingLayer) {
+ m_contentsLayer->removeFromSuperlayer();
+ m_contentsClippingLayer->appendSublayer(*m_contentsLayer);
+ }
</ins><span class="cx">
</span><ins>+ contentOrigin = FloatPoint(m_contentsRect.location() - m_contentsClippingRect.rect().location());
</ins><span class="cx"> } else {
</span><span class="cx"> if (m_contentsClippingLayer) {
</span><span class="cx"> m_contentsLayer->removeFromSuperlayer();
</span><span class="cx">
</span><span class="cx"> m_contentsClippingLayer->removeFromSuperlayer();
</span><del>- m_contentsClippingLayer->setOwner(0);
</del><ins>+ m_contentsClippingLayer->setOwner(nullptr);
+ m_contentsClippingLayer->setMask(nullptr);
</ins><span class="cx"> m_contentsClippingLayer = nullptr;
</span><span class="cx"> gainedOrLostClippingLayer = true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (m_shapeMaskLayer) {
+ m_shapeMaskLayer->setOwner(nullptr);
+ m_shapeMaskLayer = nullptr;
+ }
+
</ins><span class="cx"> contentOrigin = m_contentsRect.location();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2051,18 +2073,29 @@
</span><span class="cx"> m_contentsLayer->setBounds(contentBounds);
</span><span class="cx">
</span><span class="cx"> if (m_contentsLayerClones) {
</span><del>- LayerMap::const_iterator end = m_contentsLayerClones->end();
- for (LayerMap::const_iterator it = m_contentsLayerClones->begin(); it != end; ++it) {
- it->value->setPosition(contentOrigin);
- it->value->setBounds(contentBounds);
</del><ins>+ for (auto& layer : m_contentsLayerClones->values()) {
+ layer->setPosition(contentOrigin);
+ layer->setBounds(contentBounds);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (m_contentsClippingLayerClones) {
</span><del>- LayerMap::const_iterator end = m_contentsClippingLayerClones->end();
- for (LayerMap::const_iterator it = m_contentsClippingLayerClones->begin(); it != end; ++it) {
- it->value->setPosition(clippingOrigin);
- it->value->setBounds(clippingBounds);
</del><ins>+ if (!m_shapeMaskLayerClones && m_shapeMaskLayer)
+ m_shapeMaskLayerClones = std::make_unique<LayerMap>();
+
+ for (auto& clone : *m_contentsClippingLayerClones) {
+ CloneID cloneID = clone.key;
+ RefPtr<PlatformCALayer> shapeMaskLayerClone;
+ if (m_shapeMaskLayerClones)
+ shapeMaskLayerClone = m_shapeMaskLayerClones->get(cloneID);
+
+ bool hadShapeMask = shapeMaskLayerClone;
+ updateClippingStrategy(*clone.value, shapeMaskLayerClone, m_contentsClippingRect);
+
+ if (!shapeMaskLayerClone && m_shapeMaskLayerClones)
+ m_shapeMaskLayerClones->remove(cloneID);
+ else if (shapeMaskLayerClone && !hadShapeMask)
+ m_shapeMaskLayerClones->add(cloneID, shapeMaskLayerClone);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2075,10 +2108,9 @@
</span><span class="cx"> LayerMap* maskLayerCloneMap = m_maskLayer ? downcast<GraphicsLayerCA>(*m_maskLayer).primaryLayerClones() : nullptr;
</span><span class="cx">
</span><span class="cx"> if (LayerMap* layerCloneMap = m_layerClones.get()) {
</span><del>- LayerMap::const_iterator end = layerCloneMap->end();
- for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++it) {
- PlatformCALayer* maskClone = maskLayerCloneMap ? maskLayerCloneMap->get(it->key) : nullptr;
- it->value->setMask(maskClone);
</del><ins>+ for (auto& clone : *layerCloneMap) {
+ PlatformCALayer* maskClone = maskLayerCloneMap ? maskLayerCloneMap->get(clone.key) : nullptr;
+ clone.value->setMask(maskClone);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2217,14 +2249,13 @@
</span><span class="cx"> layer->addAnimationForKey(animationID, caAnim);
</span><span class="cx">
</span><span class="cx"> if (LayerMap* layerCloneMap = animatedLayerClones(property)) {
</span><del>- LayerMap::const_iterator end = layerCloneMap->end();
- for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++it) {
</del><ins>+ for (auto& clone : *layerCloneMap) {
</ins><span class="cx"> // Skip immediate replicas, since they move with the original.
</span><del>- if (m_replicaLayer && isReplicatedRootClone(it->key))
</del><ins>+ if (m_replicaLayer && isReplicatedRootClone(clone.key))
</ins><span class="cx"> continue;
</span><span class="cx">
</span><del>- it->value->removeAnimationForKey(animationID);
- it->value->addAnimationForKey(animationID, caAnim);
</del><ins>+ clone.value->removeAnimationForKey(animationID);
+ clone.value->addAnimationForKey(animationID, caAnim);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2256,13 +2287,12 @@
</span><span class="cx"> bug7311367Workaround(m_structuralLayer.get(), m_transform);
</span><span class="cx">
</span><span class="cx"> if (LayerMap* layerCloneMap = animatedLayerClones(property)) {
</span><del>- LayerMap::const_iterator end = layerCloneMap->end();
- for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++it) {
</del><ins>+ for (auto& clone : *layerCloneMap) {
</ins><span class="cx"> // Skip immediate replicas, since they move with the original.
</span><del>- if (m_replicaLayer && isReplicatedRootClone(it->key))
</del><ins>+ if (m_replicaLayer && isReplicatedRootClone(clone.key))
</ins><span class="cx"> continue;
</span><span class="cx">
</span><del>- it->value->removeAnimationForKey(animationID);
</del><ins>+ clone.value->removeAnimationForKey(animationID);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> return true;
</span><span class="lines">@@ -2288,12 +2318,11 @@
</span><span class="cx">
</span><span class="cx"> // Pause the animations on the clones too.
</span><span class="cx"> if (LayerMap* layerCloneMap = animatedLayerClones(property)) {
</span><del>- LayerMap::const_iterator end = layerCloneMap->end();
- for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++it) {
</del><ins>+ for (auto& clone : *layerCloneMap) {
</ins><span class="cx"> // Skip immediate replicas, since they move with the original.
</span><del>- if (m_replicaLayer && isReplicatedRootClone(it->key))
</del><ins>+ if (m_replicaLayer && isReplicatedRootClone(clone.key))
</ins><span class="cx"> continue;
</span><del>- it->value->addAnimationForKey(animationID, *newAnim);
</del><ins>+ clone.value->addAnimationForKey(animationID, *newAnim);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2817,10 +2846,9 @@
</span><span class="cx">
</span><span class="cx"> // Suspend the animations on the clones too.
</span><span class="cx"> if (LayerMap* layerCloneMap = primaryLayerClones()) {
</span><del>- LayerMap::const_iterator end = layerCloneMap->end();
- for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++it) {
- it->value->setSpeed(0);
- it->value->setTimeOffset(t);
</del><ins>+ for (auto& layer : layerCloneMap->values()) {
+ layer->setSpeed(0);
+ layer->setTimeOffset(t);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2832,10 +2860,9 @@
</span><span class="cx">
</span><span class="cx"> // Resume the animations on the clones too.
</span><span class="cx"> if (LayerMap* layerCloneMap = primaryLayerClones()) {
</span><del>- LayerMap::const_iterator end = layerCloneMap->end();
- for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++it) {
- it->value->setSpeed(1);
- it->value->setTimeOffset(0);
</del><ins>+ for (auto& layer : layerCloneMap->values()) {
+ layer->setSpeed(1);
+ layer->setTimeOffset(0);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2933,6 +2960,20 @@
</span><span class="cx"> GraphicsLayer::getDebugBorderInfo(color, width);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+
+static void dumpInnerLayer(TextStream& textStream, String label, PlatformCALayer* layer, int indent, LayerTreeAsTextBehavior behavior)
+{
+ if (!layer)
+ return;
+
+ writeIndent(textStream, indent + 1);
+ textStream << "(" << label << " ";
+ if (behavior & LayerTreeAsTextDebug)
+ textStream << "id=" << layer->layerID() << " ";
+ textStream << layer->position().x() << ", " << layer->position().y()
+ << " " << layer->bounds().width() << " x " << layer->bounds().height() << ")\n";
+}
+
</ins><span class="cx"> void GraphicsLayerCA::dumpAdditionalProperties(TextStream& textStream, int indent, LayerTreeAsTextBehavior behavior) const
</span><span class="cx"> {
</span><span class="cx"> if (behavior & LayerTreeAsTextIncludeVisibleRects) {
</span><span class="lines">@@ -2963,17 +3004,11 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (behavior & LayerTreeAsTextIncludeContentLayers) {
</span><del>- if (m_contentsClippingLayer) {
- writeIndent(textStream, indent + 1);
- textStream << "(contents clipping layer " << m_contentsClippingLayer->position().x() << ", " << m_contentsClippingLayer->position().y()
- << " " << m_contentsClippingLayer->bounds().width() << " x " << m_contentsClippingLayer->bounds().height() << ")\n";
- }
-
- if (m_contentsLayer) {
- writeIndent(textStream, indent + 1);
- textStream << "(contents layer " << m_contentsLayer->position().x() << ", " << m_contentsLayer->position().y()
- << " " << m_contentsLayer->bounds().width() << " x " << m_contentsLayer->bounds().height() << ")\n";
- }
</del><ins>+ dumpInnerLayer(textStream, "structural layer", m_structuralLayer.get(), indent, behavior);
+ dumpInnerLayer(textStream, "contents clipping layer", m_contentsClippingLayer.get(), indent, behavior);
+ dumpInnerLayer(textStream, "shape mask layer", m_shapeMaskLayer.get(), indent, behavior);
+ dumpInnerLayer(textStream, "contents layer", m_contentsLayer.get(), indent, behavior);
+ dumpInnerLayer(textStream, "backdrop layer", m_backdropLayer.get(), indent, behavior);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -3139,27 +3174,31 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void GraphicsLayerCA::ensureCloneLayers(CloneID cloneID, RefPtr<PlatformCALayer>& primaryLayer, RefPtr<PlatformCALayer>& structuralLayer,
</span><del>- RefPtr<PlatformCALayer>& contentsLayer, RefPtr<PlatformCALayer>& contentsClippingLayer, CloneLevel cloneLevel)
</del><ins>+ RefPtr<PlatformCALayer>& contentsLayer, RefPtr<PlatformCALayer>& contentsClippingLayer, RefPtr<PlatformCALayer>& shapeMaskLayer, CloneLevel cloneLevel)
</ins><span class="cx"> {
</span><del>- structuralLayer = 0;
- contentsLayer = 0;
</del><ins>+ structuralLayer = nullptr;
+ contentsLayer = nullptr;
</ins><span class="cx">
</span><span class="cx"> if (!m_layerClones)
</span><del>- m_layerClones = adoptPtr(new LayerMap);
</del><ins>+ m_layerClones = std::make_unique<LayerMap>();
</ins><span class="cx">
</span><span class="cx"> if (!m_structuralLayerClones && m_structuralLayer)
</span><del>- m_structuralLayerClones = adoptPtr(new LayerMap);
</del><ins>+ m_structuralLayerClones = std::make_unique<LayerMap>();
</ins><span class="cx">
</span><span class="cx"> if (!m_contentsLayerClones && m_contentsLayer)
</span><del>- m_contentsLayerClones = adoptPtr(new LayerMap);
</del><ins>+ m_contentsLayerClones = std::make_unique<LayerMap>();
</ins><span class="cx">
</span><span class="cx"> if (!m_contentsClippingLayerClones && m_contentsClippingLayer)
</span><del>- m_contentsClippingLayerClones = adoptPtr(new LayerMap);
</del><ins>+ m_contentsClippingLayerClones = std::make_unique<LayerMap>();
</ins><span class="cx">
</span><ins>+ if (!m_shapeMaskLayerClones && m_shapeMaskLayer)
+ m_shapeMaskLayerClones = std::make_unique<LayerMap>();
+
</ins><span class="cx"> primaryLayer = findOrMakeClone(cloneID, m_layer.get(), m_layerClones.get(), cloneLevel);
</span><span class="cx"> structuralLayer = findOrMakeClone(cloneID, m_structuralLayer.get(), m_structuralLayerClones.get(), cloneLevel);
</span><span class="cx"> contentsLayer = findOrMakeClone(cloneID, m_contentsLayer.get(), m_contentsLayerClones.get(), cloneLevel);
</span><span class="cx"> contentsClippingLayer = findOrMakeClone(cloneID, m_contentsClippingLayer.get(), m_contentsClippingLayerClones.get(), cloneLevel);
</span><ins>+ shapeMaskLayer = findOrMakeClone(cloneID, m_shapeMaskLayer.get(), m_shapeMaskLayerClones.get(), cloneLevel);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void GraphicsLayerCA::removeCloneLayers()
</span><span class="lines">@@ -3199,7 +3238,8 @@
</span><span class="cx"> RefPtr<PlatformCALayer> structuralLayer;
</span><span class="cx"> RefPtr<PlatformCALayer> contentsLayer;
</span><span class="cx"> RefPtr<PlatformCALayer> contentsClippingLayer;
</span><del>- ensureCloneLayers(replicaState.cloneID(), primaryLayer, structuralLayer, contentsLayer, contentsClippingLayer, cloneLevel);
</del><ins>+ RefPtr<PlatformCALayer> shapeMaskLayer;
+ ensureCloneLayers(replicaState.cloneID(), primaryLayer, structuralLayer, contentsLayer, contentsClippingLayer, shapeMaskLayer, cloneLevel);
</ins><span class="cx">
</span><span class="cx"> if (m_maskLayer) {
</span><span class="cx"> RefPtr<PlatformCALayer> maskClone = downcast<GraphicsLayerCA>(*m_maskLayer).fetchCloneLayers(replicaRoot, replicaState, IntermediateCloneLevel);
</span><span class="lines">@@ -3237,6 +3277,9 @@
</span><span class="cx"> ASSERT(contentsLayer);
</span><span class="cx"> contentsClippingLayer->appendSublayer(*contentsLayer);
</span><span class="cx"> }
</span><ins>+
+ if (shapeMaskLayer)
+ contentsClippingLayer->setMask(shapeMaskLayer.get());
</ins><span class="cx">
</span><span class="cx"> if (replicaLayer || structuralLayer || contentsLayer || contentsClippingLayer || childLayers.size() > 0) {
</span><span class="cx"> if (structuralLayer) {
</span><span class="lines">@@ -3311,7 +3354,7 @@
</span><span class="cx">
</span><span class="cx"> void GraphicsLayerCA::setOpacityInternal(float accumulatedOpacity)
</span><span class="cx"> {
</span><del>- LayerMap* layerCloneMap = 0;
</del><ins>+ LayerMap* layerCloneMap = nullptr;
</ins><span class="cx">
</span><span class="cx"> if (preserves3D()) {
</span><span class="cx"> m_layer->setOpacity(accumulatedOpacity);
</span><span class="lines">@@ -3322,11 +3365,10 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (layerCloneMap) {
</span><del>- LayerMap::const_iterator end = layerCloneMap->end();
- for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++it) {
- if (m_replicaLayer && isReplicatedRootClone(it->key))
</del><ins>+ for (auto& clone : *layerCloneMap) {
+ if (m_replicaLayer && isReplicatedRootClone(clone.key))
</ins><span class="cx"> continue;
</span><del>- it->value->setOpacity(m_opacity);
</del><ins>+ clone.value->setOpacity(m_opacity);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -3336,14 +3378,12 @@
</span><span class="cx"> primaryLayer()->setOpacity(m_opacity);
</span><span class="cx">
</span><span class="cx"> if (LayerMap* layerCloneMap = primaryLayerClones()) {
</span><del>- LayerMap::const_iterator end = layerCloneMap->end();
- for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++it) {
- if (m_replicaLayer && isReplicatedRootClone(it->key))
</del><ins>+ for (auto& clone : *layerCloneMap) {
+ if (m_replicaLayer && isReplicatedRootClone(clone.key))
</ins><span class="cx"> continue;
</span><span class="cx">
</span><del>- it->value->setOpacity(m_opacity);
</del><ins>+ clone.value->setOpacity(m_opacity);
</ins><span class="cx"> }
</span><del>-
</del><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscaGraphicsLayerCAh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><ins>+class FloatRoundedRect;
</ins><span class="cx"> class Image;
</span><span class="cx"> class TransformState;
</span><span class="cx">
</span><span class="lines">@@ -116,7 +117,7 @@
</span><span class="cx"> WEBCORE_EXPORT virtual void setContentsNeedsDisplay() override;
</span><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT virtual void setContentsRect(const FloatRect&) override;
</span><del>- WEBCORE_EXPORT virtual void setContentsClippingRect(const FloatRect&) override;
</del><ins>+ WEBCORE_EXPORT virtual void setContentsClippingRect(const FloatRoundedRect&) override;
</ins><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT virtual void suspendAnimations(double time) override;
</span><span class="cx"> WEBCORE_EXPORT virtual void resumeAnimations() override;
</span><span class="lines">@@ -266,6 +267,8 @@
</span><span class="cx"> void setupContentsLayer(PlatformCALayer*);
</span><span class="cx"> PlatformCALayer* contentsLayer() const { return m_contentsLayer.get(); }
</span><span class="cx">
</span><ins>+ void updateClippingStrategy(PlatformCALayer&, RefPtr<PlatformCALayer>& shapeMaskLayer, const FloatRoundedRect&);
+
</ins><span class="cx"> WEBCORE_EXPORT virtual void setReplicatedByLayer(GraphicsLayer*) override;
</span><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT virtual void getDebugBorderInfo(Color&, float& width) const override;
</span><span class="lines">@@ -344,12 +347,12 @@
</span><span class="cx"> PassRefPtr<PlatformCALayer> findOrMakeClone(CloneID, PlatformCALayer *, LayerMap*, CloneLevel);
</span><span class="cx">
</span><span class="cx"> void ensureCloneLayers(CloneID, RefPtr<PlatformCALayer>& primaryLayer, RefPtr<PlatformCALayer>& structuralLayer,
</span><del>- RefPtr<PlatformCALayer>& contentsLayer, RefPtr<PlatformCALayer>& contentsClippingLayer, CloneLevel);
</del><ins>+ RefPtr<PlatformCALayer>& contentsLayer, RefPtr<PlatformCALayer>& contentsClippingLayer, RefPtr<PlatformCALayer>& shapeMaskLayer, CloneLevel);
</ins><span class="cx">
</span><del>- bool hasCloneLayers() const { return m_layerClones; }
</del><ins>+ bool hasCloneLayers() const { return !!m_layerClones; }
</ins><span class="cx"> void removeCloneLayers();
</span><span class="cx"> FloatPoint positionForCloneRootLayer() const;
</span><del>-
</del><ins>+
</ins><span class="cx"> // All these "update" methods will be called inside a BEGIN_BLOCK_OBJC_EXCEPTIONS/END_BLOCK_OBJC_EXCEPTIONS block.
</span><span class="cx"> void updateLayerNames();
</span><span class="cx"> void updateSublayerList(bool maxLayerDepthReached = false);
</span><span class="lines">@@ -450,14 +453,16 @@
</span><span class="cx"> RefPtr<PlatformCALayer> m_layer; // The main layer
</span><span class="cx"> RefPtr<PlatformCALayer> m_structuralLayer; // A layer used for structural reasons, like preserves-3d or replica-flattening. Is the parent of m_layer.
</span><span class="cx"> RefPtr<PlatformCALayer> m_contentsClippingLayer; // A layer used to clip inner content
</span><ins>+ RefPtr<PlatformCALayer> m_shapeMaskLayer; // Used to clip with non-trivial corner radii.
</ins><span class="cx"> RefPtr<PlatformCALayer> m_contentsLayer; // A layer used for inner content, like image and video
</span><span class="cx"> RefPtr<PlatformCALayer> m_backdropLayer; // The layer used for backdrop rendering, if necessary.
</span><span class="cx">
</span><span class="cx"> // References to clones of our layers, for replicated layers.
</span><del>- OwnPtr<LayerMap> m_layerClones;
- OwnPtr<LayerMap> m_structuralLayerClones;
- OwnPtr<LayerMap> m_contentsLayerClones;
- OwnPtr<LayerMap> m_contentsClippingLayerClones;
</del><ins>+ std::unique_ptr<LayerMap> m_layerClones;
+ std::unique_ptr<LayerMap> m_structuralLayerClones;
+ std::unique_ptr<LayerMap> m_contentsLayerClones;
+ std::unique_ptr<LayerMap> m_contentsClippingLayerClones;
+ std::unique_ptr<LayerMap> m_shapeMaskLayerClones;
</ins><span class="cx">
</span><span class="cx"> #ifdef VISIBLE_TILE_WASH
</span><span class="cx"> RefPtr<PlatformCALayer> m_visibleTileWashLayer;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscaPlatformCALayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #ifndef PlatformCALayer_h
</span><span class="cx"> #define PlatformCALayer_h
</span><span class="cx">
</span><ins>+#include "FloatRoundedRect.h"
</ins><span class="cx"> #include "GraphicsLayer.h"
</span><span class="cx"> #include "PlatformCALayerClient.h"
</span><span class="cx"> #include <QuartzCore/CABase.h>
</span><span class="lines">@@ -78,6 +79,7 @@
</span><span class="cx"> LayerTypeAVPlayerLayer,
</span><span class="cx"> LayerTypeWebGLLayer,
</span><span class="cx"> LayerTypeBackdropLayer,
</span><ins>+ LayerTypeShapeLayer,
</ins><span class="cx"> LayerTypeCustom
</span><span class="cx"> };
</span><span class="cx"> enum FilterType { Linear, Nearest, Trilinear };
</span><span class="lines">@@ -199,8 +201,15 @@
</span><span class="cx"> virtual float contentsScale() const = 0;
</span><span class="cx"> virtual void setContentsScale(float) = 0;
</span><span class="cx">
</span><ins>+ virtual float cornerRadius() const = 0;
+ virtual void setCornerRadius(float) = 0;
+
</ins><span class="cx"> virtual void setEdgeAntialiasingMask(unsigned) = 0;
</span><span class="cx">
</span><ins>+ // Only used by LayerTypeShapeLayer.
+ virtual FloatRoundedRect shapeRoundedRect() const = 0;
+ virtual void setShapeRoundedRect(const FloatRoundedRect&) = 0;
+
</ins><span class="cx"> virtual GraphicsLayer::CustomAppearance customAppearance() const = 0;
</span><span class="cx"> virtual void updateCustomAppearance(GraphicsLayer::CustomAppearance) = 0;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscamacPlatformCALayerMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -134,8 +134,14 @@
</span><span class="cx"> virtual float contentsScale() const override;
</span><span class="cx"> virtual void setContentsScale(float) override;
</span><span class="cx">
</span><ins>+ virtual float cornerRadius() const override;
+ virtual void setCornerRadius(float) override;
+
</ins><span class="cx"> virtual void setEdgeAntialiasingMask(unsigned) override;
</span><span class="cx">
</span><ins>+ virtual FloatRoundedRect shapeRoundedRect() const override;
+ virtual void setShapeRoundedRect(const FloatRoundedRect&) 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 class="lines">@@ -164,6 +170,7 @@
</span><span class="cx"> std::unique_ptr<PlatformCALayerList> m_customSublayers;
</span><span class="cx"> GraphicsLayer::CustomAppearance m_customAppearance;
</span><span class="cx"> GraphicsLayer::CustomBehavior m_customBehavior;
</span><ins>+ std::unique_ptr<FloatRoundedRect> m_shapeRoundedRect;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscamacPlatformCALayerMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -259,13 +259,17 @@
</span><span class="cx"> // We don't create PlatformCALayerMacs wrapped around WebGLLayers.
</span><span class="cx"> ASSERT_NOT_REACHED();
</span><span class="cx"> break;
</span><ins>+ case LayerTypeShapeLayer:
+ layerClass = [CAShapeLayer class];
+ // fillColor defaults to opaque black.
+ break;
</ins><span class="cx"> case LayerTypeCustom:
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (layerClass)
</span><span class="cx"> m_layer = adoptNS([[layerClass alloc] init]);
</span><del>-
</del><ins>+
</ins><span class="cx"> commonInit();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -314,6 +318,9 @@
</span><span class="cx"> case LayerTypeAVPlayerLayer:
</span><span class="cx"> type = LayerTypeAVPlayerLayer;
</span><span class="cx"> break;
</span><ins>+ case LayerTypeShapeLayer:
+ type = LayerTypeShapeLayer;
+ break;
</ins><span class="cx"> case LayerTypeLayer:
</span><span class="cx"> default:
</span><span class="cx"> type = LayerTypeLayer;
</span><span class="lines">@@ -332,6 +339,7 @@
</span><span class="cx"> newLayer->setOpaque(isOpaque());
</span><span class="cx"> newLayer->setBackgroundColor(backgroundColor());
</span><span class="cx"> newLayer->setContentsScale(contentsScale());
</span><ins>+ newLayer->setCornerRadius(cornerRadius());
</ins><span class="cx"> newLayer->copyFiltersFrom(*this);
</span><span class="cx"> newLayer->updateCustomAppearance(customAppearance());
</span><span class="cx">
</span><span class="lines">@@ -345,6 +353,9 @@
</span><span class="cx"> [destinationPlayerLayer setPlayer:[sourcePlayerLayer player]];
</span><span class="cx"> });
</span><span class="cx"> }
</span><ins>+
+ if (type == LayerTypeShapeLayer)
+ newLayer->setShapeRoundedRect(shapeRoundedRect());
</ins><span class="cx">
</span><span class="cx"> return newLayer;
</span><span class="cx"> }
</span><span class="lines">@@ -501,7 +512,7 @@
</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() : 0];
</del><ins>+ [m_layer.get() setMask:layer ? layer->platformLayer() : nil];
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -806,6 +817,18 @@
</span><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+float PlatformCALayerMac::cornerRadius() const
+{
+ return [m_layer.get() cornerRadius];
+}
+
+void PlatformCALayerMac::setCornerRadius(float value)
+{
+ BEGIN_BLOCK_OBJC_EXCEPTIONS
+ [m_layer.get() setCornerRadius:value];
+ END_BLOCK_OBJC_EXCEPTIONS
+}
+
</ins><span class="cx"> void PlatformCALayerMac::setEdgeAntialiasingMask(unsigned mask)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><span class="lines">@@ -813,6 +836,27 @@
</span><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+FloatRoundedRect PlatformCALayerMac::shapeRoundedRect() const
+{
+ ASSERT(m_layerType == LayerTypeShapeLayer);
+ if (m_shapeRoundedRect)
+ return *m_shapeRoundedRect;
+
+ return FloatRoundedRect();
+}
+
+void PlatformCALayerMac::setShapeRoundedRect(const FloatRoundedRect& roundedRect)
+{
+ ASSERT(m_layerType == LayerTypeShapeLayer);
+ m_shapeRoundedRect = std::make_unique<FloatRoundedRect>(roundedRect);
+
+ BEGIN_BLOCK_OBJC_EXCEPTIONS
+ Path shapePath;
+ shapePath.addRoundedRect(roundedRect);
+ [(CAShapeLayer *)m_layer setPath:shapePath.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></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscawinPlatformCALayerWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -581,6 +581,27 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+float PlatformCALayerWin::cornerRadius() const
+{
+ return 0; // FIXME: implement.
+}
+
+void PlatformCALayerWin::setCornerRadius(float value)
+{
+ // FIXME: implement.
+}
+
+FloatRoundedRect PlatformCALayerWin::shapeRoundedRect() const
+{
+ // FIXME: implement.
+ return FloatRoundedRect();
+}
+
+void PlatformCALayerWin::setShapeRoundedRect(const FloatRoundedRect&)
+{
+ // 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 (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -122,6 +122,12 @@
</span><span class="cx"> virtual float contentsScale() const override;
</span><span class="cx"> virtual void setContentsScale(float) override;
</span><span class="cx">
</span><ins>+ virtual float cornerRadius() const override;
+ virtual void setCornerRadius(float) override;
+
+ virtual FloatRoundedRect shapeRoundedRect() const override;
+ virtual void setShapeRoundedRect(const FloatRoundedRect&) 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="trunkSourceWebCorerenderingRenderLayerBackingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -1097,13 +1097,13 @@
</span><span class="cx"> {
</span><span class="cx"> m_graphicsLayer->setContentsRect(snappedIntRect(contentsBox()));
</span><span class="cx">
</span><del>- LayoutRect contentsClippingRect;
- if (is<RenderBox>(renderer()))
- contentsClippingRect = downcast<RenderBox>(renderer()).contentBoxRect();
</del><ins>+ if (is<RenderBox>(renderer())) {
+ LayoutRect boxRect(LayoutPoint(), downcast<RenderBox>(renderer()).size());
+ FloatRoundedRect contentsClippingRect = renderer().style().getRoundedInnerBorderFor(boxRect).pixelSnappedRoundedRectForPainting(deviceScaleFactor());
+ contentsClippingRect.move(contentOffsetInCompostingLayer());
+ m_graphicsLayer->setContentsClippingRect(contentsClippingRect);
+ }
</ins><span class="cx">
</span><del>- contentsClippingRect.move(contentOffsetInCompostingLayer());
- m_graphicsLayer->setContentsClippingRect(snappedIntRect(contentsClippingRect));
-
</del><span class="cx"> m_graphicsLayer->setContentsTileSize(IntSize());
</span><span class="cx"> m_graphicsLayer->setContentsTilePhase(IntPoint());
</span><span class="cx"> }
</span><span class="lines">@@ -1270,7 +1270,7 @@
</span><span class="cx"> if (layer->usesContentsLayer()) {
</span><span class="cx"> IntRect barRect = IntRect(IntPoint(), hBarRect.size());
</span><span class="cx"> layer->setContentsRect(barRect);
</span><del>- layer->setContentsClippingRect(barRect);
</del><ins>+ layer->setContentsClippingRect(FloatRoundedRect(barRect));
</ins><span class="cx"> }
</span><span class="cx"> layer->setDrawsContent(m_owningLayer.horizontalScrollbar() && !layer->usesContentsLayer());
</span><span class="cx"> }
</span><span class="lines">@@ -1282,7 +1282,7 @@
</span><span class="cx"> if (layer->usesContentsLayer()) {
</span><span class="cx"> IntRect barRect = IntRect(IntPoint(), vBarRect.size());
</span><span class="cx"> layer->setContentsRect(barRect);
</span><del>- layer->setContentsClippingRect(barRect);
</del><ins>+ layer->setContentsClippingRect(FloatRoundedRect(barRect));
</ins><span class="cx"> }
</span><span class="cx"> layer->setDrawsContent(m_owningLayer.verticalScrollbar() && !layer->usesContentsLayer());
</span><span class="cx"> }
</span><span class="lines">@@ -1587,7 +1587,7 @@
</span><span class="cx"> m_graphicsLayer->setContentsToSolidColor(backgroundColor);
</span><span class="cx"> FloatRect contentsRect = backgroundBoxForPainting();
</span><span class="cx"> m_graphicsLayer->setContentsRect(contentsRect);
</span><del>- m_graphicsLayer->setContentsClippingRect(contentsRect);
</del><ins>+ m_graphicsLayer->setContentsClippingRect(FloatRoundedRect(contentsRect));
</ins><span class="cx"> didUpdateContentsRect = true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1615,7 +1615,7 @@
</span><span class="cx"> m_graphicsLayer->setContentsTileSize(tileSize);
</span><span class="cx"> m_graphicsLayer->setContentsTilePhase(phase);
</span><span class="cx"> m_graphicsLayer->setContentsRect(destRect);
</span><del>- m_graphicsLayer->setContentsClippingRect(destRect);
</del><ins>+ m_graphicsLayer->setContentsClippingRect(FloatRoundedRect(destRect));
</ins><span class="cx"> m_graphicsLayer->setContentsToImage(image.get());
</span><span class="cx"> didUpdateContentsRect = true;
</span><span class="cx"> }
</span><span class="lines">@@ -1905,9 +1905,10 @@
</span><span class="cx"> // This is a no-op if the layer doesn't have an inner layer for the image.
</span><span class="cx"> m_graphicsLayer->setContentsRect(snappedIntRect(contentsBox()));
</span><span class="cx">
</span><del>- LayoutRect contentsClippingRect = imageRenderer.contentBoxRect();
</del><ins>+ LayoutRect boxRect(LayoutPoint(), imageRenderer.size());
+ FloatRoundedRect contentsClippingRect = renderer().style().getRoundedInnerBorderFor(boxRect).pixelSnappedRoundedRectForPainting(deviceScaleFactor());
</ins><span class="cx"> contentsClippingRect.move(contentOffsetInCompostingLayer());
</span><del>- m_graphicsLayer->setContentsClippingRect(snappedIntRect(contentsClippingRect));
</del><ins>+ m_graphicsLayer->setContentsClippingRect(contentsClippingRect);
</ins><span class="cx">
</span><span class="cx"> m_graphicsLayer->setContentsToImage(image);
</span><span class="cx"> bool isSimpleContainer = false;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerBackingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerBacking.h        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -316,7 +316,7 @@
</span><span class="cx"> bool shouldClipCompositedBounds() const;
</span><span class="cx">
</span><span class="cx"> bool hasTiledBackingFlatteningLayer() const { return (m_childContainmentLayer && m_usingTiledCacheLayer); }
</span><del>- GraphicsLayer* tileCacheFlatteningLayer() const { return m_usingTiledCacheLayer ? m_childContainmentLayer.get() : 0; }
</del><ins>+ GraphicsLayer* tileCacheFlatteningLayer() const { return m_usingTiledCacheLayer ? m_childContainmentLayer.get() : nullptr; }
</ins><span class="cx">
</span><span class="cx"> void paintIntoLayer(const GraphicsLayer*, GraphicsContext*, const IntRect& paintDirtyRect, PaintBehavior, GraphicsLayerPaintingPhase);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebKit2/ChangeLog        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -1,3 +1,47 @@
</span><ins>+2014-11-08 Simon Fraser <simon.fraser@apple.com>
+
+ Implement round-rect clipping on video elements
+ https://bugs.webkit.org/show_bug.cgi?id=138537
+ rdar://problem/9534399
+
+ Reviewed by Darin Adler.
+
+ Support border-radius on video and other layers with composited contents,
+ by pushing a FloatRoundedRect onto the GraphicsLayer as the contentsClippingRect,
+ and, on Mac, using layer corner-radius or a CAShapeLayer mask.
+
+ * Shared/WebCoreArgumentCoders.cpp:
+ (IPC::ArgumentCoder<FloatRoundedRect>::encode):
+ (IPC::ArgumentCoder<FloatRoundedRect>::decode):
+ * Shared/WebCoreArgumentCoders.h:
+ * Shared/mac/RemoteLayerBackingStore.mm: New shape layer type.
+ (WebKit::RemoteLayerBackingStore::drawInContext):
+ * Shared/mac/RemoteLayerTreePropertyApplier.mm:
+ (WebKit::applyPropertiesToLayer): Apply corner-radius and shape path.
+ * Shared/mac/RemoteLayerTreeTransaction.h: Prettify the flags. Yes, I prefer this style.
+ * Shared/mac/RemoteLayerTreeTransaction.mm:
+ (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
+ (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
+ (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
+ (WebKit::RemoteLayerTreeTextStream::operator<<):
+ (WebKit::dumpChangedLayers):
+ (WebKit::RemoteLayerTreeTransaction::description):
+ * UIProcess/ios/RemoteLayerTreeHostIOS.mm:
+ (+[WKShapeView layerClass]): Make UIViews with a CAShapeLayer layer class.
+ (WebKit::RemoteLayerTreeHost::createLayer):
+ * UIProcess/mac/RemoteLayerTreeHost.mm:
+ (WebKit::RemoteLayerTreeHost::createLayer):
+ * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+ (WebKit::PlatformCALayerRemote::updateClonedLayerProperties):
+ (WebKit::isEquivalentLayer):
+ (WebKit::PlatformCALayerRemote::setMask):
+ (WebKit::PlatformCALayerRemote::setClonedLayer):
+ (WebKit::PlatformCALayerRemote::cornerRadius):
+ (WebKit::PlatformCALayerRemote::setCornerRadius):
+ (WebKit::PlatformCALayerRemote::shapeRoundedRect):
+ (WebKit::PlatformCALayerRemote::setShapeRoundedRect):
+ * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
+
</ins><span class="cx"> 2014-11-09 Conrad Shultz <conrad_shultz@apple.com>
</span><span class="cx">
</span><span class="cx"> Move _ignoresNonWheelMouseEvents implementation to WKView(Private)
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebCoreArgumentCoderscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -298,6 +298,16 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><ins>+void ArgumentCoder<FloatRoundedRect>::encode(ArgumentEncoder& encoder, const FloatRoundedRect& roundedRect)
+{
+ SimpleArgumentCoder<FloatRoundedRect>::encode(encoder, roundedRect);
+}
+
+bool ArgumentCoder<FloatRoundedRect>::decode(ArgumentDecoder& decoder, FloatRoundedRect& roundedRect)
+{
+ return SimpleArgumentCoder<FloatRoundedRect>::decode(decoder, roundedRect);
+}
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> void ArgumentCoder<FloatQuad>::encode(ArgumentEncoder& encoder, const FloatQuad& floatQuad)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebCoreArgumentCodersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -43,6 +43,7 @@
</span><span class="cx"> class FloatPoint;
</span><span class="cx"> class FloatPoint3D;
</span><span class="cx"> class FloatRect;
</span><ins>+class FloatRoundedRect;
</ins><span class="cx"> class FloatSize;
</span><span class="cx"> class FixedPositionViewportConstraints;
</span><span class="cx"> class HTTPHeaderMap;
</span><span class="lines">@@ -163,6 +164,11 @@
</span><span class="cx"> static bool decode(ArgumentDecoder&, WebCore::FloatSize&);
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+template<> struct ArgumentCoder<WebCore::FloatRoundedRect> {
+ static void encode(ArgumentEncoder&, const WebCore::FloatRoundedRect&);
+ static bool decode(ArgumentDecoder&, WebCore::FloatRoundedRect&);
+};
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> template<> struct ArgumentCoder<WebCore::FloatQuad> {
</span><span class="cx"> static void encode(ArgumentEncoder&, const WebCore::FloatQuad&);
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacRemoteLayerBackingStoremm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -349,6 +349,7 @@
</span><span class="cx"> case PlatformCALayer::LayerTypeAVPlayerLayer:
</span><span class="cx"> case PlatformCALayer::LayerTypeWebGLLayer:
</span><span class="cx"> case PlatformCALayer::LayerTypeBackdropLayer:
</span><ins>+ case PlatformCALayer::LayerTypeShapeLayer:
</ins><span class="cx"> case PlatformCALayer::LayerTypeCustom:
</span><span class="cx"> ASSERT_NOT_REACHED();
</span><span class="cx"> break;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacRemoteLayerTreePropertyAppliermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -29,7 +29,7 @@
</span><span class="cx"> #import "PlatformCAAnimationRemote.h"
</span><span class="cx"> #import "PlatformCALayerRemote.h"
</span><span class="cx"> #import "RemoteLayerTreeHost.h"
</span><del>-#import <QuartzCore/CALayer.h>
</del><ins>+#import <QuartzCore/QuartzCore.h>
</ins><span class="cx"> #import <WebCore/BlockExceptions.h>
</span><span class="cx"> #import <WebCore/PlatformCAFilters.h>
</span><span class="cx"> #import <WebCore/ScrollbarThemeMac.h>
</span><span class="lines">@@ -190,6 +190,17 @@
</span><span class="cx"> layer.rasterizationScale = properties.contentsScale;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (properties.changedProperties & RemoteLayerTreeTransaction::CornerRadiusChanged)
+ layer.cornerRadius = properties.cornerRadius;
+
+ if (properties.changedProperties & RemoteLayerTreeTransaction::ShapeRoundedRectChanged) {
+ Path path;
+ if (properties.shapeRoundedRect)
+ path.addRoundedRect(*properties.shapeRoundedRect);
+ ASSERT([layer isKindOfClass:[CAShapeLayer class]]);
+ [(CAShapeLayer *)layer setPath:path.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></pre></div>
<a id="trunkSourceWebKit2SharedmacRemoteLayerTreeTransactionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -50,40 +50,42 @@
</span><span class="cx"> class RemoteLayerTreeTransaction {
</span><span class="cx"> public:
</span><span class="cx"> enum LayerChanges {
</span><del>- NoChange = 0,
- NameChanged = 1 << 1,
- ChildrenChanged = 1 << 2,
- PositionChanged = 1 << 3,
- BoundsChanged = 1 << 4,
- BackgroundColorChanged = 1 << 5,
- AnchorPointChanged = 1 << 6,
- BorderWidthChanged = 1 << 7,
- BorderColorChanged = 1 << 8,
- OpacityChanged = 1 << 9,
- TransformChanged = 1 << 10,
- SublayerTransformChanged = 1 << 11,
- HiddenChanged = 1 << 12,
- GeometryFlippedChanged = 1 << 13,
- DoubleSidedChanged = 1 << 14,
- MasksToBoundsChanged = 1 << 15,
- OpaqueChanged = 1 << 16,
- MaskLayerChanged = 1 << 17,
- ClonedContentsChanged = 1 << 18,
- ContentsRectChanged = 1 << 19,
- ContentsScaleChanged = 1 << 20,
- MinificationFilterChanged = 1 << 21,
- MagnificationFilterChanged = 1 << 22,
- BlendModeChanged = 1 << 23,
- SpeedChanged = 1 << 24,
- TimeOffsetChanged = 1 << 25,
- BackingStoreChanged = 1 << 26,
- FiltersChanged = 1 << 27,
- AnimationsChanged = 1 << 28,
- EdgeAntialiasingMaskChanged = 1 << 29,
- CustomAppearanceChanged = 1 << 30,
- CustomBehaviorChanged = 1 << 31
</del><ins>+ NoChange = 0,
+ NameChanged = 1LLU << 1,
+ ChildrenChanged = 1LLU << 2,
+ PositionChanged = 1LLU << 3,
+ BoundsChanged = 1LLU << 4,
+ BackgroundColorChanged = 1LLU << 5,
+ AnchorPointChanged = 1LLU << 6,
+ BorderWidthChanged = 1LLU << 7,
+ BorderColorChanged = 1LLU << 8,
+ OpacityChanged = 1LLU << 9,
+ TransformChanged = 1LLU << 10,
+ SublayerTransformChanged = 1LLU << 11,
+ HiddenChanged = 1LLU << 12,
+ GeometryFlippedChanged = 1LLU << 13,
+ DoubleSidedChanged = 1LLU << 14,
+ MasksToBoundsChanged = 1LLU << 15,
+ OpaqueChanged = 1LLU << 16,
+ MaskLayerChanged = 1LLU << 17,
+ ClonedContentsChanged = 1LLU << 18,
+ ContentsRectChanged = 1LLU << 19,
+ ContentsScaleChanged = 1LLU << 20,
+ CornerRadiusChanged = 1LLU << 21,
+ ShapeRoundedRectChanged = 1LLU << 22,
+ MinificationFilterChanged = 1LLU << 23,
+ MagnificationFilterChanged = 1LLU << 24,
+ BlendModeChanged = 1LLU << 25,
+ SpeedChanged = 1LLU << 26,
+ TimeOffsetChanged = 1LLU << 27,
+ BackingStoreChanged = 1LLU << 28,
+ FiltersChanged = 1LLU << 29,
+ AnimationsChanged = 1LLU << 30,
+ EdgeAntialiasingMaskChanged = 1LLU << 31,
+ CustomAppearanceChanged = 1LLU << 32,
+ CustomBehaviorChanged = 1LLU << 33
</ins><span class="cx"> };
</span><del>- typedef unsigned LayerChange;
</del><ins>+ typedef uint64_t LayerChange;
</ins><span class="cx">
</span><span class="cx"> struct LayerCreationProperties {
</span><span class="cx"> LayerCreationProperties();
</span><span class="lines">@@ -122,6 +124,8 @@
</span><span class="cx"> String name;
</span><span class="cx"> std::unique_ptr<WebCore::TransformationMatrix> transform;
</span><span class="cx"> std::unique_ptr<WebCore::TransformationMatrix> sublayerTransform;
</span><ins>+ std::unique_ptr<WebCore::FloatRoundedRect> shapeRoundedRect;
+
</ins><span class="cx"> Vector<WebCore::GraphicsLayer::PlatformLayerID> children;
</span><span class="cx">
</span><span class="cx"> Vector<std::pair<String, PlatformCAAnimationRemote::Properties>> addedAnimations;
</span><span class="lines">@@ -138,6 +142,7 @@
</span><span class="cx"> double timeOffset;
</span><span class="cx"> float speed;
</span><span class="cx"> float contentsScale;
</span><ins>+ float cornerRadius;
</ins><span class="cx"> float borderWidth;
</span><span class="cx"> float opacity;
</span><span class="cx"> WebCore::Color backgroundColor;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacRemoteLayerTreeTransactionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -86,6 +86,7 @@
</span><span class="cx"> , timeOffset(0)
</span><span class="cx"> , speed(1)
</span><span class="cx"> , contentsScale(1)
</span><ins>+ , cornerRadius(0)
</ins><span class="cx"> , borderWidth(0)
</span><span class="cx"> , opacity(1)
</span><span class="cx"> , backgroundColor(Color::transparent)
</span><span class="lines">@@ -120,6 +121,7 @@
</span><span class="cx"> , timeOffset(other.timeOffset)
</span><span class="cx"> , speed(other.speed)
</span><span class="cx"> , contentsScale(other.contentsScale)
</span><ins>+ , cornerRadius(other.cornerRadius)
</ins><span class="cx"> , borderWidth(other.borderWidth)
</span><span class="cx"> , opacity(other.opacity)
</span><span class="cx"> , backgroundColor(other.backgroundColor)
</span><span class="lines">@@ -218,6 +220,12 @@
</span><span class="cx"> if (changedProperties & ContentsScaleChanged)
</span><span class="cx"> encoder << contentsScale;
</span><span class="cx">
</span><ins>+ if (changedProperties & CornerRadiusChanged)
+ encoder << cornerRadius;
+
+ if (changedProperties & ShapeRoundedRectChanged)
+ encoder << *shapeRoundedRect;
+
</ins><span class="cx"> if (changedProperties & MinificationFilterChanged)
</span><span class="cx"> encoder.encodeEnum(minificationFilter);
</span><span class="cx">
</span><span class="lines">@@ -377,6 +385,19 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (result.changedProperties & CornerRadiusChanged) {
+ if (!decoder.decode(result.cornerRadius))
+ return false;
+ }
+
+ if (result.changedProperties & ShapeRoundedRectChanged) {
+ FloatRoundedRect roundedRect;
+ if (!decoder.decode(roundedRect))
+ return false;
+
+ result.shapeRoundedRect = std::make_unique<FloatRoundedRect>(roundedRect);
+ }
+
</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">@@ -599,6 +620,7 @@
</span><span class="cx">
</span><span class="cx"> RemoteLayerTreeTextStream& operator<<(const TransformationMatrix&);
</span><span class="cx"> RemoteLayerTreeTextStream& operator<<(PlatformCALayer::FilterType);
</span><ins>+ RemoteLayerTreeTextStream& operator<<(const FloatRoundedRect&);
</ins><span class="cx"> RemoteLayerTreeTextStream& operator<<(FloatPoint3D);
</span><span class="cx"> RemoteLayerTreeTextStream& operator<<(Color);
</span><span class="cx"> RemoteLayerTreeTextStream& operator<<(FloatRect);
</span><span class="lines">@@ -651,6 +673,25 @@
</span><span class="cx"> return ts;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+RemoteLayerTreeTextStream& RemoteLayerTreeTextStream::operator<<(const FloatRoundedRect& roundedRect)
+{
+ RemoteLayerTreeTextStream& ts = *this;
+ ts << roundedRect.rect().x() << " " << roundedRect.rect().y() << " " << roundedRect.rect().width() << " " << roundedRect.rect().height() << "\n";
+
+ ts.increaseIndent();
+ ts.writeIndent();
+ ts << "topLeft=" << roundedRect.topLeftCorner().width() << " " << roundedRect.topLeftCorner().height() << "\n";
+ ts.writeIndent();
+ ts << "topRight=" << roundedRect.topRightCorner().width() << " " << roundedRect.topRightCorner().height() << "\n";
+ ts.writeIndent();
+ ts << "bottomLeft=" << roundedRect.bottomLeftCorner().width() << " " << roundedRect.bottomLeftCorner().height() << "\n";
+ ts.writeIndent();
+ ts << "bottomRight=" << roundedRect.bottomRightCorner().width() << " " << roundedRect.bottomRightCorner().height();
+ ts.decreaseIndent();
+
+ return ts;
+}
+
</ins><span class="cx"> RemoteLayerTreeTextStream& RemoteLayerTreeTextStream::operator<<(PlatformCALayer::FilterType filterType)
</span><span class="cx"> {
</span><span class="cx"> RemoteLayerTreeTextStream& ts = *this;
</span><span class="lines">@@ -1083,6 +1124,12 @@
</span><span class="cx"> if (layerProperties.changedProperties & RemoteLayerTreeTransaction::ContentsScaleChanged)
</span><span class="cx"> dumpProperty(ts, "contentsScale", layerProperties.contentsScale);
</span><span class="cx">
</span><ins>+ if (layerProperties.changedProperties & RemoteLayerTreeTransaction::CornerRadiusChanged)
+ dumpProperty(ts, "cornerRadius", layerProperties.cornerRadius);
+
+ if (layerProperties.changedProperties & RemoteLayerTreeTransaction::ShapeRoundedRectChanged)
+ dumpProperty(ts, "shapeRect", layerProperties.shapeRoundedRect ? *layerProperties.shapeRoundedRect : FloatRoundedRect());
+
</ins><span class="cx"> if (layerProperties.changedProperties & RemoteLayerTreeTransaction::MinificationFilterChanged)
</span><span class="cx"> dumpProperty(ts, "minificationFilter", layerProperties.minificationFilter);
</span><span class="cx">
</span><span class="lines">@@ -1189,6 +1236,9 @@
</span><span class="cx"> case PlatformCALayer::LayerTypeWebGLLayer:
</span><span class="cx"> ts << "web-gl-layer (context-id " << createdLayer.hostingContextID << ")";
</span><span class="cx"> break;
</span><ins>+ case PlatformCALayer::LayerTypeShapeLayer:
+ ts << "shape-layer";
+ break;
</ins><span class="cx"> case PlatformCALayer::LayerTypeCustom:
</span><span class="cx"> ts << "custom-layer (context-id " << createdLayer.hostingContextID << ")";
</span><span class="cx"> break;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosRemoteLayerTreeHostIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/RemoteLayerTreeHostIOS.mm (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/RemoteLayerTreeHostIOS.mm        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebKit2/UIProcess/ios/RemoteLayerTreeHostIOS.mm        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -83,6 +83,7 @@
</span><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> @implementation WKCompositingView
</span><ins>+
</ins><span class="cx"> - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
</span><span class="cx"> {
</span><span class="cx"> return [self _findDescendantViewAtPoint:point withEvent:event];
</span><span class="lines">@@ -94,12 +95,14 @@
</span><span class="cx"> NSString *webKitDetails = [NSString stringWithFormat:@" layerID = %llu \"%@\"", WebKit::RemoteLayerTreeHost::layerID(self.layer), self.layer.name ? self.layer.name : @""];
</span><span class="cx"> return [viewDescription stringByAppendingString:webKitDetails];
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> @interface WKTransformView : WKCompositingView
</span><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> @implementation WKTransformView
</span><ins>+
</ins><span class="cx"> + (Class)layerClass
</span><span class="cx"> {
</span><span class="cx"> return [CATransformLayer self];
</span><span class="lines">@@ -118,10 +121,23 @@
</span><span class="cx">
</span><span class="cx"> @end
</span><span class="cx">
</span><ins>+@interface WKShapeView : WKCompositingView
+@end
+
+@implementation WKShapeView
+
++ (Class)layerClass
+{
+ return [CAShapeLayer self];
+}
+
+@end
+
</ins><span class="cx"> @interface WKRemoteView : WKCompositingView
</span><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> @implementation WKRemoteView
</span><ins>+
</ins><span class="cx"> - (instancetype)initWithFrame:(CGRect)frame contextID:(uint32_t)contextID hostingDeviceScaleFactor:(float)scaleFactor
</span><span class="cx"> {
</span><span class="cx"> if ((self = [super initWithFrame:frame])) {
</span><span class="lines">@@ -179,6 +195,9 @@
</span><span class="cx"> else
</span><span class="cx"> view = adoptNS([[WKCompositingView alloc] init]);
</span><span class="cx"> break;
</span><ins>+ case PlatformCALayer::LayerTypeSimpleLayer:
+ view = adoptNS([[WKShapeView alloc] init]);
+ break;
</ins><span class="cx"> default:
</span><span class="cx"> ASSERT_NOT_REACHED();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacRemoteLayerTreeHostmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -243,6 +243,9 @@
</span><span class="cx"> else
</span><span class="cx"> layer = adoptNS([[CALayer alloc] init]);
</span><span class="cx"> break;
</span><ins>+ case PlatformCALayer::LayerTypeShapeLayer:
+ layer = adoptNS([[CAShapeLayer alloc] init]);
+ break;
</ins><span class="cx"> default:
</span><span class="cx"> ASSERT_NOT_REACHED();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacPlatformCALayerRemotecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -132,8 +132,14 @@
</span><span class="cx"> clone.setOpaque(isOpaque());
</span><span class="cx"> clone.setBackgroundColor(backgroundColor());
</span><span class="cx"> clone.setContentsScale(contentsScale());
</span><ins>+ clone.setCornerRadius(cornerRadius());
+
+ if (m_properties.shapeRoundedRect)
+ clone.setShapeRoundedRect(*m_properties.shapeRoundedRect);
+
</ins><span class="cx"> if (m_properties.filters)
</span><span class="cx"> clone.copyFiltersFrom(*this);
</span><ins>+
</ins><span class="cx"> clone.updateCustomAppearance(customAppearance());
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -360,6 +366,12 @@
</span><span class="cx"> return m_animations.get(key);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static inline bool isEquivalentLayer(const PlatformCALayer* layer, GraphicsLayer::PlatformLayerID layerID)
+{
+ GraphicsLayer::PlatformLayerID newLayerID = layer ? layer->layerID() : 0;
+ return layerID == newLayerID;
+}
+
</ins><span class="cx"> void PlatformCALayerRemote::animationStarted(const String& key, CFTimeInterval beginTime)
</span><span class="cx"> {
</span><span class="cx"> auto it = m_animations.find(key);
</span><span class="lines">@@ -378,6 +390,9 @@
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerRemote::setMask(PlatformCALayer* layer)
</span><span class="cx"> {
</span><ins>+ if (isEquivalentLayer(layer, m_properties.maskLayerID))
+ return;
+
</ins><span class="cx"> if (layer) {
</span><span class="cx"> m_maskLayer = downcast<PlatformCALayerRemote>(layer);
</span><span class="cx"> m_properties.maskLayerID = m_maskLayer->layerID();
</span><span class="lines">@@ -391,6 +406,9 @@
</span><span class="cx">
</span><span class="cx"> void PlatformCALayerRemote::setClonedLayer(const PlatformCALayer* layer)
</span><span class="cx"> {
</span><ins>+ if (isEquivalentLayer(layer, m_properties.clonedLayerID))
+ return;
+
</ins><span class="cx"> if (layer)
</span><span class="cx"> m_properties.clonedLayerID = layer->layerID();
</span><span class="cx"> else
</span><span class="lines">@@ -656,12 +674,40 @@
</span><span class="cx"> updateBackingStore();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+float PlatformCALayerRemote::cornerRadius() const
+{
+ return m_properties.cornerRadius;
+}
+
+void PlatformCALayerRemote::setCornerRadius(float value)
+{
+ if (m_properties.cornerRadius == value)
+ return;
+
+ m_properties.cornerRadius = value;
+ m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::CornerRadiusChanged);
+}
+
</ins><span class="cx"> void PlatformCALayerRemote::setEdgeAntialiasingMask(unsigned value)
</span><span class="cx"> {
</span><span class="cx"> m_properties.edgeAntialiasingMask = value;
</span><span class="cx"> m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::EdgeAntialiasingMaskChanged);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+FloatRoundedRect PlatformCALayerRemote::shapeRoundedRect() const
+{
+ return m_properties.shapeRoundedRect ? *m_properties.shapeRoundedRect : FloatRoundedRect(FloatRect());
+}
+
+void PlatformCALayerRemote::setShapeRoundedRect(const FloatRoundedRect& roundedRect)
+{
+ if (m_properties.shapeRoundedRect && *m_properties.shapeRoundedRect == roundedRect)
+ return;
+
+ m_properties.shapeRoundedRect = std::make_unique<FloatRoundedRect>(roundedRect);
+ m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ShapeRoundedRectChanged);
+}
+
</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 (175793 => 175794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h        2014-11-09 18:27:56 UTC (rev 175793)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h        2014-11-09 19:42:17 UTC (rev 175794)
</span><span class="lines">@@ -139,8 +139,14 @@
</span><span class="cx"> virtual float contentsScale() const override;
</span><span class="cx"> virtual void setContentsScale(float) override;
</span><span class="cx">
</span><ins>+ virtual float cornerRadius() const override;
+ virtual void setCornerRadius(float) override;
+
</ins><span class="cx"> virtual void setEdgeAntialiasingMask(unsigned) override;
</span><span class="cx">
</span><ins>+ virtual WebCore::FloatRoundedRect shapeRoundedRect() const override;
+ virtual void setShapeRoundedRect(const WebCore::FloatRoundedRect&) 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>