Reviewed by Darin. Tweaked and landed by Alexey.
authorap@webkit.org <ap@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Feb 2008 10:15:02 +0000 (10:15 +0000)
committerap@webkit.org <ap@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Feb 2008 10:15:02 +0000 (10:15 +0000)
        http://bugs.webkit.org/show_bug.cgi?id=17411
        Ideographic comma and full stop should be treated as line-breakable characters

        Test: fast/text/line-breaks-after-ideographic-comma-or-full-stop.html

        * platform/text/CharacterNames.h: Added ideographicComma and ideographicFullStop.
        * rendering/break_lines.cpp: (WebCore::shouldBreakAfter): Added a workaround for an issue in
        Unicode 5.0 that is causing this.

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

LayoutTests/ChangeLog
LayoutTests/fast/text/line-breaks-after-ideographic-comma-or-full-stop-expected.txt [new file with mode: 0644]
LayoutTests/fast/text/line-breaks-after-ideographic-comma-or-full-stop.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/platform/text/CharacterNames.h
WebCore/rendering/break_lines.cpp

index 06a82d4342e91a18a6e467f467c2c5e061993483..5c9023a7ba3eea51de02a03a053c3627052895f0 100644 (file)
@@ -1,3 +1,12 @@
+2008-02-26  Satoshi Nakagawa  <artension@gmail.com>
+
+        Reviewed by Darin. Tweaked and landed by Alexey.
+
+        - test for http://bugs.webkit.org/show_bug.cgi?id=17411
+
+        * fast/text/line-breaks-after-ideographic-comma-or-full-stop.html: Added.
+        * fast/text/line-breaks-after-ideographic-comma-or-full-stop-expected.txt: Added
+
 2008-02-25  Dan Bernstein  <mitz@apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/LayoutTests/fast/text/line-breaks-after-ideographic-comma-or-full-stop-expected.txt b/LayoutTests/fast/text/line-breaks-after-ideographic-comma-or-full-stop-expected.txt
new file mode 100644 (file)
index 0000000..f73bdd2
--- /dev/null
@@ -0,0 +1,18 @@
+These are good:
+う、
+texttexttexttext
+
+う。
+texttexttexttext
+
+The following two should look like “good”:
+う、texttexttexttext
+
+う。texttexttexttext
+
+These are bad:
+う、texttexttexttext
+
+う。texttexttexttext
+
+PASS
diff --git a/LayoutTests/fast/text/line-breaks-after-ideographic-comma-or-full-stop.html b/LayoutTests/fast/text/line-breaks-after-ideographic-comma-or-full-stop.html
new file mode 100644 (file)
index 0000000..3a92b57
--- /dev/null
@@ -0,0 +1,45 @@
+<html>
+    <head>
+        <title>Line breaks after ideographic comma or full stop</title>
+    </head>
+    <body>
+        These are good:
+        <div style="font-family:'Lucida Grande'; font-size:16pt; text-decoration:underline; width:5em;">
+            <p style="border:solid green 1px;">
+                &#x3046;&#x3001;<br>texttexttexttext
+            </p>
+            <p style="border:solid green 1px;">
+                &#x3046;&#x3002;<br>texttexttexttext
+            </p>
+        </div>
+        The following two should look like &ldquo;good&rdquo;:
+        <div style="font-family:'Lucida Grande'; font-size:16pt; text-decoration:underline; width:5em;">
+            <p style="border:solid blue 1px;">
+                &#x3046;&#x3001;texttexttexttext
+            </p>
+            <p style="border:solid blue 1px;">
+                &#x3046;&#x3002;texttexttexttext
+            </p>
+        </div>
+        These are bad:
+        <div style="font-family:'Lucida Grande'; font-size:16pt; text-decoration:underline; width:5em;">
+            <p style="border:solid red 1px;">
+                <nobr>&#x3046;&#x3001;texttexttexttext</nobr>
+            </p>
+            <p style="border:solid red 1px;">
+                <nobr>&#x3046;&#x3002;texttexttexttext</nobr>
+            </p>
+        </div>
+        <div id=result></div>
+        <script>
+            if (window.layoutTestController)
+                layoutTestController.dumpAsText();
+
+            function paragraphHeight(paragraphNumber) {
+                return document.defaultView.getComputedStyle(document.getElementsByTagName("p")[paragraphNumber], null).getPropertyValue("height")
+            }
+
+            document.getElementById("result").innerHTML = (paragraphHeight(0) == paragraphHeight(2) && paragraphHeight(1) == paragraphHeight(3)) ? "PASS" : "FAIL";
+        </script>
+    </body>
+</html>
index 1501a1e40931f97b7046bfbb6e7ac7860c249737..0d7555d0c88c1f35a2db29a1359b1473e5d2860e 100644 (file)
@@ -1,3 +1,16 @@
+2008-02-26  Satoshi Nakagawa  <artension@gmail.com>
+
+        Reviewed by Darin. Tweaked and landed by Alexey.
+
+        http://bugs.webkit.org/show_bug.cgi?id=17411
+        Ideographic comma and full stop should be treated as line-breakable characters
+
+        Test: fast/text/line-breaks-after-ideographic-comma-or-full-stop.html
+
+        * platform/text/CharacterNames.h: Added ideographicComma and ideographicFullStop.
+        * rendering/break_lines.cpp: (WebCore::shouldBreakAfter): Added a workaround for an issue in
+        Unicode 5.0 that is causing this.
+
 2008-02-26  MorganL  <morganl.webkit@yahoo.com>
 
         Reviewed by eseidel.  Landed by eseidel
index 5b524790e210ded076304acc93e2dc6d181cdaf4..bfbb5b09111dd5ec9992796950be9287645968fb 100644 (file)
@@ -39,6 +39,8 @@ namespace WebCore {
     const UChar bullet = 0x2022;
     const UChar horizontalEllipsis = 0x2026;
     const UChar ideographicSpace = 0x3000;
+    const UChar ideographicComma = 0x3001;
+    const UChar ideographicFullStop = 0x3002;
     const UChar leftToRightMark = 0x200E;
     const UChar leftToRightEmbed = 0x202A;
     const UChar leftToRightOverride = 0x202D;
index c6e8e2850f1ed93da21b307094fa883922aa81d8..05748ac509374bb2f476273817fcaa0fd2f8a731 100644 (file)
@@ -47,10 +47,16 @@ static inline bool isBreakableSpace(UChar ch, bool treatNoBreakSpaceAsBreak)
 static inline bool shouldBreakAfter(UChar ch)
 {
     // Match WinIE's breaking strategy, which is to always allow breaks after hyphens and question marks.
+    // FIXME: it appears that IE behavior is more complex, see <http://bugs.webkit.org/show_bug.cgi?id=17475>.
     switch (ch) {
         case '-':
         case '?':
         case softHyphen:
+        // FIXME: cases for ideographicComma and ideographicFullStop are a workaround for an issue in Unicode 5.0
+        // which is likely to be resolved in Unicode 5.1 <http://bugs.webkit.org/show_bug.cgi?id=17411>.
+        // We may want to remove or conditionalize this workaround at some point.
+        case ideographicComma:
+        case ideographicFullStop:
             return true;
         default:
             return false;