Title: [137477] trunk
Revision
137477
Author
[email protected]
Date
2012-12-12 09:53:55 -0800 (Wed, 12 Dec 2012)

Log Message

Copying text with ruby inserts new lines around rt elements
https://bugs.webkit.org/show_bug.cgi?id=104765

Reviewed by Dan Bernstein.

Source/WebCore: 

Don't emit new lines before and after rt.

Test: editing/pasteboard/copy-paste-ruby-text.html

* editing/TextIterator.cpp:
(WebCore::shouldEmitNewlinesBeforeAndAfterNode):

LayoutTests: 

Added a regression test and rebaseline a test as expected.

* editing/pasteboard/copy-paste-ruby-text-expected.txt: Added.
* editing/pasteboard/copy-paste-ruby-text-with-block-expected.txt: Added.
* editing/pasteboard/copy-paste-ruby-text-with-block.html: Added.
* editing/pasteboard/copy-paste-ruby-text.html: Added.
* editing/selection/paragraph-with-ruby-expected.txt:  new lines around "annotation" has been removed
as expected.
* fast/block/line-layout/selection-highlight-crash-expected.txt:
* fast/ruby/after-doesnt-crash-expected.txt:
* fast/ruby/before-doesnt-crash-expected.txt:
* fast/ruby/parse-rp-expected.txt:
* fast/ruby/ruby-line-height-expected.txt:
* fast/ruby/ruby-text-indent-expected.txt:
* fast/ruby/rubyDOM-insert-rt-block-1-expected.txt:
* fast/ruby/rubyDOM-insert-rt-block-2-expected.txt:
* fast/ruby/rubyDOM-insert-rt-block-3-expected.txt:
* fast/ruby/rubyDOM-remove-rt-block-1-expected.txt:
* fast/ruby/rubyDOM-remove-rt-block-2-expected.txt:
* fast/ruby/rubyDOM-remove-rt-block-3-expected.txt:
* fast/ruby/text-emphasis-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (137476 => 137477)


--- trunk/LayoutTests/ChangeLog	2012-12-12 17:35:35 UTC (rev 137476)
+++ trunk/LayoutTests/ChangeLog	2012-12-12 17:53:55 UTC (rev 137477)
@@ -1,3 +1,32 @@
+2012-12-12  Ryosuke Niwa  <[email protected]>
+
+        Copying text with ruby inserts new lines around rt elements
+        https://bugs.webkit.org/show_bug.cgi?id=104765
+
+        Reviewed by Dan Bernstein.
+
+        Added a regression test and rebaseline a test as expected.
+
+        * editing/pasteboard/copy-paste-ruby-text-expected.txt: Added.
+        * editing/pasteboard/copy-paste-ruby-text-with-block-expected.txt: Added.
+        * editing/pasteboard/copy-paste-ruby-text-with-block.html: Added.
+        * editing/pasteboard/copy-paste-ruby-text.html: Added.
+        * editing/selection/paragraph-with-ruby-expected.txt:  new lines around "annotation" has been removed
+        as expected.
+        * fast/block/line-layout/selection-highlight-crash-expected.txt:
+        * fast/ruby/after-doesnt-crash-expected.txt:
+        * fast/ruby/before-doesnt-crash-expected.txt:
+        * fast/ruby/parse-rp-expected.txt:
+        * fast/ruby/ruby-line-height-expected.txt:
+        * fast/ruby/ruby-text-indent-expected.txt:
+        * fast/ruby/rubyDOM-insert-rt-block-1-expected.txt:
+        * fast/ruby/rubyDOM-insert-rt-block-2-expected.txt:
+        * fast/ruby/rubyDOM-insert-rt-block-3-expected.txt:
+        * fast/ruby/rubyDOM-remove-rt-block-1-expected.txt:
+        * fast/ruby/rubyDOM-remove-rt-block-2-expected.txt:
+        * fast/ruby/rubyDOM-remove-rt-block-3-expected.txt:
+        * fast/ruby/text-emphasis-expected.txt:
+
 2012-12-12  Adam Klein  <[email protected]>
 
         Rebaseline after change to Chromium compositor

Added: trunk/LayoutTests/editing/pasteboard/copy-paste-ruby-text-expected.txt (0 => 137477)


--- trunk/LayoutTests/editing/pasteboard/copy-paste-ruby-text-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/copy-paste-ruby-text-expected.txt	2012-12-12 17:53:55 UTC (rev 137477)
@@ -0,0 +1,7 @@
+This tests copying and pasting text with ruby doesn't insert new lines before and after rt.To manually test, copy and paste the text into the textarea. There should be not new line in the textarea.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS textarea.value.indexOf('\n') is -1
+

Added: trunk/LayoutTests/editing/pasteboard/copy-paste-ruby-text-with-block-expected.txt (0 => 137477)


--- trunk/LayoutTests/editing/pasteboard/copy-paste-ruby-text-with-block-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/copy-paste-ruby-text-with-block-expected.txt	2012-12-12 17:53:55 UTC (rev 137477)
@@ -0,0 +1,7 @@
+This tests copying and pasting text with ruby doesn't insert new lines before and after rt but still inserts a new line around a block element around ruby.To manually test, copy and paste the text into the textarea. There should be not new line in the textarea.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS textarea.value.indexOf('\n') is firstLine.length
+

Added: trunk/LayoutTests/editing/pasteboard/copy-paste-ruby-text-with-block.html (0 => 137477)


--- trunk/LayoutTests/editing/pasteboard/copy-paste-ruby-text-with-block.html	                        (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/copy-paste-ruby-text-with-block.html	2012-12-12 17:53:55 UTC (rev 137477)
@@ -0,0 +1,36 @@
+<html>
+<head>
+<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+<script src=""
+</head>
+<body>
+<div id="container">
+<div id="content" contenteditable><div><ruby>你好<rt>ni hao</rt></ruby></ruby></div>
+<ruby><ruby>很<rt>hen</rt></ruby><ruby>好<rt>hao</rt></ruby>?
+</div>
+<textarea cols=50 rows=5></textarea>
+</div>
+<script>
+
+description("This tests copying and pasting text with ruby doesn't insert new lines before and after rt\n"
+    + "but still inserts a new line around a block element around ruby."
+    + "To manually test, copy and paste the text into the textarea. There should be not new line in the textarea.");
+
+var content = document.getElementById('content');
+content.focus();
+document.execCommand('SelectAll', false, null);
+if (document.queryCommandSupported('Copy')) {
+    document.execCommand('Copy', false, null);
+
+    var textarea = document.querySelector('textarea');
+    var firstLine = content.firstChild.innerText;
+    textarea.focus();
+    document.execCommand('Paste', false, null);
+    shouldBe("textarea.value.indexOf('\\n')", "firstLine.length");
+
+    document.getElementById('container').style.display = 'none';
+}
+
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/editing/pasteboard/copy-paste-ruby-text.html (0 => 137477)


--- trunk/LayoutTests/editing/pasteboard/copy-paste-ruby-text.html	                        (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/copy-paste-ruby-text.html	2012-12-12 17:53:55 UTC (rev 137477)
@@ -0,0 +1,34 @@
+<html>
+<head>
+<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+<script src=""
+</head>
+<body>
+<div id="container">
+<div id="content" contenteditable>
+<ruby>今日<rt>きょう</rt></ruby>は<ruby>良<rt>よ</rt></ruby>い<ruby>天気<rt>てんき</rt></ruby>ですね。
+<ruby><ruby>你<rt>ni</rt></ruby><ruby>在<rt>zai</rt></ruby><ruby>拉里<rt>zali</rt></ruby>?
+</div>
+<textarea cols=50 rows=5></textarea>
+</div>
+<script>
+
+description("This tests copying and pasting text with ruby doesn't insert new lines before and after rt."
+    + "To manually test, copy and paste the text into the textarea. There should be not new line in the textarea.");
+
+document.getElementById('content').focus();
+document.execCommand('SelectAll', false, null);
+if (document.queryCommandSupported('Copy')) {
+    document.execCommand('Copy', false, null);
+
+    var textarea = document.querySelector('textarea');
+    textarea.focus();
+    document.execCommand('Paste', false, null);
+    shouldBe("textarea.value.indexOf('\\n')", "-1");
+
+    document.getElementById('container').style.display = 'none';
+}
+
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/editing/selection/paragraph-with-ruby-expected.txt (137476 => 137477)


--- trunk/LayoutTests/editing/selection/paragraph-with-ruby-expected.txt	2012-12-12 17:35:35 UTC (rev 137476)
+++ trunk/LayoutTests/editing/selection/paragraph-with-ruby-expected.txt	2012-12-12 17:53:55 UTC (rev 137477)
@@ -1,8 +1,6 @@
 This is the paragraph before.
 
-This paragraph contains an annotated
-annotation
- word.
+This paragraph contains an annotated annotation word.
 
 This is the paragraph after.
 

Modified: trunk/LayoutTests/fast/block/line-layout/selection-highlight-crash-expected.txt (137476 => 137477)


--- trunk/LayoutTests/fast/block/line-layout/selection-highlight-crash-expected.txt	2012-12-12 17:35:35 UTC (rev 137476)
+++ trunk/LayoutTests/fast/block/line-layout/selection-highlight-crash-expected.txt	2012-12-12 17:53:55 UTC (rev 137477)
@@ -1,4 +1,2 @@
 Test passes if it does not crash.
-ab
-c
-d
+abcd

Modified: trunk/LayoutTests/fast/ruby/after-doesnt-crash-expected.txt (137476 => 137477)


--- trunk/LayoutTests/fast/ruby/after-doesnt-crash-expected.txt	2012-12-12 17:35:35 UTC (rev 137476)
+++ trunk/LayoutTests/fast/ruby/after-doesnt-crash-expected.txt	2012-12-12 17:53:55 UTC (rev 137477)
@@ -1,2 +1 @@
- 
-This test passes if it doesn't crash.
+ This test passes if it doesn't crash.

Modified: trunk/LayoutTests/fast/ruby/before-doesnt-crash-expected.txt (137476 => 137477)


--- trunk/LayoutTests/fast/ruby/before-doesnt-crash-expected.txt	2012-12-12 17:35:35 UTC (rev 137476)
+++ trunk/LayoutTests/fast/ruby/before-doesnt-crash-expected.txt	2012-12-12 17:53:55 UTC (rev 137477)
@@ -1,3 +1 @@
- 
- 
-This test passes if it doesn't crash.
+  This test passes if it doesn't crash.

Modified: trunk/LayoutTests/fast/ruby/parse-rp-expected.txt (137476 => 137477)


--- trunk/LayoutTests/fast/ruby/parse-rp-expected.txt	2012-12-12 17:35:35 UTC (rev 137476)
+++ trunk/LayoutTests/fast/ruby/parse-rp-expected.txt	2012-12-12 17:53:55 UTC (rev 137477)
@@ -2,6 +2,4 @@
 
 TEST PASSED: Markup was correct
 
-Before base/
-text/
- After
+Before base/text/ After

Modified: trunk/LayoutTests/fast/ruby/ruby-line-height-expected.txt (137476 => 137477)


--- trunk/LayoutTests/fast/ruby/ruby-line-height-expected.txt	2012-12-12 17:35:35 UTC (rev 137476)
+++ trunk/LayoutTests/fast/ruby/ruby-line-height-expected.txt	2012-12-12 17:53:55 UTC (rev 137477)
@@ -12,6 +12,4 @@
 PASS successfullyParsed is true
 
 TEST COMPLETE
-The line height of this is three times normal
-"line-height: 48px;"
-, but the ruby should have 'line-height: normal'.
+The line height of this is three times normal"line-height: 48px;", but the ruby should have 'line-height: normal'.

Modified: trunk/LayoutTests/fast/ruby/ruby-text-indent-expected.txt (137476 => 137477)


--- trunk/LayoutTests/fast/ruby/ruby-text-indent-expected.txt	2012-12-12 17:35:35 UTC (rev 137476)
+++ trunk/LayoutTests/fast/ruby/ruby-text-indent-expected.txt	2012-12-12 17:53:55 UTC (rev 137477)
@@ -1,8 +1,6 @@
 This tests that ruby base and text are not affected by CSS text-indent.
 
-This is indented by 50 pixel
-"text-indent: 50px;"
-, but the ruby should flow without extra space.
+This is indented by 50 pixel"text-indent: 50px;", but the ruby should flow without extra space.
 
 text-indent for <p>: 50px
 

Modified: trunk/LayoutTests/fast/ruby/rubyDOM-insert-rt-block-1-expected.txt (137476 => 137477)


--- trunk/LayoutTests/fast/ruby/rubyDOM-insert-rt-block-1-expected.txt	2012-12-12 17:35:35 UTC (rev 137476)
+++ trunk/LayoutTests/fast/ruby/rubyDOM-insert-rt-block-1-expected.txt	2012-12-12 17:53:55 UTC (rev 137477)
@@ -1,9 +1,6 @@
 SUCCESS!
 
 
-text
-new ruby text
+text new ruby text
 block
-more text
-ruby text
-
+more textruby text

Modified: trunk/LayoutTests/fast/ruby/rubyDOM-insert-rt-block-2-expected.txt (137476 => 137477)


--- trunk/LayoutTests/fast/ruby/rubyDOM-insert-rt-block-2-expected.txt	2012-12-12 17:35:35 UTC (rev 137476)
+++ trunk/LayoutTests/fast/ruby/rubyDOM-insert-rt-block-2-expected.txt	2012-12-12 17:53:55 UTC (rev 137477)
@@ -3,7 +3,4 @@
 
 text
 block
-new ruby text
-more text
-ruby text
-
+new ruby textmore textruby text

Modified: trunk/LayoutTests/fast/ruby/rubyDOM-insert-rt-block-3-expected.txt (137476 => 137477)


--- trunk/LayoutTests/fast/ruby/rubyDOM-insert-rt-block-3-expected.txt	2012-12-12 17:35:35 UTC (rev 137476)
+++ trunk/LayoutTests/fast/ruby/rubyDOM-insert-rt-block-3-expected.txt	2012-12-12 17:53:55 UTC (rev 137477)
@@ -3,8 +3,6 @@
 
 text
 block
-new ruby text
-more
+new ruby textmore
 text
 ruby text
-

Modified: trunk/LayoutTests/fast/ruby/rubyDOM-remove-rt-block-1-expected.txt (137476 => 137477)


--- trunk/LayoutTests/fast/ruby/rubyDOM-remove-rt-block-1-expected.txt	2012-12-12 17:35:35 UTC (rev 137476)
+++ trunk/LayoutTests/fast/ruby/rubyDOM-remove-rt-block-1-expected.txt	2012-12-12 17:53:55 UTC (rev 137477)
@@ -4,4 +4,3 @@
 some textmore text
 and a block
 ruby text 2
-

Modified: trunk/LayoutTests/fast/ruby/rubyDOM-remove-rt-block-2-expected.txt (137476 => 137477)


--- trunk/LayoutTests/fast/ruby/rubyDOM-remove-rt-block-2-expected.txt	2012-12-12 17:35:35 UTC (rev 137476)
+++ trunk/LayoutTests/fast/ruby/rubyDOM-remove-rt-block-2-expected.txt	2012-12-12 17:53:55 UTC (rev 137477)
@@ -3,6 +3,4 @@
 
 text
 block
-more text
-ruby text 2
-
+more textruby text 2

Modified: trunk/LayoutTests/fast/ruby/rubyDOM-remove-rt-block-3-expected.txt (137476 => 137477)


--- trunk/LayoutTests/fast/ruby/rubyDOM-remove-rt-block-3-expected.txt	2012-12-12 17:35:35 UTC (rev 137476)
+++ trunk/LayoutTests/fast/ruby/rubyDOM-remove-rt-block-3-expected.txt	2012-12-12 17:53:55 UTC (rev 137477)
@@ -6,4 +6,3 @@
 more
 text
 ruby text 2
-

Modified: trunk/LayoutTests/fast/ruby/text-emphasis-expected.txt (137476 => 137477)


--- trunk/LayoutTests/fast/ruby/text-emphasis-expected.txt	2012-12-12 17:35:35 UTC (rev 137476)
+++ trunk/LayoutTests/fast/ruby/text-emphasis-expected.txt	2012-12-12 17:53:55 UTC (rev 137477)
@@ -1,8 +1,5 @@
 Test the user agent style sheet rule that disables inheritance of text-emphasis to ruby text.
 
-攻殻 機動隊 攻殻
-こうかく
-機動隊
-きどうたい
+攻殻 機動隊 攻殻こうかく機動隊きどうたい
 
 PASS

Modified: trunk/Source/WebCore/ChangeLog (137476 => 137477)


--- trunk/Source/WebCore/ChangeLog	2012-12-12 17:35:35 UTC (rev 137476)
+++ trunk/Source/WebCore/ChangeLog	2012-12-12 17:53:55 UTC (rev 137477)
@@ -1,3 +1,17 @@
+2012-12-12  Ryosuke Niwa  <[email protected]>
+
+        Copying text with ruby inserts new lines around rt elements
+        https://bugs.webkit.org/show_bug.cgi?id=104765
+
+        Reviewed by Dan Bernstein.
+
+        Don't emit new lines before and after rt.
+
+        Test: editing/pasteboard/copy-paste-ruby-text.html
+
+        * editing/TextIterator.cpp:
+        (WebCore::shouldEmitNewlinesBeforeAndAfterNode):
+
 2012-12-12  Krzysztof Czech  <[email protected]>
 
         [EFL] Possibility to turn off accessibility feature for WebKit-EFL.

Modified: trunk/Source/WebCore/editing/TextIterator.cpp (137476 => 137477)


--- trunk/Source/WebCore/editing/TextIterator.cpp	2012-12-12 17:35:35 UTC (rev 137476)
+++ trunk/Source/WebCore/editing/TextIterator.cpp	2012-12-12 17:53:55 UTC (rev 137477)
@@ -796,7 +796,8 @@
             return true;
     }
     
-    return !r->isInline() && r->isRenderBlock() && !r->isFloatingOrOutOfFlowPositioned() && !r->isBody();
+    return !r->isInline() && r->isRenderBlock()
+        && !r->isFloatingOrOutOfFlowPositioned() && !r->isBody() && !r->isRubyText();
 }
 
 static bool shouldEmitNewlineAfterNode(Node* node)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to