Closed Bug 1370458 Opened 7 years ago Closed 7 years ago

Disallow floats, negative values, and values longer than six characters in the hashless quirk

Categories

(Core :: CSS Parsing and Computation, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: manishearth, Assigned: manishearth)

References

Details

Attachments

(1 file)

https://quirks.spec.whatwg.org/#the-hashless-hex-color-quirk

We were failing a bunch of WPT tests because of this.
Comment on attachment 8874718 [details]
Bug 1370458: Disallow floats, negative numbers, and long values in hashless color quirk;

https://reviewboard.mozilla.org/r/146096/#review150004

r=me with comments addressed.

::: layout/style/nsCSSParser.cpp:6700
(Diff revision 1)
> +static
> +int
> +numberSize(uint32_t number) {

* please put `static` and the return type in the same line
* the return type should probably be `uint32_t` rather than impl-dependent sized `int`
* function name should be a verb phase and it should start with uppercase, and this seems to be very specific to the color case so probably `CountNumbersForHashlessColor`.

::: layout/style/nsCSSParser.cpp:6718
(Diff revision 1)
> +  } else if (number < 100000) {
> +    return 5;
> +  } else if (number < 1000000) {
> +    return 6;
> +  } else {
> +    return 100;

Probably add a comment stating that this is the wrong case, and we don't care the specific number as far as it is larger than 6.
Attachment #8874718 - Flags: review?(xidorn+moz) → review+
Blocks: stylo-wpt
> +numberSize(uint32_t number) {

The param should be named aNumber to follow our naming conventions.
Pushed by manishearth@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/f061b418bf20
Disallow floats, negative numbers, and long values in hashless color quirk; r=xidorn
https://hg.mozilla.org/mozilla-central/rev/f061b418bf20
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
(In reply to Mats Palmgren (:mats) from comment #4)
> > +numberSize(uint32_t number) {
> 
> The param should be named aNumber to follow our naming conventions.

Yeah, you're right... Sorry for not catching this... Probably I read too much Rust code nowadays :/
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: