Bug 18039 - dx causes non-BMP characters to fail to render
Summary: dx causes non-BMP characters to fail to render
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-23 23:57 PDT by Eric Seidel (no email)
Modified: 2011-12-02 13:07 PST (History)
7 users (show)

See Also:


Attachments
test case (284 bytes, image/svg+xml)
2008-03-23 23:57 PDT, Eric Seidel (no email)
no flags Details
patch (5.71 KB, patch)
2011-11-18 16:14 PST, Tim Horton
no flags Details | Formatted Diff | Diff
patch (23.14 KB, patch)
2011-11-18 16:19 PST, Tim Horton
simon.fraser: review-
Details | Formatted Diff | Diff
patch, fixing style and no more constants (23.87 KB, patch)
2011-11-18 17:53 PST, Tim Horton
darin: review+
webkit.review.bot: commit-queue-
Details | Formatted Diff | Diff
patch, fixing both of Darin's notes (23.11 KB, patch)
2011-11-29 11:13 PST, Tim Horton
simon.fraser: review+
webkit.review.bot: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2008-03-23 23:57:17 PDT
dx causes surrogate pairs to fail to render

See test case.
Comment 1 Eric Seidel (no email) 2008-03-23 23:57:34 PDT
Created attachment 20000 [details]
test case
Comment 2 Alexey Proskuryakov 2009-02-12 05:47:55 PST
It's an internal implementation detail that we break this character into surrogate pairs in memory, so I've adjusted the title a little. Not because of me being mean, but because this did cause some confusion recently.
Comment 3 Tim Horton 2011-11-18 14:11:51 PST
<rdar://problem/10422142>
Comment 4 Tim Horton 2011-11-18 16:14:04 PST
Created attachment 115901 [details]
patch

I'm not sure this is *quite* right (ligatures of non-BMP characters won't work, I think), but it's a start.

This fixes both my test case and Eric's, without breaking any tests.
Comment 5 Tim Horton 2011-11-18 16:19:31 PST
Created attachment 115904 [details]
patch

I thought that patch seemed awfully small...
Comment 6 WebKit Review Bot 2011-11-18 16:22:06 PST
Attachment 115904 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/plat..." exit_code: 1

Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp:220:  An else should appear on the same line as the preceding }  [whitespace/newline] [4]
Total errors found: 1 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 7 Simon Fraser (smfr) 2011-11-18 16:28:39 PST
Comment on attachment 115904 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=115904&action=review

> Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp:210
> +                if (currentCharacter >= 0xD800 && currentCharacter <= 0xDBFF) {

I'd love to see an isSurrogatePair() function we can use, rather than magic hex values.
Comment 8 Tim Horton 2011-11-18 16:30:42 PST
(In reply to comment #7)
> (From update of attachment 115904 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=115904&action=review
> 
> > Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp:210
> > +                if (currentCharacter >= 0xD800 && currentCharacter <= 0xDBFF) {
> 
> I'd love to see an isSurrogatePair() function we can use, rather than magic hex values.

Dan just showed me SurrogatePairAwareTextIterator, so I'll make another patch to use that (or, failing that, the U16_IS_SURROGATE/U16_IS_SURROGATE_LEAD macros that already exist (which Font.h doesn't use?)) in a bit.
Comment 9 Tim Horton 2011-11-18 17:53:01 PST
Created attachment 115919 [details]
patch, fixing style and no more constants
Comment 10 Tim Horton 2011-11-18 17:54:29 PST
Switching to SurrogatePairAwareTextIterator caused more issues than I expected, so here's a copy using the macros, for now.
Comment 11 WebKit Review Bot 2011-11-18 19:53:25 PST
Comment on attachment 115919 [details]
patch, fixing style and no more constants

Attachment 115919 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/10495333

New failing tests:
svg/text/non-bmp-positioning-lists.svg
Comment 12 Darin Adler 2011-11-18 20:27:24 PST
Comment on attachment 115919 [details]
patch, fixing style and no more constants

View in context: https://bugs.webkit.org/attachment.cgi?id=115919&action=review

> Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp:210
> +                if (U16_IS_SURROGATE(currentCharacter) && U16_IS_SURROGATE_LEAD(currentCharacter)) {

Should be just:

    if (U16_IS_LEAD(currentCharacter))
Comment 13 Darin Adler 2011-11-18 20:28:31 PST
Comment on attachment 115919 [details]
patch, fixing style and no more constants

View in context: https://bugs.webkit.org/attachment.cgi?id=115919&action=review

> Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp:211
> +                    // Handle surrogate pairs.

I think this assumes a correctly-formed surrogate pair. It’s not so great to do that.
Comment 14 Tim Horton 2011-11-29 11:13:05 PST
Created attachment 117001 [details]
patch, fixing both of Darin's notes
Comment 15 WebKit Review Bot 2011-11-30 01:25:58 PST
Comment on attachment 117001 [details]
patch, fixing both of Darin's notes

Attachment 117001 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/10709099

New failing tests:
svg/text/non-bmp-positioning-lists.svg
svg/transforms/text-with-pattern-with-svg-transform.svg
Comment 16 Tim Horton 2011-11-30 11:22:22 PST
(In reply to comment #15)
> (From update of attachment 117001 [details])
> Attachment 117001 [details] did not pass chromium-ews (chromium-xvfb):
> Output: http://queues.webkit.org/results/10709099
> 
> New failing tests:
> svg/text/non-bmp-positioning-lists.svg
> svg/transforms/text-with-pattern-with-svg-transform.svg

I cannot reproduce a failure on that second test, plus it doesn't have any positioning lists. Pretty sure it's a lie, so I'm going to land this and keep an eye on it.
Comment 17 Tim Horton 2011-11-30 11:30:54 PST
Landed in r101537.
Comment 19 Tim Horton 2011-12-02 13:07:46 PST
(In reply to comment #18)
> Looks to be failing on lion:
> http://build.webkit.org/results/Lion%20Intel%20Release%20(Tests)/r101543%20(3091)/svg/text/non-bmp-positioning-lists-pretty-diff.html

I'll update my Lion machine and commit new baselines if needed momentarily.