Title: [188935] trunk
Revision
188935
Author
[email protected]
Date
2015-08-25 15:44:45 -0700 (Tue, 25 Aug 2015)

Log Message

Using the filter functional notation for background images results in wrong background-size rendering
https://bugs.webkit.org/show_bug.cgi?id=148221
rdar://problem/22379518

Reviewed by Daniel Bates.

Do not ignore the size argument, when the filter image is being drawn onto the context.
When the size is ignored, we end up painting the image with its native size while the filter
is applied on the size of the generated image.

Source/WebCore:

Test: fast/filter-image/background-filter-image.html

* css/CSSFilterImageValue.cpp:
(WebCore::CSSFilterImageValue::image):

LayoutTests:

* fast/filter-image/background-filter-image-expected.html: Added.
* fast/filter-image/background-filter-image.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (188934 => 188935)


--- trunk/LayoutTests/ChangeLog	2015-08-25 22:09:26 UTC (rev 188934)
+++ trunk/LayoutTests/ChangeLog	2015-08-25 22:44:45 UTC (rev 188935)
@@ -1,3 +1,18 @@
+2015-08-25  Zalan Bujtas  <[email protected]>
+
+        Using the filter functional notation for background images results in wrong background-size rendering
+        https://bugs.webkit.org/show_bug.cgi?id=148221
+        rdar://problem/22379518
+
+        Reviewed by Daniel Bates.
+
+        Do not ignore the size argument, when the filter image is being drawn onto the context.
+        When the size is ignored, we end up painting the image with its native size while the filter
+        is applied on the size of the generated image.
+
+        * fast/filter-image/background-filter-image-expected.html: Added.
+        * fast/filter-image/background-filter-image.html: Added.
+
 2015-08-25  Nan Wang  <[email protected]>
 
         [Mac] accessibility/document-attributes.html fails

Added: trunk/LayoutTests/fast/filter-image/background-filter-image-expected.html (0 => 188935)


--- trunk/LayoutTests/fast/filter-image/background-filter-image-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/filter-image/background-filter-image-expected.html	2015-08-25 22:44:45 UTC (rev 188935)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that background images with filters scale properly.</title>
+<style>
+  img {
+    width: 100px;
+    height: 100px;
+    filter: sepia(1);
+  }
+</style>
+</head>
+<body>
+  <img src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/filter-image/background-filter-image.html (0 => 188935)


--- trunk/LayoutTests/fast/filter-image/background-filter-image.html	                        (rev 0)
+++ trunk/LayoutTests/fast/filter-image/background-filter-image.html	2015-08-25 22:44:45 UTC (rev 188935)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that background images with filters scale properly.</title>
+<style>
+  div {
+    background-image: filter(url(../replaced/resources/compass.jpg), sepia(1));
+    background-size: 100px 100px;
+    width: 100px;
+    height: 100px;
+  }
+</style>
+</head>
+<body>
+  <div></div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (188934 => 188935)


--- trunk/Source/WebCore/ChangeLog	2015-08-25 22:09:26 UTC (rev 188934)
+++ trunk/Source/WebCore/ChangeLog	2015-08-25 22:44:45 UTC (rev 188935)
@@ -1,3 +1,20 @@
+2015-08-25  Zalan Bujtas  <[email protected]>
+
+        Using the filter functional notation for background images results in wrong background-size rendering
+        https://bugs.webkit.org/show_bug.cgi?id=148221
+        rdar://problem/22379518
+
+        Reviewed by Daniel Bates.
+
+        Do not ignore the size argument, when the filter image is being drawn onto the context.
+        When the size is ignored, we end up painting the image with its native size while the filter
+        is applied on the size of the generated image.
+
+        Test: fast/filter-image/background-filter-image.html
+
+        * css/CSSFilterImageValue.cpp:
+        (WebCore::CSSFilterImageValue::image):
+
 2015-08-25  Carlos Garcia Campos  <[email protected]>
 
         IconDatabase: syncThreadMainLoop() is unlocking m_syncLock twice when thread termination is requested

Modified: trunk/Source/WebCore/css/CSSFilterImageValue.cpp (188934 => 188935)


--- trunk/Source/WebCore/css/CSSFilterImageValue.cpp	2015-08-25 22:09:26 UTC (rev 188934)
+++ trunk/Source/WebCore/css/CSSFilterImageValue.cpp	2015-08-25 22:44:45 UTC (rev 188935)
@@ -123,12 +123,13 @@
     std::unique_ptr<ImageBuffer> texture = ImageBuffer::create(size);
     if (!texture)
         return Image::nullImage();
-    texture->context()->drawImage(image, ColorSpaceDeviceRGB, IntPoint());
+    FloatRect imageRect = FloatRect(FloatPoint(), size);
+    texture->context()->drawImage(image, ColorSpaceDeviceRGB, imageRect);
 
     RefPtr<FilterEffectRenderer> filterRenderer = FilterEffectRenderer::create();
     filterRenderer->setSourceImage(WTF::move(texture));
-    filterRenderer->setSourceImageRect(FloatRect(FloatPoint(), size));
-    filterRenderer->setFilterRegion(FloatRect(FloatPoint(), size));
+    filterRenderer->setSourceImageRect(imageRect);
+    filterRenderer->setFilterRegion(imageRect);
     if (!filterRenderer->build(renderer, m_filterOperations, FilterFunction))
         return Image::nullImage();
     filterRenderer->apply();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to