Open
Bug 1249755
Opened 9 years ago
Updated 2 years ago
[quirks mode] Incorrect parsing of hashless CSS colors that begin with something that looks like a scientific notation number
Categories
(Core :: CSS Parsing and Computation, defect)
Tracking
()
NEW
People
(Reporter: orsha.kaluga, Unassigned)
References
Details
(Keywords: regression)
Attachments
(1 file)
17.87 KB,
text/html
|
Details |
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:44.0) Gecko/20100101 Firefox/44.0
Build ID: 20160209234642
Steps to reproduce:
1. Open attached .html file
2. See the bug
Actual results:
Some of colours (#9e9e9e, #8e8e8e, ..., #0e0e0e) are displayed incorrectly.
Expected results:
All colours should be displayed correctly.
Reporter | ||
Updated•9 years ago
|
Summary: Incorrect incorrect display of some colours → Incorrect display of certain colours
Component: Untriaged → CSS Parsing and Computation
Keywords: regression
Product: Firefox → Core
Version: 44 Branch → 29 Branch
![]() |
||
Comment 3•9 years ago
|
||
In this case, "e" means scientific notation. And also 9e9e9e is invalid <number>. Browser has been confusion?
See https://developer.mozilla.org/en-US/Firefox/Releases/29#CSS
> Scientific exponential notation, like 3e1 or 10e+0, is now supported for <number> values and
> derivatives, like <percentage> and unit values, but not <integer> (bug 964529).
Anyway, I think this is invalid bug.
Yes, but for background-color? I don't see any reason to support scientific notation over color notation for this attribute.
Was comment 2 the wrong regression range?
This does seem like a valid bug; we shouldn't be responding in such a weird way.
Oh, and to find the code for this quirk, look for mHashlessColorQuirk in layout/style/nsCSSParser.cpp .
Flags: needinfo?(dbaron)
Summary: Incorrect display of certain colours → [quirks mode] Incorrect parsing of hashless CSS colors that begin with something that looks like a scientific notation number
Status: UNCONFIRMED → NEW
Ever confirmed: true
To fix this, we can probably use the scanner's GetTokenOffset() method to simplify the big if (mHashlessColorQuirk) block in CSSParserImpl::ParseColor to just re-scan the buffer, instead of switching on token type.
Blocks: 964529
Note that Chrome has introduce a slightly different bug (the lines are white rather than more interesting colors), probably as a result of implementing what https://quirks.spec.whatwg.org/#the-hashless-hex-color-quirk says, including what for us would be an mIntegerValid check.
Comment 10•9 years ago
|
||
Originally I specified something closer to what IE did, with preserving the CSS token's source text and having a strict syntax check of that string. But it seemed like Gecko/WebKit/Blink were not so interested in implementing that because it increases memory (I think?), and what they were doing was good enough for Web compat (this bug notwithstanding). So I changed the spec to take the other approach, which meant that some colors fail to parse. Unfortunate, but this is quirks mode, and omitting the hash is an authoring error. Can't we say that this is just the way it is, and recommend against using quirks mode in the first place?
This is also tested in http://w3c-test.org/quirks-mode/hashless-hex-color.html btw ("1e1" etc).
There are more ways where this quirk is non-sensical. Like "99" is accepted as a color, but "aa" is not. However, "making sense" is not a design goal for quirks for me... :-) If we can get interop and good-enough Web compat, I'm happy.
Comment 11•9 years ago
|
||
I researched httparchive and concluded to not change the spec. See analysis in https://www.w3.org/Bugs/Public/show_bug.cgi?id=29489#c2
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•