Title: [92005] trunk
Revision
92005
Author
m...@apple.com
Date
2011-07-29 13:20:52 -0700 (Fri, 29 Jul 2011)

Log Message

Source/WebCore: Added the regional indicator symbols to the set of codepoints that force use of the complex text code path.

Fixes <rdar://problem/9864578> Regional indicator symbols do not combine into national flags
https://bugs.webkit.org/show_bug.cgi?id=65380

Reviewed by Anders Carlsson.

Test: fast/text/regional-indicator-symobls.html

* platform/graphics/Font.cpp:
(WebCore::Font::codePath): Added handling of surrogate pairs, which returns Complex for characters in
the range U+1F1E6..U+1F1FF.

LayoutTests: Test for <rdar://problem/9864578> Regional indicator symbols do not combine into national flags
https://bugs.webkit.org/show_bug.cgi?id=65380

Reviewed by Anders Carlsson.

* fast/text/regional-indicator-symobls-expected.txt: Added.
* fast/text/regional-indicator-symobls.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (92004 => 92005)


--- trunk/LayoutTests/ChangeLog	2011-07-29 20:19:03 UTC (rev 92004)
+++ trunk/LayoutTests/ChangeLog	2011-07-29 20:20:52 UTC (rev 92005)
@@ -1,3 +1,13 @@
+2011-07-29  Dan Bernstein  <m...@apple.com>
+
+        Test for <rdar://problem/9864578> Regional indicator symbols do not combine into national flags
+        https://bugs.webkit.org/show_bug.cgi?id=65380
+
+        Reviewed by Anders Carlsson.
+
+        * fast/text/regional-indicator-symobls-expected.txt: Added.
+        * fast/text/regional-indicator-symobls.html: Added.
+
 2011-07-29  Anna Cavender  <ann...@chromium.org>
 
         Tests for validating a new WebVTT parser for <track>

Added: trunk/LayoutTests/fast/text/regional-indicator-symobls-expected.txt (0 => 92005)


--- trunk/LayoutTests/fast/text/regional-indicator-symobls-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/text/regional-indicator-symobls-expected.txt	2011-07-29 20:20:52 UTC (rev 92005)
@@ -0,0 +1,7 @@
+Test that regional indicator symobol letters can combine into national flags.
+
+The two boxes below should look the same.
+
+PASS
+
+πŸ‡¬πŸ‡§ πŸ‡ΊπŸ‡Έ πŸ‡¬πŸ‡§ πŸ‡ΊπŸ‡Έ

Added: trunk/LayoutTests/fast/text/regional-indicator-symobls.html (0 => 92005)


--- trunk/LayoutTests/fast/text/regional-indicator-symobls.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/regional-indicator-symobls.html	2011-07-29 20:20:52 UTC (rev 92005)
@@ -0,0 +1,25 @@
+<style>
+    span { border: solid; }
+    span#reference { text-rendering: optimizelegibility; }
+</style>
+<p>
+    Test that regional indicator symobol letters can combine into national flags.
+</p>
+<p>
+    The two boxes below should look the same.
+</p>
+<p id="result">
+    FAIL: Test did not finish.
+</p>
+<p style="font-size: 48px;">
+    <span id="test">&#x1f1ec;&#x1f1e7; &#x1f1fa;&#x1f1f8;</span>
+    <span id="reference">&#x1f1ec;&#x1f1e7; &#x1f1fa;&#x1f1f8;</span>
+</p>
+<script>
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+
+    var test = document.getElementById("test");
+    var reference = document.getElementById("reference");
+    document.getElementById("result").innerText = test.offsetWidth === reference.offsetWidth ? "PASS" : "FAIL";
+</script>

Modified: trunk/Source/WebCore/ChangeLog (92004 => 92005)


--- trunk/Source/WebCore/ChangeLog	2011-07-29 20:19:03 UTC (rev 92004)
+++ trunk/Source/WebCore/ChangeLog	2011-07-29 20:20:52 UTC (rev 92005)
@@ -1,3 +1,18 @@
+2011-07-29  Dan Bernstein  <m...@apple.com>
+
+        Added the regional indicator symbols to the set of codepoints that force use of the complex text code path.
+
+        Fixes <rdar://problem/9864578> Regional indicator symbols do not combine into national flags
+        https://bugs.webkit.org/show_bug.cgi?id=65380
+
+        Reviewed by Anders Carlsson.
+
+        Test: fast/text/regional-indicator-symobls.html
+
+        * platform/graphics/Font.cpp:
+        (WebCore::Font::codePath): Added handling of surrogate pairs, which returns Complex for characters in
+        the range U+1F1E6..U+1F1FF.
+
 2011-07-28  David Hyatt  <hy...@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=65342

Modified: trunk/Source/WebCore/platform/graphics/Font.cpp (92004 => 92005)


--- trunk/Source/WebCore/platform/graphics/Font.cpp	2011-07-29 20:19:03 UTC (rev 92004)
+++ trunk/Source/WebCore/platform/graphics/Font.cpp	2011-07-29 20:20:52 UTC (rev 92005)
@@ -382,13 +382,33 @@
         if (c <= 0xD7FF)
             return Complex;
 
+        if (c <= 0xDBFF) {
+            // High surrogate
+
+            if (i == run.length() - 1)
+                continue;
+
+            UChar next = run[++i];
+            if (!U16_IS_TRAIL(next))
+                continue;
+
+            UChar32 supplementaryCharacter = U16_GET_SUPPLEMENTARY(c, next);
+
+            if (supplementaryCharacter < 0x1F1E6) // U+1F1E6 through U+1F1FF Regional Indicator Symbols
+                continue;
+            if (supplementaryCharacter <= 0x1F1FF)
+                return Complex;
+
+            // FIXME: Check for Brahmi (U+11000 block), Kaithi (U+11080 block) and other complex scripts
+            // in plane 1 or higher.
+
+            continue;
+        }
+
         if (c < 0xFE20) // U+FE20 through U+FE2F Combining half marks
             continue;
         if (c <= 0xFE2F)
             return Complex;
-
-        // FIXME: Make this loop UTF-16-aware and check for Brahmi (U+11000 block)
-        // Kaithi (U+11080 block) and other complex scripts in plane 1 or higher.
     }
 
     if (typesettingFeatures())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to