abs-pos placeholder may end up on the wrong side of a line-break [was: Wrong position of github issue name on hover]
Categories
(Core :: Layout, defect, P3)
Tracking
()
People
(Reporter: sviter33, Assigned: jfkthame)
References
Details
(Whiteboard: [webcompat][wptsync upstream])
Attachments
(6 files)
Comment 1•8 years ago
|
||
Comment 3•8 years ago
|
||
Comment 4•8 years ago
|
||
Updated•8 years ago
|
![]() |
||
Comment 6•8 years ago
|
||
Comment 7•8 years ago
|
||
Assignee | ||
Comment 8•8 years ago
|
||
Assignee | ||
Comment 9•8 years ago
|
||
Comment 10•8 years ago
|
||
Comment 11•8 years ago
|
||
Assignee | ||
Comment 12•8 years ago
|
||
Assignee | ||
Comment 13•8 years ago
|
||
Updated•8 years ago
|
Comment 14•8 years ago
|
||
Comment 15•8 years ago
|
||
Comment 16•8 years ago
|
||
Updated•8 years ago
|
Assignee | ||
Updated•7 years ago
|
Comment 17•6 years ago
|
||
Migrating Webcompat whiteboard priorities to project flags. See bug 1547409.
Comment 18•6 years ago
|
||
See bug 1547409. Migrating whiteboard priority tags to program flags.
Assignee | ||
Comment 19•6 years ago
|
||
Here's a further testcase, showing examples where Firefox inappropriately allows a line-break after the placeholder of an abs-pos element adjacent to the start of a word. The issue can be demonstrated both using ::before to insert the abs-pos (as in the original Github example) or using an element that is inline in the text, but styled with position:absolute. Note how in some cases not only the abs-pos element is misplaced, but also the left border of the target span ("jumps") appears at the end of the preceding line.
In Chrome and Safari, the red "before" border and the abs-pos element consistently stay at the left edge of the target span, as would be expected.
(Note that Github appears to have made major changes to their styling of the pages where this was originally reported, so the issue no longer occurs there. However, the underlying Firefox bug is still present, as demonstrated in the attached testcases, and may still be affecting other sites.)
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Comment 20•6 years ago
|
||
The problem here arises because by the time we discover that the "target" word (e.g. the issue number in the original Github example) doesn't fit on the line, we've already appended the preceding placeholder frame to the nsLineLayout that we're building. And if it was generated by the ::before pseudo of a span, or if it occurred immediately after the beginning of a real <span> element, we'll also have begun that span on the line before the break, even though none of its actual content ends up fitting.
There's a fairly simple fix for the worst of this, it seems: if we force the BuildTextRunsScanner to do a FlushFrames() when it encounters the placeholder, then the potential line-break before the placeholder will be correctly recorded. The downside of this is that it will interrupt the textrun at this point, which means that shaping (effects like ligatures and kerning) will break across the position of the abs-pos placeholder, even if the possible line-break ends up not being used.
This also affects the implementation of text-transform:capitalize, meaning that a placeholder within a word would cause the following letter to be treated as the start of a new word, and hence capitalized. However, we can work around that by recording whether the line-breaker is in the middle of a word at the time of calling FlushFrames, and if so, suppress capitalization of the first letter after the flush.
A better fix might be possible if we could loosen the coupling between scanning frames in BuildTextRunsScanner and appending them to the nsLineLayout, so that we don't actually begin a new span within the line, or add the placeholder to it, until we've determined that we are actually adding in-flow content as well. But this seems much more invasive and risky, so I'm inclined to start with the simple fix. We can also add a test to cover this example, so that we can check for any changes in behavior if/when we restructure the code more extensively.
Assignee | ||
Comment 21•6 years ago
|
||
Assignee | ||
Comment 22•6 years ago
|
||
Depends on D32022
Comment 23•6 years ago
|
||
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Assignee | ||
Comment 24•6 years ago
|
||
Bug 1553418 discusses the issue raised by the attachment 9066458 [details] testcase, which is a somewhat separate (pre-existing) bug/interop issue.
Comment 25•6 years ago
|
||
Comment 28•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/03ffbd776c1e
https://hg.mozilla.org/mozilla-central/rev/97a9fa27755b
Updated•6 years ago
|
Description
•