RESOLVED FIXED 148221
Using the filter functional notation for background images results in wrong background-size rendering
https://bugs.webkit.org/show_bug.cgi?id=148221
Summary Using the filter functional notation for background images results in wrong b...
thatemil
Reported 2015-08-20 08:07:36 PDT
When using the filter(<image>, <filter-list>) notation for loading a background-image, the background-size property is interpreted incorrectly. Description: The rectangle where the background is supposed to be drawn appears to be sized correctly, but inside that rectangle the actual pixels remain at the intrinsic size of the source image. In the demo linked below, the source image is 30px by 16px, and should be resized to 100px by 100px. As you can see in the demo, the image remains at 30x16, but the background tile is 100x100, causing the background tiles to leave transparent gaps. Any background-size measurement or filter combination seems to exhibit this bug. Expected outcome: background-image should be stretched to 100x100 tiles, covering the element. Tested on build r188682 Demo: http://jsbin.com/lodene/8/edit
Attachments
Patch (4.65 KB, patch)
2015-08-23 18:46 PDT, zalan
no flags
Patch (4.65 KB, patch)
2015-08-25 14:52 PDT, zalan
no flags
Simon Fraser (smfr)
Comment 1 2015-08-20 21:03:46 PDT
I'm confused. I didn't think we supported filter(<image>, <filter-list>).
thatemil
Comment 2 2015-08-21 06:43:22 PDT
Well, confusion or no, the filter seems to work fine on the background image (I even tried animating it), it's just the sizing bit that doesn't seem to work. :-)
Simon Fraser (smfr)
Comment 3 2015-08-21 09:03:04 PDT
Ah I see, it was -webkit-filter() until https://trac.webkit.org/changeset/188647. Yes, this looks like a bug. We're not rendering the filtered output with the correct background-size.
Radar WebKit Bug Importer
Comment 4 2015-08-21 09:04:07 PDT
zalan
Comment 5 2015-08-22 21:22:59 PDT
genererate filter image ignores the size argument when it copies the source to the destination. diff --git a/Source/WebCore/css/CSSFilterImageValue.cpp b/Source/WebCore/css/CSSFilterImageValue.cpp index 5d80331..41de312 100644 --- a/Source/WebCore/css/CSSFilterImageValue.cpp +++ b/Source/WebCore/css/CSSFilterImageValue.cpp @@ -123,7 +123,7 @@ RefPtr<Image> CSSFilterImageValue::image(RenderElement* renderer, const FloatSiz std::unique_ptr<ImageBuffer> texture = ImageBuffer::create(size); if (!texture) return Image::nullImage(); - texture->context()->drawImage(image, ColorSpaceDeviceRGB, IntPoint()); + texture->context()->drawImage(image, ColorSpaceDeviceRGB, FloatRect(FloatPoint(0, 0), size)); RefPtr<FilterEffectRenderer> filterRenderer = FilterEffectRenderer::create(); filterRenderer->setSourceImage(WTF::move(texture));
zalan
Comment 6 2015-08-23 18:46:37 PDT
Daniel Bates
Comment 7 2015-08-24 16:43:30 PDT
Comment on attachment 259744 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=259744&action=review This looks sane to me. > Source/WebCore/ChangeLog:10 > + When the size is ignored, we end up paining the image with its native size while the filter paining => painting > LayoutTests/ChangeLog:10 > + When the size is ignored, we end up paining the image with its native size while the filter Ditto.
Daniel Bates
Comment 8 2015-08-24 16:44:34 PDT
Comment on attachment 259744 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=259744&action=review > LayoutTests/fast/filter-image/background-filter-image-expected.html:17 > + Is this empty line necessary?
zalan
Comment 9 2015-08-25 14:52:51 PDT
WebKit Commit Bot
Comment 10 2015-08-25 15:45:01 PDT
Comment on attachment 259882 [details] Patch Clearing flags on attachment: 259882 Committed r188935: <http://trac.webkit.org/changeset/188935>
WebKit Commit Bot
Comment 11 2015-08-25 15:45:04 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.