Closed
Bug 1478574
Opened 6 years ago
Closed 6 years ago
spurious break immediately before an explicit hyphen when hyphens:auto is in effect
Categories
(Core :: Layout: Text and Fonts, defect, P2)
Core
Layout: Text and Fonts
Tracking
()
VERIFIED
FIXED
mozilla63
Tracking | Status | |
---|---|---|
firefox-esr52 | --- | unaffected |
firefox-esr60 | --- | wontfix |
firefox61 | --- | wontfix |
firefox62 | --- | wontfix |
firefox63 | --- | verified |
People
(Reporter: jfkthame, Assigned: jfkthame)
References
Details
(Keywords: regression)
Attachments
(4 files)
393 bytes,
text/html
|
Details | |
2.27 KB,
patch
|
dbaron
:
review+
|
Details | Diff | Splinter Review |
1.58 KB,
patch
|
dbaron
:
review+
|
Details | Diff | Splinter Review |
40.80 KB,
image/png
|
Details |
Observed while testing bug 1476437: when there is an explicit hyphen in a word, and auto-hyphenation also operates on one (or both) of the parts of the word, we incorrectly introduce an extra hyphenation break immediately -before- the explicit hyphen. So rendering is OK for: data:text/html,<div lang="en" style="width:0;hyphens:auto">hard-hit (breaks only at the explicit hyphen), but with: data:text/html,<div lang="en" style="width:0;hyphens:auto">hard-hitting we correctly hyphenate "hitting", but also introduce an extra break before the existing hyphen (oops!), and end up with: hard- - hit- ting which is clearly wrong. This is a regression from bug 1056516.
Assignee | ||
Comment 1•6 years ago
|
||
This is caused by an off-by-one error at https://searchfox.org/mozilla-central/rev/943a6cf31a96eb439db8f241ab4df25c14003bb8/layout/generic/nsTextFrame.cpp#3646, where we're recording the position of an explicit hyphen. Potential line-break positions are recorded on the character -after- the potential break (the clue is in the name of the array 'aBreakBefore'), when we find a hyphen at position /i/ in the range, we should set the HyphenType::Explicit flag at /i+1/, otherwise we're recording a potential line-break -before- the hyphen character.
Assignee | ||
Comment 2•6 years ago
|
||
The testcase in reftest form, as we clearly don't have enough test coverage of the various edge-cases around here. :(
Attachment #8995108 -
Flags: review?(dbaron)
Assignee | ||
Updated•6 years ago
|
Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Assignee | ||
Comment 3•6 years ago
|
||
Ideally, this wants to land before bug 1476437, as this error also impacts the first of the reftests to be added there.
Attachment #8995112 -
Flags: review?(dbaron)
Assignee | ||
Comment 4•6 years ago
|
||
Try run (together with bug 1476437): https://treeherder.mozilla.org/#/jobs?repo=try&revision=e6fcbb7728907de2775b94896dd82c7a76aea5df
Comment on attachment 8995108 [details] [diff] [review] Reftest for interaction of explicit hyphen and auto-hyphenation in the same word r=dbaron, although I wonder whether maybe these should be contributed to the CSS test suite (even though you can't really guarantee what the English hyphenation rules are)...
Attachment #8995108 -
Flags: review?(dbaron) → review+
Attachment #8995112 -
Flags: review?(dbaron) → review+
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/edb45de7ff9d Reftest for interaction of explicit hyphen and auto-hyphenation in the same word. r=dbaron https://hg.mozilla.org/integration/mozilla-inbound/rev/144a3d2b7da9 Fix off-by-one error in marking explicit hyphens, so we don't introduce spurious pre-hyphen breaks. r=dbaron
Assignee | ||
Comment 7•6 years ago
|
||
Agreed, ideally we'd move various of these tests to the CSS suite, but to do that we'd need to consider how to test without depending on the exact breaks implemented by hyphens:auto. I'm not sure how much variability there currently is between browsers' hyphenation rules. Maybe it'd be OK to just use words where it's particularly obvious what the "only" reasonable hyphenation would be, even though the spec does not mandate following a specific dictionary or whatever...
Comment 8•6 years ago
|
||
Backed out 5 changesets (bug 1478574) for failing hyphenation-control-5.html on windows builds Backout: https://hg.mozilla.org/integration/mozilla-inbound/rev/08a5e31e37ae9be1d1d352f50432a574ce25f50a Push with the failures: https://treeherder.mozilla.org/#/jobs?repo=mozilla-inbound&revision=d8d3c9e7b8323246f21a8142571b99fc5f80b93b Failure log: https://treeherder.mozilla.org/logviewer.html#?job_id=190673432&repo=mozilla-inbound&lineNumber=29204
Flags: needinfo?(jfkthame)
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/5f98633a0e8f Reftest for interaction of explicit hyphen and auto-hyphenation in the same word. r=dbaron https://hg.mozilla.org/integration/mozilla-inbound/rev/0f907558ec7f Fix off-by-one error in marking explicit hyphens, so we don't introduce spurious pre-hyphen breaks. r=dbaron
Assignee | ||
Comment 10•6 years ago
|
||
The reftest failure just shows a minor DirectWrite antialiasing difference on the trailing edge of the hyphen glyph; added the necessary fuzzy-if() annotation and re-landed.
Flags: needinfo?(jfkthame)
Comment 11•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/5f98633a0e8f https://hg.mozilla.org/mozilla-central/rev/0f907558ec7f
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox63:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Comment 12•6 years ago
|
||
Comment 13•6 years ago
|
||
Hi everyone, I retested this issue in the latest version of Firefox Nightly 63.0a1 (2018-08-01), and even though it's an improvement on the old builds, it still splits differently than Chrome, can you guys take a look at the attachment and tell me if this is how its suppose to be so we can confirm it as fixed.
Updated•6 years ago
|
status-firefox61:
--- → affected
status-firefox62:
--- → affected
Assignee | ||
Comment 14•6 years ago
|
||
Firefox is using auto hyphenation on the parts of the already-hyphenated word, while Chrome isn't. The spec[1] says > Automatic hyphenation opportunities within a word must be ignored if the word contains > a conditional hyphen (­ or U+00AD), in favor of the conditional hyphen(s). However, > if, even after breaking at such opportunities, a portion of that word is is still too > long to fit on one line, an automatic hyphenation opportunity may be used. so it explicitly allows this behavior. It looks like Chrome doesn't use automatic hyphenation if the resulting word fragments still don't fit within the available width. That's kind of an odd quirk in their implementation, I think, and means that setting width:0 (as in the testcase here) doesn't work to trigger "all possible breaks". E.g. compare Firefox and Chrome rendering for data:text/html,<div lang="en" style="font-family:monospace;width:5ch;hyphens:auto">supercalifragilisticexpialidocious I'd argue the Firefox result is more sensible/useful, and should be considered correct. Indeed, given that the spec[2] says > When wrapping is enabled (see white-space), the UA must minimize the amount of content > overflowing a line by wrapping the line at a soft wrap opportunity, if one exists. I believe Chrome is wrong: it is failing to use auto-hyphenation wrap opportunities to minimize the amount of overflow. [1] https://drafts.csswg.org/css-text/#valdef-hyphens-auto [2] https://drafts.csswg.org/css-text/#line-breaking
Assignee | ||
Comment 15•6 years ago
|
||
FTR, I've filed https://bugs.chromium.org/p/chromium/issues/detail?id=870219 to report Chrome's incorrect behavior.
Comment 16•6 years ago
|
||
Based on the improvements from older versions and the content from Comment 14, I will mark this issue Verified as Fixed.
Status: RESOLVED → VERIFIED
Updated•6 years ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•