Re: [whatwg] Question about gradient stops in canvas and parsing as CSS colors

2010-12-29 Thread Ian Hickson
On Wed, 22 Sep 2010, Boris Zbarsky wrote:

 Consider this code:
 
   gradient.addColorStop(1.0,rgba(  0,   0,  0,  0);
 
 where |gradient| is a canvas radial gradient.  Note the lack of ')' at the end
 of the rgba string there.
 
 What's the correct behavior?  The spec says:
 
   If the color cannot be parsed as a CSS color, then a SYNTAX_ERR
   exception must be raised.
 
 However an actual CSS parser parsing that string as a color would infer the
 closing ')' per CSS 2.1 section 4.2 the item about unexpected EOF.  Note
 that this is a tokenization-level requirement, as far as I can tell, so this
 happens before the syntax rules for productions like color are applied.
 
 Observed behavior in UAs is:
 
 * Webkit simply doesn't implement CSS 2.1 section 4.2 correctly
 
 * Opera throws an exception from the addColorStop call above, but shows
   lime text if loading this:
 data:text/html,span style=color: rgb(0, 255, 0Lime/span
 
 * Gecko shows lime text in the HTML testcase and treats the color stop
   above as valid rgba(0, 0, 0, 0).
 
 Clearly I happen to think Gecko's behavior is the sane one here, but 
 there's a clear interoperability problem either way.  Certainly Opera 
 and Gecko interpreted the spec differently.

Your interpretation is correct. I've fixed one point in the HTML spec that 
was phrased in terms of validity rather than in terms of successful 
parsing, and added a paragraph and example clarifying this, along with 
cross-references to this paragraph where relevant.

-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


Re: [whatwg] Question about gradient stops in canvas and parsing as CSS colors

2010-12-29 Thread Boris Zbarsky

On 12/29/10 3:07 PM, Ian Hickson wrote:

* Webkit simply doesn't implement CSS 2.1 section 4.2 correctly

* Opera throws an exception from the addColorStop call above, but shows
   lime text if loading this:
 data:text/html,span style=color: rgb(0, 255, 0Lime/span

* Gecko shows lime text in the HTML testcase and treats the color stop
   above as valid rgba(0, 0, 0, 0).

Clearly I happen to think Gecko's behavior is the sane one here, but
there's a clear interoperability problem either way.  Certainly Opera
and Gecko interpreted the spec differently.


Your interpretation is correct. I've fixed one point in the HTML spec that
was phrased in terms of validity rather than in terms of successful
parsing, and added a paragraph and example clarifying this, along with
cross-references to this paragraph where relevant.


Sounds good.

Assuming the new text is in the CSS Modules section, there's a minor 
typo: the text as it closing the open construct should not have it 
there.


-Boris


Re: [whatwg] Question about gradient stops in canvas and parsing as CSS colors

2010-09-24 Thread Philip Taylor
On Wed, Sep 22, 2010 at 3:49 PM, Anne van Kesteren ann...@opera.com wrote:
 On Wed, 22 Sep 2010 16:47:02 +0200, Boris Zbarsky bzbar...@mit.edu wrote:

 Clearly I happen to think Gecko's behavior is the sane one here, but
 there's a clear interoperability problem either way.  Certainly Opera and
 Gecko interpreted the spec differently.

 Might be the way we invoke the CSS code. I think the Gecko behavior makes
 sense. Philip, can your test suite cover this?

Added with the Gecko behaviour (and added a few other cases - Opera
10.61 fails some like rgba-solid-3):
http://dvcs.w3.org/hg/html/diff/5a95d6481bac/tests/submission/PhilipTaylor/tools/canvas/tests2d.yaml

Run the tests from
http://test.w3.org/html/tests/submission/PhilipTaylor/canvas/index.2d.fillStyle.parse.html
or (if that's down)
http://dvcs.w3.org/hg/html/raw-file/tip/tests/submission/PhilipTaylor/canvas/index.2d.fillStyle.parse.html

-- 
Philip Taylor
exc...@gmail.com


[whatwg] Question about gradient stops in canvas and parsing as CSS colors

2010-09-22 Thread Boris Zbarsky

Consider this code:

  gradient.addColorStop(1.0,rgba(  0,   0,  0,  0);

where |gradient| is a canvas radial gradient.  Note the lack of ')' at 
the end of the rgba string there.


What's the correct behavior?  The spec says:

  If the color cannot be parsed as a CSS color, then a SYNTAX_ERR
  exception must be raised.

However an actual CSS parser parsing that string as a color would infer 
the closing ')' per CSS 2.1 section 4.2 the item about unexpected EOF. 
 Note that this is a tokenization-level requirement, as far as I can 
tell, so this happens before the syntax rules for productions like 
color are applied.


Observed behavior in UAs is:

* Webkit simply doesn't implement CSS 2.1 section 4.2 correctly

* Opera throws an exception from the addColorStop call above, but shows
  lime text if loading this:
data:text/html,span style=color: rgb(0, 255, 0Lime/span

* Gecko shows lime text in the HTML testcase and treats the color stop
  above as valid rgba(0, 0, 0, 0).

Clearly I happen to think Gecko's behavior is the sane one here, but 
there's a clear interoperability problem either way.  Certainly Opera 
and Gecko interpreted the spec differently.


-Boris


Re: [whatwg] Question about gradient stops in canvas and parsing as CSS colors

2010-09-22 Thread Anne van Kesteren

On Wed, 22 Sep 2010 16:47:02 +0200, Boris Zbarsky bzbar...@mit.edu wrote:
Clearly I happen to think Gecko's behavior is the sane one here, but  
there's a clear interoperability problem either way.  Certainly Opera  
and Gecko interpreted the spec differently.


Might be the way we invoke the CSS code. I think the Gecko behavior makes  
sense. Philip, can your test suite cover this?



--
Anne van Kesteren
http://annevankesteren.nl/