Title: [101537] trunk
Revision
101537
Author
timothy_hor...@apple.com
Date
2011-11-30 11:30:08 -0800 (Wed, 30 Nov 2011)

Log Message

dx causes non-BMP characters to fail to render
https://bugs.webkit.org/show_bug.cgi?id=18039
<rdar://problem/10422142>

Reviewed by Simon Fraser.

Don't split the surrogate pairs of non-BMP characters across
elements of <text> positioning lists.

Test: svg/text/non-bmp-positioning-lists.svg

* rendering/svg/SVGTextLayoutAttributesBuilder.cpp:
(WebCore::SVGTextLayoutAttributesBuilder::propagateLayoutAttributes):

Add a test combining non-BMP characters and positioning lists.

* platform/mac/svg/text/non-bmp-positioning-lists-expected.png: Added.
* platform/mac/svg/text/non-bmp-positioning-lists-expected.txt: Added.
* svg/text/non-bmp-positioning-lists.svg: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (101536 => 101537)


--- trunk/LayoutTests/ChangeLog	2011-11-30 19:27:59 UTC (rev 101536)
+++ trunk/LayoutTests/ChangeLog	2011-11-30 19:30:08 UTC (rev 101537)
@@ -1,3 +1,17 @@
+2011-11-30  Tim Horton  <timothy_hor...@apple.com>
+
+        dx causes non-BMP characters to fail to render
+        https://bugs.webkit.org/show_bug.cgi?id=18039
+        <rdar://problem/10422142>
+
+        Reviewed by Simon Fraser.
+
+        Add a test combining non-BMP characters and positioning lists.
+
+        * platform/mac/svg/text/non-bmp-positioning-lists-expected.png: Added.
+        * platform/mac/svg/text/non-bmp-positioning-lists-expected.txt: Added.
+        * svg/text/non-bmp-positioning-lists.svg: Added.
+
 2011-11-30  Philippe Normand  <pnorm...@igalia.com>
 
         Unreviewed, skip the GTK tests failing since the font metrics change.

Added: trunk/LayoutTests/platform/mac/svg/text/non-bmp-positioning-lists-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/svg/text/non-bmp-positioning-lists-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/svg/text/non-bmp-positioning-lists-expected.txt (0 => 101537)


--- trunk/LayoutTests/platform/mac/svg/text/non-bmp-positioning-lists-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/svg/text/non-bmp-positioning-lists-expected.txt	2011-11-30 19:30:08 UTC (rev 101537)
@@ -0,0 +1,8 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderSVGRoot {svg} at (50,58) size 709x225
+    RenderSVGText {text} at (50,58) size 709x225 contains 1 chunk(s)
+      RenderSVGInlineText {#text} at (0,0) size 709x225
+        chunk 1 text run 1 at (50.00,240.00) startOffset 0 endOffset 2 width 159.00: "\x{D835}\x{DC9E}"
+        chunk 1 text run 1 at (600.00,240.00) startOffset 0 endOffset 2 width 159.00: "\x{D835}\x{DC9E}"

Added: trunk/LayoutTests/svg/text/non-bmp-positioning-lists.svg (0 => 101537)


--- trunk/LayoutTests/svg/text/non-bmp-positioning-lists.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/text/non-bmp-positioning-lists.svg	2011-11-30 19:30:08 UTC (rev 101537)
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="800">
+<title>There should be two green cursive capital Cs below, with ~400px of space between them.</title>
+<text x="50 600" y="240" style="font-size: 200px; font-family: arial; fill: green;">&#x1d49e;&#x1d49e;</text>
+</svg>

Modified: trunk/Source/WebCore/ChangeLog (101536 => 101537)


--- trunk/Source/WebCore/ChangeLog	2011-11-30 19:27:59 UTC (rev 101536)
+++ trunk/Source/WebCore/ChangeLog	2011-11-30 19:30:08 UTC (rev 101537)
@@ -1,3 +1,19 @@
+2011-11-30  Tim Horton  <timothy_hor...@apple.com>
+
+        dx causes non-BMP characters to fail to render
+        https://bugs.webkit.org/show_bug.cgi?id=18039
+        <rdar://problem/10422142>
+
+        Reviewed by Simon Fraser.
+
+        Don't split the surrogate pairs of non-BMP characters across
+        elements of <text> positioning lists.
+
+        Test: svg/text/non-bmp-positioning-lists.svg
+
+        * rendering/svg/SVGTextLayoutAttributesBuilder.cpp:
+        (WebCore::SVGTextLayoutAttributesBuilder::propagateLayoutAttributes):
+
 2011-11-29  Robin Dunn  <ro...@alldunn.com>
 
         [wx] Add a scope for the raw bitmap access so that wx

Modified: trunk/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp (101536 => 101537)


--- trunk/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp	2011-11-30 19:27:59 UTC (rev 101536)
+++ trunk/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp	2011-11-30 19:30:08 UTC (rev 101537)
@@ -203,18 +203,22 @@
             for (unsigned textPosition = 0; textPosition < textLength; textPosition += metricsLength) {
                 const UChar& currentCharacter = characters[textPosition];
 
-                SVGTextMetrics startToCurrentMetrics = SVGTextMetrics::measureCharacterRange(text, 0, textPosition + 1);
-                SVGTextMetrics currentMetrics = SVGTextMetrics::measureCharacterRange(text, textPosition, 1);
-                metricsLength = currentMetrics.length();
+                SVGTextMetrics startToCurrentMetrics;
+                SVGTextMetrics currentMetrics;
+                unsigned valueListAdvance = 0;
 
-                // Eventually handle surrogate pairs here.
-                if (!metricsLength) {
-                    if (textPosition + 1 == textLength)
-                        break;
-
+                if (U16_IS_LEAD(currentCharacter) && (textPosition + 1) < textLength && U16_IS_TRAIL(characters[textPosition + 1])) {
+                    // Handle surrogate pairs.
                     startToCurrentMetrics = SVGTextMetrics::measureCharacterRange(text, 0, textPosition + 2);
                     currentMetrics = SVGTextMetrics::measureCharacterRange(text, textPosition, 2);
                     metricsLength = currentMetrics.length();
+                    valueListAdvance = 1;
+                } else {
+                    // Handle BMP characters.
+                    startToCurrentMetrics = SVGTextMetrics::measureCharacterRange(text, 0, textPosition + 1);
+                    currentMetrics = SVGTextMetrics::measureCharacterRange(text, textPosition, 1);
+                    metricsLength = currentMetrics.length();
+                    valueListAdvance = metricsLength;
                 }
 
                 if (!metricsLength)
@@ -247,7 +251,7 @@
                 }
 
                 lastCharacter = currentCharacter;
-                valueListPosition += metricsLength;
+                valueListPosition += valueListAdvance;
             }
 
 #if DUMP_TEXT_LAYOUT_ATTRIBUTES > 0
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to