New issue
Advanced search Search tips

Issue 707047 link

Starred by 11 users

Issue metadata

Status: Fixed
Owner:
Closed: Mar 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Feature



Sign in to add a comment

Implement color stop position syntax from CSS Image Values 4

Reported by leave...@gmail.com, Mar 30 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36

Steps to reproduce the problem:
Testcase: http://dabblet.com/gist/d52773b90f2bf6d6304c95c86a858c23

What is the expected behavior?
The background should be green

What went wrong?
The background is red

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 56.0.2924.87  Channel: n/a
OS Version: OS X 10.12.3
Flash Version: Shockwave Flash 25.0 r0

Spec: https://drafts.csswg.org/css-images-4/#color-stop-syntax

According to the new grammar, color stops can have two positions which is equivalent to two consecutive color stops with the same color and different positions. For example

    linear-gradient(45deg, #f06 25%, yellow 25%, yellow 50%, #f06 50%, #f06 75%, yellow 75%)

can be written as

    linear-gradient(45deg, #f06 25%, yellow 25% 50%, #f06 50% 75%, yellow 75%)

with this syntax. It's useful for all gradient types as it makes it easier and more readable to specify "bands" of color and should be relatively straightforward to implement since it's rather simple syntactic sugar.
 
Labels: -Type-Bug -OS-Mac OS-All Type-Feature
Owner: fmalita@chromium.org
Status: Assigned (was: Unconfirmed)
I can take a look at this, since I've been playing with color stops parsing recently.  Presumably it'll require intent-to-ship and approval.

Comment 3 by meade@chromium.org, Apr 3 2017

Labels: Update-Quarterly
Project Member

Comment 4 by bugdroid1@chromium.org, Apr 7 2017

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

commit 546c77f5d4ce77af661664954f0a59d7a4b45edf
Author: fmalita <fmalita@chromium.org>
Date: Fri Apr 07 12:02:26 2017

Implement color stop position syntax from CSS Image Values 4

CSS Image Values 4 allows specifying up to two positions per color stop, e.g.:

  linear-gradient(45deg, black 0% 50%, white 50% 100%)

This is equivalent to repeating the color at the given positions:

  linear-gradient(45deg, black 0%, black 50%, white 50%, white 100%)

(https://drafts.csswg.org/css-images-4/#color-stop-syntax)

Add support for the new syntax, behind a runtime flag.

BUG= 707047 

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

[modify] https://crrev.com/546c77f5d4ce77af661664954f0a59d7a4b45edf/third_party/WebKit/LayoutTests/fast/gradients/conic-gradient-parsing.html
[modify] https://crrev.com/546c77f5d4ce77af661664954f0a59d7a4b45edf/third_party/WebKit/LayoutTests/fast/gradients/unprefixed-gradient-parsing-expected.txt
[modify] https://crrev.com/546c77f5d4ce77af661664954f0a59d7a4b45edf/third_party/WebKit/LayoutTests/fast/gradients/unprefixed-gradient-parsing.html
[modify] https://crrev.com/546c77f5d4ce77af661664954f0a59d7a4b45edf/third_party/WebKit/Source/core/css/CSSGradientValue.cpp
[modify] https://crrev.com/546c77f5d4ce77af661664954f0a59d7a4b45edf/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp
[modify] https://crrev.com/546c77f5d4ce77af661664954f0a59d7a4b45edf/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5

Comment 5 by phistuck@gmail.com, Apr 10 2017

This seems weird. Why only two percentage values per color stop?...
@phistuck because the color is the same.  Sequential same-color stops are used to define color bands (no actual gradient), so only the extremes count.  Anything more than two offsets implies the intermediate values are redundant:

(green 10% 20% 30% 40%) -> (green 10%, green 20%, green 30%, green 40%) which is the same as (green 10%, green 40%).
Labels: -Update-Quarterly
Status: Fixed (was: Assigned)
Project Member

Comment 9 by bugdroid1@chromium.org, Sep 17

Project Member

Comment 10 by bugdroid1@chromium.org, Sep 18

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

commit 50689e69f63fb991c09387f486d4105abfa91988
Author: Fredrik Söderquist <fs@opera.com>
Date: Tue Sep 18 13:58:52 2018

Ship CSS gradient color stop double-position syntax

Intent-to-Ship thread:

 https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/8B9FbeTBIK0/DNkC2pz-AAAJ

Also removing the actual feature and corresponding check, because it's
only used in a single spot, so if the feature should need to be
unshipped it ought to be a fairly trivial revert.

Bug:  707047 ,  880733 
Change-Id: Ie854d7fd9f7a22e9c6144668a37f694dd1c508ee
Reviewed-on: https://chromium-review.googlesource.com/1230018
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#592028}
[modify] https://crrev.com/50689e69f63fb991c09387f486d4105abfa91988/third_party/blink/renderer/core/css/parser/css_property_parser_helpers.cc
[modify] https://crrev.com/50689e69f63fb991c09387f486d4105abfa91988/third_party/blink/renderer/platform/runtime_enabled_features.json5

Cc: phanindra.mandapaka@chromium.org
Labels: TE-Verified-M71 TE-Verified-71.0.3556.0
Able to reproduce the issue on Mac, windows and Ubuntu using chrome build without fix.

Verified the fix on Mac 10.13.6, Windows 10 and Ubuntu as per comment#0 on latest chrome version #71.0.3556.0. Attaching screen cast for reference.
Observed that  "As we are able to edit the text " 
Hence, the fix is working as expected.
Adding the verified labels.

Thanks...!
707047.mp4
860 KB View Download

Sign in to add a comment