Title: [93344] trunk
Revision
93344
Author
[email protected]
Date
2011-08-18 13:32:55 -0700 (Thu, 18 Aug 2011)

Log Message

Regional indicator symbols that are combined should behave as a single character when editing
https://bugs.webkit.org/show_bug.cgi?id=65395

Reviewed by Dan Bernstein.

Source/WebCore:

Part two: make cursor movement iterator work. This fixes the problem for strings that don't
contain more than two flags in a row, as fixing it completely doesn't seem possible with ICU.

Test: editing/selection/regional-indicators.html

* platform/text/TextBreakIteratorICU.cpp: (WebCore::cursorMovementIterator): Added custom
rules for regional indicator symbols.

LayoutTests:

* editing/selection/regional-indicators-expected.txt: Added.
* editing/selection/regional-indicators.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (93343 => 93344)


--- trunk/LayoutTests/ChangeLog	2011-08-18 20:22:52 UTC (rev 93343)
+++ trunk/LayoutTests/ChangeLog	2011-08-18 20:32:55 UTC (rev 93344)
@@ -1,3 +1,13 @@
+2011-08-18  Alexey Proskuryakov  <[email protected]>
+
+        Regional indicator symbols that are combined should behave as a single character when editing
+        https://bugs.webkit.org/show_bug.cgi?id=65395
+
+        Reviewed by Dan Bernstein.
+
+        * editing/selection/regional-indicators-expected.txt: Added.
+        * editing/selection/regional-indicators.html: Added.
+
 2011-08-18  Kentaro Hara  <[email protected]>
 
         An EventSource constructor should throw TypeError, when the number of arguments is not enough.

Added: trunk/LayoutTests/editing/selection/regional-indicators-expected.txt (0 => 93344)


--- trunk/LayoutTests/editing/selection/regional-indicators-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/regional-indicators-expected.txt	2011-08-18 20:32:55 UTC (rev 93344)
@@ -0,0 +1,9 @@
+This test checks how character breaks are computed for regional indicator characters.
+
+🇯🇵🇯🇵
+PASS document.getSelection().toString() is '🇯🇵'
+PASS document.getSelection().toString() is '🇯🇵'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/editing/selection/regional-indicators.html (0 => 93344)


--- trunk/LayoutTests/editing/selection/regional-indicators.html	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/regional-indicators.html	2011-08-18 20:32:55 UTC (rev 93344)
@@ -0,0 +1,32 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<p>This test checks how character breaks are computed for regional indicator characters.</p>
+<div contenteditable id="test">🇯🇵🇯🇵🇯🇵</div> <!-- (j)(p)(j)(p)(j)(p) -->
+<div id="console"></div>
+<script>
+
+var div = document.getElementById("test");
+var afterLastIndicator = document.createRange();
+
+afterLastIndicator.setStart(div.firstChild, 12);
+document.getSelection().addRange(afterLastIndicator);
+document.getSelection().modify("extend", "left", "character");
+shouldBe("document.getSelection().toString()", "'🇯🇵'");
+
+div.innerText = "🇯🇵🇯🇵";
+afterLastIndicator.setStart(div.firstChild, 8);
+document.getSelection().addRange(afterLastIndicator);
+document.getSelection().modify("extend", "left", "character");
+shouldBe("document.getSelection().toString()", "'🇯🇵'");
+
+var successfullyParsed = true;
+
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (93343 => 93344)


--- trunk/Source/WebCore/ChangeLog	2011-08-18 20:22:52 UTC (rev 93343)
+++ trunk/Source/WebCore/ChangeLog	2011-08-18 20:32:55 UTC (rev 93344)
@@ -1,3 +1,18 @@
+2011-08-18  Alexey Proskuryakov  <[email protected]>
+
+        Regional indicator symbols that are combined should behave as a single character when editing
+        https://bugs.webkit.org/show_bug.cgi?id=65395
+
+        Reviewed by Dan Bernstein.
+
+        Part two: make cursor movement iterator work. This fixes the problem for strings that don't
+        contain more than two flags in a row, as fixing it completely doesn't seem possible with ICU.
+
+        Test: editing/selection/regional-indicators.html
+
+        * platform/text/TextBreakIteratorICU.cpp: (WebCore::cursorMovementIterator): Added custom
+        rules for regional indicator symbols.
+
 2011-08-18  Cary Clark  <[email protected]>
 
         Fix rubber band gutter drawing for Skia on Chromium Mac

Modified: trunk/Source/WebCore/platform/text/TextBreakIteratorICU.cpp (93343 => 93344)


--- trunk/Source/WebCore/platform/text/TextBreakIteratorICU.cpp	2011-08-18 20:22:52 UTC (rev 93343)
+++ trunk/Source/WebCore/platform/text/TextBreakIteratorICU.cpp	2011-08-18 20:32:55 UTC (rev 93344)
@@ -171,6 +171,7 @@
     // * Removed rules that prevent a cursor from moving after prepend characters (Bug 24342);
     // * Added rules that prevent a cursor from moving after virama signs of Indic languages except Tamil (Bug 15790), and;
     // * Added rules that prevent a cursor from moving before Japanese half-width katakara voiced marks.
+    // * Added rules for regional indicator symbols.
     static const char* kRules =
         "$CR      = [\\p{Grapheme_Cluster_Break = CR}];"
         "$LF      = [\\p{Grapheme_Cluster_Break = LF}];"
@@ -207,6 +208,7 @@
         "$Mal0    = [\\u0D05-\\u0D39];"    // Malayalam Letter A,...,Ha
         "$MalV    = \\u0D4D;"              // Malayalam Sign Virama
         "$Mal1    = [\\u0D15-\\u0D39];"    // Malayalam Letter A,...,Ha
+        "$RI      = [\\U0001F1E6-\\U0001F1FF];" // Emoji regional indicators
         "!!chain;"
         "!!forward;"
         "$CR $LF;"
@@ -215,6 +217,8 @@
         "($LVT | $T) $T;"
         "[^$Control $CR $LF] $Extend;"
         "[^$Control $CR $LF] $SpacingMark;"
+        "$RI $RI / $RI;"
+        "$RI $RI;"
         "$Hin0 $HinV $Hin1;"               // Devanagari Virama (forward)
         "$Ben0 $BenV $Ben1;"               // Bengali Virama (forward)
         "$Pan0 $PanV $Pan1;"               // Gurmukhi Virama (forward)
@@ -230,6 +234,8 @@
         "$T ($LVT | $T);"
         "$Extend      [^$Control $CR $LF];"
         "$SpacingMark [^$Control $CR $LF];"
+        "$RI $RI / $RI $RI;"
+        "$RI $RI;"
         "$Hin1 $HinV $Hin0;"               // Devanagari Virama (backward)
         "$Ben1 $BenV $Ben0;"               // Bengali Virama (backward)
         "$Pan1 $PanV $Pan0;"               // Gurmukhi Virama (backward)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to