[go: up one dir, main page]

Page MenuHomePhabricator

Bug 1855583: Empty text line should not give line height even with `white-space: pre`. r=#layout-reviewers
ClosedPublic

Authored by dshin on Nov 16 2023, 2:51 PM.
Referenced Files
Unknown Object (File)
Nov 13 2025, 12:40 PM
Unknown Object (File)
Oct 20 2025, 3:29 PM
Unknown Object (File)
Oct 16 2025, 2:26 PM
Unknown Object (File)
Oct 14 2025, 6:44 PM
Unknown Object (File)
Oct 14 2025, 2:38 AM
Unknown Object (File)
Aug 6 2025, 12:11 AM
Unknown Object (File)
Aug 5 2025, 11:50 AM
Unknown Object (File)
Aug 2 2025, 2:33 AM
Subscribers

Event Timeline

phab-bot changed the visibility from "Custom Policy" to "Public (No Login Required)".
phab-bot changed the edit policy from "Custom Policy" to "Restricted Project (Project)".
phab-bot removed a project: secure-revision.
emilio requested changes to this revision.Nov 16 2023, 3:35 PM

I don't think this is right, see incoming test-case on the bug.

layout/base/nsCSSFrameConstructor.cpp
1555 ↗(On Diff #787670)

Hmm... Are you sure this is how other browsers behave? I don't think it is: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/dom/pseudo_element.cc;l=308;drc=42f0b9c4f60f67676d9096b3e94df9fd47f568f4

Do we behave the same if we just have an empty inline with an empty text-node? You can create it with JS quite easily...

testing/web-platform/tests/css/css-pseudo/before-after-empty-content-ref.html
15 ↗(On Diff #787670)

content does nothing here, so maybe remove for clarity?

This revision now requires changes to proceed.Nov 16 2023, 3:35 PM
emilio added a project: testing-approved.

Ok, so I think I changed my mind about this, but the spec isn't super-clear. This seems sensible and should be reasonably close to what other browsers do.

I filed https://github.com/w3c/csswg-drafts/issues/9606 on this. Mind pointing to that issue in the test-case?

Also, probably wait until after the soft-freeze. It is probably also worth looking into making empty text-nodes not export a baseline more generally. I think your test-case should ideally behave the same for content: "" and content: attr(non-existent). Mind filing a follow-up for that at least?

testing/web-platform/tests/css/css-pseudo/before-after-empty-content.html
7 ↗(On Diff #787670)
This revision is now accepted and ready to land.Nov 16 2023, 4:02 PM
dshin retitled this revision from Bug 1855583: Do not generate text run for empty pseudoelement content. r=#layout-reviewers to Bug 1855583: Empty text line should not give line height even with `white-space: pre`. r=#layout-reviewers.
dshin marked 2 inline comments as done.
testing/web-platform/tests/css/css-pseudo/before-after-empty-content-ref.html
15 ↗(On Diff #787670)

That's actually not true, at least for ::before & ::after:

"When their computed content value is not none, these pseudo-elements generate boxes [...]"

testing/web-platform/tests/css/css-pseudo/before-after-empty-content-ref.html
15 ↗(On Diff #787670)

Right, my point is that in this rule there are no pseudo-elements, right?

This is fine, but we should probably also do your original frame constructor patch while at it. content: "" is common enough to be worth optimizing some frames around.

testing/web-platform/tests/css/css-pseudo/before-after-empty-content-ref.html
15 ↗(On Diff #787670)

*facepalm* right.

This is fine, but we should probably also do your original frame constructor patch while at it. content: "" is common enough to be worth optimizing some frames around.

I'll do that as part of bug 1865668

rebase, fix double space in comment

This revision is now accepted and ready to land.Nov 20 2023, 8:51 PM