Closed Bug 1468806 Opened 6 years ago Closed 6 years ago

Font editor field for "size" causes unexpectedly huge fonts on small tweaks, for elements with inherited "em" font-size

Categories

(DevTools :: Inspector, defect, P3)

defect

Tracking

(firefox63 fixed)

RESOLVED FIXED
Firefox 63
Tracking Status
firefox63 --- fixed

People

(Reporter: dholbert, Assigned: rcaliman)

References

()

Details

(Whiteboard: [good first verify])

Attachments

(4 files)

Attached file testcase 1
STR:
 1. turn on devtools.inspector.fonteditor.enabled
 2. View attached testcase.
 3. Right-click the underlined text and choose "Inspect", and click the Fonts panel.
 4. For the Size field in the font editor, click the up arrow and then down arrow (to make and then "undo" a minor tweak)


ACTUAL RESULTS:
The text suddenly gets ~5x as big and stays that way (because we suddenly apply approximately "font-size: 5em" to the inline style for *this specific element* -- i.e. we say to be 5x *the parent's font size* -- rather than the initial rendering, where we were *inheriting* whatever font-size:5em computed to *on the parent*.)

EXPECTED RESULTS:
Visually: "uparrow" should result in a tiny, incremental change to font size. And "downarrow" should then take you back to the original font size.

Functionally: we should probably have shown the (inherited) computed font-size in px units rather than em units for this element, so that it has the same effect when you make it an explicit inline style attribute and make tweaks to it.

I discovered this in the wild at https://developer.microsoft.com/en-us/microsoft-edge/testdrive/demos/variable-fonts/ (using the word "Fonts" in "Variable Fonts" in the center of the first load page there)
FWIW, If I change the testcase to use the "font" shorthand to set the font-size on the ancestor (font: 5em serif), then I get "EXPECTED RESULTS" -- the fonts panel shows me the size in px units, which does the right thing when I hit uparrow/downarrow.
Summary: Font editor for "size" causes huge fonts for elements with inherited "em" size → Font editor field for "size" causes unexpectedly huge fonts on small tweaks, for elements with inherited "em" font-size
Attached video screencast of issue
Good catch. Thanks for filing! 

This is going to be the tip of a tricky "special cases" iceberg. We want to preserve the authored unit types for declared properties. In this case, the editor mistakenly picks-up the "5em" inherited from the element's parent instead of falling back to the computed style (approx. 80px) for the font-size that's not explicitly declared.
Priority: -- → P3
Blocks: 1441576
Assignee: nobody → rcaliman
Status: NEW → ASSIGNED
Comment on attachment 8987536 [details]
Bug 1468806 - Do not populate Font Editor with inherited property values; use computed.

https://reviewboard.mozilla.org/r/252774/#review259548
Attachment #8987536 - Flags: review?(pbrosset) → review+
Pushed by rcaliman@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/29be8a075df9
Do not populate Font Editor with inherited property values; use computed. r=pbro
https://hg.mozilla.org/mozilla-central/rev/29be8a075df9
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 63
Marking as GFV since it has clear and simple STR.
Whiteboard: [good first verify]
QA Contact: catalin.sasca
Component: Inspector: Fonts → Inspector
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: