WebCore:
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Dec 2007 18:45:03 +0000 (18:45 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Dec 2007 18:45:03 +0000 (18:45 +0000)
        Reviewed by Adam Roben.

        - ensure that Unicode bidi control characters are rendered as zero width
          spaces

        Test: fast/text/international/bidi-control-chars-treated-as-ZWS.html

        * platform/graphics/Font.h:
        (WebCore::Font::treatAsZeroWidthSpace):
        * platform/graphics/GlyphPageTreeNode.cpp:
        (WebCore::GlyphPageTreeNode::initializePage):
        * platform/text/CharacterNames.h:

LayoutTests:

        Reviewed by Adam Roben.

        - test that Unicode bidi control characters are rendered as zero width
          spaces

        * fast/text/international/bidi-control-chars-treated-as-ZWS.html: Added.
        * platform/mac-leopard/fast/text/international/bidi-control-chars-treated-as-ZWS-expected.checksum: Added.
        * platform/mac-leopard/fast/text/international/bidi-control-chars-treated-as-ZWS-expected.png: Added.
        * platform/mac-leopard/fast/text/international/bidi-control-chars-treated-as-ZWS-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28688 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/text/international/bidi-control-chars-treated-as-ZWS.html [new file with mode: 0644]
LayoutTests/platform/mac-leopard/fast/text/international/bidi-control-chars-treated-as-ZWS-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac-leopard/fast/text/international/bidi-control-chars-treated-as-ZWS-expected.png [new file with mode: 0644]
LayoutTests/platform/mac-leopard/fast/text/international/bidi-control-chars-treated-as-ZWS-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/platform/graphics/Font.h
WebCore/platform/graphics/GlyphPageTreeNode.cpp
WebCore/platform/text/CharacterNames.h

index 37b4b1bd13d917c135fb6485ea548f3a5840fbc6..f91464267d10a74473ec4874eb338d5cb96954fd 100644 (file)
@@ -1,3 +1,15 @@
+2007-12-13  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Adam Roben.
+
+        - test that Unicode bidi control characters are rendered as zero width
+          spaces
+
+        * fast/text/international/bidi-control-chars-treated-as-ZWS.html: Added.
+        * platform/mac-leopard/fast/text/international/bidi-control-chars-treated-as-ZWS-expected.checksum: Added.
+        * platform/mac-leopard/fast/text/international/bidi-control-chars-treated-as-ZWS-expected.png: Added.
+        * platform/mac-leopard/fast/text/international/bidi-control-chars-treated-as-ZWS-expected.txt: Added.
+
 2007-12-12  Dan Bernstein  <mitz@apple.com>
 
         Reviewed by Oliver Hunt.
diff --git a/LayoutTests/fast/text/international/bidi-control-chars-treated-as-ZWS.html b/LayoutTests/fast/text/international/bidi-control-chars-treated-as-ZWS.html
new file mode 100644 (file)
index 0000000..1aea5b9
--- /dev/null
@@ -0,0 +1,5 @@
+This tests that Unicode bidi control characters are not rendered and have zero width. The next two lines should look the same.
+<div style="font-family: 'Times New Roman';">
+    a&#x202d;e&#x300;<br>
+    ae&#x300;
+</div>
diff --git a/LayoutTests/platform/mac-leopard/fast/text/international/bidi-control-chars-treated-as-ZWS-expected.checksum b/LayoutTests/platform/mac-leopard/fast/text/international/bidi-control-chars-treated-as-ZWS-expected.checksum
new file mode 100644 (file)
index 0000000..a5a087d
--- /dev/null
@@ -0,0 +1 @@
+47f03934faca7ba1b6a83f3e560c6bc7
\ No newline at end of file
diff --git a/LayoutTests/platform/mac-leopard/fast/text/international/bidi-control-chars-treated-as-ZWS-expected.png b/LayoutTests/platform/mac-leopard/fast/text/international/bidi-control-chars-treated-as-ZWS-expected.png
new file mode 100644 (file)
index 0000000..833d5a1
Binary files /dev/null and b/LayoutTests/platform/mac-leopard/fast/text/international/bidi-control-chars-treated-as-ZWS-expected.png differ
diff --git a/LayoutTests/platform/mac-leopard/fast/text/international/bidi-control-chars-treated-as-ZWS-expected.txt b/LayoutTests/platform/mac-leopard/fast/text/international/bidi-control-chars-treated-as-ZWS-expected.txt
new file mode 100644 (file)
index 0000000..f62ad40
--- /dev/null
@@ -0,0 +1,16 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock (anonymous) at (0,0) size 784x36
+        RenderText {#text} at (0,0) size 751x36
+          text run at (0,0) width 751: "This tests that Unicode bidi control characters are not rendered and have zero width. The next two lines should look the"
+          text run at (0,18) width 36: "same."
+      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}"
+        RenderBR {BR} at (14,14) size 0x0
+        RenderText {#text} at (0,18) size 14x17
+          text run at (0,18) width 14: "ae\x{300}"
index fcee1af87cad80ed0fda763f8afb154d29ef9937..f0b8584b94ba523408d3252f35723dc00462e812 100644 (file)
@@ -1,3 +1,18 @@
+2007-12-13  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Adam Roben.
+
+        - ensure that Unicode bidi control characters are rendered as zero width
+          spaces
+
+        Test: fast/text/international/bidi-control-chars-treated-as-ZWS.html
+
+        * platform/graphics/Font.h:
+        (WebCore::Font::treatAsZeroWidthSpace):
+        * platform/graphics/GlyphPageTreeNode.cpp:
+        (WebCore::GlyphPageTreeNode::initializePage):
+        * platform/text/CharacterNames.h:
+
 2007-12-13  Brady Eidson  <beidson@apple.com>
 
         Build fix
index 277dadd72f2208662c97a930c0aedc8b6bd9399d..eec378fde292c5e028214e6a8d45d899d88edafc 100644 (file)
@@ -222,7 +222,7 @@ public:
     }
 #endif
     static bool treatAsSpace(UChar c) { return c == ' ' || c == '\t' || c == '\n' || c == 0x00A0; }
-    static bool treatAsZeroWidthSpace(UChar c) { return c < 0x20 || (c >= 0x7F && c < 0xA0) || c == 0x200e || c == 0x200f; }
+    static bool treatAsZeroWidthSpace(UChar c) { return c < 0x20 || (c >= 0x7F && c < 0xA0) || c == 0x200e || c == 0x200f || c >= 0x202a && c <= 0x202e; }
 private:
     FontDescription m_fontDescription;
 #if !PLATFORM(QT)
index 97aef3029d670b486ff7993739912896141b5b08..9d3df6251fbbe146a1331e6ab14f69c2336560cd 100644 (file)
@@ -121,9 +121,12 @@ void GlyphPageTreeNode::initializePage(const FontData* fontData, unsigned pageNu
                     buffer[(int)'\t'] = ' ';
                     buffer[noBreakSpace] = ' ';
                 } else if (start == (leftToRightMark & ~(GlyphPage::size - 1))) {
-                    // LRM/RLM must not render at all.
+                    // LRM, RLM, LRE, RLE and PDF must not render at all.
                     buffer[leftToRightMark - start] = zeroWidthSpace;
                     buffer[rightToLeftMark - start] = zeroWidthSpace;
+                    buffer[leftToRightEmbed - start] = zeroWidthSpace;
+                    buffer[rightToLeftEmbed - start] = zeroWidthSpace;
+                    buffer[popDirectionalFormatting - start] = zeroWidthSpace;
                 } else if (start == (objectReplacementCharacter & ~(GlyphPage::size - 1))) {
                     // Object replacement character must not render at all.
                     buffer[objectReplacementCharacter - start] = zeroWidthSpace;
index 55262369a1b39672e816b9179d59fcf3c028dadf..5b524790e210ded076304acc93e2dc6d181cdaf4 100644 (file)
@@ -40,12 +40,14 @@ namespace WebCore {
     const UChar horizontalEllipsis = 0x2026;
     const UChar ideographicSpace = 0x3000;
     const UChar leftToRightMark = 0x200E;
+    const UChar leftToRightEmbed = 0x202A;
     const UChar leftToRightOverride = 0x202D;
     const UChar newlineCharacter = 0x000A;
     const UChar noBreakSpace = 0x00A0;
     const UChar objectReplacementCharacter = 0xFFFC;
     const UChar popDirectionalFormatting = 0x202C;
     const UChar rightToLeftMark = 0x200F;
+    const UChar rightToLeftEmbed = 0x202B;
     const UChar rightToLeftOverride = 0x202E;
     const UChar softHyphen = 0x00AD;
     const UChar whiteBullet = 0x25E6;