New issue
Advanced search Search tips

Issue 803680 link

Starred by 6 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 545318



Sign in to add a comment

[css-typed-om] Make canvas.drawImage work with gradients

Project Member Reported by shend@chromium.org, Jan 18 2018

Issue description

Currently canvas.drawImage only works with CSSURLImageValues, but we should make it work with gradients too.

Main difficulty is implementing the CanvasSourceImage interface for gradients. Should be similar to how SVG images are implemented. Length resolution etc. should be similar to how FontSize is resolved in CanvasSourceImage.
 

Comment 1 by shend@chromium.org, Jan 21 2018

Owner: shend@chromium.org
Status: Assigned (was: Available)
Project Member

Comment 2 by bugdroid1@chromium.org, Feb 2 2018

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

commit 6d10aad7a6f28294851e37f6ab7f0b0ac5086508
Author: Darren Shen <shend@chromium.org>
Date: Fri Feb 02 04:40:36 2018

[css-typed-om] Refactor CSSStyleImageValue to prepare for gradients.

Currently CSSStyleImageValue implements the CSSImageValue class in
Typed OM. CSSImageValue can be anything that's an <image> i.e. a <url>,
<gradient>, or <cross-fade>.

However, the current implementation of CSSStyleImageValue only really
works for <url>s. This patch moves <url> specific logic into
CSSURLImageValue. This prepares for the implementation of <gradient> and
<cross-fade>, which will be subclasses of CSSStyleImageValue.

We also do some cleanup work (e.g. making things const, moving code in
header to cpp).

Bug: 803680
Change-Id: I848b3eab5dbbcb9bbe7f0aea0d377497f63bfda3
Reviewed-on: https://chromium-review.googlesource.com/882786
Commit-Queue: Darren Shen <shend@chromium.org>
Reviewed-by: nainar <nainar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533949}
[modify] https://crrev.com/6d10aad7a6f28294851e37f6ab7f0b0ac5086508/third_party/WebKit/Source/core/css/BUILD.gn
[modify] https://crrev.com/6d10aad7a6f28294851e37f6ab7f0b0ac5086508/third_party/WebKit/Source/core/css/cssom/CSSStyleImageValue.cpp
[modify] https://crrev.com/6d10aad7a6f28294851e37f6ab7f0b0ac5086508/third_party/WebKit/Source/core/css/cssom/CSSStyleImageValue.h
[modify] https://crrev.com/6d10aad7a6f28294851e37f6ab7f0b0ac5086508/third_party/WebKit/Source/core/css/cssom/CSSStyleImageValueTest.cpp
[add] https://crrev.com/6d10aad7a6f28294851e37f6ab7f0b0ac5086508/third_party/WebKit/Source/core/css/cssom/CSSURLImageValue.cpp
[modify] https://crrev.com/6d10aad7a6f28294851e37f6ab7f0b0ac5086508/third_party/WebKit/Source/core/css/cssom/CSSURLImageValue.h
[modify] https://crrev.com/6d10aad7a6f28294851e37f6ab7f0b0ac5086508/third_party/WebKit/Source/core/css/cssom/StyleValueFactory.cpp

Project Member

Comment 3 by bugdroid1@chromium.org, Feb 2 2018

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

commit 1f977216838ab364205dcd288b0b3efc0de1b01d
Author: Yuta Kitamura <yutak@chromium.org>
Date: Fri Feb 02 08:56:54 2018

Revert "[css-typed-om] Refactor CSSStyleImageValue to prepare for gradients."

This reverts commit 6d10aad7a6f28294851e37f6ab7f0b0ac5086508.

Reason for revert: Caused MSAN bot failure.

https://ci.chromium.org/buildbot/chromium.memory/Linux%20MSan%20Tests/7639

Original change's description:
> [css-typed-om] Refactor CSSStyleImageValue to prepare for gradients.
> 
> Currently CSSStyleImageValue implements the CSSImageValue class in
> Typed OM. CSSImageValue can be anything that's an <image> i.e. a <url>,
> <gradient>, or <cross-fade>.
> 
> However, the current implementation of CSSStyleImageValue only really
> works for <url>s. This patch moves <url> specific logic into
> CSSURLImageValue. This prepares for the implementation of <gradient> and
> <cross-fade>, which will be subclasses of CSSStyleImageValue.
> 
> We also do some cleanup work (e.g. making things const, moving code in
> header to cpp).
> 
> Bug: 803680
> Change-Id: I848b3eab5dbbcb9bbe7f0aea0d377497f63bfda3
> Reviewed-on: https://chromium-review.googlesource.com/882786
> Commit-Queue: Darren Shen <shend@chromium.org>
> Reviewed-by: nainar <nainar@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#533949}

TBR=nainar@chromium.org,shend@chromium.org

Change-Id: I9aedca3ac9e3ecb07ed283447febede0628d7aeb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 803680
Reviewed-on: https://chromium-review.googlesource.com/896671
Reviewed-by: Yuta Kitamura <yutak@chromium.org>
Commit-Queue: Yuta Kitamura <yutak@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534002}
[modify] https://crrev.com/1f977216838ab364205dcd288b0b3efc0de1b01d/third_party/WebKit/Source/core/css/BUILD.gn
[modify] https://crrev.com/1f977216838ab364205dcd288b0b3efc0de1b01d/third_party/WebKit/Source/core/css/cssom/CSSStyleImageValue.cpp
[modify] https://crrev.com/1f977216838ab364205dcd288b0b3efc0de1b01d/third_party/WebKit/Source/core/css/cssom/CSSStyleImageValue.h
[modify] https://crrev.com/1f977216838ab364205dcd288b0b3efc0de1b01d/third_party/WebKit/Source/core/css/cssom/CSSStyleImageValueTest.cpp
[delete] https://crrev.com/6134471c6a971ab2e9707889c5bc0332397fc551/third_party/WebKit/Source/core/css/cssom/CSSURLImageValue.cpp
[modify] https://crrev.com/1f977216838ab364205dcd288b0b3efc0de1b01d/third_party/WebKit/Source/core/css/cssom/CSSURLImageValue.h
[modify] https://crrev.com/1f977216838ab364205dcd288b0b3efc0de1b01d/third_party/WebKit/Source/core/css/cssom/StyleValueFactory.cpp

Project Member

Comment 4 by bugdroid1@chromium.org, Feb 5 2018

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

commit d9a71c341af98d201c3c2cafc12f47612444db76
Author: Darren Shen <shend@chromium.org>
Date: Mon Feb 05 04:52:59 2018

Revert "Revert "[css-typed-om] Refactor CSSStyleImageValue to prepare for gradients.""

This reverts commit 1f977216838ab364205dcd288b0b3efc0de1b01d.

Reason for revert: Relanding

Original change's description:
> Revert "[css-typed-om] Refactor CSSStyleImageValue to prepare for gradients."
> 
> This reverts commit 6d10aad7a6f28294851e37f6ab7f0b0ac5086508.
> 
> Reason for revert: Caused MSAN bot failure.
> 
> https://ci.chromium.org/buildbot/chromium.memory/Linux%20MSan%20Tests/7639
> 
> Original change's description:
> > [css-typed-om] Refactor CSSStyleImageValue to prepare for gradients.
> > 
> > Currently CSSStyleImageValue implements the CSSImageValue class in
> > Typed OM. CSSImageValue can be anything that's an <image> i.e. a <url>,
> > <gradient>, or <cross-fade>.
> > 
> > However, the current implementation of CSSStyleImageValue only really
> > works for <url>s. This patch moves <url> specific logic into
> > CSSURLImageValue. This prepares for the implementation of <gradient> and
> > <cross-fade>, which will be subclasses of CSSStyleImageValue.
> > 
> > We also do some cleanup work (e.g. making things const, moving code in
> > header to cpp).
> > 
> > Bug: 803680
> > Change-Id: I848b3eab5dbbcb9bbe7f0aea0d377497f63bfda3
> > Reviewed-on: https://chromium-review.googlesource.com/882786
> > Commit-Queue: Darren Shen <shend@chromium.org>
> > Reviewed-by: nainar <nainar@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#533949}
> 
> TBR=nainar@chromium.org,shend@chromium.org
> 
> Change-Id: I9aedca3ac9e3ecb07ed283447febede0628d7aeb
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: 803680
> Reviewed-on: https://chromium-review.googlesource.com/896671
> Reviewed-by: Yuta Kitamura <yutak@chromium.org>
> Commit-Queue: Yuta Kitamura <yutak@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#534002}

TBR=yutak@chromium.org,nainar@chromium.org,shend@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 803680
Change-Id: Iccabf87cde1e9bd30ab1d08e31fe1b774a59f029
Reviewed-on: https://chromium-review.googlesource.com/900563
Commit-Queue: Darren Shen <shend@chromium.org>
Reviewed-by: Darren Shen <shend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534328}
[modify] https://crrev.com/d9a71c341af98d201c3c2cafc12f47612444db76/third_party/WebKit/Source/core/css/BUILD.gn
[modify] https://crrev.com/d9a71c341af98d201c3c2cafc12f47612444db76/third_party/WebKit/Source/core/css/cssom/CSSStyleImageValue.cpp
[modify] https://crrev.com/d9a71c341af98d201c3c2cafc12f47612444db76/third_party/WebKit/Source/core/css/cssom/CSSStyleImageValue.h
[modify] https://crrev.com/d9a71c341af98d201c3c2cafc12f47612444db76/third_party/WebKit/Source/core/css/cssom/CSSStyleImageValueTest.cpp
[add] https://crrev.com/d9a71c341af98d201c3c2cafc12f47612444db76/third_party/WebKit/Source/core/css/cssom/CSSURLImageValue.cpp
[modify] https://crrev.com/d9a71c341af98d201c3c2cafc12f47612444db76/third_party/WebKit/Source/core/css/cssom/CSSURLImageValue.h
[modify] https://crrev.com/d9a71c341af98d201c3c2cafc12f47612444db76/third_party/WebKit/Source/core/css/cssom/StyleValueFactory.cpp

Comment 5 by shend@chromium.org, Feb 28 2018

There's a patch ready in [1], but we're close to branch point and I'm slightly worried that there are some subtle bugs to do with caching of resources. This shouldn't too big a deal, as the canvas can already draw gradients by itself.

[1] https://chromium-review.googlesource.com/c/chromium/src/+/882906

Comment 6 by shend@chromium.org, Feb 28 2018

If this is not critical, I'll land it after branch point for safety.

Comment 7 by shend@chromium.org, May 3 2018

Cc: shend@chromium.org
Owner: ----
Status: Available (was: Assigned)
No longer working on Typed OM, marking as Available. The patch in #c5 should work, but I was worried it degrades performance because of an additional virtual call. Would be great if there's a better way to do this.

Sign in to add a comment