Title: [117116] trunk
Revision
117116
Author
[email protected]
Date
2012-05-15 12:25:23 -0700 (Tue, 15 May 2012)

Log Message

Ruby annotation is incorrectly identified as a paragraph boundary
https://bugs.webkit.org/show_bug.cgi?id=86507

Reviewed by Darin Adler.

Source/WebCore: 

Test: editing/selection/paragraph-with-ruby.html

* editing/htmlediting.cpp:
(WebCore::isBlock): Changed to return false for ruby text.

LayoutTests: 

* editing/selection/paragraph-with-ruby-expected.txt: Added.
* editing/selection/paragraph-with-ruby.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (117115 => 117116)


--- trunk/LayoutTests/ChangeLog	2012-05-15 19:23:05 UTC (rev 117115)
+++ trunk/LayoutTests/ChangeLog	2012-05-15 19:25:23 UTC (rev 117116)
@@ -1,3 +1,13 @@
+2012-05-15  Dan Bernstein  <[email protected]>
+
+        Ruby annotation is incorrectly identified as a paragraph boundary
+        https://bugs.webkit.org/show_bug.cgi?id=86507
+
+        Reviewed by Darin Adler.
+
+        * editing/selection/paragraph-with-ruby-expected.txt: Added.
+        * editing/selection/paragraph-with-ruby.html: Added.
+
 2012-05-15  Tommy Widenflycht  <[email protected]>
 
         MediaStream API: Setting onended on a LocalMediaStream triggers an assertion in V8

Added: trunk/LayoutTests/editing/selection/paragraph-with-ruby-expected.txt (0 => 117116)


--- trunk/LayoutTests/editing/selection/paragraph-with-ruby-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/paragraph-with-ruby-expected.txt	2012-05-15 19:25:23 UTC (rev 117116)
@@ -0,0 +1,15 @@
+This is the paragraph before.
+
+This paragraph contains an annotated
+annotation
+ word.
+
+This is the paragraph after.
+
+PASS: Reached the end of the paragraph starting from P[0].
+PASS: Reached the end of the paragraph starting from RUBY[0].
+PASS: Reached the end of the paragraph starting from RT[0].
+PASS: Reached the start of the paragraph starting from P[2].
+PASS: Reached the start of the paragraph starting from RUBY[2].
+PASS: Reached the start of the paragraph starting from RT[1].
+

Added: trunk/LayoutTests/editing/selection/paragraph-with-ruby.html (0 => 117116)


--- trunk/LayoutTests/editing/selection/paragraph-with-ruby.html	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/paragraph-with-ruby.html	2012-05-15 19:25:23 UTC (rev 117116)
@@ -0,0 +1,66 @@
+<p>
+    This is the paragraph before.
+</p>
+<p id="paragraph">
+    This paragraph contains an <ruby id="ruby">annotated <rt id="rt">annotation</rt></ruby> word.
+</p>
+<p>
+    This is the paragraph after.
+</p>
+<pre id="console">
+</pre>
+<script>
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+
+    function log(message)
+    {
+        document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
+    }
+
+    function positionAsString(node, offset)
+    {
+        if (node.nodeType === Node.TEXT_NODE)
+            return "\"" + node.data.trim() + "\"[" + offset + "]";
+        return node.tagName + "[" + offset + "]";
+    }
+
+    function testMovementToEndOfParagraph(node, offset)
+    {
+        var selection = getSelection();
+
+        selection.setPosition(node, offset);
+        selection.modify("move", "forward", "paragraphBoundary");
+        if (selection.baseNode === paragraph.lastChild && selection.baseOffset === 6)
+            log("PASS: Reached the end of the paragraph starting from " + positionAsString(node, offset) + ".");
+        else
+            log("FAIL: Reached " + positionAsString(selection.baseNode, selection.baseOffset) + " instead "
+                + "of the end of the paragraph starting from " + positionAsString(node, offset) + ".");
+    }
+
+    function testMovementToStartOfParagraph(node, offset)
+    {
+        var selection = getSelection();
+
+        selection.setPosition(node, offset);
+        selection.modify("move", "backward", "paragraphBoundary");
+        if (selection.baseNode === paragraph.firstChild && selection.baseOffset === 5)
+            log("PASS: Reached the start of the paragraph starting from " + positionAsString(node, offset) + ".");
+        else
+            log("FAIL: Reached " + positionAsString(selection.baseNode, selection.baseOffset) + " instead "
+                + "of the start of the paragraph starting from " + positionAsString(node, offset) + ".");
+    }
+
+    var paragraph = document.getElementById("paragraph");
+    var ruby = document.getElementById("ruby");
+    var rt = document.getElementById("rt");
+
+    testMovementToEndOfParagraph(paragraph, 0);
+    testMovementToEndOfParagraph(ruby, 0);
+    testMovementToEndOfParagraph(rt, 0);
+
+    testMovementToStartOfParagraph(paragraph, 2);
+    testMovementToStartOfParagraph(ruby, 2);
+    testMovementToStartOfParagraph(rt, 1);
+
+</script>

Modified: trunk/Source/WebCore/ChangeLog (117115 => 117116)


--- trunk/Source/WebCore/ChangeLog	2012-05-15 19:23:05 UTC (rev 117115)
+++ trunk/Source/WebCore/ChangeLog	2012-05-15 19:25:23 UTC (rev 117116)
@@ -1,3 +1,15 @@
+2012-05-15  Dan Bernstein  <[email protected]>
+
+        Ruby annotation is incorrectly identified as a paragraph boundary
+        https://bugs.webkit.org/show_bug.cgi?id=86507
+
+        Reviewed by Darin Adler.
+
+        Test: editing/selection/paragraph-with-ruby.html
+
+        * editing/htmlediting.cpp:
+        (WebCore::isBlock): Changed to return false for ruby text.
+
 2012-05-15  Philippe Normand  <[email protected]>
 
         [GTK] Un-used GStreamer linker options

Modified: trunk/Source/WebCore/editing/htmlediting.cpp (117115 => 117116)


--- trunk/Source/WebCore/editing/htmlediting.cpp	2012-05-15 19:23:05 UTC (rev 117115)
+++ trunk/Source/WebCore/editing/htmlediting.cpp	2012-05-15 19:25:23 UTC (rev 117116)
@@ -299,7 +299,7 @@
 // Whether or not content before and after this node will collapse onto the same line as it.
 bool isBlock(const Node* node)
 {
-    return node && node->renderer() && !node->renderer()->isInline();
+    return node && node->renderer() && !node->renderer()->isInline() && !node->renderer()->isRubyText();
 }
 
 bool isInline(const Node* node)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to