<!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>[177155] 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/177155">177155</a></dd>
<dt>Author</dt> <dd>antti@apple.com</dd>
<dt>Date</dt> <dd>2014-12-11 09:54:38 -0800 (Thu, 11 Dec 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[SVG Masking] Enable the use of &lt;mask&gt; elements for -webkit-mask-image
https://bugs.webkit.org/show_bug.cgi?id=139294

Patch by Radu Stavila &lt;stavila@adobe.com&gt; on 2014-12-11
Reviewed by Simon Fraser.

Source/WebCore:

This patch links together all parts required for the functionality which improves 
the -webkit-mask-image property by allowing it to reference a &lt;mask&gt; element defined 
in an inline or external SVG document.
Support for this new functionality has been added in a previous patch, under issue
https://bugs.webkit.org/show_bug.cgi?id=139092. A more detailed description of how
the new functionality works can be found in the ChangeLog for that commit.
The containsSVGDocument in ScrollView has been removed because it was added in the
previous patch but is no longer required.

Tests: css3/masking/mask-base64.html
       css3/masking/mask-multiple-values.html
       css3/masking/mask-svg-clipped-fragmentId.html
       css3/masking/mask-svg-fragmentId.html
       css3/masking/mask-svg-inline-fragmentId.html
       css3/masking/mask-svg-inline-invalid-fragmentId.html
       css3/masking/mask-svg-invalid-fragmentId.html
       css3/masking/mask-svg-no-fragmentId-tiled.html
       css3/masking/mask-svg-no-fragmentId.html
       css3/masking/mask-svg-script-entire-svg-to-mask.html
       css3/masking/mask-svg-script-mask-to-entire-svg.html
       css3/masking/mask-svg-script-mask-to-none.html
       css3/masking/mask-svg-script-mask-to-png.html
       css3/masking/mask-svg-script-none-to-mask.html
       css3/masking/mask-svg-script-none-to-png.html
       css3/masking/mask-svg-script-png-to-mask.html
       css3/masking/mask-svg-script-png-to-none.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue):
* css/CSSParser.cpp:
(WebCore::CSSParser::parseFillShorthand):
(WebCore::CSSParser::parseFillProperty):
(WebCore::CSSParser::parseMaskImage):
* css/CSSParser.h:
* css/DeprecatedStyleBuilder.cpp:
(WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::adjustStyleForMaskImages):
(WebCore::StyleResolver::applyProperty):
(WebCore::StyleResolver::loadPendingSVGDocuments):
(WebCore::StyleResolver::createMaskImageOperations):
(WebCore::StyleResolver::loadPendingImages):
* page/animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc):
(WebCore::MaskImagePropertyWrapper::MaskImagePropertyWrapper):
(WebCore::MaskImagePropertyWrapper::equals):
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
* platform/graphics/MaskImageOperation.cpp:
(WebCore::MaskImageOperation::~MaskImageOperation):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::maskClipRect):
* rendering/RenderBox.h:
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintFillLayerExtended):
(WebCore::RenderBoxModelObject::calculateFillTileSize):
(WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::~RenderElement):
(WebCore::RenderElement::updateFillImages):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::calculateClipRects):
* rendering/RenderLayer.h:
* rendering/style/FillLayer.h:
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::setMaskImage):
* rendering/style/RenderStyle.h:

LayoutTests:

Added tests for different situations using URLs with fragment id
for the -webkit-mask-image property.

* css3/masking/mask-base64-expected.html: Added.
* css3/masking/mask-base64.html: Added.
* css3/masking/mask-multiple-values-expected.html: Added.
* css3/masking/mask-multiple-values.html: Added.
* css3/masking/mask-repeat-space-padding-expected.html:
* css3/masking/mask-repeat-space-padding.html:
* css3/masking/mask-svg-clipped-fragmentId-expected.html: Added.
* css3/masking/mask-svg-clipped-fragmentId.html: Added.
* css3/masking/mask-svg-fragmentId-expected.html: Added.
* css3/masking/mask-svg-fragmentId.html: Added.
* css3/masking/mask-svg-inline-fragmentId-expected.html: Added.
* css3/masking/mask-svg-inline-fragmentId.html: Added.
* css3/masking/mask-svg-inline-invalid-fragmentId-expected.html: Added.
* css3/masking/mask-svg-inline-invalid-fragmentId.html: Added.
* css3/masking/mask-svg-invalid-fragmentId-expected.html: Added.
* css3/masking/mask-svg-invalid-fragmentId.html: Added.
* css3/masking/mask-svg-no-fragmentId-expected.html: Added.
* css3/masking/mask-svg-no-fragmentId-tiled-expected.html: Added.
* css3/masking/mask-svg-no-fragmentId-tiled.html: Added.
* css3/masking/mask-svg-no-fragmentId.html: Added.
* css3/masking/mask-svg-script-entire-svg-to-mask-expected.html: Added.
* css3/masking/mask-svg-script-entire-svg-to-mask.html: Added.
* css3/masking/mask-svg-script-mask-to-entire-svg-expected.html: Added.
* css3/masking/mask-svg-script-mask-to-entire-svg.html: Added.
* css3/masking/mask-svg-script-mask-to-none-expected.html: Added.
* css3/masking/mask-svg-script-mask-to-none.html: Added.
* css3/masking/mask-svg-script-mask-to-png-expected.html: Added.
* css3/masking/mask-svg-script-mask-to-png.html: Added.
* css3/masking/mask-svg-script-none-to-mask-expected.html: Added.
* css3/masking/mask-svg-script-none-to-mask.html: Added.
* css3/masking/mask-svg-script-none-to-png-expected.html: Added.
* css3/masking/mask-svg-script-none-to-png.html: Added.
* css3/masking/mask-svg-script-png-to-mask-expected.html: Added.
* css3/masking/mask-svg-script-png-to-mask.html: Added.
* css3/masking/mask-svg-script-png-to-none-expected.html: Added.
* css3/masking/mask-svg-script-png-to-none.html: Added.
* css3/masking/resources/masks.svg: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestscss3maskingmaskrepeatspacepaddingexpectedhtml">trunk/LayoutTests/css3/masking/mask-repeat-space-padding-expected.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmaskrepeatspacepaddinghtml">trunk/LayoutTests/css3/masking/mask-repeat-space-padding.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSComputedStyleDeclarationcpp">trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSParsercpp">trunk/Source/WebCore/css/CSSParser.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSParserh">trunk/Source/WebCore/css/CSSParser.h</a></li>
<li><a href="#trunkSourceWebCorecssDeprecatedStyleBuildercpp">trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleResolvercpp">trunk/Source/WebCore/css/StyleResolver.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleResolverh">trunk/Source/WebCore/css/StyleResolver.h</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewcpp">trunk/Source/WebCore/page/FrameView.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewh">trunk/Source/WebCore/page/FrameView.h</a></li>
<li><a href="#trunkSourceWebCorepageanimationCSSPropertyAnimationcpp">trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollViewh">trunk/Source/WebCore/platform/ScrollView.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsMaskImageOperationcpp">trunk/Source/WebCore/platform/graphics/MaskImageOperation.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsMaskImageOperationh">trunk/Source/WebCore/platform/graphics/MaskImageOperation.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxcpp">trunk/Source/WebCore/rendering/RenderBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxh">trunk/Source/WebCore/rendering/RenderBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxModelObjectcpp">trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderElementcpp">trunk/Source/WebCore/rendering/RenderElement.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayercpp">trunk/Source/WebCore/rendering/RenderLayer.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerh">trunk/Source/WebCore/rendering/RenderLayer.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerMaskImageInfocpp">trunk/Source/WebCore/rendering/RenderLayerMaskImageInfo.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerMaskImageInfoh">trunk/Source/WebCore/rendering/RenderLayerMaskImageInfo.h</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleFillLayercpp">trunk/Source/WebCore/rendering/style/FillLayer.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleFillLayerh">trunk/Source/WebCore/rendering/style/FillLayer.h</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleRenderStylecpp">trunk/Source/WebCore/rendering/style/RenderStyle.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleRenderStyleh">trunk/Source/WebCore/rendering/style/RenderStyle.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestscss3maskingmaskbase64expectedhtml">trunk/LayoutTests/css3/masking/mask-base64-expected.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmaskbase64html">trunk/LayoutTests/css3/masking/mask-base64.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmaskmultiplevaluesexpectedhtml">trunk/LayoutTests/css3/masking/mask-multiple-values-expected.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmaskmultiplevalueshtml">trunk/LayoutTests/css3/masking/mask-multiple-values.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvgclippedfragmentIdexpectedhtml">trunk/LayoutTests/css3/masking/mask-svg-clipped-fragmentId-expected.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvgclippedfragmentIdhtml">trunk/LayoutTests/css3/masking/mask-svg-clipped-fragmentId.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvgfragmentIdexpectedhtml">trunk/LayoutTests/css3/masking/mask-svg-fragmentId-expected.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvgfragmentIdhtml">trunk/LayoutTests/css3/masking/mask-svg-fragmentId.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvginlinefragmentIdexpectedhtml">trunk/LayoutTests/css3/masking/mask-svg-inline-fragmentId-expected.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvginlinefragmentIdhtml">trunk/LayoutTests/css3/masking/mask-svg-inline-fragmentId.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvginlineinvalidfragmentIdexpectedhtml">trunk/LayoutTests/css3/masking/mask-svg-inline-invalid-fragmentId-expected.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvginlineinvalidfragmentIdhtml">trunk/LayoutTests/css3/masking/mask-svg-inline-invalid-fragmentId.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvginvalidfragmentIdexpectedhtml">trunk/LayoutTests/css3/masking/mask-svg-invalid-fragmentId-expected.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvginvalidfragmentIdhtml">trunk/LayoutTests/css3/masking/mask-svg-invalid-fragmentId.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvgnofragmentIdexpectedhtml">trunk/LayoutTests/css3/masking/mask-svg-no-fragmentId-expected.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvgnofragmentIdtiledexpectedhtml">trunk/LayoutTests/css3/masking/mask-svg-no-fragmentId-tiled-expected.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvgnofragmentIdtiledhtml">trunk/LayoutTests/css3/masking/mask-svg-no-fragmentId-tiled.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvgnofragmentIdhtml">trunk/LayoutTests/css3/masking/mask-svg-no-fragmentId.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvgscriptentiresvgtomaskexpectedhtml">trunk/LayoutTests/css3/masking/mask-svg-script-entire-svg-to-mask-expected.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvgscriptentiresvgtomaskhtml">trunk/LayoutTests/css3/masking/mask-svg-script-entire-svg-to-mask.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvgscriptmasktoentiresvgexpectedhtml">trunk/LayoutTests/css3/masking/mask-svg-script-mask-to-entire-svg-expected.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvgscriptmasktoentiresvghtml">trunk/LayoutTests/css3/masking/mask-svg-script-mask-to-entire-svg.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvgscriptmasktononeexpectedhtml">trunk/LayoutTests/css3/masking/mask-svg-script-mask-to-none-expected.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvgscriptmasktononehtml">trunk/LayoutTests/css3/masking/mask-svg-script-mask-to-none.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvgscriptmasktopngexpectedhtml">trunk/LayoutTests/css3/masking/mask-svg-script-mask-to-png-expected.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvgscriptmasktopnghtml">trunk/LayoutTests/css3/masking/mask-svg-script-mask-to-png.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvgscriptnonetomaskexpectedhtml">trunk/LayoutTests/css3/masking/mask-svg-script-none-to-mask-expected.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvgscriptnonetomaskhtml">trunk/LayoutTests/css3/masking/mask-svg-script-none-to-mask.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvgscriptnonetopngexpectedhtml">trunk/LayoutTests/css3/masking/mask-svg-script-none-to-png-expected.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvgscriptnonetopnghtml">trunk/LayoutTests/css3/masking/mask-svg-script-none-to-png.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvgscriptpngtomaskexpectedhtml">trunk/LayoutTests/css3/masking/mask-svg-script-png-to-mask-expected.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvgscriptpngtomaskhtml">trunk/LayoutTests/css3/masking/mask-svg-script-png-to-mask.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvgscriptpngtononeexpectedhtml">trunk/LayoutTests/css3/masking/mask-svg-script-png-to-none-expected.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingmasksvgscriptpngtononehtml">trunk/LayoutTests/css3/masking/mask-svg-script-png-to-none.html</a></li>
<li><a href="#trunkLayoutTestscss3maskingresourcesmaskssvg">trunk/LayoutTests/css3/masking/resources/masks.svg</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/LayoutTests/ChangeLog        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -1,3 +1,51 @@
</span><ins>+2014-12-11  Radu Stavila  &lt;stavila@adobe.com&gt;
+
+        [SVG Masking] Enable the use of &lt;mask&gt; elements for -webkit-mask-image
+        https://bugs.webkit.org/show_bug.cgi?id=139294
+
+        Reviewed by Simon Fraser.
+
+        Added tests for different situations using URLs with fragment id
+        for the -webkit-mask-image property.
+
+        * css3/masking/mask-base64-expected.html: Added.
+        * css3/masking/mask-base64.html: Added.
+        * css3/masking/mask-multiple-values-expected.html: Added.
+        * css3/masking/mask-multiple-values.html: Added.
+        * css3/masking/mask-repeat-space-padding-expected.html:
+        * css3/masking/mask-repeat-space-padding.html:
+        * css3/masking/mask-svg-clipped-fragmentId-expected.html: Added.
+        * css3/masking/mask-svg-clipped-fragmentId.html: Added.
+        * css3/masking/mask-svg-fragmentId-expected.html: Added.
+        * css3/masking/mask-svg-fragmentId.html: Added.
+        * css3/masking/mask-svg-inline-fragmentId-expected.html: Added.
+        * css3/masking/mask-svg-inline-fragmentId.html: Added.
+        * css3/masking/mask-svg-inline-invalid-fragmentId-expected.html: Added.
+        * css3/masking/mask-svg-inline-invalid-fragmentId.html: Added.
+        * css3/masking/mask-svg-invalid-fragmentId-expected.html: Added.
+        * css3/masking/mask-svg-invalid-fragmentId.html: Added.
+        * css3/masking/mask-svg-no-fragmentId-expected.html: Added.
+        * css3/masking/mask-svg-no-fragmentId-tiled-expected.html: Added.
+        * css3/masking/mask-svg-no-fragmentId-tiled.html: Added.
+        * css3/masking/mask-svg-no-fragmentId.html: Added.
+        * css3/masking/mask-svg-script-entire-svg-to-mask-expected.html: Added.
+        * css3/masking/mask-svg-script-entire-svg-to-mask.html: Added.
+        * css3/masking/mask-svg-script-mask-to-entire-svg-expected.html: Added.
+        * css3/masking/mask-svg-script-mask-to-entire-svg.html: Added.
+        * css3/masking/mask-svg-script-mask-to-none-expected.html: Added.
+        * css3/masking/mask-svg-script-mask-to-none.html: Added.
+        * css3/masking/mask-svg-script-mask-to-png-expected.html: Added.
+        * css3/masking/mask-svg-script-mask-to-png.html: Added.
+        * css3/masking/mask-svg-script-none-to-mask-expected.html: Added.
+        * css3/masking/mask-svg-script-none-to-mask.html: Added.
+        * css3/masking/mask-svg-script-none-to-png-expected.html: Added.
+        * css3/masking/mask-svg-script-none-to-png.html: Added.
+        * css3/masking/mask-svg-script-png-to-mask-expected.html: Added.
+        * css3/masking/mask-svg-script-png-to-mask.html: Added.
+        * css3/masking/mask-svg-script-png-to-none-expected.html: Added.
+        * css3/masking/mask-svg-script-png-to-none.html: Added.
+        * css3/masking/resources/masks.svg: Added.
+
</ins><span class="cx"> 2014-12-10  Alexey Proskuryakov  &lt;ap@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Mac test expectations gardening.
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmaskbase64expectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-base64-expected.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-base64-expected.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-base64-expected.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html lang=&quot;en&quot;&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #front {
+                width: 200px;
+                height: 160px;
+                background-color: green;
+                -webkit-mask-repeat: no-repeat;
+                -webkit-mask-origin: content-box;
+                -webkit-mask-clip: content-box;
+            }
+        &lt;/style&gt;
+        &lt;script&gt;
+            var sizeX = 50, sizeY = 40, spaceX = 0, spaceY = 0, width = 200, height = 160;
+
+            var urls = Array(), size = Array(), position = Array();
+
+            function addMasks() {
+                for (var x = 0; x &lt; width; x += sizeX + spaceX) {
+                    for (var y = 0; y &lt; height; y += sizeY + spaceY) {
+                        urls.push(&quot;url(resources/circle.svg)&quot;);
+                        size.push(sizeX + &quot;px &quot; + sizeY + &quot;px&quot;);
+                        position.push(x + &quot;px &quot; + y + &quot;px&quot;);
+                    }
+                }
+
+                div = document.getElementById(&quot;front&quot;);
+
+                div.style.cssText += &quot;-webkit-mask-image: &quot; + urls.join(&quot;, &quot;) + &quot;;&quot; +
+                                     &quot;-webkit-mask-size: &quot; + size.join(&quot;, &quot;)  + &quot;;&quot; +
+                                     &quot;-webkit-mask-position: &quot; + position.join(&quot;, &quot;) + &quot;;&quot;;
+           }
+       &lt;/script&gt;
+    &lt;/head&gt;
+
+    &lt;body onload=&quot;addMasks()&quot;&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see a 4x4 grid of green circles.&lt;/p&gt;
+        &lt;p&gt;This test sets the mask-image value using base64.&lt;/p&gt;
+        &lt;div id=&quot;front&quot;&gt;&lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
+
</ins></span></pre></div>
<a id="trunkLayoutTestscss3maskingmaskbase64html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-base64.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-base64.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-base64.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #maskedElement {
+                width: 200px;
+                height: 160px;
+                background-color: green;
+                -webkit-mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjM2MCIgaGVpZ2h0PSIyODgiPgogICAgPGNpcmNsZSBjeD0iMTgwIiBjeT0iMTQ0IiByPSI4MCIgLz4KPC9zdmc+Cgo=);
+                -webkit-mask-size: 50px 40px;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see a 4x4 grid of green circles.&lt;/p&gt;
+        &lt;p&gt;This test sets the mask-image value using base64.&lt;/p&gt;
+        &lt;div id=&quot;maskedElement&quot;&gt;&lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmaskmultiplevaluesexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-multiple-values-expected.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-multiple-values-expected.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-multiple-values-expected.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,57 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html lang=&quot;en&quot;&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #back {
+                width: 500px;
+                height: 500px;
+                background-color: green;
+            }
+            .front {
+                position: absolute;
+                width: 300px;
+                height: 300px;
+                background-color: black;
+                border: 50px solid blue;
+                padding: 50px;
+                -webkit-mask-repeat: no-repeat;
+                -webkit-mask-origin: content-box;
+                -webkit-mask-clip: border-box;
+            }
+            #front1 {
+                -webkit-mask-image: url('resources/circle.png');
+                -webkit-mask-size: 150px 120px;
+                -webkit-mask-position: -120px -110px;
+            }
+            #front2 {
+                -webkit-mask-image: url('resources/masks.svg#lowerHalf');
+                -webkit-mask-size: 300px 240px;
+                -webkit-mask-position: 50px 0px;
+            }
+            #front3 {
+                -webkit-mask-image: url('resources/masks.svg#upperHalf');
+                -webkit-mask-size: 300px 240px;
+                -webkit-mask-position: 50px 0px;
+            }
+            #front4 {
+                -webkit-mask-image: url('resources/masks.svg#invalidId');
+                -webkit-mask-size: 225px 180px;
+                -webkit-mask-position: 160px 220px;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - This test uses multiple masks from multiple resources.&lt;/p&gt;
+        &lt;div id=&quot;back&quot;&gt;
+            &lt;div class=&quot;front&quot; id=&quot;front1&quot;&gt;&lt;/div&gt;
+            &lt;div class=&quot;front&quot; id=&quot;front2&quot;&gt;&lt;/div&gt;
+            &lt;div class=&quot;front&quot; id=&quot;front3&quot;&gt;&lt;/div&gt;
+            &lt;div class=&quot;front&quot; id=&quot;front4&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
+
</ins></span></pre></div>
<a id="trunkLayoutTestscss3maskingmaskmultiplevalueshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-multiple-values.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-multiple-values.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-multiple-values.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html lang=&quot;en&quot;&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #back {
+                width: 500px;
+                height: 500px;
+                background-color: green;
+            }
+            #front {
+                width: 300px;
+                height: 300px;
+                background-color: black;
+                border: 50px solid blue;
+                padding: 50px;
+                -webkit-mask-image: url('resources/circle.png'), url('resources/masks.svg#lowerHalf'), url('resources/masks.svg#upperHalf'), url('resources/masks.svg#invalidId');
+                -webkit-mask-size: 150px 120px, 300px 240px, 300px 240px, 225px 180px;
+                -webkit-mask-position: -120px -110px, 50px 0px, 50px 0px, 160px 220px;
+                -webkit-mask-repeat: no-repeat;
+                -webkit-mask-origin: content-box;
+                -webkit-mask-clip: border-box;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - This test uses multiple masks from multiple resources.&lt;/p&gt;
+        &lt;div id=&quot;back&quot;&gt;
+            &lt;div id=&quot;front&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
+
</ins></span></pre></div>
<a id="trunkLayoutTestscss3maskingmaskrepeatspacepaddingexpectedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/css3/masking/mask-repeat-space-padding-expected.html (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-repeat-space-padding-expected.html        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/LayoutTests/css3/masking/mask-repeat-space-padding-expected.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx">             function addMasks() {
</span><span class="cx">                 for (var x = 0; x &lt; width; x += sizeX + spaceX) {
</span><span class="cx">                     for (var y = 0; y &lt; height; y += sizeY + spaceY) {
</span><del>-                        urls.push(&quot;url(resources/circle.png)&quot;);
</del><ins>+                        urls.push(&quot;url(resources/circle.svg)&quot;);
</ins><span class="cx">                         size.push(sizeX + &quot;px &quot; + sizeY + &quot;px&quot;);
</span><span class="cx">                         position.push(x + &quot;px &quot; + y + &quot;px&quot;);
</span><span class="cx">                     }
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmaskrepeatspacepaddinghtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/css3/masking/mask-repeat-space-padding.html (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-repeat-space-padding.html        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/LayoutTests/css3/masking/mask-repeat-space-padding.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -13,7 +13,7 @@
</span><span class="cx">                 background-color: red;
</span><span class="cx">                 border: 50px solid blue;
</span><span class="cx">                 padding: 50px;
</span><del>-                -webkit-mask-image: url(&quot;resources/circle.png&quot;);
</del><ins>+                -webkit-mask-image: url(&quot;resources/circle.svg&quot;);
</ins><span class="cx">                 -webkit-mask-size: 100px;
</span><span class="cx">                 -webkit-mask-repeat: space;
</span><span class="cx">                 -webkit-mask-origin: padding-box;
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvgclippedfragmentIdexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-clipped-fragmentId-expected.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-clipped-fragmentId-expected.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-clipped-fragmentId-expected.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html lang=&quot;en&quot;&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #back {
+                width: 320px;
+                height: 420px;
+                background-color: green;
+                overflow: hidden;
+            }
+            #blackSVG {
+                position: relative;
+                left: 60px;
+                top: -35px;
+            }
+            #blueSVG {
+                position: relative;
+                left: 70px;
+                top: -474px;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - This test used a &amp;lt;mask&amp;gt; element and paints it at the side of the masked element, causing it to be clipped.&lt;/p&gt;
+        &lt;div id=&quot;back&quot;&gt;
+            &lt;svg id=&quot;blackSVG&quot; width=&quot;320px&quot; height=&quot;420px&quot;&gt;
+                &lt;path fill=&quot;black&quot; d=&quot;M80,20 L280,20 L280,380 L240,380 L240,60 L80,60 L80,20&quot;/&gt;
+            &lt;/svg&gt;
+            &lt;svg id=&quot;blueSVG&quot; width=&quot;320px&quot; height=&quot;420px&quot;&gt;
+                &lt;path fill=&quot;blue&quot; d=&quot;M70,20 L280,20 L280,395 L240,395 L240,60 L70,60 L70,20&quot;/&gt;
+            &lt;/svg&gt;
+        &lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
+
</ins></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvgclippedfragmentIdhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-clipped-fragmentId.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-clipped-fragmentId.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-clipped-fragmentId.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html lang=&quot;en&quot;&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #back {
+                width: 320px;
+                height: 420px;
+                background-color: green;
+            }
+            #front {
+                width: 300px;
+                height: 400px;
+                background-color: black;
+                border: 10px solid blue;
+                -webkit-mask-image: url('resources/masks.svg#upperHalf');
+                -webkit-mask-size: 320px 420px;
+                -webkit-mask-position: 50px -45px;
+                -webkit-mask-repeat: no-repeat;
+                -webkit-mask-origin: content-box;
+                -webkit-mask-clip: border-box;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - This test used a &amp;lt;mask&amp;gt; element and paints it at the side of the masked element, causing it to be clipped.&lt;/p&gt;
+        &lt;div id=&quot;back&quot;&gt;
+            &lt;div id=&quot;front&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
+
</ins></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvgfragmentIdexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-fragmentId-expected.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-fragmentId-expected.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-fragmentId-expected.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see a green inverted-L shape and no red.&lt;/p&gt;
+        &lt;p&gt;This test references a &amp;lt;mask&amp;gt; element from an external SVG&lt;/p&gt;
+        &lt;svg width=&quot;300px&quot; height=&quot;400px&quot;&gt;
+            &lt;path fill=&quot;green&quot; d=&quot;M80,20 L280,20 L280,380 L240,380 L240,60 L80,60 L80,20&quot;/&gt;
+        &lt;/svg&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvgfragmentIdhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-fragmentId.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-fragmentId.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-fragmentId.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #maskedElement {
+                width: 300px;
+                height: 400px;
+                background-color: green;
+                -webkit-mask-image:url('resources/masks.svg#upperHalf');
+            }
+            #redSvg {
+                position: absolute;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see a green inverted-L shape and no red.&lt;/p&gt;
+        &lt;p&gt;This test references a &amp;lt;mask&amp;gt; element from an external SVG&lt;/p&gt;
+        &lt;svg id=&quot;redSvg&quot; width=&quot;300px&quot; height=&quot;400px&quot;&gt;
+            &lt;path fill=&quot;red&quot; d=&quot;M80,20 L280,20 L280,380 L240,380 L240,60 L80,60 L80,20&quot;/&gt;
+        &lt;/svg&gt;
+        &lt;div id=&quot;maskedElement&quot;&gt;&lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvginlinefragmentIdexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-inline-fragmentId-expected.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-inline-fragmentId-expected.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-inline-fragmentId-expected.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see a green L shape and no red.&lt;/p&gt;
+        &lt;p&gt;This test references a &amp;lt;mask&amp;gt; element defined in the main HTML document&lt;/p&gt;
+        &lt;svg width=&quot;300px&quot; height=&quot;400px&quot;&gt;
+            &lt;path fill=&quot;green&quot; d=&quot;M20,20 L60,20 L60,340 L220,340 L220,380 L20,380 L20,20&quot;/&gt;
+        &lt;/svg&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvginlinefragmentIdhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-inline-fragmentId.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-inline-fragmentId.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-inline-fragmentId.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #maskedElement {
+                width: 300px;
+                height: 400px;
+                background-color: green;
+                -webkit-mask-image:url('#lowerHalf');
+            }
+            #redSvg {
+                position: absolute;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see a green L shape and no red.&lt;/p&gt;
+        &lt;p&gt;This test references a &amp;lt;mask&amp;gt; element defined in the main HTML document&lt;/p&gt;
+        &lt;svg id=&quot;redSvg&quot; width=&quot;300px&quot; height=&quot;400px&quot;&gt;
+            &lt;path fill=&quot;red&quot; d=&quot;M20,20 L60,20 L60,340 L220,340 L220,380 L20,380 L20,20&quot;/&gt;
+            &lt;mask id=&quot;lowerHalf&quot; maskUnits=&quot;objectBoundingBox&quot;&gt;
+                &lt;path fill=&quot;#FFFFFF&quot; d=&quot;M20,20 L60,20 L60,340 L220,340 L220,380 L20,380 L20,20&quot;/&gt;
+            &lt;/mask&gt;
+        &lt;/svg&gt;
+        &lt;div id=&quot;maskedElement&quot;&gt;&lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvginlineinvalidfragmentIdexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-inline-invalid-fragmentId-expected.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-inline-invalid-fragmentId-expected.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-inline-invalid-fragmentId-expected.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #elementToNotBeCovered {
+                width: 300px;
+                height: 400px;
+                background-color: #2222FF;
+                position: absolute;
+                left: 10px;
+                top: 50px;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see a blue rectangle and no red.&lt;/p&gt;
+        &lt;p&gt;This test references an invalid fragment identifier.&lt;/p&gt;
+        &lt;div id=&quot;elementToNotBeCovered&quot;&gt;&lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvginlineinvalidfragmentIdhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-inline-invalid-fragmentId.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-inline-invalid-fragmentId.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-inline-invalid-fragmentId.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #maskedElement {
+                width: 300px;
+                height: 400px;
+                background-color: red;
+                -webkit-mask-image:url('#invalidId');
+                position: absolute;
+                left: 10px;
+                top: 50px;
+            }
+            #elementToNotBeCovered {
+                width: 300px;
+                height: 400px;
+                background-color: #2222FF;
+                position: absolute;
+                left: 10px;
+                top: 50px;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see a blue rectangle and no red.&lt;/p&gt;
+        &lt;p&gt;This test references an invalid fragment identifier.&lt;/p&gt;
+        &lt;div id=&quot;elementToNotBeCovered&quot;&gt;&lt;/div&gt;
+        &lt;div id=&quot;maskedElement&quot;&gt;&lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvginvalidfragmentIdexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-invalid-fragmentId-expected.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-invalid-fragmentId-expected.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-invalid-fragmentId-expected.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see 4 green rectangles and no red.&lt;/p&gt;
+        &lt;p&gt;This test references an invalid fragment identifier from an external SVG&lt;/p&gt;
+        &lt;svg width=&quot;300px&quot; height=&quot;400px&quot;&gt;
+            &lt;rect x=&quot;5px&quot; y=&quot;45px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;green&quot;/&gt;
+            &lt;rect x=&quot;155px&quot; y=&quot;45px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;green&quot;/&gt;
+            &lt;rect x=&quot;155px&quot; y=&quot;215px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;green&quot;/&gt;
+            &lt;rect x=&quot;5px&quot; y=&quot;215px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;green&quot;/&gt;
+        &lt;/svg&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvginvalidfragmentIdhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-invalid-fragmentId.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-invalid-fragmentId.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-invalid-fragmentId.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #maskedElement {
+                width: 300px;
+                height: 400px;
+                background-color: green;
+                -webkit-mask-image:url('resources/masks.svg#invalidId');
+            }
+            #redSvg {
+                position: absolute;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see 4 green rectangles and no red.&lt;/p&gt;
+        &lt;p&gt;This test references an invalid fragment identifier from an external SVG&lt;/p&gt;
+        &lt;svg id=&quot;redSvg&quot; width=&quot;300px&quot; height=&quot;400px&quot;&gt;
+            &lt;rect x=&quot;5px&quot; y=&quot;45px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;red&quot;/&gt;
+            &lt;rect x=&quot;155px&quot; y=&quot;45px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;red&quot;/&gt;
+            &lt;rect x=&quot;155px&quot; y=&quot;215px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;red&quot;/&gt;
+            &lt;rect x=&quot;5px&quot; y=&quot;215px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;red&quot;/&gt;
+        &lt;/svg&gt;
+        &lt;div id=&quot;maskedElement&quot;&gt;&lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvgnofragmentIdexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-no-fragmentId-expected.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-no-fragmentId-expected.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-no-fragmentId-expected.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see 4 green rectangles and no red.&lt;/p&gt;
+        &lt;p&gt;This test references an external SVG without specifying a fragment id.&lt;/p&gt;
+        &lt;svg width=&quot;300px&quot; height=&quot;400px&quot;&gt;
+            &lt;rect x=&quot;5px&quot; y=&quot;45px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;green&quot;/&gt;
+            &lt;rect x=&quot;155px&quot; y=&quot;45px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;green&quot;/&gt;
+            &lt;rect x=&quot;155px&quot; y=&quot;215px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;green&quot;/&gt;
+            &lt;rect x=&quot;5px&quot; y=&quot;215px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;green&quot;/&gt;
+        &lt;/svg&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvgnofragmentIdtiledexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-no-fragmentId-tiled-expected.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-no-fragmentId-tiled-expected.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-no-fragmentId-tiled-expected.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #background {
+                width: 400px;
+                height: 500px;
+                background-color: lightblue;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see a 4-rectangle green image painted tiled and no red.&lt;/p&gt;
+        &lt;p&gt;This test references an external SVG without specifying a fragment id and paints using multiple tiles.&lt;/p&gt;
+
+        &lt;div id=&quot;background&quot;&gt;
+            &lt;svg id=&quot;redSvg&quot; width=&quot;400px&quot; height=&quot;500px&quot;&gt;
+                &lt;rect x=&quot;5px&quot; y=&quot;45px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;green&quot;/&gt;
+                &lt;rect x=&quot;155px&quot; y=&quot;45px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;green&quot;/&gt;
+                &lt;rect x=&quot;305px&quot; y=&quot;45px&quot; width=&quot;95px&quot; height=&quot;140px&quot; fill=&quot;green&quot;/&gt;
+                &lt;rect x=&quot;155px&quot; y=&quot;215px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;green&quot;/&gt;
+                &lt;rect x=&quot;305px&quot; y=&quot;215px&quot; width=&quot;95px&quot; height=&quot;140px&quot; fill=&quot;green&quot;/&gt;
+                &lt;rect x=&quot;5px&quot; y=&quot;215px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;green&quot;/&gt;
+                &lt;rect x=&quot;5px&quot; y=&quot;445px&quot; width=&quot;140px&quot; height=&quot;55px&quot; fill=&quot;green&quot;/&gt;
+                &lt;rect x=&quot;155px&quot; y=&quot;445px&quot; width=&quot;140px&quot; height=&quot;55px&quot; fill=&quot;green&quot;/&gt;
+                &lt;rect x=&quot;305px&quot; y=&quot;445px&quot; width=&quot;95px&quot; height=&quot;55px&quot; fill=&quot;green&quot;/&gt;
+            &lt;/svg&gt;
+        &lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvgnofragmentIdtiledhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-no-fragmentId-tiled.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-no-fragmentId-tiled.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-no-fragmentId-tiled.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #background {
+                width: 400px;
+                height: 500px;
+                background-color: lightblue;
+            }
+            #maskedElement {
+                width: 400px;
+                height: 500px;
+                background-color: green;
+                -webkit-mask-image:url('resources/masks.svg');
+            }
+            #redSvg {
+                position: absolute;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see a 4-rectangle green image painted tiled and no red.&lt;/p&gt;
+        &lt;p&gt;This test references an external SVG without specifying a fragment id and paints using multiple tiles.&lt;/p&gt;
+        &lt;svg id=&quot;redSvg&quot; width=&quot;400px&quot; height=&quot;500px&quot;&gt;
+            &lt;rect x=&quot;5px&quot; y=&quot;45px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;red&quot;/&gt;
+            &lt;rect x=&quot;155px&quot; y=&quot;45px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;red&quot;/&gt;
+            &lt;rect x=&quot;305px&quot; y=&quot;45px&quot; width=&quot;95px&quot; height=&quot;140px&quot; fill=&quot;red&quot;/&gt;
+            &lt;rect x=&quot;155px&quot; y=&quot;215px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;red&quot;/&gt;
+            &lt;rect x=&quot;305px&quot; y=&quot;215px&quot; width=&quot;95px&quot; height=&quot;140px&quot; fill=&quot;red&quot;/&gt;
+            &lt;rect x=&quot;5px&quot; y=&quot;215px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;red&quot;/&gt;
+            &lt;rect x=&quot;5px&quot; y=&quot;445px&quot; width=&quot;140px&quot; height=&quot;55px&quot; fill=&quot;red&quot;/&gt;
+            &lt;rect x=&quot;155px&quot; y=&quot;445px&quot; width=&quot;140px&quot; height=&quot;55px&quot; fill=&quot;red&quot;/&gt;
+            &lt;rect x=&quot;305px&quot; y=&quot;445px&quot; width=&quot;95px&quot; height=&quot;55px&quot; fill=&quot;red&quot;/&gt;
+        &lt;/svg&gt;
+        &lt;div id=&quot;background&quot;&gt;
+            &lt;div id=&quot;maskedElement&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvgnofragmentIdhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-no-fragmentId.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-no-fragmentId.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-no-fragmentId.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #maskedElement {
+                width: 300px;
+                height: 400px;
+                background-color: green;
+                -webkit-mask-image:url('resources/masks.svg');
+            }
+            #redSvg {
+                position: absolute;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see 4 green rectangles and no red.&lt;/p&gt;
+        &lt;p&gt;This test references an external SVG without specifying a fragment id.&lt;/p&gt;
+        &lt;svg id=&quot;redSvg&quot; width=&quot;300px&quot; height=&quot;400px&quot;&gt;
+            &lt;rect x=&quot;5px&quot; y=&quot;45px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;red&quot;/&gt;
+            &lt;rect x=&quot;155px&quot; y=&quot;45px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;red&quot;/&gt;
+            &lt;rect x=&quot;155px&quot; y=&quot;215px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;red&quot;/&gt;
+            &lt;rect x=&quot;5px&quot; y=&quot;215px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;red&quot;/&gt;
+        &lt;/svg&gt;
+        &lt;div id=&quot;maskedElement&quot;&gt;&lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvgscriptentiresvgtomaskexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-script-entire-svg-to-mask-expected.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-script-entire-svg-to-mask-expected.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-script-entire-svg-to-mask-expected.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see a blue inverted-L shape and no red.&lt;/p&gt;
+        &lt;p&gt;This test sets the mask-image via CSS to the entire SVG and then changes it to a &amp;lt;mask&amp;gt; element from the SVG via a script.&lt;/p&gt;
+        &lt;svg width=&quot;300px&quot; height=&quot;400px&quot;&gt;
+            &lt;path fill=&quot;blue&quot; d=&quot;M80,20 L280,20 L280,380 L240,380 L240,60 L80,60 L80,20&quot;/&gt;
+        &lt;/svg&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvgscriptentiresvgtomaskhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-script-entire-svg-to-mask.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-script-entire-svg-to-mask.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-script-entire-svg-to-mask.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #maskedElement {
+                width: 300px;
+                height: 400px;
+                background-color: green;
+                -webkit-mask-image:url('resources/masks.svg');
+            }
+            #redSvg {
+                position: absolute;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see a blue inverted-L shape and no red.&lt;/p&gt;
+        &lt;p&gt;This test sets the mask-image via CSS to the entire SVG and then changes it to a &amp;lt;mask&amp;gt; element from the SVG via a script.&lt;/p&gt;
+        &lt;svg id=&quot;redSvg&quot; width=&quot;300px&quot; height=&quot;400px&quot;&gt;
+            &lt;path fill=&quot;red&quot; d=&quot;M80,20 L280,20 L280,380 L240,380 L240,60 L80,60 L80,20&quot;/&gt;
+        &lt;/svg&gt;
+        &lt;div id=&quot;maskedElement&quot;&gt;&lt;/div&gt;
+
+        &lt;script&gt;
+            var maskedElement = document.getElementById(&quot;maskedElement&quot;);
+            maskedElement.style.cssText += &quot;-webkit-mask-image:url('resources/masks.svg#upperHalf');background-color: blue&quot;;
+        &lt;/script&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvgscriptmasktoentiresvgexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-script-mask-to-entire-svg-expected.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-script-mask-to-entire-svg-expected.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-script-mask-to-entire-svg-expected.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #maskedElement {
+                width: 300px;
+                height: 400px;
+                background-color: blue;
+                -webkit-mask-image:url('resources/masks.svg');
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see four blue squares and no red.&lt;/p&gt;
+        &lt;p&gt;This test sets the mask-image via CSS to a &amp;lt;mask&amp;gt; element from an SVG file and then changes it to the entire SVG file via a script.&lt;/p&gt;
+        &lt;div id=&quot;maskedElement&quot;&gt;&lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvgscriptmasktoentiresvghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-script-mask-to-entire-svg.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-script-mask-to-entire-svg.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-script-mask-to-entire-svg.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #maskedElement {
+                width: 300px;
+                height: 400px;
+                background-color: green;
+                -webkit-mask-image:url('resources/masks.svg#lowerHalf');
+            }
+            #redSvg {
+                position: absolute;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see four blue squares and no red.&lt;/p&gt;
+        &lt;p&gt;This test sets the mask-image via CSS to a &amp;lt;mask&amp;gt; element from an SVG file and then changes it to the entire SVG file via a script.&lt;/p&gt;
+        &lt;svg id=&quot;redSvg&quot; width=&quot;300px&quot; height=&quot;400px&quot;&gt;
+            &lt;rect x=&quot;5px&quot; y=&quot;45px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;red&quot;/&gt;
+            &lt;rect x=&quot;155px&quot; y=&quot;45px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;red&quot;/&gt;
+            &lt;rect x=&quot;155px&quot; y=&quot;215px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;red&quot;/&gt;
+            &lt;rect x=&quot;5px&quot; y=&quot;215px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;red&quot;/&gt;
+        &lt;/svg&gt;
+        &lt;div id=&quot;maskedElement&quot;&gt;&lt;/div&gt;
+
+        &lt;script&gt;
+            var maskedElement = document.getElementById(&quot;maskedElement&quot;);
+            maskedElement.style.cssText += &quot;-webkit-mask-image:url('resources/masks.svg');background-color:blue&quot;;
+        &lt;/script&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvgscriptmasktononeexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-script-mask-to-none-expected.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-script-mask-to-none-expected.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-script-mask-to-none-expected.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #maskedElement {
+                width: 400px;
+                height: 400px;
+                background-color: blue;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see a blue rectangle and no red.&lt;/p&gt;
+        &lt;p&gt;This test sets the mask-image via CSS to a &amp;lt;mask&amp;gt; element from an external SVG file and then changes it to 'none' via a script.&lt;/p&gt;
+        &lt;div id=&quot;maskedElement&quot;&gt;&lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvgscriptmasktononehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-script-mask-to-none.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-script-mask-to-none.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-script-mask-to-none.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #maskedElement {
+                width: 400px;
+                height: 400px;
+                background-color: green;
+                -webkit-mask-image:url('resources/masks.svg#lowerHalf');
+            }
+            #redElement {
+                width: 400px;
+                height: 400px;
+                background-color: red;
+                position: absolute;
+                z-index: -1;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see a blue rectangle and no red.&lt;/p&gt;
+        &lt;p&gt;This test sets the mask-image via CSS to a &amp;lt;mask&amp;gt; element from an external SVG file and then changes it to 'none' via a script.&lt;/p&gt;
+        &lt;div id=&quot;redElement&quot;&gt;&lt;/div&gt;
+        &lt;div id=&quot;maskedElement&quot;&gt;&lt;/div&gt;
+        &lt;script&gt;
+            var maskedElement = document.getElementById(&quot;maskedElement&quot;);
+            maskedElement.style.cssText += &quot;-webkit-mask-image:none;background-color: blue&quot;;
+        &lt;/script&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvgscriptmasktopngexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-script-mask-to-png-expected.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-script-mask-to-png-expected.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-script-mask-to-png-expected.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #maskedElement {
+                width: 360px;
+                height: 288px;
+                background-color: blue;
+                -webkit-mask-image:url('resources/circle.png');
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see a blue circle and no red.&lt;/p&gt;
+        &lt;p&gt;This test sets the mask-image via CSS to a &amp;lt;mask&amp;gt; element from an SVG file and then changes it to a PNG via a script.&lt;/p&gt;
+        &lt;div id=&quot;maskedElement&quot;&gt;&lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvgscriptmasktopnghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-script-mask-to-png.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-script-mask-to-png.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-script-mask-to-png.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #maskedElement {
+                width: 360px;
+                height: 288px;
+                background-color: red;
+                -webkit-mask-image:url('resources/masks.svg#lowerHalf');
+            }
+            #redElement {
+                position: absolute;
+                width: 360px;
+                height: 288px;
+                background-color: red;
+                -webkit-transform: scale(0.95, 0.95);
+                -webkit-mask-image: url('resources/circle.png');
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see a blue circle and no red.&lt;/p&gt;
+        &lt;p&gt;This test sets the mask-image via CSS to a &amp;lt;mask&amp;gt; element from an SVG file and then changes it to a PNG via a script.&lt;/p&gt;
+        &lt;div id=&quot;redElement&quot;&gt;&lt;/div&gt;
+        &lt;div id=&quot;maskedElement&quot;&gt;&lt;/div&gt;
+
+        &lt;script&gt;
+            var maskedElement = document.getElementById(&quot;maskedElement&quot;);
+            maskedElement.style.cssText += &quot;-webkit-mask-image:url('resources/circle.png');background-color: blue&quot;;
+        &lt;/script&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvgscriptnonetomaskexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-script-none-to-mask-expected.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-script-none-to-mask-expected.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-script-none-to-mask-expected.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #maskedElement {
+                width: 400px;
+                height: 400px;
+                background-color: blue;
+                -webkit-mask-image:url('resources/masks.svg#upperHalf');
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see a blue inverted-L shape and no red.&lt;/p&gt;
+        &lt;p&gt;This test sets the mask-image value to a &amp;lt;mask&amp;gt; element from an external SVG via a script.&lt;/p&gt;
+        &lt;div id=&quot;maskedElement&quot;&gt;&lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvgscriptnonetomaskhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-script-none-to-mask.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-script-none-to-mask.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-script-none-to-mask.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #maskedElement {
+                width: 400px;
+                height: 400px;
+                background-color: red;
+            }
+            #redSvg {
+                position: absolute;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see a blue inverted-L shape and no red.&lt;/p&gt;
+        &lt;p&gt;This test sets the mask-image value to a &amp;lt;mask&amp;gt; element from an external SVG via a script.&lt;/p&gt;
+        &lt;svg id=&quot;redSvg&quot; width=&quot;300px&quot; height=&quot;400px&quot;&gt;
+            &lt;path fill=&quot;red&quot; d=&quot;M80,20 L280,20 L280,380 L240,380 L240,60 L80,60 L80,20&quot;/&gt;
+        &lt;/svg&gt;
+        &lt;div id=&quot;maskedElement&quot;&gt;&lt;/div&gt;
+
+        &lt;script&gt;
+            var maskedElement = document.getElementById(&quot;maskedElement&quot;);
+            maskedElement.style.cssText += &quot;-webkit-mask-image:url('resources/masks.svg#upperHalf');background-color: blue&quot;;
+        &lt;/script&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvgscriptnonetopngexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-script-none-to-png-expected.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-script-none-to-png-expected.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-script-none-to-png-expected.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #maskedElement {
+                width: 280px;
+                height: 210px;
+                background-color: blue;
+                -webkit-mask-image:url('resources/dice.png');
+                -webkit-mask-source-type:luminance;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see a blue-tinted image of 3 dice.&lt;/p&gt;
+        &lt;p&gt;This test sets the mask-image to a PNG image via a script.&lt;/p&gt;
+        &lt;div id=&quot;maskedElement&quot;&gt;&lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvgscriptnonetopnghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-script-none-to-png.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-script-none-to-png.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-script-none-to-png.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #maskedElement {
+                width: 280px;
+                height: 210px;
+                background-color: green;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see a blue-tinted image of 3 dice.&lt;/p&gt;
+        &lt;p&gt;This test sets the mask-image to a PNG image via a script.&lt;/p&gt;
+        &lt;div id=&quot;maskedElement&quot;&gt;&lt;/div&gt;
+        &lt;script&gt;
+            var maskedElement = document.getElementById(&quot;maskedElement&quot;);
+            maskedElement.style.cssText += &quot;-webkit-mask-image:url('resources/dice.png');-webkit-mask-source-type:luminance;background-color:blue&quot;;
+        &lt;/script&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvgscriptpngtomaskexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-script-png-to-mask-expected.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-script-png-to-mask-expected.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-script-png-to-mask-expected.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see a blue inverted-L shape and no red.&lt;/p&gt;
+        &lt;p&gt;This test sets the mask-image via CSS to a PNG and then changes it to a &amp;lt;mask&amp;gt; element from an SVG file via a script.&lt;/p&gt;
+        &lt;svg width=&quot;300px&quot; height=&quot;400px&quot;&gt;
+            &lt;path fill=&quot;blue&quot; d=&quot;M80,20 L280,20 L280,380 L240,380 L240,60 L80,60 L80,20&quot;/&gt;
+        &lt;/svg&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvgscriptpngtomaskhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-script-png-to-mask.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-script-png-to-mask.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-script-png-to-mask.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #maskedElement {
+                width: 300px;
+                height: 400px;
+                background-color: green;
+                -webkit-mask-image:url('resources/circle.png');
+            }
+            #redSvg {
+                position: absolute;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see a blue inverted-L shape and no red.&lt;/p&gt;
+        &lt;p&gt;This test sets the mask-image via CSS to a PNG and then changes it to a &amp;lt;mask&amp;gt; element from an SVG file via a script.&lt;/p&gt;
+        &lt;svg id=&quot;redSvg&quot; width=&quot;300px&quot; height=&quot;400px&quot;&gt;
+            &lt;path fill=&quot;red&quot; d=&quot;M80,20 L280,20 L280,380 L240,380 L240,60 L80,60 L80,20&quot;/&gt;
+        &lt;/svg&gt;
+        &lt;div id=&quot;maskedElement&quot;&gt;&lt;/div&gt;
+
+        &lt;script&gt;
+            var maskedElement = document.getElementById(&quot;maskedElement&quot;);
+            maskedElement.style.cssText += &quot;-webkit-mask-image:url('resources/masks.svg#upperHalf');background-color: blue&quot;;
+        &lt;/script&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvgscriptpngtononeexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-script-png-to-none-expected.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-script-png-to-none-expected.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-script-png-to-none-expected.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #maskedElement {
+                width: 280px;
+                height: 210px;
+                background-color: blue;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see a simple blue rectangle.&lt;/p&gt;
+        &lt;p&gt;This test sets the mask-image via CSS to a PNG image and then changes it to 'none' via a script.&lt;/p&gt;
+        &lt;div id=&quot;maskedElement&quot;&gt;&lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingmasksvgscriptpngtononehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/mask-svg-script-png-to-none.html (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/mask-svg-script-png-to-none.html                                (rev 0)
+++ trunk/LayoutTests/css3/masking/mask-svg-script-png-to-none.html        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            p {
+                margin: 0px;
+            }
+            #maskedElement {
+                width: 280px;
+                height: 210px;
+                background-color: green;
+                -webkit-mask-image:url('resources/dice.png');
+                -webkit-mask-source-type: luminance;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=129682&quot;&gt;Bug 129682&lt;/a&gt; - On success, you should see a simple blue rectangle.&lt;/p&gt;
+        &lt;p&gt;This test sets the mask-image via CSS to a PNG image and then changes it to 'none' via a script.&lt;/p&gt;
+        &lt;div id=&quot;maskedElement&quot;&gt;&lt;/div&gt;
+        &lt;script&gt;
+            var maskedElement = document.getElementById(&quot;maskedElement&quot;);
+            maskedElement.style.cssText += &quot;-webkit-mask-image:none;background-color: blue&quot;;
+        &lt;/script&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscss3maskingresourcesmaskssvg"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/masking/resources/masks.svg (0 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/masking/resources/masks.svg                                (rev 0)
+++ trunk/LayoutTests/css3/masking/resources/masks.svg        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
+&lt;!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363)  --&gt;
+&lt;!DOCTYPE svg PUBLIC &quot;-//W3C//DTD SVG 1.1//EN&quot; &quot;http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd&quot;&gt;
+&lt;svg version=&quot;1.1&quot; id=&quot;Layer_1&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot; x=&quot;0px&quot; y=&quot;0px&quot;
+   width=&quot;300px&quot; height=&quot;400px&quot; viewBox=&quot;0 0 300 400&quot; enable-background=&quot;new 0 0 300 400&quot; xml:space=&quot;preserve&quot;&gt;
+&lt;defs&gt;
+        &lt;mask id=&quot;upperHalf&quot; maskUnits=&quot;objectBoundingBox&quot;&gt;
+                &lt;path fill=&quot;#FFFFFF&quot; d=&quot;M80,20 L280,20 L280,380 L240,380 L240,60 L80,60 L80,20&quot;/&gt;
+        &lt;/mask&gt;
+        &lt;mask id=&quot;lowerHalf&quot; maskUnits=&quot;objectBoundingBox&quot;&gt;
+                &lt;path fill=&quot;#FFFFFF&quot; d=&quot;M20,20 L60,20 L60,340 L220,340 L220,380 L20,380 L20,20&quot;/&gt;
+        &lt;/mask&gt;
+        &lt;mask id=&quot;animatedCircle&quot; maskUnits=&quot;objectBoundingBox&quot;&gt;
+                &lt;circle cx=&quot;150&quot; cy=&quot;150&quot; r=&quot;40&quot; fill=&quot;white&quot;&gt;
+                        &lt;animate attributeName=&quot;r&quot; from=&quot;40&quot; to=&quot;120&quot; dur=&quot;10s&quot; repeatCount=&quot;indefinite&quot;/&gt;
+                &lt;/circle&gt;
+        &lt;/mask&gt;
+&lt;/defs&gt;
+
+&lt;g&gt;
+        &lt;rect x=&quot;5px&quot; y=&quot;45px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;#C1553B&quot;/&gt;
+        &lt;rect x=&quot;155px&quot; y=&quot;45px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;#71E5FF&quot;/&gt;
+        &lt;rect x=&quot;155px&quot; y=&quot;215px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;#404041&quot;/&gt;
+        &lt;rect x=&quot;5px&quot; y=&quot;215px&quot; width=&quot;140px&quot; height=&quot;140px&quot; fill=&quot;#77D091&quot;/&gt;
+&lt;/g&gt;
+
+&lt;/svg&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/Source/WebCore/ChangeLog        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -1,3 +1,77 @@
</span><ins>+2014-12-11  Radu Stavila  &lt;stavila@adobe.com&gt;
+
+        [SVG Masking] Enable the use of &lt;mask&gt; elements for -webkit-mask-image
+        https://bugs.webkit.org/show_bug.cgi?id=139294
+
+        Reviewed by Simon Fraser.
+
+        This patch links together all parts required for the functionality which improves 
+        the -webkit-mask-image property by allowing it to reference a &lt;mask&gt; element defined 
+        in an inline or external SVG document.
+        Support for this new functionality has been added in a previous patch, under issue
+        https://bugs.webkit.org/show_bug.cgi?id=139092. A more detailed description of how
+        the new functionality works can be found in the ChangeLog for that commit.
+        The containsSVGDocument in ScrollView has been removed because it was added in the
+        previous patch but is no longer required.
+
+        Tests: css3/masking/mask-base64.html
+               css3/masking/mask-multiple-values.html
+               css3/masking/mask-svg-clipped-fragmentId.html
+               css3/masking/mask-svg-fragmentId.html
+               css3/masking/mask-svg-inline-fragmentId.html
+               css3/masking/mask-svg-inline-invalid-fragmentId.html
+               css3/masking/mask-svg-invalid-fragmentId.html
+               css3/masking/mask-svg-no-fragmentId-tiled.html
+               css3/masking/mask-svg-no-fragmentId.html
+               css3/masking/mask-svg-script-entire-svg-to-mask.html
+               css3/masking/mask-svg-script-mask-to-entire-svg.html
+               css3/masking/mask-svg-script-mask-to-none.html
+               css3/masking/mask-svg-script-mask-to-png.html
+               css3/masking/mask-svg-script-none-to-mask.html
+               css3/masking/mask-svg-script-none-to-png.html
+               css3/masking/mask-svg-script-png-to-mask.html
+               css3/masking/mask-svg-script-png-to-none.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::ComputedStyleExtractor::propertyValue):
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseFillShorthand):
+        (WebCore::CSSParser::parseFillProperty):
+        (WebCore::CSSParser::parseMaskImage):
+        * css/CSSParser.h:
+        * css/DeprecatedStyleBuilder.cpp:
+        (WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::adjustStyleForMaskImages):
+        (WebCore::StyleResolver::applyProperty):
+        (WebCore::StyleResolver::loadPendingSVGDocuments):
+        (WebCore::StyleResolver::createMaskImageOperations):
+        (WebCore::StyleResolver::loadPendingImages):
+        * page/animation/CSSPropertyAnimation.cpp:
+        (WebCore::blendFunc):
+        (WebCore::MaskImagePropertyWrapper::MaskImagePropertyWrapper):
+        (WebCore::MaskImagePropertyWrapper::equals):
+        (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
+        * platform/graphics/MaskImageOperation.cpp:
+        (WebCore::MaskImageOperation::~MaskImageOperation):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::maskClipRect):
+        * rendering/RenderBox.h:
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
+        (WebCore::RenderBoxModelObject::calculateFillTileSize):
+        (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::~RenderElement):
+        (WebCore::RenderElement::updateFillImages):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::calculateClipRects):
+        * rendering/RenderLayer.h:
+        * rendering/style/FillLayer.h:
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::setMaskImage):
+        * rendering/style/RenderStyle.h:
+
</ins><span class="cx"> 2014-12-09  Jeremy Jones  &lt;jeremyj@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Restore interface state when stopping optimized fullscreen.
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSComputedStyleDeclarationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -1794,9 +1794,8 @@
</span><span class="cx"> 
</span><span class="cx">         case CSSPropertyBackgroundColor:
</span><span class="cx">             return cssValuePool().createColorValue(m_allowVisitedStyle? style-&gt;visitedDependentColor(CSSPropertyBackgroundColor).rgb() : style-&gt;backgroundColor().rgb());
</span><del>-        case CSSPropertyBackgroundImage:
-        case CSSPropertyWebkitMaskImage: {
-            const FillLayer* layers = propertyID == CSSPropertyWebkitMaskImage ? style-&gt;maskLayers() : style-&gt;backgroundLayers();
</del><ins>+        case CSSPropertyBackgroundImage: {
+            const FillLayer* layers = style-&gt;backgroundLayers();
</ins><span class="cx">             if (!layers)
</span><span class="cx">                 return cssValuePool().createIdentifierValue(CSSValueNone);
</span><span class="cx"> 
</span><span class="lines">@@ -1816,6 +1815,27 @@
</span><span class="cx">             }
</span><span class="cx">             return list.release();
</span><span class="cx">         }
</span><ins>+        case CSSPropertyWebkitMaskImage: {
+            const FillLayer* layers = style-&gt;maskLayers();
+            if (!layers)
+                return cssValuePool().createIdentifierValue(CSSValueNone);
+
+            if (!layers-&gt;next()) {
+                if (layers-&gt;maskImage().get())
+                    return layers-&gt;maskImage()-&gt;cssValue();
+
+                return cssValuePool().createIdentifierValue(CSSValueNone);
+            }
+
+            RefPtr&lt;CSSValueList&gt; list = CSSValueList::createCommaSeparated();
+            for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer-&gt;next()) {
+                if (currLayer-&gt;maskImage().get())
+                    list-&gt;append(*currLayer-&gt;maskImage()-&gt;cssValue());
+                else
+                    list-&gt;append(cssValuePool().createIdentifierValue(CSSValueNone));
+            }
+            return list.release();
+        }
</ins><span class="cx">         case CSSPropertyBackgroundSize:
</span><span class="cx">         case CSSPropertyWebkitBackgroundSize:
</span><span class="cx">         case CSSPropertyWebkitMaskSize: {
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSParser.cpp (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSParser.cpp        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/Source/WebCore/css/CSSParser.cpp        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -83,6 +83,7 @@
</span><span class="cx"> #include &quot;TextEncoding.h&quot;
</span><span class="cx"> #include &quot;WebKitCSSFilterValue.h&quot;
</span><span class="cx"> #include &quot;WebKitCSSRegionRule.h&quot;
</span><ins>+#include &quot;WebKitCSSResourceValue.h&quot;
</ins><span class="cx"> #include &quot;WebKitCSSTransformValue.h&quot;
</span><span class="cx"> #include &lt;bitset&gt;
</span><span class="cx"> #include &lt;limits.h&gt;
</span><span class="lines">@@ -3358,6 +3359,7 @@
</span><span class="cx">                 RefPtr&lt;CSSValue&gt; val2;
</span><span class="cx">                 CSSPropertyID propId1, propId2;
</span><span class="cx">                 CSSParserValue&amp; parserValue = *m_valueList-&gt;current();
</span><ins>+
</ins><span class="cx">                 if (parseFillProperty(properties[i], propId1, propId2, val1, val2)) {
</span><span class="cx">                     parsedProperty[i] = found = true;
</span><span class="cx">                     addFillValue(values[i], val1.releaseNonNull());
</span><span class="lines">@@ -4446,10 +4448,13 @@
</span><span class="cx">                     }
</span><span class="cx">                     break;
</span><span class="cx">                 case CSSPropertyBackgroundImage:
</span><del>-                case CSSPropertyWebkitMaskImage:
</del><span class="cx">                     if (parseFillImage(*m_valueList, currValue))
</span><span class="cx">                         m_valueList-&gt;next();
</span><span class="cx">                     break;
</span><ins>+                case CSSPropertyWebkitMaskImage:
+                    if (parseMaskImage(*m_valueList, currValue))
+                        m_valueList-&gt;next();
+                    break;
</ins><span class="cx">                 case CSSPropertyWebkitBackgroundClip:
</span><span class="cx">                 case CSSPropertyWebkitBackgroundOrigin:
</span><span class="cx">                 case CSSPropertyWebkitMaskClip:
</span><span class="lines">@@ -9427,6 +9432,23 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool CSSParser::parseMaskImage(CSSParserValueList&amp; valueList, RefPtr&lt;CSSValue&gt;&amp; outValue)
+{
+    outValue = nullptr;
+    CSSParserValue* value = valueList.current();
+    if (value-&gt;id == CSSValueNone)
+        outValue = WebKitCSSResourceValue::create(cssValuePool().createIdentifierValue(CSSValueNone));
+    else if (value-&gt;unit == CSSPrimitiveValue::CSS_URI)
+        outValue = WebKitCSSResourceValue::create(CSSPrimitiveValue::create(completeURL(value-&gt;string), CSSPrimitiveValue::CSS_URI));
+    else {
+        RefPtr&lt;CSSValue&gt; fillImageValue;
+        if (parseFillImage(valueList, fillImageValue))
+            outValue = WebKitCSSResourceValue::create(fillImageValue);
+    }
+
+    return outValue.get();
+}
+
</ins><span class="cx"> #if ENABLE(CSS_REGIONS)
</span><span class="cx"> static bool validFlowName(const String&amp; flowName)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSParser.h (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSParser.h        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/Source/WebCore/css/CSSParser.h        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -117,6 +117,8 @@
</span><span class="cx"> 
</span><span class="cx">     PassRefPtr&lt;CSSValue&gt; parseBackgroundColor();
</span><span class="cx"> 
</span><ins>+    // FIXME: Maybe these two methods could be combined into one.
+    bool parseMaskImage(CSSParserValueList&amp;, RefPtr&lt;CSSValue&gt;&amp;);
</ins><span class="cx">     bool parseFillImage(CSSParserValueList&amp;, RefPtr&lt;CSSValue&gt;&amp;);
</span><span class="cx"> 
</span><span class="cx">     enum FillPositionFlag { InvalidFillPosition = 0, AmbiguousFillPosition = 1, XFillPosition = 2, YFillPosition = 4 };
</span></span></pre></div>
<a id="trunkSourceWebCorecssDeprecatedStyleBuildercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -928,7 +928,6 @@
</span><span class="cx">     setPropertyHandler(CSSPropertyWebkitFontVariantLigatures, ApplyPropertyFontVariantLigatures::createHandler());
</span><span class="cx">     setPropertyHandler(CSSPropertyWebkitMaskClip, ApplyPropertyFillLayer&lt;EFillBox, CSSPropertyWebkitMaskClip, MaskFillLayer, &amp;RenderStyle::accessMaskLayers, &amp;RenderStyle::maskLayers, &amp;FillLayer::isClipSet, &amp;FillLayer::clip, &amp;FillLayer::setClip, &amp;FillLayer::clearClip, &amp;FillLayer::initialFillClip, &amp;CSSToStyleMap::mapFillClip&gt;::createHandler());
</span><span class="cx">     setPropertyHandler(CSSPropertyWebkitMaskComposite, ApplyPropertyFillLayer&lt;CompositeOperator, CSSPropertyWebkitMaskComposite, MaskFillLayer, &amp;RenderStyle::accessMaskLayers, &amp;RenderStyle::maskLayers, &amp;FillLayer::isCompositeSet, &amp;FillLayer::composite, &amp;FillLayer::setComposite, &amp;FillLayer::clearComposite, &amp;FillLayer::initialFillComposite, &amp;CSSToStyleMap::mapFillComposite&gt;::createHandler());
</span><del>-    setPropertyHandler(CSSPropertyWebkitMaskImage, ApplyPropertyFillLayer&lt;StyleImage*, CSSPropertyWebkitMaskImage, MaskFillLayer, &amp;RenderStyle::accessMaskLayers, &amp;RenderStyle::maskLayers, &amp;FillLayer::isImageSet, &amp;FillLayer::image, &amp;FillLayer::setImage, &amp;FillLayer::clearImage, &amp;FillLayer::initialFillImage, &amp;CSSToStyleMap::mapFillImage&gt;::createHandler());
</del><span class="cx">     setPropertyHandler(CSSPropertyWebkitMaskOrigin, ApplyPropertyFillLayer&lt;EFillBox, CSSPropertyWebkitMaskOrigin, MaskFillLayer, &amp;RenderStyle::accessMaskLayers, &amp;RenderStyle::maskLayers, &amp;FillLayer::isOriginSet, &amp;FillLayer::origin, &amp;FillLayer::setOrigin, &amp;FillLayer::clearOrigin, &amp;FillLayer::initialFillOrigin, &amp;CSSToStyleMap::mapFillOrigin&gt;::createHandler());
</span><span class="cx">     setPropertyHandler(CSSPropertyWebkitMaskPositionX, ApplyPropertyFillLayer&lt;Length, CSSPropertyWebkitMaskPositionX, MaskFillLayer, &amp;RenderStyle::accessMaskLayers, &amp;RenderStyle::maskLayers, &amp;FillLayer::isXPositionSet, &amp;FillLayer::xPosition, &amp;FillLayer::setXPosition, &amp;FillLayer::clearXPosition, &amp;FillLayer::initialFillXPosition, &amp;CSSToStyleMap::mapFillXPosition&gt;::createHandler());
</span><span class="cx">     setPropertyHandler(CSSPropertyWebkitMaskPositionY, ApplyPropertyFillLayer&lt;Length, CSSPropertyWebkitMaskPositionY, MaskFillLayer, &amp;RenderStyle::accessMaskLayers, &amp;RenderStyle::maskLayers, &amp;FillLayer::isYPositionSet, &amp;FillLayer::yPosition, &amp;FillLayer::setYPosition, &amp;FillLayer::clearYPosition, &amp;FillLayer::initialFillYPosition, &amp;CSSToStyleMap::mapFillYPosition&gt;::createHandler());
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.cpp (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.cpp        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/Source/WebCore/css/StyleResolver.cpp        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -1157,6 +1157,61 @@
</span><span class="cx">         style-&gt;setWritingMode(LeftToRightWritingMode);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void StyleResolver::adjustStyleForMaskImages()
+{
+    // If we already have the same mask image objects loaded on the old style,
+    // use the old ones instead of loading new ones.
+    RenderStyle* newStyle = m_state.style();
+    RenderStyle* oldStyle = (m_state.element() ? m_state.element()-&gt;renderStyle() : nullptr);
+
+    if (newStyle &amp;&amp; oldStyle) {
+        Vector&lt;RefPtr&lt;MaskImageOperation&gt;&gt; removedExternalResources;
+        
+        // Get all mask objects from the old style in a vector
+        // so we can remove them as we match them, making the following steps faster.
+        Vector&lt;RefPtr&lt;MaskImageOperation&gt;&gt; oldStyleMaskImages;
+        const FillLayer* oldMaskLayer = oldStyle-&gt;maskLayers();
+        while (oldMaskLayer) {
+            RefPtr&lt;MaskImageOperation&gt; oldMaskImage = oldMaskLayer-&gt;maskImage();
+            if (oldMaskImage.get())
+                oldStyleMaskImages.append(oldMaskImage);
+
+            oldMaskLayer = oldMaskLayer-&gt;next();
+        }
+        
+        // Try to match the new mask objects through the list from the old style.
+        // This should work perfectly and optimal when the list of masks remained
+        // the same and also work correctly (but slower) when they were reordered.
+        FillLayer* newMaskLayer = newStyle-&gt;accessMaskLayers();
+        int countOldStyleMaskImages = oldStyleMaskImages.size();
+        while (newMaskLayer &amp;&amp; countOldStyleMaskImages) {
+            RefPtr&lt;MaskImageOperation&gt; newMaskImage = newMaskLayer-&gt;maskImage();
+            if (newMaskImage.get()) {
+                for (int i = 0; i &lt; countOldStyleMaskImages; i++) {
+                    RefPtr&lt;MaskImageOperation&gt; oldMaskImage = oldStyleMaskImages[i];
+                    if (*oldMaskImage == *newMaskImage) {
+                        newMaskLayer-&gt;setMaskImage(oldMaskImage);
+                        if (newMaskImage-&gt;isExternalDocument())
+                            removedExternalResources.append(newMaskImage);
+
+                        oldStyleMaskImages.remove(i);
+                        countOldStyleMaskImages--;
+                        break;
+                    }
+                }
+            }
+
+            newMaskLayer = newMaskLayer-&gt;next();
+        }
+
+        Vector&lt;RefPtr&lt;MaskImageOperation&gt;&gt;&amp; pendingResources = m_state.maskImagesWithPendingSVGDocuments();
+        for (int i = pendingResources.size() - 1; i &gt;= 0; i--) {
+            if (removedExternalResources.contains(pendingResources[i]))
+                pendingResources.remove(i);
+        }
+    }
+}
+
</ins><span class="cx"> void StyleResolver::adjustRenderStyle(RenderStyle&amp; style, const RenderStyle&amp; parentStyle, Element *e)
</span><span class="cx"> {
</span><span class="cx">     // Cache our original display.
</span><span class="lines">@@ -1763,6 +1818,8 @@
</span><span class="cx">     // There are some CSS properties that affect the same RenderStyle values,
</span><span class="cx">     // so to preserve behavior, we queue them up during cascade and flush here.
</span><span class="cx">     cascade.applyDeferredProperties(*this);
</span><ins>+    
+    adjustStyleForMaskImages();
</ins><span class="cx"> 
</span><span class="cx">     // Start loading resources referenced by this style.
</span><span class="cx">     loadPendingResources();
</span><span class="lines">@@ -2540,6 +2597,14 @@
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    case CSSPropertyWebkitMaskImage: {
+        Vector&lt;RefPtr&lt;MaskImageOperation&gt;&gt; operations;
+        if (createMaskImageOperations(value, operations))
+            state.style()-&gt;setMaskImage(operations);
+
+        return;
+    }
+
</ins><span class="cx"> #if ENABLE(CSS_GRID_LAYOUT)
</span><span class="cx">     case CSSPropertyWebkitGridAutoColumns: {
</span><span class="cx">         HANDLE_INHERIT_AND_INITIAL(gridAutoColumns, GridAutoColumns);
</span><span class="lines">@@ -2966,7 +3031,6 @@
</span><span class="cx">     case CSSPropertyWebkitMaskBoxImageWidth:
</span><span class="cx">     case CSSPropertyWebkitMaskClip:
</span><span class="cx">     case CSSPropertyWebkitMaskComposite:
</span><del>-    case CSSPropertyWebkitMaskImage:
</del><span class="cx">     case CSSPropertyWebkitMaskOrigin:
</span><span class="cx">     case CSSPropertyWebkitMaskPositionX:
</span><span class="cx">     case CSSPropertyWebkitMaskPositionY:
</span><span class="lines">@@ -3317,14 +3381,30 @@
</span><span class="cx">     // style is NULL. We don't know exactly why this happens. Our guess is
</span><span class="cx">     // reentering styleForElement().
</span><span class="cx">     ASSERT(state.style());
</span><del>-    if (!state.style() || !state.style()-&gt;hasFilter() || state.filtersWithPendingSVGDocuments().isEmpty())
</del><ins>+    if (!state.style())
</ins><span class="cx">         return;
</span><ins>+    
+    bool hasFilters = (state.style()-&gt;hasFilter() &amp;&amp; !state.filtersWithPendingSVGDocuments().isEmpty());
+    bool hasMasks = (state.style()-&gt;hasMask() &amp;&amp; !state.maskImagesWithPendingSVGDocuments().isEmpty());
+    
+    if (!hasFilters &amp;&amp; !hasMasks)
+        return;
</ins><span class="cx"> 
</span><span class="cx">     CachedResourceLoader* cachedResourceLoader = state.document().cachedResourceLoader();
</span><del>-    for (auto&amp; filterOperation : state.filtersWithPendingSVGDocuments())
-        filterOperation-&gt;getOrCreateCachedSVGDocumentReference()-&gt;load(cachedResourceLoader);
</del><ins>+    
+    if (hasFilters) {
+        for (auto&amp; filterOperation : state.filtersWithPendingSVGDocuments())
+            filterOperation-&gt;getOrCreateCachedSVGDocumentReference()-&gt;load(cachedResourceLoader);
</ins><span class="cx"> 
</span><del>-    state.filtersWithPendingSVGDocuments().clear();
</del><ins>+        state.filtersWithPendingSVGDocuments().clear();
+    }
+    
+    if (hasMasks) {
+        for (auto&amp; maskImageOperation : state.maskImagesWithPendingSVGDocuments())
+            maskImageOperation-&gt;ensureCachedSVGDocumentReference()-&gt;load(cachedResourceLoader);
+
+        state.maskImagesWithPendingSVGDocuments().clear();
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool StyleResolver::createFilterOperations(CSSValue* inValue, FilterOperations&amp; outOperations)
</span><span class="lines">@@ -3472,16 +3552,22 @@
</span><span class="cx">     if (!inValue)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    ASSERT(is&lt;CSSValueList&gt;(*inValue));
</del><ins>+    RefPtr&lt;WebKitCSSResourceValue&gt; maskImageValue;
+    RefPtr&lt;CSSValueList&gt; maskImagesList;
+    CSSValueList::iterator listIterator;
+    if (is&lt;WebKitCSSResourceValue&gt;(*inValue))
+        maskImageValue = downcast&lt;WebKitCSSResourceValue&gt;(inValue);
+    else if (is&lt;CSSValueList&gt;(*inValue)) {
+        maskImagesList = downcast&lt;CSSValueList&gt;(inValue);
+        listIterator = maskImagesList-&gt;begin();
+        if (listIterator != maskImagesList-&gt;end())
+            maskImageValue = &amp;downcast&lt;WebKitCSSResourceValue&gt;(listIterator-&gt;get());
+    }
</ins><span class="cx"> 
</span><del>-    for (auto&amp; currValue : downcast&lt;CSSValueList&gt;(*inValue)) {
-        if (!is&lt;WebKitCSSResourceValue&gt;(currValue.get()))
-            continue;
-        
-        WebKitCSSResourceValue&amp; maskImageValue = downcast&lt;WebKitCSSResourceValue&gt;(currValue.get());
-        RefPtr&lt;CSSValue&gt; maskInnerValue = maskImageValue.innerValue();
</del><ins>+    while (maskImageValue.get()) {
+        RefPtr&lt;CSSValue&gt; maskInnerValue = maskImageValue-&gt;innerValue();
</ins><span class="cx">         RefPtr&lt;MaskImageOperation&gt; newMaskImage;
</span><del>-        
</del><ins>+
</ins><span class="cx">         if (is&lt;CSSPrimitiveValue&gt;(maskInnerValue.get())) {
</span><span class="cx">             RefPtr&lt;CSSPrimitiveValue&gt; primitiveValue = downcast&lt;CSSPrimitiveValue&gt;(maskInnerValue.get());
</span><span class="cx">             if (primitiveValue-&gt;isValueID() &amp;&amp; primitiveValue-&gt;getValueID() == CSSValueNone)
</span><span class="lines">@@ -3491,7 +3577,7 @@
</span><span class="cx">                 URL url = m_state.document().completeURL(cssUrl);
</span><span class="cx">                 
</span><span class="cx">                 bool isExternalDocument = (SVGURIReference::isExternalURIReference(cssUrl, m_state.document()));
</span><del>-                newMaskImage = MaskImageOperation::create(&amp;maskImageValue, cssUrl, url.fragmentIdentifier(), isExternalDocument, m_state.document().cachedResourceLoader());
</del><ins>+                newMaskImage = MaskImageOperation::create(maskImageValue, cssUrl, url.fragmentIdentifier(), isExternalDocument, m_state.document().cachedResourceLoader());
</ins><span class="cx">                 if (isExternalDocument)
</span><span class="cx">                     m_state.maskImagesWithPendingSVGDocuments().append(newMaskImage);
</span><span class="cx">             }
</span><span class="lines">@@ -3506,6 +3592,12 @@
</span><span class="cx">             newMaskImage = MaskImageOperation::create();
</span><span class="cx"> 
</span><span class="cx">         outOperations.append(newMaskImage);
</span><ins>+
+        if (maskImagesList.get()) {
+            listIterator++;
+            maskImageValue = (listIterator != maskImagesList-&gt;end() ? &amp;downcast&lt;WebKitCSSResourceValue&gt;(listIterator-&gt;get()) : nullptr);
+        } else
+            maskImageValue = nullptr;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return true;
</span><span class="lines">@@ -3629,9 +3721,10 @@
</span><span class="cx">         }
</span><span class="cx">         case CSSPropertyWebkitMaskImage: {
</span><span class="cx">             for (FillLayer* maskLayer = m_state.style()-&gt;accessMaskLayers(); maskLayer; maskLayer = maskLayer-&gt;next()) {
</span><del>-                auto* styleImage = maskLayer-&gt;image();
</del><ins>+                RefPtr&lt;MaskImageOperation&gt; maskImage = maskLayer-&gt;maskImage();
+                auto* styleImage = maskImage.get() ? maskImage-&gt;image() : nullptr;
</ins><span class="cx">                 if (is&lt;StylePendingImage&gt;(styleImage))
</span><del>-                    maskLayer-&gt;setImage(loadPendingImage(downcast&lt;StylePendingImage&gt;(*styleImage)));
</del><ins>+                    maskImage-&gt;setImage(loadPendingImage(downcast&lt;StylePendingImage&gt;(*styleImage)));
</ins><span class="cx">             }
</span><span class="cx">             break;
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolverh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.h (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.h        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/Source/WebCore/css/StyleResolver.h        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -301,6 +301,7 @@
</span><span class="cx"> #endif
</span><span class="cx">     
</span><span class="cx">     void adjustStyleForInterCharacterRuby();
</span><ins>+    void adjustStyleForMaskImages();
</ins><span class="cx">     
</span><span class="cx">     bool fastRejectSelector(const RuleData&amp;) const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.cpp (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.cpp        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/Source/WebCore/page/FrameView.cpp        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -4390,14 +4390,6 @@
</span><span class="cx">     return renderView-&gt;style().isFlippedBlocksWritingMode();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool FrameView::containsSVGDocument() const
-{
-    if (frame().document())
-        return frame().document()-&gt;isSVGDocument();
-    
-    return false;
-}
-
</del><span class="cx"> void FrameView::notifyWidgetsInAllFrames(WidgetNotification notification)
</span><span class="cx"> {
</span><span class="cx">     for (Frame* frame = m_frame.get(); frame; frame = frame-&gt;tree().traverseNext(m_frame.get())) {
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.h (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.h        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/Source/WebCore/page/FrameView.h        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -527,7 +527,6 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool isVerticalDocument() const override;
</span><span class="cx">     virtual bool isFlippedDocument() const override;
</span><del>-    virtual bool containsSVGDocument() const override;
</del><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     explicit FrameView(Frame&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCorepageanimationCSSPropertyAnimationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx"> #include &quot;ClipPathOperation.h&quot;
</span><span class="cx"> #include &quot;FloatConversion.h&quot;
</span><span class="cx"> #include &quot;IdentityTransformOperation.h&quot;
</span><ins>+#include &quot;MaskImageOperation.h&quot;
</ins><span class="cx"> #include &quot;Matrix3DTransformOperation.h&quot;
</span><span class="cx"> #include &quot;MatrixTransformOperation.h&quot;
</span><span class="cx"> #include &quot;RenderBox.h&quot;
</span><span class="lines">@@ -341,6 +342,19 @@
</span><span class="cx">     return to;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static inline PassRefPtr&lt;MaskImageOperation&gt; blendFunc(const AnimationBase* anim, const RefPtr&lt;MaskImageOperation&gt; from, const RefPtr&lt;MaskImageOperation&gt; to, double progress)
+{
+    if (!from.get() || !to.get())
+        return to;
+
+    // Only animates between masks using images (PNG, entire SVG, generated image).
+    // It does not animate between &lt;mask&gt; elements (file.svg#identifier).
+    if (from-&gt;image() &amp;&amp; to-&gt;image())
+        return MaskImageOperation::create(blendFunc(anim, from-&gt;image(), to-&gt;image(), progress));
+
+    return to;
+}
+
</ins><span class="cx"> static inline NinePieceImage blendFunc(const AnimationBase* anim, const NinePieceImage&amp; from, const NinePieceImage&amp; to, double progress)
</span><span class="cx"> {
</span><span class="cx">     if (!from.hasImage() || !to.hasImage())
</span><span class="lines">@@ -500,6 +514,30 @@
</span><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+class MaskImagePropertyWrapper : public PropertyWrapper&lt;const RefPtr&lt;MaskImageOperation&gt;&gt; {
+public:
+    MaskImagePropertyWrapper()
+        : PropertyWrapper&lt;const RefPtr&lt;MaskImageOperation&gt;&gt;(CSSPropertyWebkitMaskImage, &amp;RenderStyle::maskImage, &amp;RenderStyle::setMaskImage)
+    {
+    }
+    
+    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
+    {
+        // If the style pointers are the same, don't bother doing the test.
+        // If either is null, return false. If both are null, return true.
+        if (a == b)
+            return true;
+        if (!a || !b)
+            return false;
+        
+        const RefPtr&lt;MaskImageOperation&gt; maskImageA = (a-&gt;*m_getter)();
+        const RefPtr&lt;MaskImageOperation&gt; maskImageB = (b-&gt;*m_getter)();
+        StyleImage* styleImageA = (maskImageA ? maskImageA-&gt;image() : nullptr);
+        StyleImage* styleImageB = (maskImageB ? maskImageB-&gt;image() : nullptr);
+        return StyleImage::imagesEquivalent(styleImageA, styleImageB);
+    }
+};
+
</ins><span class="cx"> class PropertyWrapperColor : public PropertyWrapperGetter&lt;Color&gt; {
</span><span class="cx"> public:
</span><span class="cx">     PropertyWrapperColor(CSSPropertyID prop, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&amp;))
</span><span class="lines">@@ -1152,7 +1190,7 @@
</span><span class="cx"> 
</span><span class="cx">         new FillLayersPropertyWrapper(CSSPropertyBackgroundImage, &amp;RenderStyle::backgroundLayers, &amp;RenderStyle::accessBackgroundLayers),
</span><span class="cx">         new StyleImagePropertyWrapper(CSSPropertyListStyleImage, &amp;RenderStyle::listStyleImage, &amp;RenderStyle::setListStyleImage),
</span><del>-        new StyleImagePropertyWrapper(CSSPropertyWebkitMaskImage, &amp;RenderStyle::maskImage, &amp;RenderStyle::setMaskImage),
</del><ins>+        new MaskImagePropertyWrapper(),
</ins><span class="cx"> 
</span><span class="cx">         new StyleImagePropertyWrapper(CSSPropertyBorderImageSource, &amp;RenderStyle::borderImageSource, &amp;RenderStyle::setBorderImageSource),
</span><span class="cx">         new LengthPropertyWrapper&lt;LengthBox&gt;(CSSPropertyBorderImageSlice, &amp;RenderStyle::borderImageSlices, &amp;RenderStyle::setBorderImageSlices),
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollView.h (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollView.h        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/Source/WebCore/platform/ScrollView.h        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -410,7 +410,6 @@
</span><span class="cx">     // Subclassed by FrameView to check the writing-mode of the document.
</span><span class="cx">     virtual bool isVerticalDocument() const { return true; }
</span><span class="cx">     virtual bool isFlippedDocument() const { return false; }
</span><del>-    virtual bool containsSVGDocument() const { return false; }
</del><span class="cx"> 
</span><span class="cx">     // Called to update the scrollbars to accurately reflect the state of the view.
</span><span class="cx">     void updateScrollbars(const IntSize&amp; desiredOffset);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsMaskImageOperationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/MaskImageOperation.cpp (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/MaskImageOperation.cpp        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/Source/WebCore/platform/graphics/MaskImageOperation.cpp        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -82,8 +82,17 @@
</span><span class="cx"> 
</span><span class="cx"> MaskImageOperation::~MaskImageOperation()
</span><span class="cx"> {
</span><ins>+    setRenderLayerImageClient(nullptr);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool MaskImageOperation::operator==(const MaskImageOperation&amp; other) const
+{
+    if (m_url.length())
+        return (m_url == other.m_url &amp;&amp; m_fragment == other.m_fragment &amp;&amp; m_isExternalDocument == other.m_isExternalDocument);
+
+    return m_styleImage.get() == other.m_styleImage.get();
+}
+
</ins><span class="cx"> bool MaskImageOperation::isCSSValueNone() const
</span><span class="cx"> {
</span><span class="cx">     if (image())
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsMaskImageOperationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/MaskImageOperation.h (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/MaskImageOperation.h        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/Source/WebCore/platform/graphics/MaskImageOperation.h        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -57,9 +57,13 @@
</span><span class="cx">     PassRefPtr&lt;CSSValue&gt; cssValue();
</span><span class="cx"> 
</span><span class="cx">     virtual ~MaskImageOperation();
</span><ins>+    
+    bool operator==(const MaskImageOperation&amp;) const;
+    inline bool operator!=(const MaskImageOperation&amp; other) const { return !operator==(other); }
</ins><span class="cx"> 
</span><span class="cx">     const String&amp; url() const { return m_url; }
</span><span class="cx">     const String&amp; fragment() const { return m_fragment; }
</span><ins>+    bool isExternalDocument() const { return m_isExternalDocument; }
</ins><span class="cx">     StyleImage* image() const { return m_styleImage.get(); }
</span><span class="cx">     void setImage(PassRefPtr&lt;StyleImage&gt; image) { m_styleImage = image; }
</span><span class="cx">     void setRenderLayerImageClient(CachedImageClient*);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.cpp        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -1530,7 +1530,7 @@
</span><span class="cx">     LayoutRect result;
</span><span class="cx">     LayoutRect borderBox = borderBoxRect();
</span><span class="cx">     for (const FillLayer* maskLayer = style().maskLayers(); maskLayer; maskLayer = maskLayer-&gt;next()) {
</span><del>-        if (maskLayer-&gt;image()) {
</del><ins>+        if (maskLayer-&gt;maskImage()) {
</ins><span class="cx">             BackgroundImageGeometry geometry;
</span><span class="cx">             // Masks should never have fixed attachment, so it's OK for paintContainer to be null.
</span><span class="cx">             calculateBackgroundImageGeometry(0, maskLayer, borderBox, geometry);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.h (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.h        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/Source/WebCore/rendering/RenderBox.h        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -175,6 +175,9 @@
</span><span class="cx">     // Bounds of the outline box in absolute coords. Respects transforms
</span><span class="cx">     virtual LayoutRect outlineBoundsForRepaint(const RenderLayerModelObject* /*repaintContainer*/, const RenderGeometryMap*) const override final;
</span><span class="cx">     virtual void addFocusRingRects(Vector&lt;IntRect&gt;&amp;, const LayoutPoint&amp; additionalOffset, const RenderLayerModelObject* paintContainer = 0) override;
</span><ins>+    
+    virtual FloatRect repaintRectInLocalCoordinates() const override { return borderBoxRect(); }
+    virtual FloatRect objectBoundingBox() const override { return borderBoxRect(); }
</ins><span class="cx"> 
</span><span class="cx">     // Use this with caution! No type checking is done!
</span><span class="cx">     RenderBox* previousSiblingBox() const;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxModelObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -27,6 +27,8 @@
</span><span class="cx"> #include &quot;RenderBoxModelObject.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;BorderEdge.h&quot;
</span><ins>+#include &quot;CachedImage.h&quot;
+#include &quot;CachedSVGDocument.h&quot;
</ins><span class="cx"> #include &quot;FloatRoundedRect.h&quot;
</span><span class="cx"> #include &quot;Frame.h&quot;
</span><span class="cx"> #include &quot;FrameView.h&quot;
</span><span class="lines">@@ -47,13 +49,17 @@
</span><span class="cx"> #include &quot;RenderNamedFlowFragment.h&quot;
</span><span class="cx"> #include &quot;RenderNamedFlowThread.h&quot;
</span><span class="cx"> #include &quot;RenderRegion.h&quot;
</span><ins>+#include &quot;RenderSVGResourceMasker.h&quot;
</ins><span class="cx"> #include &quot;RenderTable.h&quot;
</span><span class="cx"> #include &quot;RenderTableRow.h&quot;
</span><span class="cx"> #include &quot;RenderText.h&quot;
</span><span class="cx"> #include &quot;RenderTextFragment.h&quot;
</span><span class="cx"> #include &quot;RenderView.h&quot;
</span><ins>+#include &quot;SVGImageForContainer.h&quot;
+#include &quot;SVGSVGElement.h&quot;
</ins><span class="cx"> #include &quot;ScrollingConstraints.h&quot;
</span><span class="cx"> #include &quot;Settings.h&quot;
</span><ins>+#include &quot;StyleCachedImage.h&quot;
</ins><span class="cx"> #include &quot;TransformState.h&quot;
</span><span class="cx"> #include &lt;wtf/NeverDestroyed.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -676,7 +682,7 @@
</span><span class="cx">     FloatRect pixelSnappedRect = snapRectToDevicePixels(rect, deviceScaleFactor);
</span><span class="cx"> 
</span><span class="cx">     // Fast path for drawing simple color backgrounds.
</span><del>-    if (!isRoot &amp;&amp; !clippedWithLocalScrolling &amp;&amp; !shouldPaintBackgroundImage &amp;&amp; isBorderFill &amp;&amp; !bgLayer-&gt;next()) {
</del><ins>+    if (!isRoot &amp;&amp; !clippedWithLocalScrolling &amp;&amp; !shouldPaintBackgroundImage &amp;&amp; isBorderFill &amp;&amp; !bgLayer-&gt;hasMaskImage() &amp;&amp; !bgLayer-&gt;next()) {
</ins><span class="cx">         if (!colorVisible)
</span><span class="cx">             return;
</span><span class="cx"> 
</span><span class="lines">@@ -837,19 +843,26 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // no progressive loading of the background image
</span><del>-    if (!baseBgColorOnly &amp;&amp; shouldPaintBackgroundImage) {
</del><ins>+    if (!baseBgColorOnly &amp;&amp; (shouldPaintBackgroundImage || bgLayer-&gt;hasMaskImage())) {
</ins><span class="cx">         BackgroundImageGeometry geometry;
</span><span class="cx">         calculateBackgroundImageGeometry(paintInfo.paintContainer, bgLayer, scrolledPaintRect, geometry, backgroundObject);
</span><span class="cx">         geometry.clip(LayoutRect(pixelSnappedRect));
</span><ins>+
</ins><span class="cx">         if (!geometry.destRect().isEmpty()) {
</span><ins>+            bool didPaintCustomMask = false;
</ins><span class="cx">             CompositeOperator compositeOp = op == CompositeSourceOver ? bgLayer-&gt;composite() : op;
</span><span class="cx">             auto clientForBackgroundImage = backgroundObject ? backgroundObject : this;
</span><del>-            RefPtr&lt;Image&gt; image = bgImage-&gt;image(clientForBackgroundImage, geometry.tileSize());
-            context-&gt;setDrawLuminanceMask(bgLayer-&gt;maskSourceType() == MaskLuminance);
-            bool useLowQualityScaling = shouldPaintAtLowQuality(context, image.get(), bgLayer, geometry.tileSize());
-            if (image.get())
-                image-&gt;setSpaceSize(geometry.spaceSize());
-            context-&gt;drawTiledImage(image.get(), style().colorSpace(), geometry.destRect(), geometry.relativePhase(), geometry.tileSize(), ImagePaintingOptions(compositeOp, bgLayer-&gt;blendMode(), ImageOrientationDescription(), useLowQualityScaling));
</del><ins>+            RefPtr&lt;Image&gt; image = (bgImage ? bgImage-&gt;image(clientForBackgroundImage, geometry.tileSize()) : nullptr);
+            if (!image.get() &amp;&amp; bgLayer-&gt;hasMaskImage())
+                didPaintCustomMask = bgLayer-&gt;maskImage()-&gt;drawMask(*this, geometry, context, compositeOp);
+
+            if (!didPaintCustomMask &amp;&amp; shouldPaintBackgroundImage) {
+                context-&gt;setDrawLuminanceMask(bgLayer-&gt;maskSourceType() == MaskLuminance);
+                bool useLowQualityScaling = shouldPaintAtLowQuality(context, image.get(), bgLayer, geometry.tileSize());
+                if (image.get())
+                    image-&gt;setSpaceSize(geometry.spaceSize());
+                context-&gt;drawTiledImage(image.get(), style().colorSpace(), geometry.destRect(), geometry.relativePhase(), geometry.tileSize(), ImagePaintingOptions(compositeOp, bgLayer-&gt;blendMode(), ImageOrientationDescription(), useLowQualityScaling));
+            }
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -954,8 +967,13 @@
</span><span class="cx">     StyleImage* image = fillLayer-&gt;image();
</span><span class="cx">     EFillSizeType type = fillLayer-&gt;size().type;
</span><span class="cx"> 
</span><del>-    LayoutSize imageIntrinsicSize = calculateImageIntrinsicDimensions(image, positioningAreaSize, ScaleByEffectiveZoom);
-    imageIntrinsicSize.scale(1 / image-&gt;imageScaleFactor(), 1 / image-&gt;imageScaleFactor());
</del><ins>+    LayoutSize imageIntrinsicSize;
+    if (image) {
+        imageIntrinsicSize = calculateImageIntrinsicDimensions(image, positioningAreaSize, ScaleByEffectiveZoom);
+        imageIntrinsicSize.scale(1 / image-&gt;imageScaleFactor(), 1 / image-&gt;imageScaleFactor());
+    } else
+        imageIntrinsicSize = positioningAreaSize;
+
</ins><span class="cx">     switch (type) {
</span><span class="cx">         case SizeLength: {
</span><span class="cx">             LayoutSize tileSize = positioningAreaSize;
</span><span class="lines">@@ -1151,7 +1169,9 @@
</span><span class="cx"> 
</span><span class="cx">     auto clientForBackgroundImage = backgroundObject ? backgroundObject : this;
</span><span class="cx">     LayoutSize fillTileSize = calculateFillTileSize(fillLayer, positioningAreaSize);
</span><del>-    fillLayer-&gt;image()-&gt;setContainerSizeForRenderer(clientForBackgroundImage, fillTileSize, style().effectiveZoom());
</del><ins>+    if (StyleImage* layerImage = fillLayer-&gt;image())
+        layerImage-&gt;setContainerSizeForRenderer(clientForBackgroundImage, fillTileSize, style().effectiveZoom());
+    
</ins><span class="cx">     geometry.setTileSize(fillTileSize);
</span><span class="cx"> 
</span><span class="cx">     EFillRepeat backgroundRepeatX = fillLayer-&gt;repeatX();
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderElement.cpp        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -116,6 +116,8 @@
</span><span class="cx">         for (const FillLayer* maskLayer = m_style-&gt;maskLayers(); maskLayer; maskLayer = maskLayer-&gt;next()) {
</span><span class="cx">             if (StyleImage* maskImage = maskLayer-&gt;image())
</span><span class="cx">                 maskImage-&gt;removeClient(this);
</span><ins>+            else if (maskLayer-&gt;maskImage().get())
+                maskLayer-&gt;maskImage()-&gt;removeRendererImageClient(this);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if (StyleImage* borderImage = m_style-&gt;borderImage().image())
</span><span class="lines">@@ -321,18 +323,22 @@
</span><span class="cx"> void RenderElement::updateFillImages(const FillLayer* oldLayers, const FillLayer* newLayers)
</span><span class="cx"> {
</span><span class="cx">     // Optimize the common case
</span><del>-    if (oldLayers &amp;&amp; !oldLayers-&gt;next() &amp;&amp; newLayers &amp;&amp; !newLayers-&gt;next() &amp;&amp; (oldLayers-&gt;image() == newLayers-&gt;image()))
</del><ins>+    if (oldLayers &amp;&amp; !oldLayers-&gt;next() &amp;&amp; newLayers &amp;&amp; !newLayers-&gt;next() &amp;&amp; oldLayers-&gt;image() == newLayers-&gt;image() &amp;&amp; oldLayers-&gt;maskImage() == newLayers-&gt;maskImage())
</ins><span class="cx">         return;
</span><span class="cx">     
</span><span class="cx">     // Go through the new layers and addClients first, to avoid removing all clients of an image.
</span><span class="cx">     for (const FillLayer* currNew = newLayers; currNew; currNew = currNew-&gt;next()) {
</span><del>-        if (currNew-&gt;image())
-            currNew-&gt;image()-&gt;addClient(this);
</del><ins>+        if (StyleImage* image = currNew-&gt;image())
+            image-&gt;addClient(this);
+        else if (currNew-&gt;maskImage().get())
+            currNew-&gt;maskImage()-&gt;addRendererImageClient(this);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     for (const FillLayer* currOld = oldLayers; currOld; currOld = currOld-&gt;next()) {
</span><del>-        if (currOld-&gt;image())
-            currOld-&gt;image()-&gt;removeClient(this);
</del><ins>+        if (StyleImage* image = currOld-&gt;image())
+            image-&gt;removeClient(this);
+        else if (currOld-&gt;maskImage().get())
+            currOld-&gt;maskImage()-&gt;removeRendererImageClient(this);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.cpp        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -6499,6 +6499,7 @@
</span><span class="cx">     updateBlendMode();
</span><span class="cx"> #endif
</span><span class="cx">     updateOrRemoveFilterClients();
</span><ins>+    updateOrRemoveMaskImageClients(oldStyle);
</ins><span class="cx"> 
</span><span class="cx">     updateNeedsCompositedScrolling();
</span><span class="cx"> 
</span><span class="lines">@@ -6653,6 +6654,19 @@
</span><span class="cx">         filterInfo-&gt;removeReferenceFilterClients();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void RenderLayer::updateOrRemoveMaskImageClients(const RenderStyle* oldStyle)
+{
+    if (oldStyle &amp;&amp; oldStyle-&gt;maskImage().get()) {
+        if (MaskImageInfo* maskImageInfo = MaskImageInfo::getIfExists(*this))
+            maskImageInfo-&gt;removeMaskImageClients(*oldStyle);
+    }
+
+    if (renderer().style().maskImage().get())
+        MaskImageInfo::get(*this).updateMaskImageClients();
+    else if (MaskImageInfo* maskImageInfo = MaskImageInfo::getIfExists(*this))
+        maskImageInfo-&gt;removeMaskImageClients(renderer().style());
+}
+
</ins><span class="cx"> void RenderLayer::updateOrRemoveFilterEffectRenderer()
</span><span class="cx"> {
</span><span class="cx">     // FilterEffectRenderer is only used to render the filters in software mode,
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.h (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.h        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/Source/WebCore/rendering/RenderLayer.h        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -1127,6 +1127,8 @@
</span><span class="cx">     void updateOrRemoveFilterClients();
</span><span class="cx">     void updateOrRemoveFilterEffectRenderer();
</span><span class="cx"> 
</span><ins>+    void updateOrRemoveMaskImageClients(const RenderStyle* oldStyle);
+
</ins><span class="cx"> #if ENABLE(CSS_COMPOSITING)
</span><span class="cx">     void updateAncestorChainHasBlendingDescendants();
</span><span class="cx">     void dirtyAncestorChainHasBlendingDescendants();
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerMaskImageInfocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerMaskImageInfo.cpp (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerMaskImageInfo.cpp        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/Source/WebCore/rendering/RenderLayerMaskImageInfo.cpp        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -77,7 +77,7 @@
</span><span class="cx"> 
</span><span class="cx"> RenderLayer::MaskImageInfo::~MaskImageInfo()
</span><span class="cx"> {
</span><del>-    removeMaskImageClients();
</del><ins>+    removeMaskImageClients(m_layer.renderer().style());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderLayer::MaskImageInfo::notifyFinished(CachedResource*)
</span><span class="lines">@@ -92,7 +92,7 @@
</span><span class="cx"> 
</span><span class="cx"> void RenderLayer::MaskImageInfo::updateMaskImageClients()
</span><span class="cx"> {
</span><del>-    removeMaskImageClients();
</del><ins>+    removeMaskImageClients(m_layer.renderer().style());
</ins><span class="cx">     
</span><span class="cx">     const FillLayer* maskLayer = m_layer.renderer().style().maskLayers();
</span><span class="cx">     while (maskLayer) {
</span><span class="lines">@@ -119,9 +119,9 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderLayer::MaskImageInfo::removeMaskImageClients()
</del><ins>+void RenderLayer::MaskImageInfo::removeMaskImageClients(const RenderStyle&amp; oldStyle)
</ins><span class="cx"> {
</span><del>-    const FillLayer* maskLayer = m_layer.renderer().style().maskLayers();
</del><ins>+    const FillLayer* maskLayer = oldStyle.maskLayers();
</ins><span class="cx">     while (maskLayer) {
</span><span class="cx">         if (maskLayer-&gt;maskImage())
</span><span class="cx">             maskLayer-&gt;maskImage()-&gt;setRenderLayerImageClient(nullptr);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerMaskImageInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerMaskImageInfo.h (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerMaskImageInfo.h        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/Source/WebCore/rendering/RenderLayerMaskImageInfo.h        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -80,7 +80,7 @@
</span><span class="cx">     ~MaskImageInfo();
</span><span class="cx"> 
</span><span class="cx">     void updateMaskImageClients();
</span><del>-    void removeMaskImageClients();
</del><ins>+    void removeMaskImageClients(const RenderStyle&amp; oldStyle);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     friend void WTF::deleteOwnedPtr&lt;MaskImageInfo&gt;(MaskImageInfo*);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleFillLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/FillLayer.cpp (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/FillLayer.cpp        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/Source/WebCore/rendering/style/FillLayer.cpp        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -378,7 +378,7 @@
</span><span class="cx"> bool FillLayer::hasImage() const
</span><span class="cx"> {
</span><span class="cx">     for (auto* layer = this; layer; layer = layer-&gt;m_next.get()) {
</span><del>-        if (layer-&gt;m_image)
</del><ins>+        if (layer-&gt;image())
</ins><span class="cx">             return true;
</span><span class="cx">     }
</span><span class="cx">     return false;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleFillLayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/FillLayer.h (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/FillLayer.h        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/Source/WebCore/rendering/style/FillLayer.h        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -68,9 +68,8 @@
</span><span class="cx">     explicit FillLayer(EFillLayerType);
</span><span class="cx">     ~FillLayer();
</span><span class="cx"> 
</span><ins>+    StyleImage* image() const { return hasMaskImage() ? maskImage()-&gt;image() : m_image.get(); }
</ins><span class="cx">     const RefPtr&lt;MaskImageOperation&gt;&amp; maskImage() const { return m_maskImageOperation; }
</span><del>-    StyleImage* image() const { return m_image.get(); }
-    StyleImage* imageOrMaskImage() const { return hasMaskImage() ? maskImage()-&gt;image() : image(); }
</del><span class="cx">     const Length&amp; xPosition() const { return m_xPosition; }
</span><span class="cx">     const Length&amp; yPosition() const { return m_yPosition; }
</span><span class="cx">     BackgroundEdgeOrigin backgroundXOrigin() const { return static_cast&lt;BackgroundEdgeOrigin&gt;(m_backgroundXOrigin); }
</span><span class="lines">@@ -182,6 +181,8 @@
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;FillLayer&gt; m_next;
</span><span class="cx"> 
</span><ins>+    // FIXME: A FillLayer will always have at least one of these pointers null.
+    // Maybe we could group them together somehow and decrease the size of FillLayer.
</ins><span class="cx">     RefPtr&lt;MaskImageOperation&gt; m_maskImageOperation;
</span><span class="cx">     RefPtr&lt;StyleImage&gt; m_image;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleRenderStylecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -830,7 +830,29 @@
</span><span class="cx"> 
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><ins>+    
+void RenderStyle::setMaskImage(const Vector&lt;RefPtr&lt;MaskImageOperation&gt;&gt;&amp; ops)
+{
+    FillLayer* curLayer = &amp;rareNonInheritedData.access()-&gt;m_mask;
+    while (curLayer) {
+        curLayer-&gt;setMaskImage(nullptr);
+        curLayer = curLayer-&gt;next();
+    }
</ins><span class="cx"> 
</span><ins>+    curLayer = &amp;rareNonInheritedData.access()-&gt;m_mask;
+    FillLayer* prevLayer = nullptr;
+    for (auto&amp; maskImage : ops) {
+        if (!curLayer) {
+            prevLayer-&gt;setNext(std::make_unique&lt;FillLayer&gt;(MaskFillLayer));
+            curLayer = prevLayer-&gt;next();
+        }
+
+        curLayer-&gt;setMaskImage(maskImage);
+        prevLayer = curLayer;
+        curLayer = curLayer-&gt;next();
+    }
+}
+
</ins><span class="cx"> void RenderStyle::setClip(Length top, Length right, Length bottom, Length left)
</span><span class="cx"> {
</span><span class="cx">     StyleVisualData* data = visual.access();
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleRenderStyleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (177154 => 177155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/RenderStyle.h        2014-12-11 17:51:25 UTC (rev 177154)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h        2014-12-11 17:54:38 UTC (rev 177155)
</span><span class="lines">@@ -108,6 +108,7 @@
</span><span class="cx"> class Font;
</span><span class="cx"> class FontMetrics;
</span><span class="cx"> class IntRect;
</span><ins>+class MaskImageOperation;
</ins><span class="cx"> class Pair;
</span><span class="cx"> class ShadowData;
</span><span class="cx"> class StyleImage;
</span><span class="lines">@@ -798,7 +799,6 @@
</span><span class="cx">     FillLayer* accessBackgroundLayers() { return &amp;(m_background.access()-&gt;m_background); }
</span><span class="cx">     const FillLayer* backgroundLayers() const { return &amp;(m_background-&gt;background()); }
</span><span class="cx"> 
</span><del>-    StyleImage* maskImage() const { return rareNonInheritedData-&gt;m_mask.image(); }
</del><span class="cx">     EFillRepeat maskRepeatX() const { return static_cast&lt;EFillRepeat&gt;(rareNonInheritedData-&gt;m_mask.repeatX()); }
</span><span class="cx">     EFillRepeat maskRepeatY() const { return static_cast&lt;EFillRepeat&gt;(rareNonInheritedData-&gt;m_mask.repeatY()); }
</span><span class="cx">     CompositeOperator maskComposite() const { return static_cast&lt;CompositeOperator&gt;(rareNonInheritedData-&gt;m_mask.composite()); }
</span><span class="lines">@@ -1025,7 +1025,7 @@
</span><span class="cx">     void applyTransform(TransformationMatrix&amp;, const FloatRect&amp; boundingBox, ApplyTransformOrigin = IncludeTransformOrigin) const;
</span><span class="cx">     void setPageScaleTransform(float);
</span><span class="cx"> 
</span><del>-    bool hasMask() const { return rareNonInheritedData-&gt;m_mask.hasImage() || rareNonInheritedData-&gt;m_maskBoxImage.hasImage(); }
</del><ins>+    bool hasMask() const { return rareNonInheritedData-&gt;m_mask.hasNonEmptyMaskImage() || rareNonInheritedData-&gt;m_mask.hasImage() || rareNonInheritedData-&gt;m_maskBoxImage.hasImage(); }
</ins><span class="cx"> 
</span><span class="cx">     TextCombine textCombine() const { return static_cast&lt;TextCombine&gt;(rareNonInheritedData-&gt;m_textCombine); }
</span><span class="cx">     bool hasTextCombine() const { return textCombine() != TextCombineNone; }
</span><span class="lines">@@ -1126,6 +1126,9 @@
</span><span class="cx">     FilterOperations&amp; mutableFilter() { return rareNonInheritedData.access()-&gt;m_filter.access()-&gt;m_operations; }
</span><span class="cx">     const FilterOperations&amp; filter() const { return rareNonInheritedData-&gt;m_filter-&gt;m_operations; }
</span><span class="cx">     bool hasFilter() const { return !rareNonInheritedData-&gt;m_filter-&gt;m_operations.operations().isEmpty(); }
</span><ins>+    
+    RefPtr&lt;MaskImageOperation&gt;&amp; mutableMaskImage() { return rareNonInheritedData.access()-&gt;m_mask.m_maskImageOperation; }
+    const RefPtr&lt;MaskImageOperation&gt; maskImage() const { return rareNonInheritedData-&gt;m_mask.maskImage(); }
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(FILTERS_LEVEL_2)
</span><span class="cx">     FilterOperations&amp; mutableBackdropFilter() { return rareNonInheritedData.access()-&gt;m_backdropFilter.access()-&gt;m_operations; }
</span><span class="lines">@@ -1377,8 +1380,6 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void setMaskImage(PassRefPtr&lt;StyleImage&gt; v) { rareNonInheritedData.access()-&gt;m_mask.setImage(v); }
-
</del><span class="cx">     void setMaskBoxImage(const NinePieceImage&amp; b) { SET_VAR(rareNonInheritedData, m_maskBoxImage, b); }
</span><span class="cx">     void setMaskBoxImageSource(PassRefPtr&lt;StyleImage&gt; v) { rareNonInheritedData.access()-&gt;m_maskBoxImage.setImage(v); }
</span><span class="cx">     void setMaskXPosition(Length length) { SET_VAR(rareNonInheritedData, m_mask.m_xPosition, WTF::move(length)); }
</span><span class="lines">@@ -1569,6 +1570,9 @@
</span><span class="cx">     void setBackdropFilter(const FilterOperations&amp; ops) { SET_VAR(rareNonInheritedData.access()-&gt;m_backdropFilter, m_operations, ops); }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    void setMaskImage(const Vector&lt;RefPtr&lt;MaskImageOperation&gt;&gt;&amp;);
+    void setMaskImage(const RefPtr&lt;MaskImageOperation&gt; maskImage) { Vector&lt;RefPtr&lt;MaskImageOperation&gt;&gt; vectMask; vectMask.append(maskImage); setMaskImage(vectMask); }
+
</ins><span class="cx">     void setTabSize(unsigned size) { SET_VAR(rareInheritedData, m_tabSize, size); }
</span><span class="cx"> 
</span><span class="cx">     // End CSS3 Setters
</span></span></pre>
</div>
</div>

</body>
</html>