Bug 118894 - [CSS blending] Background-blend-mode doesn't apply for an SVG image with css border-style or padding property set
Summary: [CSS blending] Background-blend-mode doesn't apply for an SVG image with css ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 126988 127056
Blocks: 108546
  Show dependency treegraph
 
Reported: 2013-07-19 02:10 PDT by Mirela
Modified: 2014-03-04 00:29 PST (History)
15 users (show)

See Also:


Attachments
Sample file (575 bytes, text/html)
2013-07-19 02:10 PDT, Mirela
no flags Details
Patch (22.77 KB, patch)
2014-01-13 07:48 PST, Mihai Tica
no flags Details | Formatted Diff | Diff
Patch for review (7.70 KB, patch)
2014-01-14 00:26 PST, Mihai Tica
no flags Details | Formatted Diff | Diff
Patch (7.72 KB, patch)
2014-01-14 01:22 PST, Mihai Tica
no flags Details | Formatted Diff | Diff
Includes tests with rects instead of circles (8.59 KB, patch)
2014-01-15 01:20 PST, Mihai Tica
no flags Details | Formatted Diff | Diff
Updated test expectations on mac (9.49 KB, patch)
2014-01-16 02:02 PST, Mihai Tica
no flags Details | Formatted Diff | Diff
Patch (9.50 KB, patch)
2014-01-16 02:26 PST, Mihai Tica
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mirela 2013-07-19 02:10:33 PDT
Created attachment 207072 [details]
Sample file

Setting a border-style or padding property for a div with an SVG background image results in background-blending not being applied.

Sample code:

<style>
div { 
	border: 5px navy;
	border-style: dotted double;
	padding: 8.5px;
	background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDEwMCAxMDAiPgogIDxjaXJjbGUgY3g9IjUwIiBjeT0iNTAiIHI9IjQwIiBmaWxsPSJyZWQiLz4KPC9zdmc+'), green;
       width: 200px;
      height: 200px;
}
</style>
<div style="-webkit-background-blend-mode: screen;"></div>
Comment 1 Horia Olaru 2013-08-01 05:31:16 PDT
I tested this with the current nightly: Version 6.0.5 (8536.30.1, 538+)

I can reproduce this only using border-style. If I take out the border, and leave only the padding, background blending works.

Also,the bug reproduces even without the padding added.
This only seems to reproduce with data uri svg images. I could not reproduce it with a local file svg (url).

It is probably worth checking if this reproduces with data uri non-svg images.
Comment 2 Mirela 2013-08-07 06:17:06 PDT
The same issue for:

	background-origin: content-box;
        background-size:  - specified in pixels and percent (e.g. 50% 50%; and 100px 100px; )
Comment 3 Mihai Tica 2014-01-13 07:48:33 PST
Created attachment 221041 [details]
Patch
Comment 4 WebKit Commit Bot 2014-01-13 07:50:09 PST
Attachment 221041 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/css3/compositing/background-blend-mode-data-uri-svg-image.html', u'LayoutTests/platform/mac/css3/compositing/background-blend-mode-data-uri-svg-image-expected.png', u'LayoutTests/platform/mac/css3/compositing/background-blend-mode-data-uri-svg-image-expected.txt', u'Source/WebCore/ChangeLog', u'Source/WebCore/svg/graphics/SVGImage.cpp', u'Source/WebCore/svg/graphics/SVGImage.h', u'Source/WebCore/svg/graphics/SVGImageForContainer.cpp', '--commit-queue']" exit_code: 1
Traceback (most recent call last):
  File "Tools/Scripts/check-webkit-style", line 48, in <module>
    sys.exit(CheckWebKitStyle().main())
  File "/Volumes/Data/StyleQueue/WebKit/Tools/Scripts/webkitpy/style/main.py", line 154, in main
    patch_checker.check(patch)
  File "/Volumes/Data/StyleQueue/WebKit/Tools/Scripts/webkitpy/style/patchreader.py", line 71, in check
    self._text_file_reader.process_file(file_path=path, line_numbers=None)
  File "/Volumes/Data/StyleQueue/WebKit/Tools/Scripts/webkitpy/style/filereader.py", line 118, in process_file
    lines = self._read_lines(file_path)
  File "/Volumes/Data/StyleQueue/WebKit/Tools/Scripts/webkitpy/style/filereader.py", line 86, in _read_lines
    contents = file.read()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/codecs.py", line 671, in read
    return self.reader.read(size)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/codecs.py", line 477, in read
    newchars, decodedbytes = self.decode(data, self.errors)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x89 in position 0: invalid start byte


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Mihai Tica 2014-01-14 00:26:58 PST
Created attachment 221114 [details]
Patch for review

Replacing pixel with ref test
Comment 6 Dirk Schulze 2014-01-14 00:29:16 PST
Comment on attachment 221114 [details]
Patch for review

View in context: https://bugs.webkit.org/attachment.cgi?id=221114&action=review

> LayoutTests/css3/compositing/background-blend-mode-data-uri-svg-image-expected.html:7
> +        background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDEwMCAxMDAiPg0KICA8Y2lyY2xlIGN4PSI1MCIgY3k9IjUwIiByPSI0MCIgZmlsbD0iIzBGMCIvPg0KPC9zdmc+'), #FF0;

please no base64 encoded SVGs, normal data urls with readable SVG please.

> LayoutTests/css3/compositing/background-blend-mode-data-uri-svg-image.html:7
> +        background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDEwMCAxMDAiPg0KICA8Y2lyY2xlIGN4PSI1MCIgY3k9IjUwIiByPSI0MCIgZmlsbD0iI0YwMCIvPg0KPC9zdmc+'), #FF0;

Ditto.
Comment 7 Mihai Tica 2014-01-14 01:22:55 PST
Created attachment 221120 [details]
Patch

Converted SVG encoding to UTF8
Comment 8 WebKit Commit Bot 2014-01-14 07:34:20 PST
Comment on attachment 221120 [details]
Patch

Clearing flags on attachment: 221120

Committed r161964: <http://trac.webkit.org/changeset/161964>
Comment 9 WebKit Commit Bot 2014-01-14 07:34:23 PST
All reviewed patches have been landed.  Closing bug.
Comment 10 Alexey Proskuryakov 2014-01-14 09:38:33 PST
These tests are now failing on Mavericks Debug bots:

css3/compositing/background-blend-mode-crossfade-image.htmlhistory
css3/compositing/background-blend-mode-data-uri-svg-image.html

One looks like a color diff, another is antialiasing.
Comment 11 Alexey Proskuryakov 2014-01-14 09:53:03 PST
Not sure if it's this change that is to blame, there were multiple related changes landed at once, and tested at once.
Comment 12 Dirk Schulze 2014-01-14 10:07:18 PST
(In reply to comment #11)
> Not sure if it's this change that is to blame, there were multiple related changes landed at once, and tested at once.

(In reply to comment #10)
> These tests are now failing on Mavericks Debug bots:
> 
> css3/compositing/background-blend-mode-crossfade-image.htmlhistory
> css3/compositing/background-blend-mode-data-uri-svg-image.html
> 
> One looks like a color diff, another is antialiasing.



I think we can deal with these tests differently. It should be easy to find a compositing mode that calculates to black if one layer is red and the other green. We should roll the patch out and redo the tests.
Comment 13 WebKit Commit Bot 2014-01-14 10:12:15 PST
Re-opened since this is blocked by bug 126988
Comment 14 Alexey Proskuryakov 2014-01-14 10:19:21 PST
This change was responsible for css3/compositing/background-blend-mode-data-uri-svg-image.html failures seen on some of the bots: <http://build.webkit.org/results/Apple%20Mavericks%20Debug%20WK2%20(Tests)/r161973%20(1629)/css3/compositing/background-blend-mode-data-uri-svg-image-diffs.html>.

This looks like an antialiasing only diff.

Complete history: <http://webkit-test-results.appspot.com/dashboards/flakiness_dashboard.html#showAllRuns=true&tests=css3%2Fcompositing%2Fbackground-blend-mode-data-uri-svg-image.html>.

For some reason, this bug cannot be re-opened!
Comment 15 David Kilzer (:ddkilzer) 2014-01-14 12:27:40 PST
Attempting to reopen with Web Inspector editing of the form.
Comment 16 Mihai Tica 2014-01-15 01:20:21 PST
Created attachment 221239 [details]
Includes tests with rects instead of circles

Adding a new version of the patch that uses rectangles in the tests instead of circles. Also skipping efl for the test and testing the hardware path.
Comment 17 Dirk Schulze 2014-01-15 01:27:10 PST
Comment on attachment 221239 [details]
Includes tests with rects instead of circles

That looks better, lets wait for the bots first.
Comment 18 WebKit Commit Bot 2014-01-15 04:27:53 PST
Comment on attachment 221239 [details]
Includes tests with rects instead of circles

Clearing flags on attachment: 221239

Committed r162066: <http://trac.webkit.org/changeset/162066>
Comment 19 WebKit Commit Bot 2014-01-15 04:27:57 PST
All reviewed patches have been landed.  Closing bug.
Comment 21 Alexey Proskuryakov 2014-01-15 10:22:03 PST
Looks like neither author nor reviewer are available to advise on the best course of action, so rolling out again.
Comment 22 WebKit Commit Bot 2014-01-15 10:23:02 PST
Re-opened since this is blocked by bug 127056
Comment 23 Mihai Tica 2014-01-16 02:02:16 PST
Created attachment 221348 [details]
Updated test expectations on mac

This patch skips the added test on mac as the result from applying blending is slightly different than the result of the blending formula.
Comment 24 Mihai Tica 2014-01-16 02:26:51 PST
Created attachment 221350 [details]
Patch

Add Pass aswell for test on mac
Comment 25 WebKit Commit Bot 2014-01-20 08:11:25 PST
Comment on attachment 221350 [details]
Patch

Clearing flags on attachment: 221350

Committed r162341: <http://trac.webkit.org/changeset/162341>
Comment 26 WebKit Commit Bot 2014-01-20 08:11:29 PST
All reviewed patches have been landed.  Closing bug.