Closed Bug 1864258 Opened 7 months ago Closed 7 months ago

[css-color] HSL & HWB syntax should allow numbers as well as percentage.

Categories

(Core :: CSS Parsing and Computation, defect)

defect

Tracking

()

RESOLVED FIXED
122 Branch
Tracking Status
firefox122 --- fixed

People

(Reporter: tlouw, Assigned: tlouw)

References

Details

Attachments

(2 files)

According to:
https://drafts.csswg.org/css-color-4/#the-hwb-notation

the HWB syntax allows percentages and numbers for the whiteness and blackness components:

hwb() = hwb( 
  [<hue> | none] 
  [<percentage> | <number> | none] 
  [<percentage> | <number> | none] 
  [ / [<alpha-value> | none] ]? )

Currently we only parse percentages for those components.

hwb(20deg 50 40) should be a valid hwb value. The color-valid-hwb.html wpt test doesn't test for these values either.

According to:
https://drafts.csswg.org/css-color-4/#the-hsl-notation

the modern HSL syntax allows percentages and numbers for the saturation and lightness components:

<modern-hsl-syntax> = hsl( 
    [<hue> | none] 
    [<percentage> | <number> | none] 
    [<percentage> | <number> | none] 
    [ / [<alpha-value> | none] ]? )

Currently we only parse percentages for the modern syntax.

hsl(20deg 50 40) should be a valid hsl value. The color-valid-hsl.html wpt test doesn't test for these values either.

Summary: [css-color] Modern HSL syntax should allow numbers as well as percentage. → [css-color] HWB syntax should allow numbers as well as percentage.
Assignee: nobody → tlouw
Status: NEW → ASSIGNED
Attachment #9363104 - Attachment description: Bug 1864258 - HWB syntax should allow numbers as well as percentage r=#layout → WIP: Bug 1864258 - HWB syntax should allow numbers as well as percentage r=#layout

The second and third components for HSL and HWB are stored as
percentages in the range [0..1], but as part of the change to allow
numbers for those two components as well as percentages, they act like
all the other <number-or-percentage> components. This means the values
are store in their number value. For HSL and HWB they both match with
the percentage values and are in the range [0..100].

https://drafts.csswg.org/css-color-4/#the-hsl-notation
https://drafts.csswg.org/css-color-4/#the-hwb-notation

Change to the accepted types for the components are discussed here:
https://github.com/w3c/csswg-drafts/issues/8322

Attachment #9363104 - Attachment description: WIP: Bug 1864258 - HWB syntax should allow numbers as well as percentage r=#layout → WIP: Bug 1864258 - HSL and HWB syntax should allow numbers as well as percentage r=#layout
Attachment #9363701 - Attachment description: WIP: Bug 1864258 - Change HSL and HWB to use number components r=emilio,#layout → WIP: Bug 1864258 - Change HSL and HWB to store components as numbers r=emilio,#layout
Attachment #9363701 - Attachment description: WIP: Bug 1864258 - Change HSL and HWB to store components as numbers r=emilio,#layout → Bug 1864258 - Change HSL and HWB to store components as numbers r=emilio,#layout
Attachment #9363104 - Attachment description: WIP: Bug 1864258 - HSL and HWB syntax should allow numbers as well as percentage r=#layout → Bug 1864258 - HSL and HWB syntax should allow numbers as well as percentage r=#layout
Summary: [css-color] HWB syntax should allow numbers as well as percentage. → [css-color] HSL & HWB syntax should allow numbers as well as percentage.
Duplicate of this bug: 1862918
Pushed by tlouw@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/23dfad39643a
Change HSL and HWB to store components as numbers r=emilio,layout-reviewers
Pushed by tlouw@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/cf1b9592b97f
HSL and HWB syntax should allow numbers as well as percentage r=layout-reviewers,emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/43320 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → 122 Branch
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: