Closed Bug 2063835 Opened 2 months ago Closed 2 months ago

[text-box-trim] Trim does not use font metrics of ::first-line

Categories

(Core :: Layout: Block and Inline, defect)

defect

Tracking

()

RESOLVED FIXED
156 Branch
Tracking Status
relnote-firefox --- 156+
firefox154 --- wontfix
firefox155 --- wontfix
firefox156 --- fixed

People

(Reporter: sajidanwar, Assigned: sajidanwar)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 external file)

Gecko's implementation of text-box-trim doesn't use the font metrics of a ::first-line container when trimming. Blink and WebKit both do, and the specification is clear that this is the intended behavior, because:

  • text-box-trim uses the metrics of the line's root inline box (ref)
  • The root inline box (at least the fragment corresponding to the first line) is inside the ::first-line pseudo-element (ref)

I believe this isn't working in Gecko out of the box because it doesn't actually generate frames for root inline boxes, so it currently always retrieves the font metrics from the block frame itself.

Pushed by agoloman@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/15719fcab866 https://hg.mozilla.org/integration/autoland/rev/d23a6e69a9aa Revert "Bug 2063835 - Use ::first-line font metrics if available for text-box-trim. r=layout-reviewers,jfkthame,emilio" for causing wr failures @text-box-trim-first-line-pseudo-003.html.

Backed out for causing wr failures @text-box-trim-first-line-pseudo-003.html.

Flags: needinfo?(sajidanwar94)

Windows is always doing this to me 😩 Looks like 1 pixel off vertically that's affecting every single pixel below ... bit large for fuzzy metadata to be reasonable, maybe. Probably I just need to switch from Lato-Medium to a different font that will avoid fractional pixel issues.

Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/61973 for changes under testing/web-platform/tests

Pushed by sajidanwar94@gmail.com: https://github.com/mozilla-firefox/firefox/commit/3c49bc448a56 https://hg.mozilla.org/integration/autoland/rev/559c690a70df Use ::first-line font metrics if available for text-box-trim. r=layout-reviewers,jfkthame,emilio

Upstream PR was closed without merging

Flags: needinfo?(sajidanwar94)
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 156 Branch

Since nightly and release are affected, beta will likely be affected too.
For more information, please visit BugBot documentation.

The patch landed in nightly and beta is affected.
:sajidanwar, is this bug important enough to require an uplift?

For more information, please visit BugBot documentation.

Flags: needinfo?(sajidanwar94)

Aw, didn't realize we already passed merge day for 155. Ah well, this is a low severity edge case for a new CSS feature, it's probably fine to ride the train to 156, so I'm marking 155 as wontfix.

Flags: needinfo?(sajidanwar94)

Upstream PR merged by moz-wptsync-bot

Did you want to nominate this for the Fx156 relnotes? If so, set the relnote-firefox flag to "?"
https://wiki.mozilla.org/Release_Management/Release_Notes_Nomination

Possible wording:

text-box-trim now uses the font metrics of a ::first-line pseudo-element when one applies, matching other browsers and the specification.

Flags: needinfo?(sajidanwar94)

Thanks, that seems like a good idea and I like the suggested wording as well.

Release Note Request (optional, but appreciated)
[Why is this notable]: Interop fix for CSS feature
[Affects Firefox for Android]: Yes
[Suggested wording]: text-box-trim now uses the font metrics of a ::first-line pseudo-element when one applies, matching other browsers and the specification.
[Links (documentation, blog post, etc)]:

relnote-firefox: --- → ?
Flags: needinfo?(sajidanwar94)

Thanks, added to the Fx156 nightly release notes, please allow 30 minutes for the site to update.

QA Whiteboard: [qa-triage-done-c157/b156]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: