Closed Bug 1837272 Opened 1 year ago Closed 1 year ago

abspos placeholder between adjacent inline elements prevents `text-transform:capitalize` from working on the second one

Categories

(Core :: Layout: Text and Fonts, defect)

Firefox 113
defect

Tracking

()

RESOLVED FIXED
117 Branch
Tracking Status
firefox-esr102 --- wontfix
firefox-esr115 --- wontfix
firefox115 --- wontfix
firefox116 --- wontfix
firefox117 --- fixed

People

(Reporter: chris, Assigned: jfkthame)

References

(Regression)

Details

(Keywords: regression)

Attachments

(4 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/113.0
Firefox for Android

Steps to reproduce:

Create a list of links:
<a href="#">about</a>
<a href="#">blogs</a>
<a href="#">contact</a>

Apply text-transform: capitalize:
a{
text-transform: capitalize;
position: relative;
}
Add a pseudo-element "::after":
a::after{
content: "";
position: absolute;
inset: 0;
outline:1px dashed red;
}

Note - this only happens on the "after" pseudo-element. When using "before" the capitalisation occurs correctly.

Actual results:

Only the first anchor text got the capitalization.
All other links remained in lower case

Expected results:

The first letter of each word should be capitalized

Setting this issue to Core > CSS Parsing and Computation component, to allow our engineers to take a closer look at it. If this is not the right component, please assign a more appropriate one. Thanks!

Component: Untriaged → CSS Parsing and Computation
Product: Firefox → Core
Attached file testcase 1

Thanks for the bug report! I can reproduce. Here's a testcase, not using ::after but instead just using an actual element in place of the pseudo-element that ::after generates. So: this isn't specific to pseudo-elements. It seems to be related to the absence of whitespace, too, as shown when comparing the upper vs. lower half of this testcase.

It looks like when we've got two inline elements side by side, we treat each one as being a capitalizeable word. But when we've got an abspos element spliced between them with no whitespace, then we treat the second one as if it weren't a new word.

Severity: -- → S3
Status: UNCONFIRMED → NEW
Component: CSS Parsing and Computation → Layout: Text and Fonts
Ever confirmed: true

This seems to be a regression, though it's an old one.

Regression range:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=257f2c96cef502a1d674df56c8e39d76d8ed4d89&tochange=aaae630f30291056f4f40bbd9e12a917309e401e

Looks like a regression from bug 1418472. jfkthame, maybe you could take a look?

Flags: needinfo?(jfkthame)
Keywords: regression
Regressed by: 1418472
Summary: a tag with pseudo element after breaks text-transform: capitalize → abspos placeholder between adjacent inline elements prevents `text-transform:capitalize` from working on the second one

Set release status flags based on info from the regressing bug 1418472

The issue here was that the 8-bit version of AppendText failed to reset the flag on space.
Where text-transform:capitalize is applied to a multi-word chunk of text, this wasn't an issue
because AppendText delegates to the more comprehensive 16-bit version whenever capitalization
is requested, so only that version cares about the word-continuation flag.

However, in this case the whitespace between the spans does not itself have the capitalization
property set, and so it doesn't go via the 16-bit function, and we failed to clear the flag.

Assignee: nobody → jfkthame
Status: NEW → ASSIGNED

No functional change, just cleaning up minor code formatting issues I noticed while reading this file.

Depends on D183251

Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9733569bfd85
patch 1 - Ensure the 8-bit version of nsLineBreaker::AppendText clears the word-continuation flag on encountering space. r=emilio
https://hg.mozilla.org/integration/autoland/rev/a7a9a2467492
patch 2 - Clean up some trivial code-style violations in nsLineBreaker. r=emilio
https://hg.mozilla.org/integration/autoland/rev/e3c9958afc20
patch 3 - Add the testcase here as a WPT reftest. r=emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/40989 for changes under testing/web-platform/tests
Upstream PR merged by moz-wptsync-bot
Flags: needinfo?(jfkthame)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: