[webkit-reviews] review requested: [Bug 17427] Line breaking opportunities at the end of a text node are missed : [Attachment 164327] Proposed patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Sep 16 17:25:04 PDT 2012


Alex Henrie <alexhenrie24 at gmail.com> has asked	for review:
Bug 17427: Line breaking opportunities at the end of a text node are missed
https://bugs.webkit.org/show_bug.cgi?id=17427

Attachment 164327: Proposed patch
https://bugs.webkit.org/attachment.cgi?id=164327&action=review

------- Additional Comments from Alex Henrie <alexhenrie24 at gmail.com>
I've written a patch that fixes this bug. It determines whether or not a line
break is possible immediately before a text node by running the line-breaking
algorithm on a temporary string made from the first two UChars of that text
node and the last two UChars of the preceding text node. I chose this approach
over adding a 'context' parameter to TextBreakIterator for two reasons: First,
I could not figure out how to combine two UChar* strings into a UText without
allocating a new string and copying them both into it, and second, because it
would have required much more intrusive changes for a dubious benefit.

I noticed that my patch causes LayoutTests/fast/text/international/003.html and
LayoutTests/fast/text/international/text-combine-image-test.html to "fail". I
believe that my patch actually makes the rendering of 003.html more correct
because it correctly allows a line break between the number 20 and the
character 日. As far as text-combine-image-test.html, I do not believe that this
page renders correctly with or without the patch because the text should render
in a single vertical column, the same as if it had no markup. For what it's
worth, I think the page looks a little nicer with the patch than without.

Even if you think there is a better approach, could this patch be accepted as
an interim solution? This bug needs to be fixed to make the best use of limited
screen space on mobile devices, for consistency with other web browsers and
applications in general, and for web applications such as [1] that require line
breaking to be consistent.

[1] http://meta.wikimedia.org/wiki/User:Remember_the_dot/Syntax_highlighter


More information about the webkit-reviews mailing list