New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 602509 link

Starred by 5 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Jul 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

CANVAS 2d createPattern with 'no-repeat' bleeds color from edges of pattern image

Reported by ydelen...@mozilla.com, Apr 12 2016

Issue description

Chrome Version       : 52.0.2705.0
OS Version: OS X 10.11.3
URLs (if applicable) : https://bugzilla.mozilla.org/attachment.cgi?id=8740195
Other browsers tested:
  Add OK or FAIL after other browsers where you have tested this issue:
     Safari 5: 9.0.3 OK
  Firefox 4.x: 44.0.2 FAIL
     IE 7/8/9: IE 9 OK

What steps will reproduce the problem?
1. Open web page that contains createPattern created with 'no-repeat' and used in fill, e.g. https://bugzilla.mozilla.org/attachment.cgi?id=8740195
2.
3.

What is the expected result?
No artifacts from the pattern edges

What happens instead of that?
The fill area filed with extra colors from the pattern edges


Please provide any additional information below. Attach a screenshot if
possible.

See screenshot with comparison of FF, Chrome, Safari and IE9

UserAgentString: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2705.0 Safari/537.36



 
Screen Shot 2016-04-11 at 7.04.47 PM.png
216 KB View Download
Components: Internals>GPU>Canvas2D
Labels: -OS-Mac M-51 OS-All
Status: Untriaged (was: Unconfirmed)
Able to reproduce the issue on Windows 7, Ubuntu 14.04 and Mac OS 10.11.4 using chrome latest canary M52-52.0.2705.0. Observed the area filed with extra colors from the pattern edges as shown in the above snapshot. 

This is a non-regression issue seen from past M35-35.0.1851.0, Hence marking it as untriaged.

Comment 2 by junov@chromium.org, Apr 12 2016

Components: -Internals>GPU>Canvas2D Blink>Canvas
Owner: xlai@chromium.org
Status: Assigned (was: Untriaged)

Comment 3 by junov@chromium.org, Jun 17 2016

Labels: Hotlist-Fixit-PE2016

Comment 4 by xlai@chromium.org, Jun 17 2016

The test html is here (https://jsfiddle.net/hymkgLbh/2/). 

It looks like the translate and fillStyle with pattern interfere with each other. When I move the translate before rect, it works fine. When I set fillStyle to be color, it fills the whole canvas regardless of the translation.

According to the spec, "The transformation matrix is applied to coordinates when creating the current path, and when painting text, shapes, and paths, on CanvasRenderingContext2D objects." "When rendered, however, patterns must actually be painted only where the stroking or filling effect requires that they be drawn, and the repeated pattern must be affected by the current transformation matrix. Pixels not covered by the repeating pattern (if the repeat string was not specified) must be transparent black."

It seems like fillStyle=pattern and fillStyle=color works differently when the path is transformed. But exactly how it is supposed to work do not look clear to me.


Comment 5 by junov@chromium.org, Jun 20 2016

fillStyle=pattern and fillStyle=color do not really work differently.  The transform is simply irrelevant on a style that is a solid color: an infinite uniformly colored plane is invariant to transforms.

What exactly do you find unclear?  The way I interpret the spec is that the style and the primitive follow the same transform, so they should not move with respect to each other.

Comment 6 by xlai@chromium.org, Jun 20 2016

Status: Started (was: Assigned)
I guess you want to say "path" and "primitive" goes together with transformation. I now see where the implementation problem lies.
Project Member

Comment 7 by bugdroid1@chromium.org, Jul 8 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c2635f87e413ac3f81a81ac1e37fce54fdc8d26d

commit c2635f87e413ac3f81a81ac1e37fce54fdc8d26d
Author: xlai <xlai@chromium.org>
Date: Fri Jul 08 21:18:53 2016

Correct color bleeding of no-repeat pattern in canvas2d

Currently the image pattern shader created is only padded
with 1 black transparent pixel right and bottom. We should
pad it on the left and top as well so that when pattern is
transformed, the color on its left and top will not bleed.

BUG= 602509 

Review-Url: https://codereview.chromium.org/2130063002
Cr-Commit-Position: refs/heads/master@{#404491}

[modify] https://crrev.com/c2635f87e413ac3f81a81ac1e37fce54fdc8d26d/third_party/WebKit/LayoutTests/TestExpectations
[modify] https://crrev.com/c2635f87e413ac3f81a81ac1e37fce54fdc8d26d/third_party/WebKit/LayoutTests/canvas/philip/tests/2d.pattern.paint.norepeat.coord3-expected.txt
[modify] https://crrev.com/c2635f87e413ac3f81a81ac1e37fce54fdc8d26d/third_party/WebKit/LayoutTests/canvas/philip/tests/2d.pattern.paint.repeatx.coord1-expected.txt
[modify] https://crrev.com/c2635f87e413ac3f81a81ac1e37fce54fdc8d26d/third_party/WebKit/LayoutTests/canvas/philip/tests/2d.pattern.paint.repeaty.coord1-expected.txt
[add] https://crrev.com/c2635f87e413ac3f81a81ac1e37fce54fdc8d26d/third_party/WebKit/LayoutTests/fast/canvas/canvas-pattern-no-repeat-with-transformations-expected.png
[add] https://crrev.com/c2635f87e413ac3f81a81ac1e37fce54fdc8d26d/third_party/WebKit/LayoutTests/fast/canvas/canvas-pattern-no-repeat-with-transformations-expected.txt
[add] https://crrev.com/c2635f87e413ac3f81a81ac1e37fce54fdc8d26d/third_party/WebKit/LayoutTests/fast/canvas/canvas-pattern-no-repeat-with-transformations.html
[modify] https://crrev.com/c2635f87e413ac3f81a81ac1e37fce54fdc8d26d/third_party/WebKit/Source/platform/graphics/ImagePattern.cpp

Comment 8 by xlai@chromium.org, Jul 11 2016

Labels: -M-51 M-54
Status: Fixed (was: Started)
Verified the rendering result on the Win Canary and the color no longer bleeds.
Project Member

Comment 9 by bugdroid1@chromium.org, Jul 12 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/fa81bdf8aab522be1930d2680e6d186755a12661

commit fa81bdf8aab522be1930d2680e6d186755a12661
Author: Rebaseline Bot <blink-rebaseline-bot@chromium.org>
Date: Tue Jul 12 00:29:52 2016

Auto-rebaseline for r404491

https://chromium.googlesource.com/chromium/src/+/c2635f87e

BUG= 602509 
TBR=xlai@chromium.org

Review URL: https://codereview.chromium.org/2139023003 .

Cr-Commit-Position: refs/heads/master@{#404751}

[modify] https://crrev.com/fa81bdf8aab522be1930d2680e6d186755a12661/third_party/WebKit/LayoutTests/TestExpectations
[add] https://crrev.com/fa81bdf8aab522be1930d2680e6d186755a12661/third_party/WebKit/LayoutTests/platform/android/fast/canvas/image-object-in-canvas-expected.png
[add] https://crrev.com/fa81bdf8aab522be1930d2680e6d186755a12661/third_party/WebKit/LayoutTests/platform/android/virtual/display_list_2d_canvas/fast/canvas/image-object-in-canvas-expected.png
[add] https://crrev.com/fa81bdf8aab522be1930d2680e6d186755a12661/third_party/WebKit/LayoutTests/platform/android/virtual/gpu/fast/canvas/canvas-pattern-no-repeat-with-transformations-expected.png
[add] https://crrev.com/fa81bdf8aab522be1930d2680e6d186755a12661/third_party/WebKit/LayoutTests/platform/linux-precise/fast/canvas/canvas-pattern-no-repeat-with-transformations-expected.png
[add] https://crrev.com/fa81bdf8aab522be1930d2680e6d186755a12661/third_party/WebKit/LayoutTests/platform/linux-precise/fast/canvas/image-object-in-canvas-expected.png
[add] https://crrev.com/fa81bdf8aab522be1930d2680e6d186755a12661/third_party/WebKit/LayoutTests/platform/linux-precise/virtual/gpu/fast/canvas/canvas-pattern-no-repeat-with-transformations-expected.png
[modify] https://crrev.com/fa81bdf8aab522be1930d2680e6d186755a12661/third_party/WebKit/LayoutTests/platform/linux/fast/canvas/image-object-in-canvas-expected.png
[modify] https://crrev.com/fa81bdf8aab522be1930d2680e6d186755a12661/third_party/WebKit/LayoutTests/platform/linux/virtual/display_list_2d_canvas/fast/canvas/image-object-in-canvas-expected.png
[add] https://crrev.com/fa81bdf8aab522be1930d2680e6d186755a12661/third_party/WebKit/LayoutTests/platform/linux/virtual/gpu/fast/canvas/canvas-pattern-no-repeat-with-transformations-expected.png
[modify] https://crrev.com/fa81bdf8aab522be1930d2680e6d186755a12661/third_party/WebKit/LayoutTests/platform/mac/fast/canvas/image-object-in-canvas-expected.png
[modify] https://crrev.com/fa81bdf8aab522be1930d2680e6d186755a12661/third_party/WebKit/LayoutTests/platform/mac/virtual/display_list_2d_canvas/fast/canvas/image-object-in-canvas-expected.png
[add] https://crrev.com/fa81bdf8aab522be1930d2680e6d186755a12661/third_party/WebKit/LayoutTests/platform/mac/virtual/gpu/fast/canvas/canvas-pattern-no-repeat-with-transformations-expected.png
[modify] https://crrev.com/fa81bdf8aab522be1930d2680e6d186755a12661/third_party/WebKit/LayoutTests/platform/win/fast/canvas/image-object-in-canvas-expected.png
[modify] https://crrev.com/fa81bdf8aab522be1930d2680e6d186755a12661/third_party/WebKit/LayoutTests/platform/win/virtual/display_list_2d_canvas/fast/canvas/image-object-in-canvas-expected.png
[add] https://crrev.com/fa81bdf8aab522be1930d2680e6d186755a12661/third_party/WebKit/LayoutTests/platform/win/virtual/gpu/fast/canvas/canvas-pattern-no-repeat-with-transformations-expected.png

Project Member

Comment 10 by bugdroid1@chromium.org, Jul 12 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ba785a6c45cac446073ba0ecabb06c5fdb850706

commit ba785a6c45cac446073ba0ecabb06c5fdb850706
Author: engedy <engedy@chromium.org>
Date: Tue Jul 12 18:27:17 2016

Rebaseline canvas-pattern-no-repeat-with-transformations.html.

Rebaseline expectations for:
  fast/canvas/canvas-pattern-no-repeat-with-transformations.html
on WebKit Linux Trusty with --enable-display-list-2d-canvas.

BUG= 602509 
NOTRY=true
TBR=xlai@chromium.org

Review-Url: https://codereview.chromium.org/2144703002
Cr-Commit-Position: refs/heads/master@{#404817}

[add] https://crrev.com/ba785a6c45cac446073ba0ecabb06c5fdb850706/third_party/WebKit/LayoutTests/platform/linux-precise/virtual/display_list_2d_canvas/fast/canvas/canvas-pattern-no-repeat-with-transformations-expected.png

Project Member

Comment 11 by bugdroid1@chromium.org, Jul 12 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b9c478fb71789df6d9c442197f3e5589929d427d

commit b9c478fb71789df6d9c442197f3e5589929d427d
Author: xlai <xlai@chromium.org>
Date: Tue Jul 12 23:37:09 2016

Mark two canvas tests as need rebaseline on Linux due to Skia change.

A recent Skia change that increases draw batching has resulted in minor pixel
diff.

TBR=junov@chromium.org
BUG= 602509 
NOTRY=true
NOPRESUBMIT=true

Review-Url: https://codereview.chromium.org/2142273002
Cr-Commit-Position: refs/heads/master@{#404859}

[modify] https://crrev.com/b9c478fb71789df6d9c442197f3e5589929d427d/third_party/WebKit/LayoutTests/TestExpectations

Comment 13 by xlai@chromium.org, Oct 3 2016

Cc: kkaluri@chromium.org xlai@chromium.org
 Issue 652096  has been merged into this issue.

Sign in to add a comment