Open Bug 1600224 Opened 5 years ago Updated 9 days ago

Unexpectedly small line box, with "display:contents; line-height:[anything]"

Categories

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

defect

Tracking

()

People

(Reporter: dholbert, Unassigned, NeedInfo)

References

Details

Attachments

(3 files)

Attached file testcase 1

STR:

  1. Load attached testcase.

EXPECTED RESULTS:
There should be a box around the text.

ACTUAL RESULTS:
The box is very tiny and doesn't fit the text. It seems to be as tall as the inherited font-size (which in this case is tiny).

Note that the testcase includes a custom line-height value, which Chrome honors (and I'm not sure if it makes sense to honor or not, but we probably should?). Instead of honoring it, we throw it away and then trigger this bug. It does have some effect, though, because if I remove the line-height entirely, then we produce EXPECTED RESULTS with a box that's as tall as the text.

Here's a reference-ish case (not an exact reference, but just for comparison). It's identical to the testcase, except I've removed line-height:50px which we're not respecting anyway.

With that removal, we produce a nicely sized box and nicely positioned text, for some reason.

Attachment #9112460 - Attachment description: reference(ish) case 1 (removed `line-height`) → semi-reference case 1 (removed `line-height`)

(This might really be a style-system bug -- not sure.)

Meant to say:

So the issue here seems to be that we look at the wrong font-size during line layout... I'm ~sure there's no style system bug but I can take a look anyway.

Flags: needinfo?(emilio)

Here's the bug: https://searchfox.org/mozilla-central/rev/42c2ecdc429115c32e6bcb78bf087a228a051044/layout/generic/nsLineLayout.cpp#2202

I don't understand why... But we should probably do that for display: contents children.

Assignee: nobody → emilio

Well, that was unexpectedly super-orange... :/

It seems like Blink and WebKit create an anonymous inline around display: contents text: https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/dom/layout_tree_builder.cc?l=113&rcl=b6b46648babb128b40277a4bdcf7a1bde09ba81d

Jonathan, do you have any insight here? Is there anything totally off with the patch in comment 6?

Assignee: emilio → nobody
Flags: needinfo?(jfkthame)
See Also: → 1597680
Webcompat Priority: --- → ?
Webcompat Priority: ? → P3
Severity: normal → S3
Duplicate of this bug: 1822718

No currently known WebCompat breakage for this, unsetting the flag accordingly.

Webcompat Priority: P3 → ---
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: