[css-typed-om] Make canvas.drawImage work with gradients |
||
Issue descriptionCurrently 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.
,
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
,
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
,
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
,
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
,
Feb 28 2018
If this is not critical, I'll land it after branch point for safety.
,
May 3 2018
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 |
||
Comment 1 by shend@chromium.org
, Jan 21 2018Status: Assigned (was: Available)