[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

xji at chromium.org xji at chromium.org
Wed Dec 22 15:35:22 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 32dbea58951b9de323560e7338835e3f1efada49
Author: xji at chromium.org <xji at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Nov 8 21:35:58 2010 +0000

    2010-11-08  Xiaomei Ji  <xji at chromium.org>
    
            Reviewed by Dan Bernstein.
    
            Fix Unicode explicit bidi control characters are removed in editing operations,
            such as insert/copy/cut/paste.
            https://bugs.webkit.org/show_bug.cgi?id=25321
    
            Unicode explicit bidi control characters were excluded in BidiRun and
            consequently from InlineTextBoxes due to their effect on rendering complex
            text with ATSUI.
            The fix is including those characters in BidiRun and remove them from
            ComplexTextRun with ATSUI.
    
            Test: editing/inserting/insert-paste-bidi-control.html
                   fast/text/atsui-bidi-control.html
    
            * platform/graphics/mac/ComplexTextControllerATSUI.cpp:
            (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
            * platform/text/BidiResolver.h:
            (WebCore::::checkDirectionInLowerRaiseEmbeddingLevel):
            (WebCore::::lowerExplicitEmbeddingLevel):
            (WebCore::::raiseExplicitEmbeddingLevel):
            (WebCore::::createBidiRunsForLine):
    2010-11-08  Xiaomei Ji  <xji at chromium.org>
    
            Reviewed by Dan Bernstein.
    
            Fix Unicode explicit bidi control characters are removed in editing operations,
            such as insert/copy/cut/paste.
            https://bugs.webkit.org/show_bug.cgi?id=25321
    
            Unicode explicit bidi control characters were excluded in BidiRun and
            consequently from InlineTextBoxes due to their effect on rendering complex
            text with ATSUI.
            The fix is including those characters in BidiRun and remove them from
            ComplexTextRun with ATSUI.
    
            * editing/inserting/insert-paste-bidi-control-expected.txt: Added.
            * editing/inserting/insert-paste-bidi-control.html: Added.
            * editing/selection/extend-selection-expected.txt:
            * editing/selection/home-end-expected.txt:
            * fast/text/atsui-bidi-control-expected.txt: Added.
            * fast/text/atsui-bidi-control.html: Added.
            * platform/mac/fast/css/text-overflow-ellipsis-bidi-expected.txt:
            * platform/mac/fast/text/international/bidi-LDB-2-formatting-characters-expected.txt:
            * platform/mac/fast/text/international/bidi-control-chars-treated-as-ZWS-expected.txt:
            * platform/mac/fast/text/international/bidi-explicit-embedding-expected.txt:
            * platform/mac/fast/text/international/bidi-ignored-for-first-child-inline-expected.txt:
            * platform/mac/fast/text/international/bidi-neutral-run-expected.txt:
            * platform/mac/fast/text/international/bidi-override-expected.txt:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71566 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index eb8a0d0..bf90d98 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,31 @@
+2010-11-08  Xiaomei Ji  <xji at chromium.org>
+
+        Reviewed by Dan Bernstein.
+
+        Fix Unicode explicit bidi control characters are removed in editing operations,
+        such as insert/copy/cut/paste.
+        https://bugs.webkit.org/show_bug.cgi?id=25321
+
+        Unicode explicit bidi control characters were excluded in BidiRun and
+        consequently from InlineTextBoxes due to their effect on rendering complex
+        text with ATSUI.
+        The fix is including those characters in BidiRun and remove them from
+        ComplexTextRun with ATSUI.
+
+        * editing/inserting/insert-paste-bidi-control-expected.txt: Added.
+        * editing/inserting/insert-paste-bidi-control.html: Added.
+        * editing/selection/extend-selection-expected.txt:
+        * editing/selection/home-end-expected.txt:
+        * fast/text/atsui-bidi-control-expected.txt: Added.
+        * fast/text/atsui-bidi-control.html: Added.
+        * platform/mac/fast/css/text-overflow-ellipsis-bidi-expected.txt:
+        * platform/mac/fast/text/international/bidi-LDB-2-formatting-characters-expected.txt:
+        * platform/mac/fast/text/international/bidi-control-chars-treated-as-ZWS-expected.txt:
+        * platform/mac/fast/text/international/bidi-explicit-embedding-expected.txt:
+        * platform/mac/fast/text/international/bidi-ignored-for-first-child-inline-expected.txt:
+        * platform/mac/fast/text/international/bidi-neutral-run-expected.txt:
+        * platform/mac/fast/text/international/bidi-override-expected.txt:
+
 2010-11-08  David Hyatt  <hyatt at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/LayoutTests/editing/inserting/insert-paste-bidi-control-expected.txt b/LayoutTests/editing/inserting/insert-paste-bidi-control-expected.txt
new file mode 100644
index 0000000..024bbf1
--- /dev/null
+++ b/LayoutTests/editing/inserting/insert-paste-bidi-control-expected.txt
@@ -0,0 +1,5 @@
+a‫b!‬
+‫b!‬
+a‫b!‬
+‫b!‬
+
diff --git a/LayoutTests/editing/inserting/insert-paste-bidi-control.html b/LayoutTests/editing/inserting/insert-paste-bidi-control.html
new file mode 100644
index 0000000..568f133
--- /dev/null
+++ b/LayoutTests/editing/inserting/insert-paste-bidi-control.html
@@ -0,0 +1,111 @@
+<html> 
+<head>
+
+<style>
+.editing { 
+    border: 2px solid red; 
+    padding: 12px; 
+    font-size: 24px; 
+}
+</style>
+<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
+
+<script>
+function log(str) 
+{
+    var li = document.createElement("li");
+    li.appendChild(document.createTextNode(str));
+    var console = document.getElementById("console");
+    console.appendChild(li);
+}
+
+function convertStringToUnicode(string)
+{
+    var returnValue = " (character in Unicode value): ";
+    for (var i = 0; i < string.length; ++i)
+    {
+        returnValue += " " + string.charCodeAt(i);
+    }
+    return returnValue;
+}
+
+function assertEqual(test_name, actual, expected)
+{
+    if (actual != expected) {
+        log("==================================");
+        log("FAILED: " + test_name);
+        var actual_string = "actual" + convertStringToUnicode(actual);
+        var expected_string = "expected" + convertStringToUnicode(expected);
+        log(actual_string);
+        log(expected_string);
+    }
+}
+
+
+function test(element)
+{
+    var textarea = document.getElementById(element + "1");
+    textarea.focus();
+    // Type in unicode bidi control character in the middle of a string.
+    typeCharacterCommand('a');
+    typeCharacterCommand(String.fromCharCode(0x202B));
+    typeCharacterCommand('b');
+    typeCharacterCommand('!');
+    typeCharacterCommand(String.fromCharCode(0x202C));
+
+    var string = textarea.innerHTML;
+    assertEqual("type a&#x202B;b!&#x202C;", string, "a\u202Bb!\u202c");
+
+    // Copy and past string contains unicode bidi control character in the middle.
+    document.execCommand("SelectAll");
+    copyCommand();
+    textarea = document.getElementById(element + "3");
+    textarea.focus();
+    pasteCommand(); 
+
+    string = textarea.innerHTML;
+    assertEqual("copy/paste a&#x202B;b!&#x202C;", string, "a\u202Bb!\u202c");
+
+    textarea = document.getElementById(element + "2");
+    textarea.focus();
+    // Type in unicode bidi control character as the beginning of a string.
+    typeCharacterCommand(String.fromCharCode(0x202B));
+    typeCharacterCommand('b');
+    typeCharacterCommand('!');
+    typeCharacterCommand(String.fromCharCode(0x202C));
+
+    string = textarea.innerHTML;
+    assertEqual("type &#x202B;b!&#x202C;", string, "\u202Bb!\u202c");
+
+    // Copy and past string contains unicode bidi control character at the beginning.
+    document.execCommand("SelectAll");
+    copyCommand();
+    textarea = document.getElementById(element + "4");
+    textarea.focus();
+    pasteCommand(); 
+
+    string = textarea.innerHTML;
+    assertEqual("copy/paste &#x202B;b!&#x202C;", string, "\u202Bb!\u202c");
+}
+
+onload = function()
+{
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+    test("div");
+}
+</script>
+
+<title>Editing Test</title> 
+</head> 
+<body>
+<div contenteditable id="div1" class="editing"></div>
+
+<div contenteditable id="div2" class="editing"></div>
+
+<div contenteditable id="div3" class="editing"></div>
+
+<div contenteditable id="div4" class="editing"></div>
+<ul id="console"></ul>
+</body>
+</html>
diff --git a/LayoutTests/editing/selection/extend-selection-expected.txt b/LayoutTests/editing/selection/extend-selection-expected.txt
index cf3af55..d5fe30d 100644
--- a/LayoutTests/editing/selection/extend-selection-expected.txt
+++ b/LayoutTests/editing/selection/extend-selection-expected.txt
@@ -20,9 +20,9 @@ amet
 Just testing רק בודק
 Just testing what ever
 car means אבג.
-car דהו אבג.
-he said " car דהו אבג ."
-זחט יךכ לםמ ' he said " car דהו אבג " '?
+‫car דהו אבג.‬
+he said "‫car דהו אבג‬."
+זחט יךכ לםמ '‪he said "‫car דהו אבג‬"‬'?
 אבג abc דהו
 edf זחט abrebg
 abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg
@@ -490,11 +490,11 @@ Test 16, RTL:
   Extending forward: "car means ABC."[(0,0), (0,14)]
   Extending backward:  "car means ABC."[(0,14)]
 Test 17, LTR:
-  Extending forward: "᪜car DEF ABC.᪝"[(1,1), (1,13)]
-  Extending backward:  "᪜car DEF ABC.᪝"[(1,13)]
+  Extending forward: "᪜car DEF ABC.᪝"[(0,0), (0,14)]
+  Extending backward:  "᪜car DEF ABC.᪝"[(0,14)]
 Test 17, RTL:
-  Extending forward: "᪜car DEF ABC.᪝"[(1,1), (1,13)]
-  Extending backward:  "᪜car DEF ABC.᪝"[(1,13)]
+  Extending forward: "᪜car DEF ABC.᪝"[(0,0), (0,14)]
+  Extending backward:  "᪜car DEF ABC.᪝"[(0,14)]
 Test 18, LTR:
   Extending forward: "he said "᪜car DEF ABC᪝.""[(0,0), (0,24)]
   Extending backward:  "he said "᪜car DEF ABC᪝.""[(0,24)]
diff --git a/LayoutTests/editing/selection/home-end-expected.txt b/LayoutTests/editing/selection/home-end-expected.txt
index a401bf6..897c86d 100644
--- a/LayoutTests/editing/selection/home-end-expected.txt
+++ b/LayoutTests/editing/selection/home-end-expected.txt
@@ -89,11 +89,11 @@ Test 15, RTL:
   Moving forward: "car means ABC."[0, 14]
   Moving backward:  "car means ABC."[14, 0]
 Test 16, LTR:
-  Moving forward: "᪜car DEF ABC.᪝"[1, 13]
-  Moving backward:  "᪜car DEF ABC.᪝"[13, 1]
+  Moving forward: "᪜car DEF ABC.᪝"[0, 14]
+  Moving backward:  "᪜car DEF ABC.᪝"[14, 0]
 Test 16, RTL:
-  Moving forward: "᪜car DEF ABC.᪝"[1, 13]
-  Moving backward:  "᪜car DEF ABC.᪝"[13, 1]
+  Moving forward: "᪜car DEF ABC.᪝"[0, 14]
+  Moving backward:  "᪜car DEF ABC.᪝"[14, 0]
 Test 17, LTR:
   Moving forward: "he said "᪜car DEF ABC᪝.""[0, 24]
   Moving backward:  "he said "᪜car DEF ABC᪝.""[24, 0]
diff --git a/LayoutTests/fast/text/atsui-bidi-control-expected.txt b/LayoutTests/fast/text/atsui-bidi-control-expected.txt
new file mode 100644
index 0000000..9edf548
--- /dev/null
+++ b/LayoutTests/fast/text/atsui-bidi-control-expected.txt
@@ -0,0 +1,17 @@
+فق ‪ك ل abc ‬ م
+(0,0)
+(1,1)
+(2,2)
+(3,3)
+(6,6)
+(5,5)
+(4,4)
+(7,7)
+(8,8)
+(9,9)
+(10,10)
+(11,11)
+(12,12)
+(13,13)
+(14,14)
+(15,15)
diff --git a/LayoutTests/fast/text/atsui-bidi-control.html b/LayoutTests/fast/text/atsui-bidi-control.html
new file mode 100644
index 0000000..f226a1e
--- /dev/null
+++ b/LayoutTests/fast/text/atsui-bidi-control.html
@@ -0,0 +1,74 @@
+<html> 
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
+
+<style>
+.editing { 
+    border: 2px solid red; 
+    padding: 12px; 
+    font-size: 24px; 
+}
+</style>
+
+<script>
+function log(str) {
+    var li = document.createElement("li");
+    li.appendChild(document.createTextNode(str));
+    var console = document.getElementById("console");
+    console.appendChild(li);
+}
+
+function convertStringToUnicode(string)
+{
+    var returnValue = " (character in Unicode value): ";
+    for (var i = 0; i < string.length; ++i)
+    {
+        returnValue += " " + string.charCodeAt(i);
+    }
+    return returnValue;
+}
+
+function assertEqual(test_name, actual, expected)
+{
+    if (actual != expected) {
+        log("==================================");
+        log("FAILED: " + test_name);
+        var actual_string = "actual" + convertStringToUnicode(actual);
+        var expected_string = "expected" + convertStringToUnicode(expected);
+        log(actual_string);
+        log(expected_string);
+    }
+}
+
+onload = function()
+{
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+
+    var div = document.getElementById("div");
+    var string = div.innerHTML;
+    assertEqual("arabic string", string, "\u0641\u0642 \u202A\u0643 \u0644 abc \u202C \u0645");
+
+    var sel = getSelection();
+    sel.setPosition(div, 0);
+    
+    var positions = [];
+    while (true) {
+        positions.push({ node: sel.extentNode, begin: sel.baseOffset, end: sel.extentOffset });
+        sel.modify("move", "right", "character");
+        if (positions[positions.length - 1].node == sel.extentNode && positions[positions.length - 1].end == sel.extentOffset)
+            break;
+    };
+
+    for (var i = 0; i < positions.length; ++i)
+        log("(" + positions[i].begin + "," + positions[i].end + ")");
+}
+</script>
+
+<title>Editing Test</title> 
+</head> 
+<body>
+<div contenteditable id="div" class="editing">&#x0641;&#x0642; &#x202a;&#x0643; &#x0644; abc &#x202c; &#x0645;</div>
+<ul id="console"></ul>
+</body>
+</html>
diff --git a/LayoutTests/platform/mac/fast/css/text-overflow-ellipsis-bidi-expected.txt b/LayoutTests/platform/mac/fast/css/text-overflow-ellipsis-bidi-expected.txt
index 88ea207..1b48330 100644
--- a/LayoutTests/platform/mac/fast/css/text-overflow-ellipsis-bidi-expected.txt
+++ b/LayoutTests/platform/mac/fast/css/text-overflow-ellipsis-bidi-expected.txt
@@ -20,15 +20,17 @@ layer at (0,0) size 800x200
 layer at (8,80) size 207x19 scrollX 154 scrollWidth 361
   RenderBlock {DIV} at (0,72) size 207x19
     RenderText {#text} at (-154,1) size 361x18
+      text run at (-154,1) width 0 RTL: "\x{202C}"
       text run at (-154,1) width 276 RTL: " \x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5E2}\x{5D1}\x{5E8}\x{5D9} \x{5DC}\x{5D3}\x{5D5}\x{5D2}\x{5DE}\x{5D0} \x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5E2}\x{5D1}\x{5E8}\x{5D9} \x{5DC}\x{5D3}\x{5D5}\x{5D2}\x{5DE}\x{5D0} "
       text run at (122,1) width 81: "English Text"
-      text run at (203,1) width 4 RTL: " "
+      text run at (203,1) width 4 RTL: "\x{202B} "
 layer at (8,99) size 207x19 scrollX 154 scrollWidth 361
   RenderBlock {DIV} at (0,91) size 207x19
     RenderText {#text} at (-154,1) size 361x18
+      text run at (-154,1) width 0 RTL: "\x{202C}"
       text run at (-154,1) width 276 RTL: " \x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5E2}\x{5D1}\x{5E8}\x{5D9} \x{5DC}\x{5D3}\x{5D5}\x{5D2}\x{5DE}\x{5D0} \x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5E2}\x{5D1}\x{5E8}\x{5D9} \x{5DC}\x{5D3}\x{5D5}\x{5D2}\x{5DE}\x{5D0} "
       text run at (122,1) width 81: "English Text"
-      text run at (203,1) width 4 RTL: " "
+      text run at (203,1) width 4 RTL: "\x{202B} "
 layer at (8,154) size 207x19 scrollWidth 262
   RenderBlock {DIV} at (0,146) size 207x19
     RenderText {#text} at (0,1) size 262x18
diff --git a/LayoutTests/platform/mac/fast/text/international/bidi-LDB-2-formatting-characters-expected.txt b/LayoutTests/platform/mac/fast/text/international/bidi-LDB-2-formatting-characters-expected.txt
index 0125502..e1511f6 100644
--- a/LayoutTests/platform/mac/fast/text/international/bidi-LDB-2-formatting-characters-expected.txt
+++ b/LayoutTests/platform/mac/fast/text/international/bidi-LDB-2-formatting-characters-expected.txt
@@ -42,46 +42,54 @@ layer at (0,0) size 800x588
               text run at (0,0) width 94: "ABCDEFGHI"
           RenderBlock {P} at (4,22) size 94x18
             RenderText {#text} at (0,0) size 94x18
-              text run at (0,0) width 94: "ABCDEFGHI"
+              text run at (0,0) width 0 RTL: "\x{202C}"
+              text run at (0,0) width 94: "\x{202B}ABCDEFGHI"
           RenderBlock {P} at (4,40) size 94x18
             RenderText {#text} at (0,0) size 34x18
-              text run at (0,0) width 34: "ABC"
+              text run at (0,0) width 34: "\x{202B}ABC"
             RenderInline {SPAN} at (0,0) size 31x18
               RenderText {#text} at (34,0) size 31x18
                 text run at (34,0) width 31: "DEF"
-            RenderText {#text} at (65,0) size 29x18
+            RenderText {#text} at (0,0) size 94x18
+              text run at (0,0) width 0 RTL: "\x{202C}"
               text run at (65,0) width 29: "GHI"
           RenderBlock {P} at (4,58) size 94x18
             RenderText {#text} at (0,0) size 94x18
-              text run at (0,0) width 94 RTL override: "IHGFEDCBA"
+              text run at (0,0) width 0 RTL: "\x{202C}"
+              text run at (0,0) width 94 RTL override: "\x{202E}IHGFEDCBA"
           RenderBlock {P} at (4,76) size 94x18
             RenderText {#text} at (65,0) size 29x18
-              text run at (65,0) width 29 RTL override: "IHG"
+              text run at (65,0) width 29 RTL override: "\x{202E}IHG"
             RenderInline {SPAN} at (0,0) size 31x18
               RenderText {#text} at (34,0) size 31x18
                 text run at (34,0) width 31 RTL override: "FED"
             RenderText {#text} at (0,0) size 34x18
+              text run at (0,0) width 0 RTL: "\x{202C}"
               text run at (0,0) width 34 RTL override: "CBA"
           RenderBlock {P} at (4,94) size 94x18
             RenderText {#text} at (0,0) size 94x18
-              text run at (0,0) width 34 RTL override: "CBA"
-              text run at (34,0) width 31: "DEF"
-              text run at (65,0) width 29 RTL override: "IHG"
+              text run at (0,0) width 0 RTL: "\x{202C}"
+              text run at (0,0) width 34 RTL override: "\x{202C}CBA"
+              text run at (34,0) width 31: "\x{202B}DEF"
+              text run at (65,0) width 29 RTL override: "\x{202E}IHG"
           RenderBlock {P} at (4,112) size 94x18
             RenderText {#text} at (0,0) size 94x18
-              text run at (0,0) width 34 RTL override: "CBA"
-              text run at (34,0) width 31 RTL override: "FED"
-              text run at (65,0) width 29 RTL override: "IHG"
+              text run at (0,0) width 0 RTL: "\x{202C}"
+              text run at (0,0) width 34 RTL override: "\x{202C}CBA"
+              text run at (34,0) width 31 RTL override: "\x{202E}FED"
+              text run at (65,0) width 29 RTL override: "\x{202E}IHG"
           RenderBlock {P} at (4,130) size 94x18
             RenderText {#text} at (0,0) size 94x18
-              text run at (0,0) width 34 RTL override: "CBA"
-              text run at (34,0) width 31 RTL override: "FED"
-              text run at (65,0) width 29 RTL override: "IHG"
+              text run at (0,0) width 0 RTL: "\x{202C}"
+              text run at (0,0) width 34 RTL override: "\x{202C}CBA"
+              text run at (34,0) width 31 RTL override: "\x{202E}FED"
+              text run at (65,0) width 29 RTL override: "\x{202E}IHG"
           RenderBlock {P} at (4,148) size 94x18
             RenderText {#text} at (0,0) size 94x18
-              text run at (0,0) width 34 RTL override: "CBA"
-              text run at (34,0) width 31 LTR override: "DEF"
-              text run at (65,0) width 29 RTL override: "IHG"
+              text run at (0,0) width 0 RTL: "\x{202C}"
+              text run at (0,0) width 34 RTL override: "\x{202C}CBA"
+              text run at (34,0) width 31 LTR override: "\x{202D}DEF"
+              text run at (65,0) width 29 RTL override: "\x{202E}IHG"
         RenderText {#text} at (108,81) size 4x18
           text run at (108,81) width 4: " "
         RenderBlock {DIV} at (115,50) size 36x84 [border: (1px solid #008000)]
@@ -102,10 +110,12 @@ layer at (0,0) size 800x588
               text run at (0,1) width 27 RTL: "\x{5D0}\x{5D1}\x{5D2}"
           RenderBlock {P} at (4,42) size 28x19
             RenderText {#text} at (0,1) size 27x18
-              text run at (0,1) width 27 RTL: "\x{5D0}\x{5D1}\x{5D2}"
+              text run at (0,1) width 27 RTL: "\x{202A}\x{5D0}\x{5D1}\x{5D2}"
+              text run at (27,1) width 0: "\x{202C}"
           RenderBlock {P} at (4,61) size 28x19
             RenderText {#text} at (0,1) size 27x18
-              text run at (0,1) width 27 LTR override: "\x{5D2}\x{5D1}\x{5D0}"
+              text run at (0,1) width 27 LTR override: "\x{202D}\x{5D2}\x{5D1}\x{5D0}"
+              text run at (27,1) width 0: "\x{202C}"
         RenderText {#text} at (154,81) size 4x18
           text run at (154,81) width 4: " "
         RenderBlock {DIV} at (161,60) size 105x65 [border: (1px solid #008000)]
@@ -240,43 +250,43 @@ layer at (0,0) size 800x588
             RenderText {#text} at (0,1) size 161x18
               text run at (0,1) width 27 RTL: "\x{5D0}\x{5D1}\x{5D2}"
               text run at (27,1) width 4: " "
-              text run at (31,1) width 38: "ABC "
+              text run at (31,1) width 38: "\x{202A}ABC "
               text run at (69,1) width 25 RTL: "\x{5D3}\x{5D4}\x{5D5}"
               text run at (94,1) width 35: " DEF"
-              text run at (129,1) width 4: " "
+              text run at (129,1) width 4: "\x{202C} "
               text run at (133,1) width 28 RTL: "\x{5D6}\x{5D7}\x{5D8}"
           RenderBlock {P} at (4,80) size 165x19
             RenderText {#text} at (0,1) size 161x18
-              text run at (0,1) width 31 RTL: " \x{5D0}\x{5D1}\x{5D2}"
+              text run at (0,1) width 31 RTL: "\x{202C} \x{5D0}\x{5D1}\x{5D2}"
               text run at (31,1) width 34: "ABC"
               text run at (65,1) width 33 RTL: " \x{5D3}\x{5D4}\x{5D5} "
-              text run at (98,1) width 31: "DEF"
+              text run at (98,1) width 31: "\x{202B}DEF"
               text run at (129,1) width 32 RTL: "\x{5D6}\x{5D7}\x{5D8} "
           RenderBlock {P} at (4,99) size 165x19
             RenderText {#text} at (0,1) size 161x18
               text run at (0,1) width 31 RTL: " \x{5D0}\x{5D1}\x{5D2}"
-              text run at (31,1) width 34: "ABC"
+              text run at (31,1) width 34: "\x{202B}ABC"
               text run at (65,1) width 29 RTL: "\x{5D3}\x{5D4}\x{5D5} "
-              text run at (94,1) width 39: " DEF "
+              text run at (94,1) width 39: "\x{202C} DEF "
               text run at (133,1) width 28 RTL: "\x{5D6}\x{5D7}\x{5D8}"
           RenderBlock {P} at (4,118) size 165x19
             RenderText {#text} at (0,1) size 161x18
-              text run at (0,1) width 65 RTL override: "CBA \x{5D0}\x{5D1}\x{5D2}"
+              text run at (0,1) width 65 RTL override: "\x{202E}CBA \x{5D0}\x{5D1}\x{5D2}"
               text run at (65,1) width 29 RTL: "\x{5D3}\x{5D4}\x{5D5} "
-              text run at (94,1) width 39: " DEF "
+              text run at (94,1) width 39: "\x{202C} DEF "
               text run at (133,1) width 28 RTL: "\x{5D6}\x{5D7}\x{5D8}"
           RenderBlock {P} at (4,137) size 165x19
             RenderText {#text} at (0,1) size 161x18
               text run at (0,1) width 27 RTL: "\x{5D0}\x{5D1}\x{5D2}"
               text run at (27,1) width 4: " "
-              text run at (31,1) width 63 LTR override: "ABC \x{5D5}\x{5D4}\x{5D3}"
-              text run at (94,1) width 39: " DEF "
+              text run at (31,1) width 63 LTR override: "\x{202D}ABC \x{5D5}\x{5D4}\x{5D3}"
+              text run at (94,1) width 39: "\x{202C} DEF "
               text run at (133,1) width 28 RTL: "\x{5D6}\x{5D7}\x{5D8}"
           RenderBlock {P} at (4,156) size 165x19
             RenderText {#text} at (0,1) size 161x18
               text run at (0,1) width 31 RTL: " \x{5D0}\x{5D1}\x{5D2}"
-              text run at (31,1) width 63 LTR override: "ABC \x{5D5}\x{5D4}\x{5D3}"
-              text run at (94,1) width 35: " DEF"
+              text run at (31,1) width 63 LTR override: "\x{202D}ABC \x{5D5}\x{5D4}\x{5D3}"
+              text run at (94,1) width 35: "\x{202C} DEF"
               text run at (129,1) width 32 RTL: "\x{5D6}\x{5D7}\x{5D8} "
         RenderText {#text} at (452,81) size 4x18
           text run at (452,81) width 4: " "
@@ -438,9 +448,9 @@ layer at (0,0) size 800x588
                     text run at (0,1) width 6 RTL: "\x{5D6}"
           RenderBlock {P} at (4,23) size 198x19
             RenderText {#text} at (0,1) size 194x18
-              text run at (0,1) width 98 RTL override: "ABC \x{5D3}\x{5D4}\x{5D5} DEF"
+              text run at (0,1) width 98 RTL override: "\x{202E}ABC \x{5D3}\x{5D4}\x{5D5} DEF"
               text run at (98,1) width 31 RTL: "\x{5D0}\x{5D1}\x{5D2} "
-              text run at (129,1) width 37: " GHI "
+              text run at (129,1) width 37: "\x{202C} GHI "
               text run at (166,1) width 28 RTL: "\x{5D6}\x{5D7}\x{5D8}"
         RenderText {#text} at (212,200) size 4x18
           text run at (212,200) width 4: " "
@@ -521,8 +531,8 @@ layer at (0,0) size 800x588
             RenderText {#text} at (0,1) size 194x18
               text run at (0,1) width 27 RTL: "\x{5D0}\x{5D1}\x{5D2}"
               text run at (27,1) width 42: " ABC "
-              text run at (69,1) width 60 RTL override: "\x{5D3}\x{5D4}\x{5D5} DEF"
-              text run at (129,1) width 37: " GHI "
+              text run at (69,1) width 60 RTL override: "\x{202E}\x{5D3}\x{5D4}\x{5D5} DEF"
+              text run at (129,1) width 37: "\x{202C} GHI "
               text run at (166,1) width 28 RTL: "\x{5D6}\x{5D7}\x{5D8}"
         RenderText {#text} at (0,0) size 0x0
       RenderBlock {P} at (0,413) size 784x18
diff --git a/LayoutTests/platform/mac/fast/text/international/bidi-control-chars-treated-as-ZWS-expected.txt b/LayoutTests/platform/mac/fast/text/international/bidi-control-chars-treated-as-ZWS-expected.txt
index f62ad40..de869b6 100644
--- a/LayoutTests/platform/mac/fast/text/international/bidi-control-chars-treated-as-ZWS-expected.txt
+++ b/LayoutTests/platform/mac/fast/text/international/bidi-control-chars-treated-as-ZWS-expected.txt
@@ -10,7 +10,7 @@ layer at (0,0) size 800x600
       RenderBlock {DIV} at (0,36) size 784x36
         RenderText {#text} at (0,0) size 14x17
           text run at (0,0) width 7: "a"
-          text run at (7,0) width 7 LTR override: "e\x{300}"
+          text run at (7,0) width 7 LTR override: "\x{202D}e\x{300}"
         RenderBR {BR} at (14,14) size 0x0
         RenderText {#text} at (0,18) size 14x17
           text run at (0,18) width 14: "ae\x{300}"
diff --git a/LayoutTests/platform/mac/fast/text/international/bidi-explicit-embedding-expected.txt b/LayoutTests/platform/mac/fast/text/international/bidi-explicit-embedding-expected.txt
index 591bfcd..a1dfae1 100644
--- a/LayoutTests/platform/mac/fast/text/international/bidi-explicit-embedding-expected.txt
+++ b/LayoutTests/platform/mac/fast/text/international/bidi-explicit-embedding-expected.txt
@@ -47,15 +47,15 @@ layer at (0,0) size 800x494
           text run at (39,0) width 21: "23"
           text run at (60,0) width 5 RTL: " "
           text run at (65,0) width 21: "45"
-          text run at (86,0) width 6 RTL: "("
-          text run at (92,0) width 31: " fgh"
+          text run at (86,0) width 6 RTL: "\x{202B}("
+          text run at (92,0) width 31: "\x{202C} fgh"
       RenderBlock {P} at (0,206) size 784x18
         RenderText {#text} at (0,0) size 110x18
           text run at (0,0) width 33: "abc "
           text run at (33,0) width 6 RTL: "]"
           text run at (39,0) width 40: "de fg"
-          text run at (79,0) width 6 RTL: "("
-          text run at (85,0) width 25: " hij"
+          text run at (79,0) width 6 RTL: "\x{202B}("
+          text run at (85,0) width 25: "\x{202C} hij"
       RenderBlock {P} at (0,240) size 784x18
         RenderText {#text} at (0,0) size 11x18
           text run at (0,0) width 11: "1"
@@ -81,7 +81,8 @@ layer at (0,0) size 800x494
           RenderText {#text} at (11,0) size 23x18
             text run at (11,0) width 6 RTL: "]"
             text run at (17,0) width 11: "2"
-            text run at (28,0) width 6 RTL: "("
+            text run at (28,0) width 6 RTL: "\x{202B}("
+            text run at (34,0) width 0: "\x{202C}"
         RenderText {#text} at (0,0) size 0x0
       RenderBlock {P} at (0,342) size 784x18
         RenderText {#text} at (0,0) size 11x18
@@ -90,14 +91,16 @@ layer at (0,0) size 800x494
           RenderText {#text} at (11,0) size 21x18
             text run at (11,0) width 6 RTL: "]"
             text run at (17,0) width 9: "a"
-            text run at (26,0) width 6 RTL: "("
+            text run at (26,0) width 6 RTL: "\x{202B}("
+            text run at (32,0) width 0: "\x{202C}"
         RenderText {#text} at (0,0) size 0x0
       RenderBlock {P} at (0,376) size 784x18
         RenderText {#text} at (0,0) size 62x18
           text run at (0,0) width 11: "1"
           text run at (11,0) width 26 RTL: " \x{5D2}\x{5D3}]"
           text run at (37,0) width 19: "ab"
-          text run at (56,0) width 6 RTL: "("
+          text run at (56,0) width 6 RTL: "\x{202B}("
+          text run at (62,0) width 0: "\x{202C}"
       RenderBlock {P} at (0,410) size 784x18
         RenderInline {SPAN} at (0,0) size 102x18
           RenderText {#text} at (0,0) size 102x18
@@ -113,4 +116,5 @@ layer at (0,0) size 800x494
           text run at (6,0) width 28: "abc"
           text run at (34,0) width 37 RTL: " \x{5D0}\x{5D1}\x{5D2} "
           text run at (71,0) width 25: "def"
-          text run at (96,0) width 6 RTL: "("
+          text run at (96,0) width 6 RTL: "\x{202B}("
+          text run at (102,0) width 0: "\x{202C}"
diff --git a/LayoutTests/platform/mac/fast/text/international/bidi-ignored-for-first-child-inline-expected.txt b/LayoutTests/platform/mac/fast/text/international/bidi-ignored-for-first-child-inline-expected.txt
index e4549e2..071182b 100644
--- a/LayoutTests/platform/mac/fast/text/international/bidi-ignored-for-first-child-inline-expected.txt
+++ b/LayoutTests/platform/mac/fast/text/international/bidi-ignored-for-first-child-inline-expected.txt
@@ -86,7 +86,8 @@ layer at (0,0) size 800x600
         RenderText {#text} at (0,1) size 62x18
           text run at (0,1) width 25 RTL: "\x{5D3}\x{5D4}\x{5D5}"
           text run at (25,1) width 10: "(["
-          text run at (35,1) width 27 RTL: "\x{5D0}\x{5D1}\x{5D2}"
+          text run at (35,1) width 27 RTL: "\x{202C}\x{5D0}\x{5D1}\x{5D2}"
+          text run at (62,1) width 0: "\x{202A}"
       RenderBlock {P} at (0,421) size 784x19
         RenderText {#text} at (0,1) size 35x18
           text run at (0,1) width 25 RTL: "\x{5D3}\x{5D4}\x{5D5}"
diff --git a/LayoutTests/platform/mac/fast/text/international/bidi-neutral-run-expected.txt b/LayoutTests/platform/mac/fast/text/international/bidi-neutral-run-expected.txt
index d8b0740..2ea0cb6 100644
--- a/LayoutTests/platform/mac/fast/text/international/bidi-neutral-run-expected.txt
+++ b/LayoutTests/platform/mac/fast/text/international/bidi-neutral-run-expected.txt
@@ -48,12 +48,12 @@ layer at (0,0) size 785x6274
             text run at (31,2) width 28: "(^cd"
         RenderBlock {P} at (0,318) size 769x18
           RenderText {#text} at (0,0) size 35x18
-            text run at (0,0) width 7: "?"
-            text run at (7,0) width 28: "(^cd"
+            text run at (0,0) width 7: "\x{202A}?"
+            text run at (7,0) width 28: "\x{202C}(^cd"
         RenderBlock {P} at (0,352) size 769x18
           RenderText {#text} at (0,0) size 35x18
-            text run at (0,0) width 7 RTL: "?"
-            text run at (7,0) width 28: "(^cd"
+            text run at (0,0) width 7 RTL: "\x{202B}?"
+            text run at (7,0) width 28: "\x{202C}(^cd"
         RenderBlock {P} at (0,386) size 769x19
           RenderText {#text} at (0,1) size 43x18
             text run at (0,1) width 28: "ab(^"
@@ -95,13 +95,13 @@ layer at (0,0) size 785x6274
             text run at (44,2) width 15 RTL: "\x{627}\x{628}"
         RenderBlock {P} at (0,706) size 769x19
           RenderText {#text} at (0,1) size 35x18
-            text run at (0,1) width 7: "?"
-            text run at (7,1) width 13: "(^"
+            text run at (0,1) width 7: "\x{202A}?"
+            text run at (7,1) width 13: "\x{202C}(^"
             text run at (20,1) width 15 RTL: "\x{5D2}\x{5D3}"
         RenderBlock {P} at (0,741) size 769x19
           RenderText {#text} at (0,1) size 35x18
-            text run at (0,1) width 28 RTL: "(^\x{5D2}\x{5D3}"
-            text run at (28,1) width 7 RTL: "?"
+            text run at (0,1) width 28 RTL: "\x{202C}(^\x{5D2}\x{5D3}"
+            text run at (28,1) width 7 RTL: "\x{202B}?"
         RenderBlock {P} at (0,776) size 769x20
           RenderText {#text} at (0,2) size 45x18
             text run at (0,2) width 28: "ab(^"
@@ -143,13 +143,13 @@ layer at (0,0) size 785x6274
             text run at (46,2) width 15 RTL: "\x{627}\x{628}"
         RenderBlock {P} at (0,1100) size 769x20
           RenderText {#text} at (0,2) size 37x18
-            text run at (0,2) width 7: "?"
-            text run at (7,2) width 13: "(^"
+            text run at (0,2) width 7: "\x{202A}?"
+            text run at (7,2) width 13: "\x{202C}(^"
             text run at (20,2) width 17 RTL: "\x{62C}\x{62F}"
         RenderBlock {P} at (0,1136) size 769x20
           RenderText {#text} at (0,2) size 37x18
-            text run at (0,2) width 30 RTL: "(^\x{62C}\x{62F}"
-            text run at (30,2) width 7 RTL: "?"
+            text run at (0,2) width 30 RTL: "\x{202C}(^\x{62C}\x{62F}"
+            text run at (30,2) width 7 RTL: "\x{202B}?"
         RenderBlock {P} at (0,1172) size 769x19
           RenderText {#text} at (0,1) size 63x18
             text run at (0,1) width 44: "ab(^34"
@@ -213,16 +213,16 @@ layer at (0,0) size 785x6274
             text run at (72,2) width 7: "z"
         RenderBlock {P} at (0,1492) size 769x19
           RenderText {#text} at (0,1) size 55x18
-            text run at (0,1) width 7: "?"
-            text run at (7,1) width 29: "(^34"
+            text run at (0,1) width 7: "\x{202A}?"
+            text run at (7,1) width 29: "\x{202C}(^34"
             text run at (36,1) width 12 RTL: "\x{5E9}"
             text run at (48,1) width 7: "z"
         RenderBlock {P} at (0,1527) size 769x19
           RenderText {#text} at (0,1) size 55x18
             text run at (0,1) width 12 RTL: "\x{5E9}"
             text run at (12,1) width 16: "34"
-            text run at (28,1) width 13 RTL: "(^"
-            text run at (41,1) width 7 RTL: "?"
+            text run at (28,1) width 13 RTL: "\x{202C}(^"
+            text run at (41,1) width 7 RTL: "\x{202B}?"
             text run at (48,1) width 7: "z"
         RenderBlock {P} at (0,1562) size 769x20
           RenderText {#text} at (0,2) size 63x18
@@ -290,8 +290,8 @@ layer at (0,0) size 785x6274
             text run at (72,2) width 7: "z"
         RenderBlock {P} at (0,1886) size 769x20
           RenderText {#text} at (0,2) size 55x18
-            text run at (0,2) width 7: "?"
-            text run at (7,2) width 13: "(^"
+            text run at (0,2) width 7: "\x{202A}?"
+            text run at (7,2) width 13: "\x{202C}(^"
             text run at (20,2) width 12 RTL: "\x{5E9}"
             text run at (32,2) width 16: "\x{663}\x{664}"
             text run at (48,2) width 7: "z"
@@ -299,170 +299,205 @@ layer at (0,0) size 785x6274
           RenderText {#text} at (0,2) size 55x18
             text run at (0,2) width 12 RTL: "\x{5E9}"
             text run at (12,2) width 16: "\x{663}\x{664}"
-            text run at (28,2) width 13 RTL: "(^"
-            text run at (41,2) width 7 RTL: "?"
+            text run at (28,2) width 13 RTL: "\x{202C}(^"
+            text run at (41,2) width 7 RTL: "\x{202B}?"
             text run at (48,2) width 7: "z"
         RenderBlock {P} at (0,1958) size 769x18
           RenderText {#text} at (0,0) size 33x18
             text run at (0,0) width 28: "ab(^"
-            text run at (28,0) width 5: "!"
+            text run at (28,0) width 5: "\x{202A}!"
+            text run at (33,0) width 0: "\x{202C}"
         RenderBlock {P} at (0,1992) size 769x19
           RenderText {#text} at (0,1) size 38x18
             text run at (0,1) width 20 RTL: "\x{5D0}\x{5D1}"
             text run at (20,1) width 13: "(^"
-            text run at (33,1) width 5: "!"
+            text run at (33,1) width 5: "\x{202A}!"
+            text run at (38,1) width 0: "\x{202C}"
         RenderBlock {P} at (0,2027) size 769x20
           RenderText {#text} at (0,2) size 33x18
             text run at (0,2) width 15 RTL: "\x{627}\x{628}"
             text run at (15,2) width 13: "(^"
-            text run at (28,2) width 5: "!"
+            text run at (28,2) width 5: "\x{202A}!"
+            text run at (33,2) width 0: "\x{202C}"
         RenderBlock {P} at (0,2063) size 769x18
           RenderText {#text} at (0,0) size 49x18
             text run at (0,0) width 44: "ab12(^"
-            text run at (44,0) width 5: "!"
+            text run at (44,0) width 5: "\x{202A}!"
+            text run at (49,0) width 0: "\x{202C}"
         RenderBlock {P} at (0,2097) size 769x19
           RenderText {#text} at (0,1) size 54x18
             text run at (0,1) width 16: "12"
             text run at (16,1) width 20 RTL: "\x{5D0}\x{5D1}"
             text run at (36,1) width 13: "(^"
-            text run at (49,1) width 5: "!"
+            text run at (49,1) width 5: "\x{202A}!"
+            text run at (54,1) width 0: "\x{202C}"
         RenderBlock {P} at (0,2132) size 769x20
           RenderText {#text} at (0,2) size 49x18
             text run at (0,2) width 16: "12"
             text run at (16,2) width 15 RTL: "\x{627}\x{628}"
             text run at (31,2) width 13: "(^"
-            text run at (44,2) width 5: "!"
+            text run at (44,2) width 5: "\x{202A}!"
+            text run at (49,2) width 0: "\x{202C}"
         RenderBlock {P} at (0,2168) size 769x20
           RenderText {#text} at (0,2) size 49x18
             text run at (0,2) width 15: "ab"
             text run at (15,2) width 16: "\x{661}\x{662}"
             text run at (31,2) width 13: "(^"
-            text run at (44,2) width 5: "!"
+            text run at (44,2) width 5: "\x{202A}!"
+            text run at (49,2) width 0: "\x{202C}"
         RenderBlock {P} at (0,2204) size 769x20
           RenderText {#text} at (0,2) size 54x18
             text run at (0,2) width 16: "\x{661}\x{662}"
             text run at (16,2) width 20 RTL: "\x{5D0}\x{5D1}"
             text run at (36,2) width 13: "(^"
-            text run at (49,2) width 5: "!"
+            text run at (49,2) width 5: "\x{202A}!"
+            text run at (54,2) width 0: "\x{202C}"
         RenderBlock {P} at (0,2240) size 769x20
           RenderText {#text} at (0,2) size 49x18
             text run at (0,2) width 16: "\x{661}\x{662}"
             text run at (16,2) width 15 RTL: "\x{627}\x{628}"
             text run at (31,2) width 13: "(^"
-            text run at (44,2) width 5: "!"
+            text run at (44,2) width 5: "\x{202A}!"
+            text run at (49,2) width 0: "\x{202C}"
         RenderBlock {P} at (0,2276) size 769x18
           RenderText {#text} at (0,0) size 25x18
-            text run at (0,0) width 7: "?"
-            text run at (7,0) width 13: "(^"
-            text run at (20,0) width 5: "!"
+            text run at (0,0) width 7: "\x{202A}?"
+            text run at (7,0) width 13: "\x{202C}(^"
+            text run at (20,0) width 5: "\x{202A}!"
+            text run at (25,0) width 0: "\x{202C}"
         RenderBlock {P} at (0,2310) size 769x18
           RenderText {#text} at (0,0) size 25x18
-            text run at (0,0) width 7 RTL: "?"
-            text run at (7,0) width 13: "(^"
-            text run at (20,0) width 5: "!"
+            text run at (0,0) width 7 RTL: "\x{202B}?"
+            text run at (7,0) width 13: "\x{202C}(^"
+            text run at (20,0) width 5: "\x{202A}!"
+            text run at (25,0) width 0: "\x{202C}"
         RenderBlock {P} at (0,2344) size 769x18
           RenderText {#text} at (0,0) size 33x18
             text run at (0,0) width 28: "ab(^"
-            text run at (28,0) width 5 RTL: "!"
+            text run at (28,0) width 5 RTL: "\x{202B}!"
+            text run at (33,0) width 0: "\x{202C}"
         RenderBlock {P} at (0,2378) size 769x19
           RenderText {#text} at (0,1) size 38x18
-            text run at (0,1) width 5 RTL: "!"
+            text run at (0,1) width 5 RTL: "\x{202B}!"
             text run at (5,1) width 33 RTL: "\x{5D0}\x{5D1}(^"
+            text run at (38,1) width 0: "\x{202C}"
         RenderBlock {P} at (0,2413) size 769x20
           RenderText {#text} at (0,2) size 33x18
-            text run at (0,2) width 5 RTL: "!"
+            text run at (0,2) width 5 RTL: "\x{202B}!"
             text run at (5,2) width 28 RTL: "\x{627}\x{628}(^"
+            text run at (33,2) width 0: "\x{202C}"
         RenderBlock {P} at (0,2449) size 769x18
           RenderText {#text} at (0,0) size 49x18
             text run at (0,0) width 44: "ab12(^"
-            text run at (44,0) width 5 RTL: "!"
+            text run at (44,0) width 5 RTL: "\x{202B}!"
+            text run at (49,0) width 0: "\x{202C}"
         RenderBlock {P} at (0,2483) size 769x19
           RenderText {#text} at (0,1) size 54x18
-            text run at (0,1) width 5 RTL: "!"
+            text run at (0,1) width 5 RTL: "\x{202B}!"
             text run at (5,1) width 13 RTL: "(^"
             text run at (18,1) width 16: "12"
             text run at (34,1) width 20 RTL: "\x{5D0}\x{5D1}"
+            text run at (54,1) width 0: "\x{202C}"
         RenderBlock {P} at (0,2518) size 769x20
           RenderText {#text} at (0,2) size 49x18
-            text run at (0,2) width 5 RTL: "!"
+            text run at (0,2) width 5 RTL: "\x{202B}!"
             text run at (5,2) width 13 RTL: "(^"
             text run at (18,2) width 16: "12"
             text run at (34,2) width 15 RTL: "\x{627}\x{628}"
+            text run at (49,2) width 0: "\x{202C}"
         RenderBlock {P} at (0,2554) size 769x20
           RenderText {#text} at (0,2) size 49x18
             text run at (0,2) width 15: "ab"
-            text run at (15,2) width 5 RTL: "!"
+            text run at (15,2) width 5 RTL: "\x{202B}!"
             text run at (20,2) width 13 RTL: "(^"
             text run at (33,2) width 16: "\x{661}\x{662}"
+            text run at (49,2) width 0: "\x{202C}"
         RenderBlock {P} at (0,2590) size 769x20
           RenderText {#text} at (0,2) size 54x18
-            text run at (0,2) width 5 RTL: "!"
+            text run at (0,2) width 5 RTL: "\x{202B}!"
             text run at (5,2) width 13 RTL: "(^"
             text run at (18,2) width 16: "\x{661}\x{662}"
             text run at (34,2) width 20 RTL: "\x{5D0}\x{5D1}"
+            text run at (54,2) width 0: "\x{202C}"
         RenderBlock {P} at (0,2626) size 769x20
           RenderText {#text} at (0,2) size 49x18
-            text run at (0,2) width 5 RTL: "!"
+            text run at (0,2) width 5 RTL: "\x{202B}!"
             text run at (5,2) width 13 RTL: "(^"
             text run at (18,2) width 16: "\x{661}\x{662}"
             text run at (34,2) width 15 RTL: "\x{627}\x{628}"
+            text run at (49,2) width 0: "\x{202C}"
         RenderBlock {P} at (0,2662) size 769x18
           RenderText {#text} at (0,0) size 25x18
-            text run at (0,0) width 7: "?"
-            text run at (7,0) width 13: "(^"
-            text run at (20,0) width 5 RTL: "!"
+            text run at (0,0) width 7: "\x{202A}?"
+            text run at (7,0) width 13: "\x{202C}(^"
+            text run at (20,0) width 5 RTL: "\x{202B}!"
+            text run at (25,0) width 0: "\x{202C}"
         RenderBlock {P} at (0,2696) size 769x18
           RenderText {#text} at (0,0) size 25x18
-            text run at (0,0) width 5 RTL: "!"
-            text run at (5,0) width 13 RTL: "(^"
-            text run at (18,0) width 7 RTL: "?"
+            text run at (0,0) width 5 RTL: "\x{202B}!"
+            text run at (5,0) width 13 RTL: "\x{202C}(^"
+            text run at (18,0) width 7 RTL: "\x{202B}?"
+            text run at (25,0) width 0: "\x{202C}"
         RenderBlock {P} at (0,2730) size 769x18
           RenderText {#text} at (0,0) size 28x18
-            text run at (0,0) width 28: "ab(^"
+            text run at (0,0) width 28: "\x{202A}ab(^"
+            text run at (28,0) width 0: "\x{202C}"
         RenderBlock {P} at (0,2764) size 769x19
           RenderText {#text} at (0,1) size 33x18
-            text run at (0,1) width 20 RTL: "\x{5D0}\x{5D1}"
+            text run at (0,1) width 20 RTL: "\x{202A}\x{5D0}\x{5D1}"
             text run at (20,1) width 13: "(^"
+            text run at (33,1) width 0: "\x{202C}"
         RenderBlock {P} at (0,2799) size 769x20
           RenderText {#text} at (0,2) size 28x18
-            text run at (0,2) width 15 RTL: "\x{627}\x{628}"
+            text run at (0,2) width 15 RTL: "\x{202A}\x{627}\x{628}"
             text run at (15,2) width 13: "(^"
+            text run at (28,2) width 0: "\x{202C}"
         RenderBlock {P} at (0,2835) size 769x18
           RenderText {#text} at (0,0) size 44x18
-            text run at (0,0) width 44: "ab12(^"
+            text run at (0,0) width 44: "\x{202A}ab12(^"
+            text run at (44,0) width 0: "\x{202C}"
         RenderBlock {P} at (0,2869) size 769x19
           RenderText {#text} at (0,1) size 49x18
             text run at (0,1) width 16: "12"
-            text run at (16,1) width 20 RTL: "\x{5D0}\x{5D1}"
+            text run at (16,1) width 20 RTL: "\x{202A}\x{5D0}\x{5D1}"
             text run at (36,1) width 13: "(^"
+            text run at (49,1) width 0: "\x{202C}"
         RenderBlock {P} at (0,2904) size 769x20
           RenderText {#text} at (0,2) size 44x18
             text run at (0,2) width 16: "12"
-            text run at (16,2) width 15 RTL: "\x{627}\x{628}"
+            text run at (16,2) width 15 RTL: "\x{202A}\x{627}\x{628}"
             text run at (31,2) width 13: "(^"
+            text run at (44,2) width 0: "\x{202C}"
         RenderBlock {P} at (0,2940) size 769x20
           RenderText {#text} at (0,2) size 44x18
-            text run at (0,2) width 15: "ab"
+            text run at (0,2) width 15: "\x{202A}ab"
             text run at (15,2) width 16: "\x{661}\x{662}"
             text run at (31,2) width 13: "(^"
+            text run at (44,2) width 0: "\x{202C}"
         RenderBlock {P} at (0,2976) size 769x20
           RenderText {#text} at (0,2) size 49x18
             text run at (0,2) width 16: "\x{661}\x{662}"
-            text run at (16,2) width 20 RTL: "\x{5D0}\x{5D1}"
+            text run at (16,2) width 20 RTL: "\x{202A}\x{5D0}\x{5D1}"
             text run at (36,2) width 13: "(^"
+            text run at (49,2) width 0: "\x{202C}"
         RenderBlock {P} at (0,3012) size 769x20
           RenderText {#text} at (0,2) size 44x18
             text run at (0,2) width 16: "\x{661}\x{662}"
-            text run at (16,2) width 15 RTL: "\x{627}\x{628}"
+            text run at (16,2) width 15 RTL: "\x{202A}\x{627}\x{628}"
             text run at (31,2) width 13: "(^"
+            text run at (44,2) width 0: "\x{202C}"
         RenderBlock {P} at (0,3048) size 769x18
           RenderText {#text} at (0,0) size 20x18
-            text run at (0,0) width 7: "?"
-            text run at (7,0) width 13: "(^"
+            text run at (0,0) width 0: "\x{202A}"
+            text run at (0,0) width 7: "\x{202A}?"
+            text run at (7,0) width 13: "\x{202C}(^"
+            text run at (20,0) width 0: "\x{202C}"
         RenderBlock {P} at (0,3082) size 769x18
           RenderText {#text} at (0,0) size 20x18
-            text run at (0,0) width 7 RTL: "?"
-            text run at (7,0) width 13: "(^"
+            text run at (0,0) width 0: "\x{202A}"
+            text run at (0,0) width 7 RTL: "\x{202B}?"
+            text run at (7,0) width 13: "\x{202C}(^"
+            text run at (20,0) width 0: "\x{202C}"
       RenderBlock {DIV} at (0,3150) size 769x3100
         RenderBlock {P} at (0,0) size 769x18
           RenderText {#text} at (0,0) size 43x18
@@ -509,13 +544,13 @@ layer at (0,0) size 785x6274
             text run at (44,2) width 15 RTL: "\x{627}\x{628}"
         RenderBlock {P} at (0,318) size 769x18
           RenderText {#text} at (0,0) size 35x18
-            text run at (0,0) width 7: "?"
-            text run at (7,0) width 28: "(^cd"
+            text run at (0,0) width 7: "\x{202A}?"
+            text run at (7,0) width 28: "\x{202C}(^cd"
         RenderBlock {P} at (0,352) size 769x18
           RenderText {#text} at (0,0) size 35x18
             text run at (0,0) width 15: "cd"
-            text run at (15,0) width 13 RTL: "(^"
-            text run at (28,0) width 7 RTL: "?"
+            text run at (15,0) width 13 RTL: "\x{202C}(^"
+            text run at (28,0) width 7 RTL: "\x{202B}?"
         RenderBlock {P} at (0,386) size 769x19
           RenderText {#text} at (0,1) size 43x18
             text run at (0,1) width 28 RTL: "(^\x{5D2}\x{5D3}"
@@ -556,12 +591,12 @@ layer at (0,0) size 785x6274
             text run at (44,2) width 15 RTL: "\x{627}\x{628}"
         RenderBlock {P} at (0,706) size 769x19
           RenderText {#text} at (0,1) size 35x18
-            text run at (0,1) width 28 RTL: "(^\x{5D2}\x{5D3}"
-            text run at (28,1) width 7: "?"
+            text run at (0,1) width 28 RTL: "\x{202C}(^\x{5D2}\x{5D3}"
+            text run at (28,1) width 7: "\x{202A}?"
         RenderBlock {P} at (0,741) size 769x19
           RenderText {#text} at (0,1) size 35x18
-            text run at (0,1) width 28 RTL: "(^\x{5D2}\x{5D3}"
-            text run at (28,1) width 7 RTL: "?"
+            text run at (0,1) width 28 RTL: "\x{202C}(^\x{5D2}\x{5D3}"
+            text run at (28,1) width 7 RTL: "\x{202B}?"
         RenderBlock {P} at (0,776) size 769x20
           RenderText {#text} at (0,2) size 45x18
             text run at (0,2) width 30 RTL: "(^\x{62C}\x{62F}"
@@ -602,12 +637,12 @@ layer at (0,0) size 785x6274
             text run at (46,2) width 15 RTL: "\x{627}\x{628}"
         RenderBlock {P} at (0,1100) size 769x20
           RenderText {#text} at (0,2) size 37x18
-            text run at (0,2) width 30 RTL: "(^\x{62C}\x{62F}"
-            text run at (30,2) width 7: "?"
+            text run at (0,2) width 30 RTL: "\x{202C}(^\x{62C}\x{62F}"
+            text run at (30,2) width 7: "\x{202A}?"
         RenderBlock {P} at (0,1136) size 769x20
           RenderText {#text} at (0,2) size 37x18
-            text run at (0,2) width 30 RTL: "(^\x{62C}\x{62F}"
-            text run at (30,2) width 7 RTL: "?"
+            text run at (0,2) width 30 RTL: "\x{202C}(^\x{62C}\x{62F}"
+            text run at (30,2) width 7 RTL: "\x{202B}?"
         RenderBlock {P} at (0,1172) size 769x19
           RenderText {#text} at (0,1) size 63x18
             text run at (0,1) width 7: "z"
@@ -673,15 +708,15 @@ layer at (0,0) size 785x6274
           RenderText {#text} at (0,1) size 55x18
             text run at (0,1) width 7: "z"
             text run at (7,1) width 12 RTL: "\x{5E9}"
-            text run at (19,1) width 7: "?"
-            text run at (26,1) width 29: "(^34"
+            text run at (19,1) width 7: "\x{202A}?"
+            text run at (26,1) width 29: "\x{202C}(^34"
         RenderBlock {P} at (0,1527) size 769x19
           RenderText {#text} at (0,1) size 55x18
             text run at (0,1) width 7: "z"
             text run at (7,1) width 12 RTL: "\x{5E9}"
             text run at (19,1) width 16: "34"
-            text run at (35,1) width 13 RTL: "(^"
-            text run at (48,1) width 7 RTL: "?"
+            text run at (35,1) width 13 RTL: "\x{202C}(^"
+            text run at (48,1) width 7 RTL: "\x{202B}?"
         RenderBlock {P} at (0,1562) size 769x20
           RenderText {#text} at (0,2) size 63x18
             text run at (0,2) width 7: "z"
@@ -752,171 +787,206 @@ layer at (0,0) size 785x6274
             text run at (0,2) width 7: "z"
             text run at (7,2) width 12 RTL: "\x{5E9}"
             text run at (19,2) width 16: "\x{663}\x{664}"
-            text run at (35,2) width 13 RTL: "(^"
-            text run at (48,2) width 7: "?"
+            text run at (35,2) width 13 RTL: "\x{202C}(^"
+            text run at (48,2) width 7: "\x{202A}?"
         RenderBlock {P} at (0,1922) size 769x20
           RenderText {#text} at (0,2) size 55x18
             text run at (0,2) width 7: "z"
             text run at (7,2) width 12 RTL: "\x{5E9}"
             text run at (19,2) width 16: "\x{663}\x{664}"
-            text run at (35,2) width 13 RTL: "(^"
-            text run at (48,2) width 7 RTL: "?"
+            text run at (35,2) width 13 RTL: "\x{202C}(^"
+            text run at (48,2) width 7 RTL: "\x{202B}?"
         RenderBlock {P} at (0,1958) size 769x18
           RenderText {#text} at (0,0) size 33x18
+            text run at (0,0) width 0 RTL: "\x{202C}"
             text run at (0,0) width 28: "ab(^"
-            text run at (28,0) width 5: "!"
+            text run at (28,0) width 5: "\x{202A}!"
         RenderBlock {P} at (0,1992) size 769x19
           RenderText {#text} at (0,1) size 38x18
-            text run at (0,1) width 5: "!"
+            text run at (0,1) width 0 RTL: "\x{202C}"
+            text run at (0,1) width 5: "\x{202A}!"
             text run at (5,1) width 33 RTL: "\x{5D0}\x{5D1}(^"
         RenderBlock {P} at (0,2027) size 769x20
           RenderText {#text} at (0,2) size 33x18
-            text run at (0,2) width 5: "!"
+            text run at (0,2) width 0 RTL: "\x{202C}"
+            text run at (0,2) width 5: "\x{202A}!"
             text run at (5,2) width 28 RTL: "\x{627}\x{628}(^"
         RenderBlock {P} at (0,2063) size 769x18
           RenderText {#text} at (0,0) size 49x18
+            text run at (0,0) width 0 RTL: "\x{202C}"
             text run at (0,0) width 44: "ab12(^"
-            text run at (44,0) width 5: "!"
+            text run at (44,0) width 5: "\x{202A}!"
         RenderBlock {P} at (0,2097) size 769x19
           RenderText {#text} at (0,1) size 54x18
-            text run at (0,1) width 5: "!"
+            text run at (0,1) width 0 RTL: "\x{202C}"
+            text run at (0,1) width 5: "\x{202A}!"
             text run at (5,1) width 13 RTL: "(^"
             text run at (18,1) width 16: "12"
             text run at (34,1) width 20 RTL: "\x{5D0}\x{5D1}"
         RenderBlock {P} at (0,2132) size 769x20
           RenderText {#text} at (0,2) size 49x18
-            text run at (0,2) width 5: "!"
+            text run at (0,2) width 0 RTL: "\x{202C}"
+            text run at (0,2) width 5: "\x{202A}!"
             text run at (5,2) width 13 RTL: "(^"
             text run at (18,2) width 16: "12"
             text run at (34,2) width 15 RTL: "\x{627}\x{628}"
         RenderBlock {P} at (0,2168) size 769x20
           RenderText {#text} at (0,2) size 49x18
-            text run at (0,2) width 5: "!"
+            text run at (0,2) width 0 RTL: "\x{202C}"
+            text run at (0,2) width 5: "\x{202A}!"
             text run at (5,2) width 13 RTL: "(^"
             text run at (18,2) width 31: "ab\x{661}\x{662}"
         RenderBlock {P} at (0,2204) size 769x20
           RenderText {#text} at (0,2) size 54x18
-            text run at (0,2) width 5: "!"
+            text run at (0,2) width 0 RTL: "\x{202C}"
+            text run at (0,2) width 5: "\x{202A}!"
             text run at (5,2) width 13 RTL: "(^"
             text run at (18,2) width 16: "\x{661}\x{662}"
             text run at (34,2) width 20 RTL: "\x{5D0}\x{5D1}"
         RenderBlock {P} at (0,2240) size 769x20
           RenderText {#text} at (0,2) size 49x18
-            text run at (0,2) width 5: "!"
+            text run at (0,2) width 0 RTL: "\x{202C}"
+            text run at (0,2) width 5: "\x{202A}!"
             text run at (5,2) width 13 RTL: "(^"
             text run at (18,2) width 16: "\x{661}\x{662}"
             text run at (34,2) width 15 RTL: "\x{627}\x{628}"
         RenderBlock {P} at (0,2276) size 769x18
           RenderText {#text} at (0,0) size 25x18
-            text run at (0,0) width 7: "?"
-            text run at (7,0) width 13: "(^"
-            text run at (20,0) width 5: "!"
+            text run at (0,0) width 0 RTL: "\x{202C}"
+            text run at (0,0) width 7: "\x{202A}?"
+            text run at (7,0) width 13: "\x{202C}(^"
+            text run at (20,0) width 5: "\x{202A}!"
         RenderBlock {P} at (0,2310) size 769x18
           RenderText {#text} at (0,0) size 25x18
-            text run at (0,0) width 5: "!"
-            text run at (5,0) width 13 RTL: "(^"
-            text run at (18,0) width 7 RTL: "?"
+            text run at (0,0) width 0 RTL: "\x{202C}"
+            text run at (0,0) width 5: "\x{202A}!"
+            text run at (5,0) width 13 RTL: "\x{202C}(^"
+            text run at (18,0) width 7 RTL: "\x{202B}?"
         RenderBlock {P} at (0,2344) size 769x18
           RenderText {#text} at (0,0) size 33x18
-            text run at (0,0) width 5 RTL: "!"
+            text run at (0,0) width 0 RTL: "\x{202C}"
+            text run at (0,0) width 5 RTL: "\x{202B}!"
             text run at (5,0) width 13 RTL: "(^"
             text run at (18,0) width 15: "ab"
         RenderBlock {P} at (0,2378) size 769x19
           RenderText {#text} at (0,1) size 38x18
-            text run at (0,1) width 5 RTL: "!"
+            text run at (0,1) width 0 RTL: "\x{202C}"
+            text run at (0,1) width 5 RTL: "\x{202B}!"
             text run at (5,1) width 33 RTL: "\x{5D0}\x{5D1}(^"
         RenderBlock {P} at (0,2413) size 769x20
           RenderText {#text} at (0,2) size 33x18
-            text run at (0,2) width 5 RTL: "!"
+            text run at (0,2) width 0 RTL: "\x{202C}"
+            text run at (0,2) width 5 RTL: "\x{202B}!"
             text run at (5,2) width 28 RTL: "\x{627}\x{628}(^"
         RenderBlock {P} at (0,2449) size 769x18
           RenderText {#text} at (0,0) size 49x18
-            text run at (0,0) width 5 RTL: "!"
+            text run at (0,0) width 0 RTL: "\x{202C}"
+            text run at (0,0) width 5 RTL: "\x{202B}!"
             text run at (5,0) width 13 RTL: "(^"
             text run at (18,0) width 31: "ab12"
         RenderBlock {P} at (0,2483) size 769x19
           RenderText {#text} at (0,1) size 54x18
-            text run at (0,1) width 5 RTL: "!"
+            text run at (0,1) width 0 RTL: "\x{202C}"
+            text run at (0,1) width 5 RTL: "\x{202B}!"
             text run at (5,1) width 13 RTL: "(^"
             text run at (18,1) width 16: "12"
             text run at (34,1) width 20 RTL: "\x{5D0}\x{5D1}"
         RenderBlock {P} at (0,2518) size 769x20
           RenderText {#text} at (0,2) size 49x18
-            text run at (0,2) width 5 RTL: "!"
+            text run at (0,2) width 0 RTL: "\x{202C}"
+            text run at (0,2) width 5 RTL: "\x{202B}!"
             text run at (5,2) width 13 RTL: "(^"
             text run at (18,2) width 16: "12"
             text run at (34,2) width 15 RTL: "\x{627}\x{628}"
         RenderBlock {P} at (0,2554) size 769x20
           RenderText {#text} at (0,2) size 49x18
-            text run at (0,2) width 5 RTL: "!"
+            text run at (0,2) width 0 RTL: "\x{202C}"
+            text run at (0,2) width 5 RTL: "\x{202B}!"
             text run at (5,2) width 13 RTL: "(^"
             text run at (18,2) width 31: "ab\x{661}\x{662}"
         RenderBlock {P} at (0,2590) size 769x20
           RenderText {#text} at (0,2) size 54x18
-            text run at (0,2) width 5 RTL: "!"
+            text run at (0,2) width 0 RTL: "\x{202C}"
+            text run at (0,2) width 5 RTL: "\x{202B}!"
             text run at (5,2) width 13 RTL: "(^"
             text run at (18,2) width 16: "\x{661}\x{662}"
             text run at (34,2) width 20 RTL: "\x{5D0}\x{5D1}"
         RenderBlock {P} at (0,2626) size 769x20
           RenderText {#text} at (0,2) size 49x18
-            text run at (0,2) width 5 RTL: "!"
+            text run at (0,2) width 0 RTL: "\x{202C}"
+            text run at (0,2) width 5 RTL: "\x{202B}!"
             text run at (5,2) width 13 RTL: "(^"
             text run at (18,2) width 16: "\x{661}\x{662}"
             text run at (34,2) width 15 RTL: "\x{627}\x{628}"
         RenderBlock {P} at (0,2662) size 769x18
           RenderText {#text} at (0,0) size 25x18
-            text run at (0,0) width 5 RTL: "!"
-            text run at (5,0) width 13 RTL: "(^"
-            text run at (18,0) width 7: "?"
+            text run at (0,0) width 0 RTL: "\x{202C}"
+            text run at (0,0) width 5 RTL: "\x{202B}!"
+            text run at (5,0) width 13 RTL: "\x{202C}(^"
+            text run at (18,0) width 7: "\x{202A}?"
         RenderBlock {P} at (0,2696) size 769x18
           RenderText {#text} at (0,0) size 25x18
-            text run at (0,0) width 5 RTL: "!"
-            text run at (5,0) width 13 RTL: "(^"
-            text run at (18,0) width 7 RTL: "?"
+            text run at (0,0) width 0 RTL: "\x{202C}"
+            text run at (0,0) width 5 RTL: "\x{202B}!"
+            text run at (5,0) width 13 RTL: "\x{202C}(^"
+            text run at (18,0) width 7 RTL: "\x{202B}?"
         RenderBlock {P} at (0,2730) size 769x18
           RenderText {#text} at (0,0) size 28x18
-            text run at (0,0) width 28: "ab(^"
+            text run at (0,0) width 0 RTL: "\x{202C}"
+            text run at (0,0) width 28: "\x{202A}ab(^"
         RenderBlock {P} at (0,2764) size 769x19
           RenderText {#text} at (0,1) size 33x18
-            text run at (0,1) width 20 RTL: "\x{5D0}\x{5D1}"
+            text run at (0,1) width 0 RTL: "\x{202C}"
+            text run at (0,1) width 20 RTL: "\x{202A}\x{5D0}\x{5D1}"
             text run at (20,1) width 13: "(^"
         RenderBlock {P} at (0,2799) size 769x20
           RenderText {#text} at (0,2) size 28x18
-            text run at (0,2) width 15 RTL: "\x{627}\x{628}"
+            text run at (0,2) width 0 RTL: "\x{202C}"
+            text run at (0,2) width 15 RTL: "\x{202A}\x{627}\x{628}"
             text run at (15,2) width 13: "(^"
         RenderBlock {P} at (0,2835) size 769x18
           RenderText {#text} at (0,0) size 44x18
-            text run at (0,0) width 44: "ab12(^"
+            text run at (0,0) width 0 RTL: "\x{202C}"
+            text run at (0,0) width 44: "\x{202A}ab12(^"
         RenderBlock {P} at (0,2869) size 769x19
           RenderText {#text} at (0,1) size 49x18
+            text run at (0,1) width 0 RTL: "\x{202C}"
             text run at (0,1) width 16: "12"
-            text run at (16,1) width 20 RTL: "\x{5D0}\x{5D1}"
+            text run at (16,1) width 20 RTL: "\x{202A}\x{5D0}\x{5D1}"
             text run at (36,1) width 13: "(^"
         RenderBlock {P} at (0,2904) size 769x20
           RenderText {#text} at (0,2) size 44x18
+            text run at (0,2) width 0 RTL: "\x{202C}"
             text run at (0,2) width 16: "12"
-            text run at (16,2) width 15 RTL: "\x{627}\x{628}"
+            text run at (16,2) width 15 RTL: "\x{202A}\x{627}\x{628}"
             text run at (31,2) width 13: "(^"
         RenderBlock {P} at (0,2940) size 769x20
           RenderText {#text} at (0,2) size 44x18
-            text run at (0,2) width 15: "ab"
+            text run at (0,2) width 0 RTL: "\x{202C}"
+            text run at (0,2) width 15: "\x{202A}ab"
             text run at (15,2) width 16: "\x{661}\x{662}"
             text run at (31,2) width 13: "(^"
         RenderBlock {P} at (0,2976) size 769x20
           RenderText {#text} at (0,2) size 49x18
+            text run at (0,2) width 0 RTL: "\x{202C}"
             text run at (0,2) width 16: "\x{661}\x{662}"
-            text run at (16,2) width 20 RTL: "\x{5D0}\x{5D1}"
+            text run at (16,2) width 20 RTL: "\x{202A}\x{5D0}\x{5D1}"
             text run at (36,2) width 13: "(^"
         RenderBlock {P} at (0,3012) size 769x20
           RenderText {#text} at (0,2) size 44x18
+            text run at (0,2) width 0 RTL: "\x{202C}"
             text run at (0,2) width 16: "\x{661}\x{662}"
-            text run at (16,2) width 15 RTL: "\x{627}\x{628}"
+            text run at (16,2) width 15 RTL: "\x{202A}\x{627}\x{628}"
             text run at (31,2) width 13: "(^"
         RenderBlock {P} at (0,3048) size 769x18
           RenderText {#text} at (0,0) size 20x18
-            text run at (0,0) width 7: "?"
-            text run at (7,0) width 13: "(^"
+            text run at (0,0) width 0 RTL: "\x{202C}"
+            text run at (0,0) width 0: "\x{202A}"
+            text run at (0,0) width 7: "\x{202A}?"
+            text run at (7,0) width 13: "\x{202C}(^"
         RenderBlock {P} at (0,3082) size 769x18
           RenderText {#text} at (0,0) size 20x18
-            text run at (0,0) width 7 RTL: "?"
-            text run at (7,0) width 13: "(^"
+            text run at (0,0) width 0 RTL: "\x{202C}"
+            text run at (0,0) width 0: "\x{202A}"
+            text run at (0,0) width 7 RTL: "\x{202B}?"
+            text run at (7,0) width 13: "\x{202C}(^"
diff --git a/LayoutTests/platform/mac/fast/text/international/bidi-override-expected.txt b/LayoutTests/platform/mac/fast/text/international/bidi-override-expected.txt
index a0baaa1..3e309fe 100644
--- a/LayoutTests/platform/mac/fast/text/international/bidi-override-expected.txt
+++ b/LayoutTests/platform/mac/fast/text/international/bidi-override-expected.txt
@@ -110,20 +110,20 @@ layer at (0,0) size 800x344
             RenderTableCell {TD} at (97,84) size 242x28 [border: (1px solid #008000)] [r=3 c=1 rs=1 cs=1]
               RenderText {#text} at (5,6) size 233x18
                 text run at (5,6) width 22: "abc"
-                text run at (27,6) width 67 RTL override: "ihg\x{5D0}\x{5D1}\x{5D2}fed"
-                text run at (94,6) width 20: "jkl "
-                text run at (114,6) width 23 RTL: "\x{5D9}\x{5DB}\x{5DC}"
-                text run at (137,6) width 74 LTR override: "\x{5D8}\x{5D7}\x{5D6}abc\x{5D5}\x{5D4}\x{5D3}"
+                text run at (27,6) width 67 RTL override: "\x{202E}ihg\x{5D0}\x{5D1}\x{5D2}fed"
+                text run at (94,6) width 20: "\x{202C}jkl "
+                text run at (114,6) width 23 RTL: "\x{202C}\x{5D9}\x{5DB}\x{5DC}"
+                text run at (137,6) width 74 LTR override: "\x{202D}\x{5D8}\x{5D7}\x{5D6}abc\x{5D5}\x{5D4}\x{5D3}"
                 text run at (211,6) width 27 RTL: "\x{5D0}\x{5D1}\x{5D2}"
             RenderTableCell {TD} at (339,84) size 242x28 [border: (1px solid #008000)] [r=3 c=2 rs=1 cs=1]
               RenderText {#text} at (5,6) size 233x18
-                text run at (5,6) width 23 RTL: "\x{5D9}\x{5DB}\x{5DC}"
-                text run at (28,6) width 74 LTR override: "\x{5D8}\x{5D7}\x{5D6}abc\x{5D5}\x{5D4}\x{5D3}"
+                text run at (5,6) width 23 RTL: "\x{202C}\x{5D9}\x{5DB}\x{5DC}"
+                text run at (28,6) width 74 LTR override: "\x{202D}\x{5D8}\x{5D7}\x{5D6}abc\x{5D5}\x{5D4}\x{5D3}"
                 text run at (102,6) width 27 RTL: "\x{5D0}\x{5D1}\x{5D2}"
                 text run at (129,6) width 4 RTL: " "
                 text run at (133,6) width 22: "abc"
-                text run at (155,6) width 67 RTL override: "ihg\x{5D0}\x{5D1}\x{5D2}fed"
-                text run at (222,6) width 16: "jkl"
+                text run at (155,6) width 67 RTL override: "\x{202E}ihg\x{5D0}\x{5D1}\x{5D2}fed"
+                text run at (222,6) width 16: "\x{202C}jkl"
       RenderBlock {P} at (0,163) size 784x18
         RenderText {#text} at (0,0) size 387x18
           text run at (0,0) width 387: "The CSS column should be identical to the reference column."
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 2fe1b72..bf788df 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,28 @@
+2010-11-08  Xiaomei Ji  <xji at chromium.org>
+
+        Reviewed by Dan Bernstein.
+
+        Fix Unicode explicit bidi control characters are removed in editing operations,
+        such as insert/copy/cut/paste.
+        https://bugs.webkit.org/show_bug.cgi?id=25321
+
+        Unicode explicit bidi control characters were excluded in BidiRun and
+        consequently from InlineTextBoxes due to their effect on rendering complex
+        text with ATSUI.
+        The fix is including those characters in BidiRun and remove them from
+        ComplexTextRun with ATSUI.
+
+        Test: editing/inserting/insert-paste-bidi-control.html
+               fast/text/atsui-bidi-control.html
+
+        * platform/graphics/mac/ComplexTextControllerATSUI.cpp:
+        (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
+        * platform/text/BidiResolver.h:
+        (WebCore::::checkDirectionInLowerRaiseEmbeddingLevel):
+        (WebCore::::lowerExplicitEmbeddingLevel):
+        (WebCore::::raiseExplicitEmbeddingLevel):
+        (WebCore::::createBidiRunsForLine):
+
 2010-11-08  David Hyatt  <hyatt at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp b/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp
index 1656854..2c4a7c4 100644
--- a/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp
+++ b/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp
@@ -30,9 +30,9 @@
 #include "ShapeArabic.h"
 
 #ifdef __LP64__
-// ATSUTextInserted() is SPI in 64-bit.
 extern "C" {
 OSStatus ATSUTextInserted(ATSUTextLayout iTextLayout,  UniCharArrayOffset iInsertionLocation, UniCharCount iInsertionLength);
+OSStatus ATSUTextDeleted(ATSUTextLayout iTextLayout,  UniCharArrayOffset iInsertionLocation, UniCharCount iInsertionLength);
 }
 #endif
 
@@ -188,6 +188,32 @@ ComplexTextController::ComplexTextRun::ComplexTextRun(ATSUTextLayout atsuTextLay
         ATSUTextMoved(atsuTextLayout, substituteCharacters.data());
     }
 
+    // Remove the leading character if it is one of explicit Unicode bidi control characters.
+    // Explicit Unicode bidi control character, if present, is always the leading
+    // character in a run. And it could be the leading character in a LTR run.
+    // For example, "a&#x202b;x!&#202c;y", the last run "&#x202c;y" is a LTR run
+    // and begins with an explicit Unicode bidi control character.
+    if (stringLength > 0) {
+        UChar leadingCharacter;
+        if (substituteCharacters.isEmpty())
+            leadingCharacter = characters[0];
+        else
+            leadingCharacter = substituteCharacters[0];
+        if (leadingCharacter == leftToRightEmbed
+            || leadingCharacter == leftToRightOverride 
+            || leadingCharacter == rightToLeftEmbed
+            || leadingCharacter == rightToLeftOverride
+            || leadingCharacter == popDirectionalFormatting)
+            if (substituteCharacters.isEmpty()) {
+                substituteCharacters.grow(stringLength - 1);
+                memcpy(substituteCharacters.data(), characters + 1, (stringLength - 1) * sizeof(UChar));
+                ATSUTextMoved(atsuTextLayout, substituteCharacters.data());
+            } else {
+                substituteCharacters.remove(0);
+                ATSUTextDeleted(atsuTextLayout, 0, 1);
+            }
+    }
+
     if (directionalOverride) {
         UChar override = ltr ? leftToRightOverride : rightToLeftOverride;
         if (substituteCharacters.isEmpty()) {
@@ -214,7 +240,7 @@ ComplexTextController::ComplexTextRun::ComplexTextRun(ATSUTextLayout atsuTextLay
     status = ATSUSetLayoutControls(atsuTextLayout, 3, tags, sizes, values);
 
     ItemCount boundsCount;
-    status = ATSUGetGlyphBounds(atsuTextLayout, 0, 0, 0, m_stringLength, kATSUseFractionalOrigins, 0, 0, &boundsCount);
+    status = ATSUGetGlyphBounds(atsuTextLayout, 0, 0, 0, kATSUToTextEnd, kATSUseFractionalOrigins, 0, 0, &boundsCount);
 
     status = ATSUDisposeTextLayout(atsuTextLayout);
 }
diff --git a/WebCore/platform/text/BidiResolver.h b/WebCore/platform/text/BidiResolver.h
index a99fd01..1f87115 100644
--- a/WebCore/platform/text/BidiResolver.h
+++ b/WebCore/platform/text/BidiResolver.h
@@ -201,6 +201,7 @@ protected:
 private:
     void raiseExplicitEmbeddingLevel(WTF::Unicode::Direction from, WTF::Unicode::Direction to);
     void lowerExplicitEmbeddingLevel(WTF::Unicode::Direction from);
+    void checkDirectionInLowerRaiseEmbeddingLevel();
 
     Vector<WTF::Unicode::Direction, 8> m_currentExplicitEmbeddingSequence;
 };
@@ -308,23 +309,39 @@ void BidiResolver<Iterator, Run>::embed(WTF::Unicode::Direction d)
 }
 
 template <class Iterator, class Run>
+void BidiResolver<Iterator, Run>::checkDirectionInLowerRaiseEmbeddingLevel()
+{
+    using namespace WTF::Unicode;
+
+    ASSERT(m_status.eor != OtherNeutral || eor.atEnd());
+    // bidi.sor ... bidi.eor ... bidi.last eor; need to append the bidi.sor-bidi.eor run or extend it through bidi.last
+    // Bidi control characters are included into BidiRun, so last direction
+    // could be one of the bidi embeddings when there are nested embeddings.
+    // For example:  "&#x202a;&#x202b;....."
+    ASSERT(m_status.last == EuropeanNumberSeparator
+        || m_status.last == EuropeanNumberTerminator
+        || m_status.last == CommonNumberSeparator
+        || m_status.last == BoundaryNeutral
+        || m_status.last == BlockSeparator
+        || m_status.last == SegmentSeparator
+        || m_status.last == WhiteSpaceNeutral
+        || m_status.last == OtherNeutral
+        || m_status.last == RightToLeftEmbedding
+        || m_status.last == LeftToRightEmbedding
+        || m_status.last == RightToLeftOverride
+        || m_status.last == LeftToRightOverride
+        || m_status.last == PopDirectionalFormat);
+    if (m_direction == OtherNeutral)
+        m_direction = m_status.lastStrong == LeftToRight ? LeftToRight : RightToLeft;
+}
+
+template <class Iterator, class Run>
 void BidiResolver<Iterator, Run>::lowerExplicitEmbeddingLevel(WTF::Unicode::Direction from)
 {
     using namespace WTF::Unicode;
 
     if (!emptyRun && eor != last) {
-        ASSERT(m_status.eor != OtherNeutral || eor.atEnd());
-        // bidi.sor ... bidi.eor ... bidi.last eor; need to append the bidi.sor-bidi.eor run or extend it through bidi.last
-        ASSERT(m_status.last == EuropeanNumberSeparator
-            || m_status.last == EuropeanNumberTerminator
-            || m_status.last == CommonNumberSeparator
-            || m_status.last == BoundaryNeutral
-            || m_status.last == BlockSeparator
-            || m_status.last == SegmentSeparator
-            || m_status.last == WhiteSpaceNeutral
-            || m_status.last == OtherNeutral);
-        if (m_direction == OtherNeutral)
-            m_direction = m_status.lastStrong == LeftToRight ? LeftToRight : RightToLeft;
+        checkDirectionInLowerRaiseEmbeddingLevel();
         if (from == LeftToRight) {
             // bidi.sor ... bidi.eor ... bidi.last L
             if (m_status.eor == EuropeanNumber) {
@@ -359,18 +376,7 @@ void BidiResolver<Iterator, Run>::raiseExplicitEmbeddingLevel(WTF::Unicode::Dire
     using namespace WTF::Unicode;
 
     if (!emptyRun && eor != last) {
-        ASSERT(m_status.eor != OtherNeutral || eor.atEnd());
-        // bidi.sor ... bidi.eor ... bidi.last eor; need to append the bidi.sor-bidi.eor run or extend it through bidi.last
-        ASSERT(m_status.last == EuropeanNumberSeparator
-            || m_status.last == EuropeanNumberTerminator
-            || m_status.last == CommonNumberSeparator
-            || m_status.last == BoundaryNeutral
-            || m_status.last == BlockSeparator
-            || m_status.last == SegmentSeparator
-            || m_status.last == WhiteSpaceNeutral
-            || m_status.last == OtherNeutral);
-        if (m_direction == OtherNeutral)
-            m_direction = m_status.lastStrong == LeftToRight ? LeftToRight : RightToLeft;
+        checkDirectionInLowerRaiseEmbeddingLevel();
         if (to == LeftToRight) {
             // bidi.sor ... bidi.eor ... bidi.last L
             if (m_status.eor == EuropeanNumber) {
@@ -568,7 +574,7 @@ void BidiResolver<Iterator, Run>::createBidiRunsForLine(const Iterator& end, boo
             commitExplicitEmbedding();
             break;
 
-            // strong types
+        // strong types
         case LeftToRight:
             switch(m_status.last) {
                 case RightToLeft:
@@ -860,11 +866,6 @@ void BidiResolver<Iterator, Run>::createBidiRunsForLine(const Iterator& end, boo
                 break;
             case NonSpacingMark:
             case BoundaryNeutral:
-            case RightToLeftEmbedding:
-            case LeftToRightEmbedding:
-            case RightToLeftOverride:
-            case LeftToRightOverride:
-            case PopDirectionalFormat:
                 // ignore these
                 break;
             case EuropeanNumber:
@@ -875,11 +876,7 @@ void BidiResolver<Iterator, Run>::createBidiRunsForLine(const Iterator& end, boo
 
         last = current;
 
-        if (emptyRun && !(dirCurrent == RightToLeftEmbedding
-                || dirCurrent == LeftToRightEmbedding
-                || dirCurrent == RightToLeftOverride
-                || dirCurrent == LeftToRightOverride
-                || dirCurrent == PopDirectionalFormat)) {
+        if (emptyRun) {
             sor = current;
             emptyRun = false;
         }
@@ -901,17 +898,6 @@ void BidiResolver<Iterator, Run>::createBidiRunsForLine(const Iterator& end, boo
             }
         }
 
-        if (emptyRun && (dirCurrent == RightToLeftEmbedding
-                || dirCurrent == LeftToRightEmbedding
-                || dirCurrent == RightToLeftOverride
-                || dirCurrent == LeftToRightOverride
-                || dirCurrent == PopDirectionalFormat)) {
-            // exclude the embedding char itself from the new run so that ATSUI will never see it
-            eor = Iterator();
-            last = current;
-            sor = current;
-        }
-
         if (!pastEnd && (current == end || current.atEnd())) {
             if (emptyRun)
                 break;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list