<!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>[168577] 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/168577">168577</a></dd>
<dt>Author</dt> <dd>dino@apple.com</dd>
<dt>Date</dt> <dd>2014-05-10 02:30:02 -0700 (Sat, 10 May 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>-webkit-filter prevents rendering at retina scale
https://bugs.webkit.org/show_bug.cgi?id=93471
Reviewed by Dirk Schulze.
Source/WebCore:
Implement 2x support for filters that go through
the -webkit-filter property. This includes all
shorthand filters, and any referenced SVG-style filters
(as long as they use only the supported subset of
operations - basically the same as is exposed for
the shorthands).
Tests: fast/hidpi/filters-blur.html
fast/hidpi/filters-hue-rotate.html
fast/hidpi/filters-invert.html
fast/hidpi/filters-multiple.html
fast/hidpi/filters-reference.html
fast/hidpi/filters-shadow.html
* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::ImageBuffer::getUnmultipliedImageData): Scale the source rectangle if the method was
called using LogicalCoordinates.
(WebCore::ImageBuffer::getPremultipliedImageData): Ditto.
(WebCore::ImageBuffer::putByteArray): Ditto.
* platform/graphics/filters/FEDropShadow.cpp:
(WebCore::FEDropShadow::platformApplySoftware): Make sure to scale the blur radius by the filter
resolution, and call the byte-array methods with the native coordinate system.
* platform/graphics/filters/FEGaussianBlur.cpp:
(WebCore::FEGaussianBlur::calculateUnscaledKernelSize): Fix typo.
(WebCore::FEGaussianBlur::platformApplySoftware): Scale the kernel and paint rectangles
by the filter scale.
* platform/graphics/filters/Filter.h:
(WebCore::Filter::Filter): Initialise the filter scale.
(WebCore::Filter::filterScale): New property which reflects the mapping between logical pixels
and device pixels.
(WebCore::Filter::setFilterScale):
* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::asImageBuffer): Make sure buffer creation takes scale into account.
(WebCore::FilterEffect::asUnmultipliedImage): Ditto.
(WebCore::FilterEffect::asPremultipliedImage): Ditto.
(WebCore::FilterEffect::copyImageBytes): Scale any incoming regions if they are talking about
device pixels rather than logical pixels.
(WebCore::FilterEffect::copyUnmultipliedImage): Ditto.
(WebCore::FilterEffect::copyPremultipliedImage): Ditto.
(WebCore::FilterEffect::createImageBufferResult): Take scale into account when creating byte array.
(WebCore::FilterEffect::createUnmultipliedImageResult): Ditto.
(WebCore::FilterEffect::createPremultipliedImageResult): Ditto.
* rendering/FilterEffectRenderer.cpp:
(WebCore::FilterEffectRenderer::allocateBackingStoreIfNeeded): Pass filter scale into buffer creation.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateOrRemoveFilterEffectRenderer): Make sure to set the filter scale to
the device scale factor, and notice if we ever change scales.
LayoutTests:
New tests for filters at high resolutions. The image used
has a crosshatch at the pixel level, so any scale changes
are visible (such as going from 2x to 1x). All the actual
filters are no-ops so they can be compared to an element
without a filter in the -expected version.
* fast/hidpi/filters-blur-expected.html: Added.
* fast/hidpi/filters-blur.html: Added.
* fast/hidpi/filters-hue-rotate-expected.html: Added.
* fast/hidpi/filters-hue-rotate.html: Added.
* fast/hidpi/filters-invert-expected.html: Added.
* fast/hidpi/filters-invert.html: Added.
* fast/hidpi/filters-multiple-expected.html: Added.
* fast/hidpi/filters-multiple.html: Added.
* fast/hidpi/filters-reference-expected.html: Added.
* fast/hidpi/filters-reference.html: Added.
* fast/hidpi/filters-shadow-expected.html: Added.
* fast/hidpi/filters-shadow.html: Added.
* fast/hidpi/resources/color-grid.png: Added.
* fast/hidpi/resources/ensure-hidpi.js: Added.
(runTest):
(scaleFactorIsSet):
* platform/mac-wk2/TestExpectations: Skip some of these on WK2 Mac.
See webkit.org/b/132766.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2TestExpectations">trunk/LayoutTests/platform/mac-wk2/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscgImageBufferCGcpp">trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersFEDropShadowcpp">trunk/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersFEGaussianBlurcpp">trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersFilterh">trunk/Source/WebCore/platform/graphics/filters/Filter.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersFilterEffectcpp">trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingFilterEffectRenderercpp">trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayercpp">trunk/Source/WebCore/rendering/RenderLayer.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfasthidpifiltersblurexpectedhtml">trunk/LayoutTests/fast/hidpi/filters-blur-expected.html</a></li>
<li><a href="#trunkLayoutTestsfasthidpifiltersblurhtml">trunk/LayoutTests/fast/hidpi/filters-blur.html</a></li>
<li><a href="#trunkLayoutTestsfasthidpifiltershuerotateexpectedhtml">trunk/LayoutTests/fast/hidpi/filters-hue-rotate-expected.html</a></li>
<li><a href="#trunkLayoutTestsfasthidpifiltershuerotatehtml">trunk/LayoutTests/fast/hidpi/filters-hue-rotate.html</a></li>
<li><a href="#trunkLayoutTestsfasthidpifiltersinvertexpectedhtml">trunk/LayoutTests/fast/hidpi/filters-invert-expected.html</a></li>
<li><a href="#trunkLayoutTestsfasthidpifiltersinverthtml">trunk/LayoutTests/fast/hidpi/filters-invert.html</a></li>
<li><a href="#trunkLayoutTestsfasthidpifiltersmultipleexpectedhtml">trunk/LayoutTests/fast/hidpi/filters-multiple-expected.html</a></li>
<li><a href="#trunkLayoutTestsfasthidpifiltersmultiplehtml">trunk/LayoutTests/fast/hidpi/filters-multiple.html</a></li>
<li><a href="#trunkLayoutTestsfasthidpifiltersreferenceexpectedhtml">trunk/LayoutTests/fast/hidpi/filters-reference-expected.html</a></li>
<li><a href="#trunkLayoutTestsfasthidpifiltersreferencehtml">trunk/LayoutTests/fast/hidpi/filters-reference.html</a></li>
<li><a href="#trunkLayoutTestsfasthidpifiltersshadowexpectedhtml">trunk/LayoutTests/fast/hidpi/filters-shadow-expected.html</a></li>
<li><a href="#trunkLayoutTestsfasthidpifiltersshadowhtml">trunk/LayoutTests/fast/hidpi/filters-shadow.html</a></li>
<li><a href="#trunkLayoutTestsfasthidpiresourcesensurehidpijs">trunk/LayoutTests/fast/hidpi/resources/ensure-hidpi.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (168576 => 168577)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-05-10 07:30:12 UTC (rev 168576)
+++ trunk/LayoutTests/ChangeLog        2014-05-10 09:30:02 UTC (rev 168577)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2014-05-09 Dean Jackson <dino@apple.com>
+
+ -webkit-filter prevents rendering at retina scale
+ https://bugs.webkit.org/show_bug.cgi?id=93471
+
+ Reviewed by Dirk Schulze.
+
+ New tests for filters at high resolutions. The image used
+ has a crosshatch at the pixel level, so any scale changes
+ are visible (such as going from 2x to 1x). All the actual
+ filters are no-ops so they can be compared to an element
+ without a filter in the -expected version.
+
+ * fast/hidpi/filters-blur-expected.html: Added.
+ * fast/hidpi/filters-blur.html: Added.
+ * fast/hidpi/filters-hue-rotate-expected.html: Added.
+ * fast/hidpi/filters-hue-rotate.html: Added.
+ * fast/hidpi/filters-invert-expected.html: Added.
+ * fast/hidpi/filters-invert.html: Added.
+ * fast/hidpi/filters-multiple-expected.html: Added.
+ * fast/hidpi/filters-multiple.html: Added.
+ * fast/hidpi/filters-reference-expected.html: Added.
+ * fast/hidpi/filters-reference.html: Added.
+ * fast/hidpi/filters-shadow-expected.html: Added.
+ * fast/hidpi/filters-shadow.html: Added.
+ * fast/hidpi/resources/color-grid.png: Added.
+ * fast/hidpi/resources/ensure-hidpi.js: Added.
+ (runTest):
+ (scaleFactorIsSet):
+ * platform/mac-wk2/TestExpectations: Skip some of these on WK2 Mac.
+ See webkit.org/b/132766.
+
</ins><span class="cx"> 2014-05-10 Zalan Bujtas <zalan@apple.com>
</span><span class="cx">
</span><span class="cx"> Subpixel rendering: Empty rects should remain empty after integrally enclosing them.
</span></span></pre></div>
<a id="trunkLayoutTestsfasthidpifiltersblurexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/hidpi/filters-blur-expected.html (0 => 168577)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/hidpi/filters-blur-expected.html         (rev 0)
+++ trunk/LayoutTests/fast/hidpi/filters-blur-expected.html        2014-05-10 09:30:02 UTC (rev 168577)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+<script src="resources/ensure-hidpi.js"></script>
+<style>
+img {
+ width: 200px;
+ height: 200px;
+}
+
+p {
+ width: 200px;
+ height: 100px;
+ display: inline-block;
+ font: 20px/1 Ahem;
+}
+</style>
+<div>This is testing HiDPI output from filters. The actual effects are no-ops.</div>
+<img src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><rect fill='green' width='100%' height='100%'/></svg>">
+<img src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><rect fill='green' width='100%' height='100%'/></svg>">
+<div>
+ <p>Text</p>
+ <p>Text</p>
+</div>
</ins><span class="cx">Property changes on: trunk/LayoutTests/fast/hidpi/filters-blur-expected.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestsfasthidpifiltersblurhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/hidpi/filters-blur.html (0 => 168577)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/hidpi/filters-blur.html         (rev 0)
+++ trunk/LayoutTests/fast/hidpi/filters-blur.html        2014-05-10 09:30:02 UTC (rev 168577)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+<script src="resources/ensure-hidpi.js"></script>
+<style>
+img {
+ width: 200px;
+ height: 200px;
+}
+
+p {
+ width: 200px;
+ height: 100px;
+ display: inline-block;
+ font: 20px/1 Ahem;
+}
+
+.filtered {
+ -webkit-filter: blur(0px);
+}
+</style>
+<div>This is testing HiDPI output from filters. The actual effects are no-ops.</div>
+<img src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><rect fill='green' width='100%' height='100%'/></svg>">
+<img class="filtered" src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><rect fill='green' width='100%' height='100%'/></svg>">
+<div>
+ <p>Text</p>
+ <p class="filtered">Text</p>
+</div>
</ins><span class="cx">Property changes on: trunk/LayoutTests/fast/hidpi/filters-blur.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestsfasthidpifiltershuerotateexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/hidpi/filters-hue-rotate-expected.html (0 => 168577)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/hidpi/filters-hue-rotate-expected.html         (rev 0)
+++ trunk/LayoutTests/fast/hidpi/filters-hue-rotate-expected.html        2014-05-10 09:30:02 UTC (rev 168577)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+<script src="resources/ensure-hidpi.js"></script>
+<style>
+img {
+ width: 200px;
+ height: 200px;
+}
+
+p {
+ width: 200px;
+ height: 100px;
+ display: inline-block;
+ font: 20px/1 Ahem;
+}
+</style>
+<div>This is testing HiDPI output from filters. The actual effects are no-ops.</div>
+<img src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><rect fill='green' width='100%' height='100%'/></svg>">
+<img src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><rect fill='green' width='100%' height='100%'/></svg>">
+<div>
+ <p>Text</p>
+ <p>Text</p>
+</div>
</ins><span class="cx">Property changes on: trunk/LayoutTests/fast/hidpi/filters-hue-rotate-expected.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestsfasthidpifiltershuerotatehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/hidpi/filters-hue-rotate.html (0 => 168577)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/hidpi/filters-hue-rotate.html         (rev 0)
+++ trunk/LayoutTests/fast/hidpi/filters-hue-rotate.html        2014-05-10 09:30:02 UTC (rev 168577)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+<script src="resources/ensure-hidpi.js"></script>
+<style>
+img {
+ width: 200px;
+ height: 200px;
+}
+
+p {
+ width: 200px;
+ height: 100px;
+ display: inline-block;
+ font: 20px/1 Ahem;
+}
+
+.filtered {
+ -webkit-filter: hue-rotate(0deg);
+}
+</style>
+<div>This is testing HiDPI output from filters. The actual effects are no-ops.</div>
+<img src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><rect fill='green' width='100%' height='100%'/></svg>">
+<img class="filtered" src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><rect fill='green' width='100%' height='100%'/></svg>">
+<div>
+ <p>Text</p>
+ <p class="filtered">Text</p>
+</div>
</ins><span class="cx">Property changes on: trunk/LayoutTests/fast/hidpi/filters-hue-rotate.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestsfasthidpifiltersinvertexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/hidpi/filters-invert-expected.html (0 => 168577)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/hidpi/filters-invert-expected.html         (rev 0)
+++ trunk/LayoutTests/fast/hidpi/filters-invert-expected.html        2014-05-10 09:30:02 UTC (rev 168577)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+<script src="resources/ensure-hidpi.js"></script>
+<style>
+img {
+ width: 200px;
+ height: 200px;
+}
+
+p {
+ width: 200px;
+ height: 100px;
+ display: inline-block;
+ font: 20px/1 Ahem;
+}
+</style>
+<div>This is testing HiDPI output from filters. The actual effects are no-ops.</div>
+<img src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><rect fill='green' width='100%' height='100%'/></svg>">
+<img src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><rect fill='green' width='100%' height='100%'/></svg>">
+<div>
+ <p>Text</p>
+ <p>Text</p>
+</div>
</ins><span class="cx">Property changes on: trunk/LayoutTests/fast/hidpi/filters-invert-expected.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestsfasthidpifiltersinverthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/hidpi/filters-invert.html (0 => 168577)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/hidpi/filters-invert.html         (rev 0)
+++ trunk/LayoutTests/fast/hidpi/filters-invert.html        2014-05-10 09:30:02 UTC (rev 168577)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+<script src="resources/ensure-hidpi.js"></script>
+<style>
+img {
+ width: 200px;
+ height: 200px;
+}
+
+p {
+ width: 200px;
+ height: 100px;
+ display: inline-block;
+ font: 20px/1 Ahem;
+}
+
+.filtered {
+ -webkit-filter: invert(0);
+}
+</style>
+<div>This is testing HiDPI output from filters. The actual effects are no-ops.</div>
+<img src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><rect fill='green' width='100%' height='100%'/></svg>">
+<img class="filtered" src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><rect fill='green' width='100%' height='100%'/></svg>">
+<div>
+ <p>Text</p>
+ <p class="filtered">Text</p>
+</div>
</ins><span class="cx">Property changes on: trunk/LayoutTests/fast/hidpi/filters-invert.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestsfasthidpifiltersmultipleexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/hidpi/filters-multiple-expected.html (0 => 168577)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/hidpi/filters-multiple-expected.html         (rev 0)
+++ trunk/LayoutTests/fast/hidpi/filters-multiple-expected.html        2014-05-10 09:30:02 UTC (rev 168577)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+<script src="resources/ensure-hidpi.js"></script>
+<style>
+img {
+ width: 200px;
+ height: 200px;
+}
+
+p {
+ width: 200px;
+ height: 100px;
+ display: inline-block;
+ font: 20px/1 Ahem;
+}
+</style>
+<div>This is testing HiDPI output from filters. The actual effects are no-ops.</div>
+<img src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><rect fill='green' width='100%' height='100%'/></svg>">
+<img src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><rect fill='green' width='100%' height='100%'/></svg>">
+<div>
+ <p>Text</p>
+ <p>Text</p>
+</div>
</ins><span class="cx">Property changes on: trunk/LayoutTests/fast/hidpi/filters-multiple-expected.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestsfasthidpifiltersmultiplehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/hidpi/filters-multiple.html (0 => 168577)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/hidpi/filters-multiple.html         (rev 0)
+++ trunk/LayoutTests/fast/hidpi/filters-multiple.html        2014-05-10 09:30:02 UTC (rev 168577)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+<script src="resources/ensure-hidpi.js"></script>
+<style>
+img {
+ width: 200px;
+ height: 200px;
+}
+
+p {
+ width: 200px;
+ height: 100px;
+ display: inline-block;
+ font: 20px/1 Ahem;
+}
+
+.filtered {
+ -webkit-filter: invert(0) hue-rotate(0) sepia(0);
+}
+</style>
+<div>This is testing HiDPI output from filters. The actual effects are no-ops.</div>
+<img src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><rect fill='green' width='100%' height='100%'/></svg>">
+<img class="filtered" src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><rect fill='green' width='100%' height='100%'/></svg>">
+<div>
+ <p>Text</p>
+ <p class="filtered">Text</p>
+</div>
</ins><span class="cx">Property changes on: trunk/LayoutTests/fast/hidpi/filters-multiple.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestsfasthidpifiltersreferenceexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/hidpi/filters-reference-expected.html (0 => 168577)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/hidpi/filters-reference-expected.html         (rev 0)
+++ trunk/LayoutTests/fast/hidpi/filters-reference-expected.html        2014-05-10 09:30:02 UTC (rev 168577)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+<script src="resources/ensure-hidpi.js"></script>
+<style>
+img {
+ width: 200px;
+ height: 200px;
+}
+
+p {
+ width: 200px;
+ height: 100px;
+ display: inline-block;
+ font: 20px/1 Ahem;
+}
+</style>
+<div>This is testing HiDPI output from filters. The actual effects are no-ops.</div>
+<img src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><rect fill='green' width='100%' height='100%'/></svg>">
+<img src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><rect fill='green' width='100%' height='100%'/></svg>">
+<div>
+ <p>Text</p>
+ <p>Text</p>
+</div>
</ins><span class="cx">Property changes on: trunk/LayoutTests/fast/hidpi/filters-reference-expected.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestsfasthidpifiltersreferencehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/hidpi/filters-reference.html (0 => 168577)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/hidpi/filters-reference.html         (rev 0)
+++ trunk/LayoutTests/fast/hidpi/filters-reference.html        2014-05-10 09:30:02 UTC (rev 168577)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+<script src="resources/ensure-hidpi.js"></script>
+<style>
+img {
+ width: 200px;
+ height: 200px;
+}
+
+p {
+ width: 200px;
+ height: 100px;
+ display: inline-block;
+ font: 20px/1 Ahem;
+}
+
+.filtered {
+ -webkit-filter: url(#hueRotate);
+}
+</style>
+<div style="display: none">
+ <svg xmlns="http://www.w3.org/2000/svg" width="0" height="0">
+ <defs>
+ <filter id="hueRotate">
+ <feColorMatrix type="hueRotate" values="0"/>
+ <feMerge>
+ <feMergeNode/>
+ </feMerge>
+ </filter>
+ </defs>
+ </svg>
+</div>
+<div>This is testing HiDPI output from filters. The actual effects are no-ops.</div>
+<img src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><rect fill='green' width='100%' height='100%'/></svg>">
+<img class="filtered" src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><rect fill='green' width='100%' height='100%'/></svg>">
+<div>
+ <p>Text</p>
+ <p class="filtered">Text</p>
+</div>
</ins><span class="cx">Property changes on: trunk/LayoutTests/fast/hidpi/filters-reference.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestsfasthidpifiltersshadowexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/hidpi/filters-shadow-expected.html (0 => 168577)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/hidpi/filters-shadow-expected.html         (rev 0)
+++ trunk/LayoutTests/fast/hidpi/filters-shadow-expected.html        2014-05-10 09:30:02 UTC (rev 168577)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+<script src="resources/ensure-hidpi.js"></script>
+<style>
+img {
+ width: 200px;
+ height: 200px;
+}
+
+p {
+ width: 200px;
+ height: 100px;
+ display: inline-block;
+ font: 14px/1 Ahem;
+}
+</style>
+<div>This is testing HiDPI output from filters. The actual effects are no-ops.</div>
+<img src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><rect fill='green' width='100%' height='100%'/></svg>">
+<img src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><rect fill='green' width='100%' height='100%'/></svg>">
</ins><span class="cx">Property changes on: trunk/LayoutTests/fast/hidpi/filters-shadow-expected.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestsfasthidpifiltersshadowhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/hidpi/filters-shadow.html (0 => 168577)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/hidpi/filters-shadow.html         (rev 0)
+++ trunk/LayoutTests/fast/hidpi/filters-shadow.html        2014-05-10 09:30:02 UTC (rev 168577)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+<script src="resources/ensure-hidpi.js"></script>
+<style>
+img {
+ width: 200px;
+ height: 200px;
+}
+
+p {
+ width: 200px;
+ height: 100px;
+ display: inline-block;
+ font: 14px/1 Ahem;
+}
+
+.filtered {
+ -webkit-filter: drop-shadow(0px 0px 0px black);
+}
+</style>
+<div>This is testing HiDPI output from filters. The actual effects are no-ops.</div>
+<img src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><rect fill='green' width='100%' height='100%'/></svg>">
+<img class="filtered" src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><rect fill='green' width='100%' height='100%'/></svg>">
</ins><span class="cx">Property changes on: trunk/LayoutTests/fast/hidpi/filters-shadow.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestsfasthidpiresourcesensurehidpijs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/hidpi/resources/ensure-hidpi.js (0 => 168577)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/hidpi/resources/ensure-hidpi.js         (rev 0)
+++ trunk/LayoutTests/fast/hidpi/resources/ensure-hidpi.js        2014-05-10 09:30:02 UTC (rev 168577)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+function runTest() {
+ if (!window.testRunner)
+ return;
+
+ testRunner.waitUntilDone();
+ testRunner.setBackingScaleFactor(2, scaleFactorIsSet);
+}
+
+function scaleFactorIsSet() {
+ testRunner.notifyDone();
+}
+
+window.addEventListener("load", runTest, false);
</ins><span class="cx">Property changes on: trunk/LayoutTests/fast/hidpi/resources/ensure-hidpi.js
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestsplatformmacwk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (168576 => 168577)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/TestExpectations        2014-05-10 07:30:12 UTC (rev 168576)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations        2014-05-10 09:30:02 UTC (rev 168577)
</span><span class="lines">@@ -423,6 +423,12 @@
</span><span class="cx">
</span><span class="cx"> webkit.org/b/129468 [ MountainLion Debug ] css3/blending/isolation-isolate-blended-child.html [ ImageOnlyFailure ]
</span><span class="cx">
</span><ins>+webkit.org/b/132766 fast/hidpi/filters-blur.html [ ImageOnlyFailure ]
+webkit.org/b/132766 fast/hidpi/filters-hue-rotate.html [ ImageOnlyFailure ]
+webkit.org/b/132766 fast/hidpi/filters-invert.html [ ImageOnlyFailure ]
+webkit.org/b/132766 fast/hidpi/filters-multiple.html [ ImageOnlyFailure ]
+webkit.org/b/132766 fast/hidpi/filters-reference.html [ ImageOnlyFailure ]
+
</ins><span class="cx"> ### END OF (3) Unclassified failures
</span><span class="cx"> ########################################
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (168576 => 168577)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-05-10 07:30:12 UTC (rev 168576)
+++ trunk/Source/WebCore/ChangeLog        2014-05-10 09:30:02 UTC (rev 168577)
</span><span class="lines">@@ -1,3 +1,63 @@
</span><ins>+2014-05-09 Dean Jackson <dino@apple.com>
+
+ -webkit-filter prevents rendering at retina scale
+ https://bugs.webkit.org/show_bug.cgi?id=93471
+
+ Reviewed by Dirk Schulze.
+
+ Implement 2x support for filters that go through
+ the -webkit-filter property. This includes all
+ shorthand filters, and any referenced SVG-style filters
+ (as long as they use only the supported subset of
+ operations - basically the same as is exposed for
+ the shorthands).
+
+ Tests: fast/hidpi/filters-blur.html
+ fast/hidpi/filters-hue-rotate.html
+ fast/hidpi/filters-invert.html
+ fast/hidpi/filters-multiple.html
+ fast/hidpi/filters-reference.html
+ fast/hidpi/filters-shadow.html
+
+ * platform/graphics/cg/ImageBufferCG.cpp:
+ (WebCore::ImageBuffer::getUnmultipliedImageData): Scale the source rectangle if the method was
+ called using LogicalCoordinates.
+ (WebCore::ImageBuffer::getPremultipliedImageData): Ditto.
+ (WebCore::ImageBuffer::putByteArray): Ditto.
+
+ * platform/graphics/filters/FEDropShadow.cpp:
+ (WebCore::FEDropShadow::platformApplySoftware): Make sure to scale the blur radius by the filter
+ resolution, and call the byte-array methods with the native coordinate system.
+ * platform/graphics/filters/FEGaussianBlur.cpp:
+ (WebCore::FEGaussianBlur::calculateUnscaledKernelSize): Fix typo.
+ (WebCore::FEGaussianBlur::platformApplySoftware): Scale the kernel and paint rectangles
+ by the filter scale.
+
+ * platform/graphics/filters/Filter.h:
+ (WebCore::Filter::Filter): Initialise the filter scale.
+ (WebCore::Filter::filterScale): New property which reflects the mapping between logical pixels
+ and device pixels.
+ (WebCore::Filter::setFilterScale):
+
+ * platform/graphics/filters/FilterEffect.cpp:
+ (WebCore::FilterEffect::asImageBuffer): Make sure buffer creation takes scale into account.
+ (WebCore::FilterEffect::asUnmultipliedImage): Ditto.
+ (WebCore::FilterEffect::asPremultipliedImage): Ditto.
+ (WebCore::FilterEffect::copyImageBytes): Scale any incoming regions if they are talking about
+ device pixels rather than logical pixels.
+ (WebCore::FilterEffect::copyUnmultipliedImage): Ditto.
+ (WebCore::FilterEffect::copyPremultipliedImage): Ditto.
+ (WebCore::FilterEffect::createImageBufferResult): Take scale into account when creating byte array.
+ (WebCore::FilterEffect::createUnmultipliedImageResult): Ditto.
+ (WebCore::FilterEffect::createPremultipliedImageResult): Ditto.
+
+ * rendering/FilterEffectRenderer.cpp:
+ (WebCore::FilterEffectRenderer::allocateBackingStoreIfNeeded): Pass filter scale into buffer creation.
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::updateOrRemoveFilterEffectRenderer): Make sure to set the filter scale to
+ the device scale factor, and notice if we ever change scales.
+
</ins><span class="cx"> 2014-05-10 Praveen R Jadhav <praveen.j@samsung.com>
</span><span class="cx">
</span><span class="cx"> [MediaStream] Rename NavigatorMediaStream as NavigatorUserMedia.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscgImageBufferCGcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp (168576 => 168577)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp        2014-05-10 07:30:12 UTC (rev 168576)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp        2014-05-10 09:30:02 UTC (rev 168577)
</span><span class="lines">@@ -343,7 +343,11 @@
</span><span class="cx"> if (m_context->isAcceleratedContext())
</span><span class="cx"> flushContext();
</span><span class="cx">
</span><del>- return m_data.getData(rect, internalSize(), m_context->isAcceleratedContext(), true, coordinateSystem == LogicalCoordinateSystem ? m_resolutionScale : 1);
</del><ins>+ IntRect srcRect = rect;
+ if (coordinateSystem == LogicalCoordinateSystem)
+ srcRect.scale(m_resolutionScale);
+
+ return m_data.getData(srcRect, internalSize(), m_context->isAcceleratedContext(), true, 1);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> PassRefPtr<Uint8ClampedArray> ImageBuffer::getPremultipliedImageData(const IntRect& rect, CoordinateSystem coordinateSystem) const
</span><span class="lines">@@ -351,13 +355,24 @@
</span><span class="cx"> if (m_context->isAcceleratedContext())
</span><span class="cx"> flushContext();
</span><span class="cx">
</span><del>- return m_data.getData(rect, internalSize(), m_context->isAcceleratedContext(), false, coordinateSystem == LogicalCoordinateSystem ? m_resolutionScale : 1);
</del><ins>+ IntRect srcRect = rect;
+ if (coordinateSystem == LogicalCoordinateSystem)
+ srcRect.scale(m_resolutionScale);
+
+ return m_data.getData(srcRect, internalSize(), m_context->isAcceleratedContext(), false, 1);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void ImageBuffer::putByteArray(Multiply multiplied, Uint8ClampedArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint, CoordinateSystem coordinateSystem)
</span><span class="cx"> {
</span><span class="cx"> if (!m_context->isAcceleratedContext()) {
</span><del>- m_data.putData(source, sourceSize, sourceRect, destPoint, internalSize(), m_context->isAcceleratedContext(), multiplied == Unmultiplied, coordinateSystem == LogicalCoordinateSystem ? m_resolutionScale : 1);
</del><ins>+ IntRect scaledSourceRect = sourceRect;
+ IntSize scaledSourceSize = sourceSize;
+ if (coordinateSystem == LogicalCoordinateSystem) {
+ scaledSourceRect.scale(m_resolutionScale);
+ scaledSourceSize.scale(m_resolutionScale);
+ }
+
+ m_data.putData(source, scaledSourceSize, scaledSourceRect, destPoint, internalSize(), false, multiplied == Unmultiplied, 1);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersFEDropShadowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp (168576 => 168577)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp        2014-05-10 07:30:12 UTC (rev 168576)
+++ trunk/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp        2014-05-10 09:30:02 UTC (rev 168577)
</span><span class="lines">@@ -82,6 +82,7 @@
</span><span class="cx">
</span><span class="cx"> Filter& filter = this->filter();
</span><span class="cx"> FloatSize blurRadius(filter.applyHorizontalScale(m_stdX), filter.applyVerticalScale(m_stdY));
</span><ins>+ blurRadius.scale(filter.filterScale());
</ins><span class="cx"> FloatSize offset(filter.applyHorizontalScale(m_dx), filter.applyVerticalScale(m_dy));
</span><span class="cx">
</span><span class="cx"> FloatRect drawingRegion = drawingRegionOfInputImage(in->absolutePaintRect());
</span><span class="lines">@@ -100,11 +101,11 @@
</span><span class="cx">
</span><span class="cx"> // TODO: Direct pixel access to ImageBuffer would avoid copying the ImageData.
</span><span class="cx"> IntRect shadowArea(IntPoint(), resultImage->internalSize());
</span><del>- RefPtr<Uint8ClampedArray> srcPixelArray = resultImage->getPremultipliedImageData(shadowArea);
</del><ins>+ RefPtr<Uint8ClampedArray> srcPixelArray = resultImage->getPremultipliedImageData(shadowArea, ImageBuffer::BackingStoreCoordinateSystem);
</ins><span class="cx">
</span><span class="cx"> contextShadow.blurLayerImage(srcPixelArray->data(), shadowArea.size(), 4 * shadowArea.size().width());
</span><span class="cx">
</span><del>- resultImage->putByteArray(Premultiplied, srcPixelArray.get(), shadowArea.size(), shadowArea, IntPoint());
</del><ins>+ resultImage->putByteArray(Premultiplied, srcPixelArray.get(), shadowArea.size(), shadowArea, IntPoint(), ImageBuffer::BackingStoreCoordinateSystem);
</ins><span class="cx">
</span><span class="cx"> resultContext->setCompositeOperation(CompositeSourceIn);
</span><span class="cx"> resultContext->fillRect(FloatRect(FloatPoint(), absolutePaintRect().size()), m_shadowColor, ColorSpaceDeviceRGB);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersFEGaussianBlurcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp (168576 => 168577)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp        2014-05-10 07:30:12 UTC (rev 168576)
+++ trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp        2014-05-10 09:30:02 UTC (rev 168577)
</span><span class="lines">@@ -391,7 +391,7 @@
</span><span class="cx"> IntSize kernelSize;
</span><span class="cx">
</span><span class="cx"> // Limit the kernel size to 500. A bigger radius won't make a big difference for the result image but
</span><del>- // inflates the absolute paint rect to much. This is compatible with Firefox' behavior.
</del><ins>+ // inflates the absolute paint rect too much. This is compatible with Firefox' behavior.
</ins><span class="cx"> if (stdDeviation.x()) {
</span><span class="cx"> int size = std::max<unsigned>(2, static_cast<unsigned>(floorf(stdDeviation.x() * gaussianKernelFactor() + 0.5f)));
</span><span class="cx"> kernelSize.setWidth(std::min(size, gMaxKernelSize));
</span><span class="lines">@@ -451,8 +451,10 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> IntSize kernelSize = calculateKernelSize(filter(), FloatPoint(m_stdX, m_stdY));
</span><ins>+ kernelSize.scale(filter().filterScale());
</ins><span class="cx">
</span><span class="cx"> IntSize paintSize = absolutePaintRect().size();
</span><ins>+ paintSize.scale(filter().filterScale());
</ins><span class="cx"> RefPtr<Uint8ClampedArray> tmpImageData = Uint8ClampedArray::createUninitialized(paintSize.width() * paintSize.height() * 4);
</span><span class="cx"> Uint8ClampedArray* tmpPixelArray = tmpImageData.get();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersFilterh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/filters/Filter.h (168576 => 168577)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/Filter.h        2014-05-10 07:30:12 UTC (rev 168576)
+++ trunk/Source/WebCore/platform/graphics/filters/Filter.h        2014-05-10 09:30:02 UTC (rev 168577)
</span><span class="lines">@@ -33,9 +33,10 @@
</span><span class="cx">
</span><span class="cx"> class Filter : public RefCounted<Filter> {
</span><span class="cx"> public:
</span><del>- Filter(const AffineTransform& absoluteTransform)
</del><ins>+ Filter(const AffineTransform& absoluteTransform, float filterScale = 1)
</ins><span class="cx"> : m_absoluteTransform(absoluteTransform)
</span><span class="cx"> , m_renderingMode(Unaccelerated)
</span><ins>+ , m_filterScale(filterScale)
</ins><span class="cx"> { }
</span><span class="cx"> virtual ~Filter() { }
</span><span class="cx">
</span><span class="lines">@@ -45,6 +46,9 @@
</span><span class="cx"> FloatSize filterResolution() const { return m_filterResolution; }
</span><span class="cx"> void setFilterResolution(const FloatSize& filterResolution) { m_filterResolution = filterResolution; }
</span><span class="cx">
</span><ins>+ float filterScale() const { return m_filterScale; }
+ void setFilterScale(float scale) { m_filterScale = scale; }
+
</ins><span class="cx"> const AffineTransform& absoluteTransform() const { return m_absoluteTransform; }
</span><span class="cx"> FloatPoint mapAbsolutePointToLocalPoint(const FloatPoint& point) const { return m_absoluteTransform.inverse().mapPoint(point); }
</span><span class="cx">
</span><span class="lines">@@ -64,6 +68,7 @@
</span><span class="cx"> FloatSize m_filterResolution;
</span><span class="cx"> AffineTransform m_absoluteTransform;
</span><span class="cx"> RenderingMode m_renderingMode;
</span><ins>+ float m_filterScale;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> #define FILTER_TYPE_CASTS(ToValueTypeName, predicate) \
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersFilterEffectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp (168576 => 168577)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp        2014-05-10 07:30:12 UTC (rev 168576)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp        2014-05-10 09:30:02 UTC (rev 168577)
</span><span class="lines">@@ -268,7 +268,7 @@
</span><span class="cx"> if (m_openCLImageResult)
</span><span class="cx"> return openCLImageToImageBuffer();
</span><span class="cx"> #endif
</span><del>- m_imageBufferResult = ImageBuffer::create(m_absolutePaintRect.size(), 1, m_resultColorSpace, m_filter->renderingMode());
</del><ins>+ m_imageBufferResult = ImageBuffer::create(m_absolutePaintRect.size(), m_filter->filterScale(), m_resultColorSpace, m_filter->renderingMode());
</ins><span class="cx"> IntRect destinationRect(IntPoint(), m_absolutePaintRect.size());
</span><span class="cx"> if (m_premultipliedImageResult)
</span><span class="cx"> m_imageBufferResult->putByteArray(Premultiplied, m_premultipliedImageResult.get(), destinationRect.size(), destinationRect, IntPoint());
</span><span class="lines">@@ -308,7 +308,9 @@
</span><span class="cx"> PassRefPtr<Uint8ClampedArray> FilterEffect::asUnmultipliedImage(const IntRect& rect)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(isFilterSizeValid(rect));
</span><del>- RefPtr<Uint8ClampedArray> imageData = Uint8ClampedArray::createUninitialized(rect.width() * rect.height() * 4);
</del><ins>+ IntSize scaledSize(rect.size());
+ scaledSize.scale(m_filter->filterScale());
+ RefPtr<Uint8ClampedArray> imageData = Uint8ClampedArray::createUninitialized(scaledSize.width() * scaledSize.height() * 4);
</ins><span class="cx"> copyUnmultipliedImage(imageData.get(), rect);
</span><span class="cx"> return imageData.release();
</span><span class="cx"> }
</span><span class="lines">@@ -316,46 +318,53 @@
</span><span class="cx"> PassRefPtr<Uint8ClampedArray> FilterEffect::asPremultipliedImage(const IntRect& rect)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(isFilterSizeValid(rect));
</span><del>- RefPtr<Uint8ClampedArray> imageData = Uint8ClampedArray::createUninitialized(rect.width() * rect.height() * 4);
</del><ins>+ IntSize scaledSize(rect.size());
+ scaledSize.scale(m_filter->filterScale());
+ RefPtr<Uint8ClampedArray> imageData = Uint8ClampedArray::createUninitialized(scaledSize.width() * scaledSize.height() * 4);
</ins><span class="cx"> copyPremultipliedImage(imageData.get(), rect);
</span><span class="cx"> return imageData.release();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> inline void FilterEffect::copyImageBytes(Uint8ClampedArray* source, Uint8ClampedArray* destination, const IntRect& rect)
</span><span class="cx"> {
</span><ins>+ IntRect scaledRect(rect);
+ scaledRect.scale(m_filter->filterScale());
+ IntSize scaledPaintSize(m_absolutePaintRect.size());
+ scaledPaintSize.scale(m_filter->filterScale());
+
</ins><span class="cx"> // Initialize the destination to transparent black, if not entirely covered by the source.
</span><del>- if (rect.x() < 0 || rect.y() < 0 || rect.maxX() > m_absolutePaintRect.width() || rect.maxY() > m_absolutePaintRect.height())
</del><ins>+ if (scaledRect.x() < 0 || scaledRect.y() < 0 || scaledRect.maxX() > scaledPaintSize.width() || scaledRect.maxY() > scaledPaintSize.height())
</ins><span class="cx"> memset(destination->data(), 0, destination->length());
</span><span class="cx">
</span><span class="cx"> // Early return if the rect does not intersect with the source.
</span><del>- if (rect.maxX() <= 0 || rect.maxY() <= 0 || rect.x() >= m_absolutePaintRect.width() || rect.y() >= m_absolutePaintRect.height())
</del><ins>+ if (scaledRect.maxX() <= 0 || scaledRect.maxY() <= 0 || scaledRect.x() >= scaledPaintSize.width() || scaledRect.y() >= scaledPaintSize.height())
</ins><span class="cx"> return;
</span><span class="cx">
</span><del>- int xOrigin = rect.x();
</del><ins>+ int xOrigin = scaledRect.x();
</ins><span class="cx"> int xDest = 0;
</span><span class="cx"> if (xOrigin < 0) {
</span><span class="cx"> xDest = -xOrigin;
</span><span class="cx"> xOrigin = 0;
</span><span class="cx"> }
</span><del>- int xEnd = rect.maxX();
- if (xEnd > m_absolutePaintRect.width())
- xEnd = m_absolutePaintRect.width();
</del><ins>+ int xEnd = scaledRect.maxX();
+ if (xEnd > scaledPaintSize.width())
+ xEnd = scaledPaintSize.width();
</ins><span class="cx">
</span><del>- int yOrigin = rect.y();
</del><ins>+ int yOrigin = scaledRect.y();
</ins><span class="cx"> int yDest = 0;
</span><span class="cx"> if (yOrigin < 0) {
</span><span class="cx"> yDest = -yOrigin;
</span><span class="cx"> yOrigin = 0;
</span><span class="cx"> }
</span><del>- int yEnd = rect.maxY();
- if (yEnd > m_absolutePaintRect.height())
- yEnd = m_absolutePaintRect.height();
</del><ins>+ int yEnd = scaledRect.maxY();
+ if (yEnd > scaledPaintSize.height())
+ yEnd = scaledPaintSize.height();
</ins><span class="cx">
</span><span class="cx"> int size = (xEnd - xOrigin) * 4;
</span><del>- int destinationScanline = rect.width() * 4;
- int sourceScanline = m_absolutePaintRect.width() * 4;
- unsigned char *destinationPixel = destination->data() + ((yDest * rect.width()) + xDest) * 4;
- unsigned char *sourcePixel = source->data() + ((yOrigin * m_absolutePaintRect.width()) + xOrigin) * 4;
</del><ins>+ int destinationScanline = scaledRect.width() * 4;
+ int sourceScanline = scaledPaintSize.width() * 4;
+ unsigned char *destinationPixel = destination->data() + ((yDest * scaledRect.width()) + xDest) * 4;
+ unsigned char *sourcePixel = source->data() + ((yOrigin * scaledPaintSize.width()) + xOrigin) * 4;
</ins><span class="cx">
</span><span class="cx"> while (yOrigin < yEnd) {
</span><span class="cx"> memcpy(destinationPixel, sourcePixel, size);
</span><span class="lines">@@ -375,10 +384,12 @@
</span><span class="cx"> m_unmultipliedImageResult = m_imageBufferResult->getUnmultipliedImageData(IntRect(IntPoint(), m_absolutePaintRect.size()));
</span><span class="cx"> else {
</span><span class="cx"> ASSERT(isFilterSizeValid(m_absolutePaintRect));
</span><del>- m_unmultipliedImageResult = Uint8ClampedArray::createUninitialized(m_absolutePaintRect.width() * m_absolutePaintRect.height() * 4);
</del><ins>+ IntSize inputSize(m_absolutePaintRect.size());
+ inputSize.scale(m_filter->filterScale());
+ m_unmultipliedImageResult = Uint8ClampedArray::createUninitialized(inputSize.width() * inputSize.height() * 4);
</ins><span class="cx"> unsigned char* sourceComponent = m_premultipliedImageResult->data();
</span><span class="cx"> unsigned char* destinationComponent = m_unmultipliedImageResult->data();
</span><del>- unsigned char* end = sourceComponent + (m_absolutePaintRect.width() * m_absolutePaintRect.height() * 4);
</del><ins>+ unsigned char* end = sourceComponent + (inputSize.width() * inputSize.height() * 4);
</ins><span class="cx"> while (sourceComponent < end) {
</span><span class="cx"> int alpha = sourceComponent[3];
</span><span class="cx"> if (alpha) {
</span><span class="lines">@@ -409,10 +420,12 @@
</span><span class="cx"> m_premultipliedImageResult = m_imageBufferResult->getPremultipliedImageData(IntRect(IntPoint(), m_absolutePaintRect.size()));
</span><span class="cx"> else {
</span><span class="cx"> ASSERT(isFilterSizeValid(m_absolutePaintRect));
</span><del>- m_premultipliedImageResult = Uint8ClampedArray::createUninitialized(m_absolutePaintRect.width() * m_absolutePaintRect.height() * 4);
</del><ins>+ IntSize inputSize(m_absolutePaintRect.size());
+ inputSize.scale(m_filter->filterScale());
+ m_premultipliedImageResult = Uint8ClampedArray::createUninitialized(inputSize.width() * inputSize.height() * 4);
</ins><span class="cx"> unsigned char* sourceComponent = m_unmultipliedImageResult->data();
</span><span class="cx"> unsigned char* destinationComponent = m_premultipliedImageResult->data();
</span><del>- unsigned char* end = sourceComponent + (m_absolutePaintRect.width() * m_absolutePaintRect.height() * 4);
</del><ins>+ unsigned char* end = sourceComponent + (inputSize.width() * inputSize.height() * 4);
</ins><span class="cx"> while (sourceComponent < end) {
</span><span class="cx"> int alpha = sourceComponent[3];
</span><span class="cx"> destinationComponent[0] = static_cast<int>(sourceComponent[0]) * alpha / 255;
</span><span class="lines">@@ -433,7 +446,7 @@
</span><span class="cx"> ASSERT(!hasResult());
</span><span class="cx"> if (m_absolutePaintRect.isEmpty())
</span><span class="cx"> return 0;
</span><del>- m_imageBufferResult = ImageBuffer::create(m_absolutePaintRect.size(), 1, m_resultColorSpace, m_filter->renderingMode());
</del><ins>+ m_imageBufferResult = ImageBuffer::create(m_absolutePaintRect.size(), m_filter->filterScale(), m_resultColorSpace, m_filter->renderingMode());
</ins><span class="cx"> if (!m_imageBufferResult)
</span><span class="cx"> return 0;
</span><span class="cx"> ASSERT(m_imageBufferResult->context());
</span><span class="lines">@@ -448,7 +461,9 @@
</span><span class="cx">
</span><span class="cx"> if (m_absolutePaintRect.isEmpty())
</span><span class="cx"> return 0;
</span><del>- m_unmultipliedImageResult = Uint8ClampedArray::createUninitialized(m_absolutePaintRect.width() * m_absolutePaintRect.height() * 4);
</del><ins>+ IntSize resultSize(m_absolutePaintRect.size());
+ resultSize.scale(m_filter->filterScale());
+ m_unmultipliedImageResult = Uint8ClampedArray::createUninitialized(resultSize.width() * resultSize.height() * 4);
</ins><span class="cx"> return m_unmultipliedImageResult.get();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -460,7 +475,9 @@
</span><span class="cx">
</span><span class="cx"> if (m_absolutePaintRect.isEmpty())
</span><span class="cx"> return 0;
</span><del>- m_premultipliedImageResult = Uint8ClampedArray::createUninitialized(m_absolutePaintRect.width() * m_absolutePaintRect.height() * 4);
</del><ins>+ IntSize resultSize(m_absolutePaintRect.size());
+ resultSize.scale(m_filter->filterScale());
+ m_premultipliedImageResult = Uint8ClampedArray::createUninitialized(resultSize.width() * resultSize.height() * 4);
</ins><span class="cx"> return m_premultipliedImageResult.get();
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingFilterEffectRenderercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp (168576 => 168577)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp        2014-05-10 07:30:12 UTC (rev 168576)
+++ trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp        2014-05-10 09:30:02 UTC (rev 168577)
</span><span class="lines">@@ -331,7 +331,7 @@
</span><span class="cx"> if (!m_graphicsBufferAttached) {
</span><span class="cx"> IntSize logicalSize(m_sourceDrawingRegion.width(), m_sourceDrawingRegion.height());
</span><span class="cx"> if (!sourceImage() || sourceImage()->logicalSize() != logicalSize)
</span><del>- setSourceImage(ImageBuffer::create(logicalSize, 1, ColorSpaceDeviceRGB, renderingMode()));
</del><ins>+ setSourceImage(ImageBuffer::create(logicalSize, filterScale(), ColorSpaceDeviceRGB, renderingMode()));
</ins><span class="cx"> m_graphicsBufferAttached = true;
</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 (168576 => 168577)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.cpp        2014-05-10 07:30:12 UTC (rev 168576)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp        2014-05-10 09:30:02 UTC (rev 168577)
</span><span class="lines">@@ -6647,12 +6647,16 @@
</span><span class="cx"> FilterInfo& filterInfo = FilterInfo::get(*this);
</span><span class="cx"> if (!filterInfo.renderer()) {
</span><span class="cx"> RefPtr<FilterEffectRenderer> filterRenderer = FilterEffectRenderer::create();
</span><ins>+ filterRenderer->setFilterScale(renderer().frame().page()->deviceScaleFactor());
</ins><span class="cx"> RenderingMode renderingMode = renderer().frame().settings().acceleratedFiltersEnabled() ? Accelerated : Unaccelerated;
</span><span class="cx"> filterRenderer->setRenderingMode(renderingMode);
</span><span class="cx"> filterInfo.setRenderer(filterRenderer.release());
</span><span class="cx">
</span><span class="cx"> // We can optimize away code paths in other places if we know that there are no software filters.
</span><span class="cx"> renderer().view().setHasSoftwareFilters(true);
</span><ins>+ } else if (filterInfo.renderer()->filterScale() != renderer().frame().page()->deviceScaleFactor()) {
+ filterInfo.renderer()->setFilterScale(renderer().frame().page()->deviceScaleFactor());
+ filterInfo.renderer()->clearIntermediateResults();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // If the filter fails to build, remove it from the layer. It will still attempt to
</span></span></pre>
</div>
</div>
</body>
</html>