word-wrap:break-word should not break up base+diacritic clusters or surrogate pairs

RESOLVED FIXED in mozilla15

Status

()

Core
Layout: Text
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: jfkthame, Assigned: jfkthame)

Tracking

unspecified
mozilla15
x86
Mac OS X
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Assignee)

Description

5 years ago
The word-wrap:break-word property (being renamed to overflow-wrap in CSS3 Text) inappropriately causes breaks between a base character and its applied diacritics, and (even worse) breaks between the two code units of a surrogate pair.

Testcase:
data:text/html;charset=utf-8,
  <div style="width:0px;word-wrap:break-word">abc d̥e̕f̣  
(Assignee)

Comment 1

5 years ago
Argh, I forgot bugzilla would truncate my text as soon as it encountered a surrogate codepoint.

Trying again....

data:text/html;charset=utf-8,
  <div style="width:0px;word-wrap:break-word">abc d̥e̕f̣ %F0%90%90%80%F0%90%90%81%F0%90%90%82

Note the "blank" lines between the Deseret letters, because internally we split the low surrogate onto a separate line. (The fact that they're split across lines can be demonstrated by drag-selecting one of the Deseret glyphs (or hexboxes), *or* one of the invisible blanks in between them, and copy-pasting it into the search box - you get just the single, unpaired surrogate codepoint.)
(Assignee)

Comment 2

5 years ago
Created attachment 621571 [details] [diff] [review]
patch, respect clusters when doing word-wrap:break-word

It looks like this can be trivially fixed, actually - we just need to check whether the current character is a cluster start when considering a possible breakpoint for word-wrap:break-word.
Assignee: nobody → jfkthame
Attachment #621571 - Flags: review?(smontagu)
(Assignee)

Comment 3

5 years ago
Created attachment 621572 [details] [diff] [review]
add a reftest for word-wrap cluster support
Attachment #621572 - Flags: review?(smontagu)
Attachment #621571 - Flags: review?(smontagu) → review+
Attachment #621572 - Flags: review?(smontagu) → review+
(Assignee)

Comment 4

5 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/9b57d5c5a713
https://hg.mozilla.org/integration/mozilla-inbound/rev/88c5fc8ffd6c
Target Milestone: --- → mozilla15
https://hg.mozilla.org/mozilla-central/rev/9b57d5c5a713
https://hg.mozilla.org/mozilla-central/rev/88c5fc8ffd6c
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.