Open Bug 1347812 Opened 4 years ago Updated 3 years ago

Consecutive percent signs arbitrarily wrap after every 6 characters (but not if there are fewer than 12 on the line)

Categories

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

defect

Tracking

()

Tracking Status
firefox55 --- affected

People

(Reporter: dholbert, Unassigned)

References

Details

Attachments

(5 files)

STR:
 1. Load attached testcase.

EXPECTED RESULTS:
Each bordered box of percent characters should be on a single line (and overflow its bordered box).

ACTUAL RESULTS:
The percent characters wrap after 6 characters -- but not if there are fewer than 12 characters on the line.  (So anywhere up to 11 % characters will not wrap -- but 12 will wrap to two lines of 6.)  This also doesn't have much to do with the available space -- if they wanted to avoid overflow, they'd need to wrap after only a few characters.

Other browsers don't seem to have this odd behavior. And in Firefox, I can only reproduce this with percent characters in particular (so far).

(I discovered this while playing with testcases for bug 1347808, a somewhat related bug about long strings of hyphens.)
Attached file testcase 1
(Here's a similar testcase but now using a monospace font, so that I can use an "em" div width and have it be about the same (relative to the text) on all platforms.)
Attachment #8847915 - Attachment description: testcase 2 (using monospace) → testcase 2 (using monospace font)
Here's a variant of testcase 2 with wider divs. The line-wrapping does not change -- it's the same as in testcase 2 -- despite the fact that we could now fit more percent characters on the first line without overflow.
Attachment #8847917 - Attachment description: testcase 2 (same as previous but with wider div) → testcase 3 (same as previous but with wider div)
And here's one more testcase the same as the previous two but with a *much* wider div.  It shows that we do finally stop wrapping and lay the text out all on one line, once the whole line will definitely fit.
(In reply to Daniel Holbert [:dholbert] from comment #0)
> Other browsers don't seem to have this odd behavior. And in Firefox, I can
> only reproduce this with percent characters in particular (so far).

Specifically:
 - Chrome 55 places all of the percent signs on a single line.
 - Edge 14 wraps the percent sign as-needed to prevent overflow (but not in odd groupings of 6 like we do -- just when they hit the edge of the container).

Each of these behaviors make sense to me. Our behavior does not.
% is a special character, it's used in URL and may make the URL too long. Therefore, we treat it as breakable when it's in a long "word".
Ah, and "long word" = "12 or more consecutive characters on the same line", I suppose?

That makes some sense. Though it still seems like we should break at the last % that fits rather than arbitrarily at the 6th one. *shrug*
Yeah, in older build, perhaps, pre-Gecko-1.9, we didn't break long words like file path nor URL. That caused a lot of such long words are overflown from web page and caused unexpected horizontal scrollbars.

For solving that issue, we added new line break rules to break between ASCII characters too.  However, it caused regressions like breaking in datetiem format, smilies, etc.  Therefore, we backed out a part of the new break rules from "near" start and end from a word.  That's length is 6.  Therefore, 12 becomes a magic number, perhaps.
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.