From 193d58bd45b1901b9db5e644e525d14fe3a945be Mon Sep 17 00:00:00 2001 From: Florian Rivoal Date: Mon, 9 Jan 2017 20:54:25 +0900 Subject: [PATCH 1/7] [css-color] Define "resolving color values" This is a first pass at providing a centralized definition of how all <> values are treated at computed value and used value time. This relates to #741, #480, #867 --- css-color/Overview.bs | 79 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 66 insertions(+), 13 deletions(-) diff --git a/css-color/Overview.bs b/css-color/Overview.bs index 259730c3879..9f8667b8962 100644 --- a/css-color/Overview.bs +++ b/css-color/Overview.bs @@ -60,12 +60,11 @@ Foreground Color: the 'color' property Inherited: yes Percentages: N/A Media: visual - Computed value: an RGBA color + Computed value: See resolving color values This property describes the foreground fill color of an element's text content. - In addition, it provides the value that ''currentcolor'' resolves to. - If the ''currentcolor'' keyword is set on the 'color' property itself, it is treated as ''color: inherit''. + In addition, it provides the value that ''/currentcolor'' resolves to. The initial value of this property is ''black''. @@ -161,6 +160,67 @@ Notes On Using Colors Really? Isn't HD video in Rec.709? Shouldn't video be consistent with images? Or do implementations really do this differently? +

+Resolving Color values

+ + Various properties accept <> values. + Unless an exception is explicitly defined, + all such properties must resolve color values as defined below + to determine the computed value and the used value for <>. + +
    +
  • + The computed value of the ''/currentcolor'' keyword is ''/currentcolor''. + + If ''/currentcolor'' is used as the value of the 'color' property, + the used value is the same as if ''inherit'' had been specified instead. + For all other properties that accept a <>, + the used value of ''/currentcolor'' is the same as + the used value of the 'color' property on the same element. + + Note: This means that if the ''/currentcolor'' value is inherited, + it’s inherited as a keyword, + not as the value of the 'color' property, + so descendants will use their own 'color' property to resolve it. + +
  • + The computed value and used value of ''/transparent'' is ''rgba(0,0,0,0)''. + +
  • + The computed value and used value of + named colors (including <> colors), + 3 and 6 digits hex colors, + comma separated ''rgb()'' colors without an alpha channel, + and comma separated ''hsl()'' colors without an alpha channel, + is the equivalent numeric value in comma separated ''rgb()'' notation omitting the alpha value. + +
  • + The computed value and used value of + 4 and 8 digits hex colors, + comma separated ''rgba()'' colors with an alpha channel, + and comma separated ''hsla()'' colors with an alpha channel, + is the equivalent numeric value in comma separated ''rgba()'' notation with the alpha value. + +
+ +
+ The above defines values that are already implemented + based on the most interoperable behavior. + We still need to define how newer syntaxes work: + * comma-less with slash separated optional alpha variants of ''rgb()'', ''rgba()'', ''hsl()'', ''hsla()'' + * comma separated with optional alpha variants of ''rgb()'', ''rgba()'', ''hsl()'', ''hsla()'' + * ''device-cmyk()'' + * ''hwb()'' + * ''lab()'' and ''lch()'' + * ''gray()'' + * ''color()'' + * ''color-mod()'' +
+ + Issue: Define if changing the working color space should have any impact on the above. + + Any future specification extending the syntax of <> + must define the how to resolve color values for the new extensions.

RGB Colors

@@ -639,17 +699,10 @@ The ''transparent'' keyword

-The ''currentcolor'' keyword

- - The keyword currentcolor takes its value from the value of the 'color' property on the same element. - This happens at used-value time, - which means that if the value is inherited, - it's inherited as ''currentcolor'', - not as the value of the 'color' property, - so descendants will use their own 'color' property to resolve it. +The ''/currentcolor'' keyword - If ''currentcolor'' is used as the value of the 'color' property, - it instead takes its value from the inherited value of the 'color' property. + The keyword currentcolor represents value of the 'color' property on the same element. + Its computed value and used values are determined by resolving color values.
Here's a simple example showing how to use the ''currentcolor'' keyword: From 0fa38b622976eee391e2d0f15aeb5139e0866b47 Mon Sep 17 00:00:00 2001 From: Florian Rivoal Date: Mon, 9 Jan 2017 20:57:08 +0900 Subject: [PATCH 2/7] [css-color] Resolve ambiguities to make bikeshed happy --- css-color/Overview.bs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/css-color/Overview.bs b/css-color/Overview.bs index 9f8667b8962..cb95dbf3d60 100644 --- a/css-color/Overview.bs +++ b/css-color/Overview.bs @@ -368,7 +368,7 @@ Named Colors Most of the rest come from one version of the X11 color system, used in Unix-derived systems to specify colors for the console. - (Two special color values, ''transparent'' and ''currentcolor'', + (Two special color values, ''transparent'' and ''/currentcolor'', are specially defined in their own sections.) Note: The history of the X11 color system is interesting, @@ -705,7 +705,7 @@ The ''/currentcolor'' keyword Its computed value and used values are determined by resolving color values.
- Here's a simple example showing how to use the ''currentcolor'' keyword: + Here's a simple example showing how to use the ''/currentcolor'' keyword:
 		.foo {
@@ -726,7 +726,7 @@ The ''/currentcolor'' keyword
 
 	
For example, the 'text-emphasis-color' property [[CSS3-TEXT-DECOR]], - whose initial value is ''currentcolor'', + whose initial value is ''/currentcolor'', by default matches the text color even as the 'color' property changes across elements. @@ -744,7 +744,7 @@ The ''/currentcolor'' keyword
Note: Multi-word keywords in CSS usually separate their component words with hyphens. - ''currentcolor'' doesn't, because it was originally introduced in SVG + ''/currentcolor'' doesn't, because it was originally introduced in SVG as a special attribute value spelled "currentColor", rather than a CSS value. Only later did CSS pick it up, From d5e23216ddd3df7806bf6e218321788e52045543 Mon Sep 17 00:00:00 2001 From: Florian Rivoal Date: Mon, 9 Jan 2017 21:11:15 +0900 Subject: [PATCH 3/7] [css-color] Add inline issue about clamping --- css-color/Overview.bs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/css-color/Overview.bs b/css-color/Overview.bs index cb95dbf3d60..360ddc08d09 100644 --- a/css-color/Overview.bs +++ b/css-color/Overview.bs @@ -219,6 +219,14 @@ Resolving Color values Issue: Define if changing the working color space should have any impact on the above. + Issue: Various parts of the spec define + the kind of clamping that should happen to the various numeric notations + when the numbers specified are out of range, + and do so with varrying precision, sometimes saying that this happens at computed value time, + sometimes not saying when it happens, + and sometimes not saying anything at all. + Maybe this should be consolidated here. + Any future specification extending the syntax of <> must define the how to resolve color values for the new extensions. From 3008229308486f173d2e056bd58720d8ba754a0e Mon Sep 17 00:00:00 2001 From: Florian Rivoal Date: Tue, 10 Jan 2017 16:30:26 +0900 Subject: [PATCH 4/7] [css-color] Make definition of resolving color values match implementations better --- css-color/Overview.bs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/css-color/Overview.bs b/css-color/Overview.bs index 360ddc08d09..6fee03aab3a 100644 --- a/css-color/Overview.bs +++ b/css-color/Overview.bs @@ -190,15 +190,18 @@ Resolving Color values The computed value and used value of named colors (including <> colors), 3 and 6 digits hex colors, + 4 and 8 digits hex colors with an explicitly opaque alpha channel, comma separated ''rgb()'' colors without an alpha channel, - and comma separated ''hsl()'' colors without an alpha channel, + comma separated ''rgba()'' colors with an explicitly opaque alpha channel, + comma separated ''hsl()'' colors without an alpha channel, + and comma separated ''hsla()'' colors with an explicitly opaque alpha channel, is the equivalent numeric value in comma separated ''rgb()'' notation omitting the alpha value.
  • The computed value and used value of - 4 and 8 digits hex colors, - comma separated ''rgba()'' colors with an alpha channel, - and comma separated ''hsla()'' colors with an alpha channel, + 4 and 8 digits hex colors with a non opaque alpha channel, + comma separated ''rgba()'' colors with a non opaque alpha channel, + and comma separated ''hsla()'' colors with a non opaque alpha channel, is the equivalent numeric value in comma separated ''rgba()'' notation with the alpha value. From 5ecbaadf272db4aeaf3cba7a9be7bd2af0412006 Mon Sep 17 00:00:00 2001 From: Florian Rivoal Date: Tue, 10 Jan 2017 16:47:11 +0900 Subject: [PATCH 5/7] [css-color] Call out different behavior from Gecko --- css-color/Overview.bs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/css-color/Overview.bs b/css-color/Overview.bs index 6fee03aab3a..10005026585 100644 --- a/css-color/Overview.bs +++ b/css-color/Overview.bs @@ -186,6 +186,9 @@ Resolving Color values
  • The computed value and used value of ''/transparent'' is ''rgba(0,0,0,0)''. + Issue: Gecko disagrees, and serializes any <> with an alpha channel of 0 as transparent. + No other browser does that though. +
  • The computed value and used value of named colors (including <> colors), From c74c007e89faa6db170d25425e3dc04c961b23d6 Mon Sep 17 00:00:00 2001 From: Florian Rivoal Date: Wed, 11 Jan 2017 15:32:12 -0800 Subject: [PATCH 6/7] [css-color] treat currentcolor as inherit at computed value time as well --- css-color/Overview.bs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/css-color/Overview.bs b/css-color/Overview.bs index 10005026585..2cfc2976896 100644 --- a/css-color/Overview.bs +++ b/css-color/Overview.bs @@ -170,12 +170,12 @@ Resolving Color values
    • - The computed value of the ''/currentcolor'' keyword is ''/currentcolor''. + If ''/currentcolor'' is the specified value of the 'color' property, + it is treated as if the specified value was ''inherit''. - If ''/currentcolor'' is used as the value of the 'color' property, - the used value is the same as if ''inherit'' had been specified instead. For all other properties that accept a <>, - the used value of ''/currentcolor'' is the same as + the computed value of the ''/currentcolor'' keyword is ''/currentcolor'', + and the used value of ''/currentcolor'' is the same as the used value of the 'color' property on the same element. Note: This means that if the ''/currentcolor'' value is inherited, From d2e2e5d371cd1129c3712d9ee61e85b2056e1835 Mon Sep 17 00:00:00 2001 From: Florian Rivoal Date: Wed, 11 Jan 2017 15:47:18 -0800 Subject: [PATCH 7/7] [css-color] Fix spacing --- css-color/Overview.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css-color/Overview.bs b/css-color/Overview.bs index 2cfc2976896..e2b4e49e681 100644 --- a/css-color/Overview.bs +++ b/css-color/Overview.bs @@ -184,7 +184,7 @@ Resolving Color values so descendants will use their own 'color' property to resolve it.
    • - The computed value and used value of ''/transparent'' is ''rgba(0,0,0,0)''. + The computed value and used value of ''/transparent'' is ''rgba(0, 0, 0, 0)''. Issue: Gecko disagrees, and serializes any <> with an alpha channel of 0 as transparent. No other browser does that though.