Fix text positioning with non-bmp characters.
authorpdr@google.com <pdr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Jul 2012 10:29:08 +0000 (10:29 +0000)
committerpdr@google.com <pdr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Jul 2012 10:29:08 +0000 (10:29 +0000)
commitaf7cdc8773e18ac3e8a6c4b966a125ac7703920f
tree82146190438acbfb25ad3493fdf6c5f35a268d92
parent1d0bfe4ef4fe8f675b1e083bada5193fef1130e2
Fix text positioning with non-bmp characters.
https://bugs.webkit.org/show_bug.cgi?id=87681

Reviewed by Nikolas Zimmermann.

Source/WebCore:

Previously when constructing metrics for tspans with non-bmp characters,
each non-bmp character treated as a skipped character in the same way that
spaces are ignored.
This made sense because the initial SVGCharacterDataMap for <text> is
indexed by character index (not string length) so the high portion of a
non-bmp character was treated as a skipped space. Unfortunately, this
led to a bug because skipped spaces lead to an offset in the positioning
values list but non-bmp characters do not.

This change switches the code to use a new offset for non-bmp characters,
surrogatePairCharacters, which does not affect the positioning values list.

Tests: svg/text/non-bmp-tspans-expected.svg
       svg/text/non-bmp-tspans.svg

* rendering/svg/SVGTextMetricsBuilder.cpp:
(WebCore::SVGTextMetricsBuilder::measureTextRenderer):

LayoutTests:

* svg/text/non-bmp-tspans-expected.svg: Added.
* svg/text/non-bmp-tspans.svg: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121756 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/svg/text/non-bmp-tspans-expected.svg [new file with mode: 0644]
LayoutTests/svg/text/non-bmp-tspans.svg [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/svg/SVGTextMetricsBuilder.cpp