Open Bug 2003395 Opened 5 months ago Updated 5 months ago

Firefox doesn't create linebreak opportunities for spaces inside of `rb` elements

Categories

(Core :: Layout: Ruby, defect)

defect

Tracking

()

People

(Reporter: dholbert, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: webcompat:platform-bug)

User Story

user-impact-score:90

Attachments

(5 files)

Attached file testcase 1

STR:

  1. Load attached testcase.

EXPECTED RESULTS:
Text should linewrap (one word on each line).

ACTUAL RESULTS:
Text does not linewrap.

This testcase just has some <rb> elements with a space at the end of each one (before the closing </rb> tag). That should create a linewrap opportunity, and it does in Chrome, but doesn't in Firefox.

This is the root cause of WebCompat Site Report bug 2003019.

Here's a reference case where I simply replaced the rb elements with span elements. In this case, we do linewrap as expected.

(Chrome gives the same linewrapping results for testcase 1 and this reference case.)

Notably: if I adjust the testcases to move the spaces outside of the rb tags (as in this version), then we get the correct rendering.

Attachment #9530175 - Attachment description: reference case 1b (moved spaces out to be between rb tags) → reference case 1b (moved spaces out to be between rb tags in a single <ruby>

Here's another interesting testcase where we differ from Chrome.

For this one, we don't even render the spaces at all -- we show Doesthistextlinewrap (though the spaces are included if you copy the text to clipboard).

Chrome renders this testcase the same as all the others here (with linebreaks, and with spaces that do render properly if I increase the container width so that linebreaking isn't necessary).

Attachment #9530173 - Attachment description: reference case 1 → reference case 1a (replaced rb tags with spans)
User Story: (updated)

FWIW, the behavior in testcase 2 is expected per CSS Ruby spec:

Trim leading/trailing white space: Any intra-ruby white space that is not the sole in-flow child of its parent and is the first or last in-flow child of a ruby container, ruby annotation container, or ruby base container is removed, as if it had display: none

For the initial testcase, I tend to agree there probably should be a break opportunity. We do have code handling its line breaking, and it seems to at least works correctly for Chinese and Japanese. I'm not sure what happens to the whitespaces.

Attached file modified testcase 1

Note that the line wrapping is handled correctly for Chinese and Japanese here. Specifically, it can't break between the question mark and Chinese character / kana before, and it can't break between kana and as well, even if they are at <rb> boundary.

User Story: (updated)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: