{inc} style of :first-letter used to erroneously calculate (intrinsic) width of element
Categories
(Core :: Layout, defect)
Tracking
()
People
(Reporter: martijn.martijn, Assigned: jfkthame)
References
(Depends on 1 open bug)
Details
(Keywords: parity-chrome, regression, testcase)
Attachments
(11 files, 1 obsolete file)
131 bytes,
text/html
|
Details | |
656 bytes,
application/xhtml+xml
|
Details | |
1.28 KB,
text/html
|
Details | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
Bug 385615 - Revert backout changeset 709248f1fc69, to re-land the original patch stack. (no review)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
Updated•17 years ago
|
Comment 8•14 years ago
|
||
Comment 11•13 years ago
|
||
Comment 13•12 years ago
|
||
Comment 15•12 years ago
|
||
Updated•11 years ago
|
Comment 18•11 years ago
|
||
Comment 20•10 years ago
|
||
Assignee | ||
Comment 23•8 years ago
|
||
Updated•6 years ago
|
Updated•5 years ago
|
Comment hidden (off-topic) |
Updated•3 years ago
|
Updated•2 years ago
|
Comment 37•2 years ago
|
||
The severity field for this bug is relatively low, S3. However, the bug has 24 duplicates and 14 votes.
:dholbert, could you consider increasing the bug severity?
For more information, please visit auto_nag documentation.
Comment 38•2 years ago
|
||
The last needinfo from me was triggered in error by recent activity on the bug. I'm clearing the needinfo since this is a very old bug and I don't know if it's still relevant.
Comment 40•1 year ago
|
||
I just ran in to this same issue: CodePen example. https://codepen.io/rickdoesburg/pen/KKbjKpB
Comment 41•10 months ago
•
|
||
Bit of an update. I ran into what appears to be the same behaviour, and came up with a workaround.
https://m8y.org/tmp/testcase502.xhtml
The desired behaviour was that the elements would be the width of the first letter and no more. What was happening was that they were wider than this. -But, by an amount that did not seem to be related to the length of the overall content, or the width of the first letter, or the default styling of the span-. CORRECTION. I had tested wrong element when I added extra content (the fix one). It is indeed using first-letter styling for all letters, confirmed by adding a lot more text to the 2nd span. Sorry. So it is indeed this bug...
However! I did verify that this is "fixed" by adding a CSS animation :D :D :D
So. Since this is the same issue as people are experiencing here, there is a (silly) workaround for Firefox you can drop into your stylesheet.
Checkout the max-width test in the 2nd portion. I'm just adding an animation that shrinks the max-width by 1% for 0.01s, no repeat. This change which seems to get ignored by everyone else since it shouldn't impact the layout, causes a recalculation in Firefox.
Comment 42•7 months ago
|
||
None of the real-world sites linked in the see-also's and in the see-alos's of dependencies/duplicates of this bug still exist or show an issue. So all we have is isolated test-cases - unsetting the webcompat-priority flag per our rules.
Comment 43•7 months ago
|
||
(In reply to Dennis Schubert [:denschub] from comment #42)
None of the real-world sites linked in the see-also's and in the see-alos's of dependencies/duplicates of this bug still exist or show an issue. So all we have is isolated test-cases - unsetting the webcompat-priority flag per our rules.
I created several sites affected by this bug during the COVID-19 pandemic for various small businesses and nonprofits. Several of those sites are still out there. Here are a couple of examples:
Comment 44•7 months ago
|
||
Thanks for the nudge! I don't see an obvious difference in how those sites render in a quick test. But given your message (and a quick chat with dholbert just now), I'll restore the webcompat-priority to a P3. If you have examples where this is visually affecting the layout, I do encourage you to file a new bug in the Web Compatibility::Site Reports component, that would make it much easier for us to track! :)
Assignee | ||
Comment 45•6 months ago
|
||
Given the regularity with which we get dupes reported here, I think this deserves to be higher than a webcompat-P3.... yes, sites from old reports may no longer exist (or have changed to avoid the bug), but authors keep running into this, realizing it's a Firefox bug, and filing new bugs with new testcases based on whatever they were trying to do on their site.
I count at least 40-plus separate reports across the years, all stemming from this same root issue, which I think indicates that it's causing ongoing difficulties for web developers.
Comment 46•6 months ago
|
||
I think revisit
is the wrong tag tho, that's "let's revisit it at some point in the future", I believe :)
Comment 47•6 months ago
•
|
||
So... I agree with jfkthame... I run into this periodically, realise it's the same issue I've worked around before, and work around it again by slapping an extra element in or doing something else (like that css animation). That doesn't mean it isn't annoying.
And, yeah, the workaround I gave in comment #41 is a testcase, but I can't link you to the actual site since it's an internal site.
If I ever use that workaround on a public site, I'll be sure to link it.
Updated•6 months ago
|
Updated•6 months ago
|
Comment 48•6 months ago
|
||
Thanks for flagging this again! It's right, we do see a lot of duplicates, and it can be a significant visual difference. P2 seems right. We'll import the existing webcompat-reports to Bugzilla soon so we can properly score this.
Comment 49•6 months ago
|
||
Verified this issue and could not reproduce it on Firefox Nightly. Since the issue is addressing an internal site to which we do not have access, and with the given test case I could not reproduce, I will leave this issue opened.
Tested with:
Browser / Version: Firefox Nightly 128.0a1 (2024-05-21) (64-bit)
Operating System: Windows 10 PRO x64
Assignee | ||
Comment 50•6 months ago
|
||
(In reply to Raul Bucata from comment #49)
Verified this issue and could not reproduce it on Firefox Nightly.
This does reproduce in Nightly, e.g. with the testcases attached here.
E.g. load https://bugzilla.mozilla.org/attachment.cgi?id=269562. Observe that the button has quite a lot of padding each side. Now press Ctrl-+ to zoom the page, and then Ctrl-0 to reset the zoom level. Observe how the button size unexpectedly changes when the page is zoomed. This is because it was incorrect after the initial reflow.
Similarly, load https://bugzilla.mozilla.org/attachment.cgi?id=562320. Observe how the shaded backgrounds don't match the width of the text in the various elements. Again, zoom the page to force a reflow, and see how it corrects itself.
Comment 51•6 months ago
|
||
I just reran my testcase in comment #41 (click on the link - it's a public demo) and verified that the bug still occurs in latest nightly as of 2024-05-22
I can also confirm that my workaround in that same testcase still works, if people want to use that (it's a simple drop-in CSS hack).
Comment 52•6 months ago
•
|
||
Important note with regards to comment #49 - if it seems "Fixed" in nightly, try refreshing the page. The rendering bug seems inconsistent and breaks 95% of the time but not, you know, 100%. I don't know what the reasons for that are. Caching? Something triggering a similar recalculation to my CSS hack? Verified the bug still is active in nightly on Linux and Windows 10.
Updated•6 months ago
|
Comment 53•6 months ago
•
|
||
See testcase, when clicking on the button, it shrinks
I assume Raul's comment 49 was going off of these^ instructions from comment 0. For me too, this part doesn't reproduce anymore (the button doesn't change size for me when clicked), but that's probably just because we've gotten smarter about avoiding unnecessary reflow when the button is clicked in this case. The fact remains that we start out with the button too large, and that's the bug here; and the button does still unexpectedly shrink if you use full-page zoom (which does force it to reflow). I added a note to the attachment description to make that clearer.
Comment 54•6 months ago
|
||
Ah. Gotcha. Good to know.
For my part, I had just switched back to the Windows 10 VM at work where I was rechecking testcase502.xhtml and was shocked that the first red line was same width as the 2nd, so I added a "not 100%" addendum. I have no idea what caused that to happen though. Maybe due to my updating the nightly? Reconnecting to VM/window resize? In any case the bug reappeared when I refreshed.
Comment 55•6 months ago
•
|
||
Indeed, zooming in and out reproduces the bug. Also, refreshing the page without doing any zooming on the page shows a different button size compared to Chrome.
I was confused by the original STRs: "See testcase, when clicking on the button, it shrinks", which is usually our to-go STRs. But will take that into consideration for future references. Thanks for the heads-up.
Assignee | ||
Comment 56•6 months ago
|
||
No behavior change here, just factoring out a helper that will be wanted
for the following patch.
Updated•6 months ago
|
Assignee | ||
Comment 57•6 months ago
|
||
If we're querying the intrinsic widths of a first-letter and its continuation
before they have been reflowed, we need to check the extent of the first-letter
text (similarly to what nsTextFrame::ReflowText does) to avoid measuring too
much of the content using the first-letter styling.
This patch checks the first-letter length during intrinsic size computation,
but does not actually work in most cases because nsTextFrame::SetLength will
bail out if there is not already a next-in-flow frame. The following patch
will address that.
Assignee | ||
Comment 58•6 months ago
|
||
This is an alternative version of SetLength to be used for the child of an nsFirstLetterFrame,
when we may need to create continuations in order to separate the first-letter from its
following text.
With this, the intrinsic sizes of first-letter should be computed correctly.
Assignee | ||
Comment 59•6 months ago
|
||
Also add an extra first-letter-width testcase (based on a case that was still failing
with an earlier iteration of the fix).
Comment 60•5 months ago
|
||
Assignee | ||
Comment 62•5 months ago
|
||
Comment 63•5 months ago
|
||
Comment 64•5 months ago
|
||
Comment 65•5 months ago
|
||
Comment 66•5 months ago
|
||
Comment 67•5 months ago
|
||
Comment 68•5 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/5cd51f055a1a
https://hg.mozilla.org/mozilla-central/rev/82242b2d942d
https://hg.mozilla.org/mozilla-central/rev/30718580670d
https://hg.mozilla.org/mozilla-central/rev/36fc4e06713d
https://hg.mozilla.org/mozilla-central/rev/f6022837406b
https://hg.mozilla.org/mozilla-central/rev/07004e2608f3
https://hg.mozilla.org/mozilla-central/rev/fe82d67b63ef
https://hg.mozilla.org/mozilla-central/rev/f9c2e5707d43
https://hg.mozilla.org/mozilla-central/rev/aec1be189f68
Updated•5 months ago
|
Assignee | ||
Comment 71•5 months ago
|
||
Comment 72•5 months ago
|
||
Comment 73•5 months ago
|
||
Comment 75•5 months ago
|
||
bugherder |
Updated•5 months ago
|
Comment 77•5 months ago
|
||
bugherder |
Comment 78•5 months ago
|
||
I think this was closed accidentally.
Updated•5 months ago
|
Assignee | ||
Comment 79•5 months ago
|
||
This reverts the backout, effectively re-landing all the original patches here and the test-manifest
followups that were pushed after the original landing.
Assignee | ||
Comment 80•5 months ago
|
||
This fixes the fuzzer-found assertion reported in bug 1899840, as well as the real-world
website hangs reported in bug 1900169.
In addition, it adds a pref (layout.css.intrinsic-size-first-letter.enabled) that gates
the new functionality during intrinsic size computation. This gives us a way to easily
disable it in the event of other regressions showing up.
Also add the testcase from 1899840 as a wpt crashtest.
Comment 81•5 months ago
|
||
Comment 83•5 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/d8ab045a10e2
https://hg.mozilla.org/mozilla-central/rev/e07ecd4899ee
Updated•5 months ago
|
Description
•