Closed Bug 1541829 Opened 6 years ago Closed 6 years ago

Fix typo in Color.jsm and ensure that consumers are updated to function properly

Categories

(Toolkit :: General, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: mikedeboer, Assigned: mikedeboer)

References

Details

Attachments

(2 files)

ThunderBird devs over at bug 1534360 discovered that I made a typo in the relativeLuminance getter in our Color baseclass.

Apart from fixing that, I'll need to update its known consumers: browser.js, FinderHighlighter.jsm and ThunderBird's TagUtils.jsm.

Component: Untriaged → General
Product: Thunderbird → Toolkit

I'll gladly fix TB's consumer. You don't need to provide a patch.

Since we rarely touch this code, I took the liberty of changing this to a JS class
and fix the contrast ratio calculations to actually conform to the WCAG spec,
instead of using arbitrary constants.
Is change the isBright getter to useBrightText, because that is more apt;
we're usually looking for an answer to 'should I use white text on this background?',
instead of looking for an arbitrary threshold to classify a color as being bright.
I updated the tests to cover more of this and clarified the assertion messages as
well.

@Jorg K: with this patch, you should change the TB code to use useBrightText, which has the 0.179 constant baked in.

Pushed by mdeboer@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2585178aea39 Fixup the relative luminance implementation in the Color class and update its consumers with the correct API. r=jaws

Richard, please r+ this. R? doesn't work in M-C bugs any more.

Attachment #9055978 - Flags: feedback?(richard.marti)
Comment on attachment 9055978 [details] [diff] [review] 1541829-C-C-useBrightText.patch Works like before.
Attachment #9055978 - Flags: feedback?(richard.marti) → review+
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Pushed by mozilla@jorgk.com: https://hg.mozilla.org/comm-central/rev/2593415a462f C-C part: Use Color.useBrightText for contrast calculation. r=Paenglab
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: