Ruby text is incorrectly positioned when its writing-mode is changed to vertical...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Mar 2013 01:12:11 +0000 (01:12 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Mar 2013 01:12:11 +0000 (01:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=96592

Patch by Yuki Sekiguchi <yuki.sekiguchi@access-company.com> on 2013-03-11
Reviewed by Hajime Morrita.

Source/WebCore:

Fixed logical left of RenderRubyText is not cleared.

This causes trouble when RenderRubyTest is laid out vertically after horizontally.
Horizontal layout set logical top(== y).
Vertical layout don't set logical left(== y).
RenderRubyText::y remain old one.
We clear old RenderRubyText::y at the first part of layout().

Test: fast/writing-mode/ruby-text-logical-left.html

* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::layout): Reset logicalLeft not to reuse old one.

LayoutTests:

* fast/writing-mode/ruby-text-logical-left-expected.html: Added.
* fast/writing-mode/ruby-text-logical-left.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/writing-mode/ruby-text-logical-left-expected.html [new file with mode: 0644]
LayoutTests/fast/writing-mode/ruby-text-logical-left.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderRubyRun.cpp

index d186682..e50e172 100644 (file)
@@ -1,3 +1,13 @@
+2013-03-11  Yuki Sekiguchi  <yuki.sekiguchi@access-company.com>
+
+        Ruby text is incorrectly positioned when its writing-mode is changed to vertical after layout is done
+        https://bugs.webkit.org/show_bug.cgi?id=96592
+
+        Reviewed by Hajime Morrita.
+
+        * fast/writing-mode/ruby-text-logical-left-expected.html: Added.
+        * fast/writing-mode/ruby-text-logical-left.html: Added.
+
 2013-03-11  Lamarque V. Souza  <Lamarque.Souza@basyskom.com>
 
         [css3-text] Add partial parsing support for text-underline-position property from CSS3 Text
diff --git a/LayoutTests/fast/writing-mode/ruby-text-logical-left-expected.html b/LayoutTests/fast/writing-mode/ruby-text-logical-left-expected.html
new file mode 100644 (file)
index 0000000..02aa890
--- /dev/null
@@ -0,0 +1,27 @@
+<!DOCTYPE html>\r
+<html>\r
+    <head>\r
+        <style>\r
+            ruby { border: solid 5px cyan; }\r
+            .vert { -webkit-writing-mode: vertical-rl; }\r
+        </style>\r
+    </head>\r
+    <body>\r
+        Ruby text should be at the center of ruby base.\r
+        <div class="vert">\r
+            <ruby>aaaaa<rt>b</rt></ruby><br>\r
+        </div>\r
+        <hr>\r
+        <div class="vert">\r
+            <ruby>a<rt>bbbb</rt></ruby><br>\r
+        </div>\r
+        <hr>\r
+        <div>\r
+            <ruby>aaaaa<rt>b</rt></ruby><br>\r
+        </div>\r
+        <hr>\r
+        <div>\r
+            <ruby>a<rt>bbbb</rt></ruby><br>\r
+        </div>\r
+    </body>\r
+</html>\r
diff --git a/LayoutTests/fast/writing-mode/ruby-text-logical-left.html b/LayoutTests/fast/writing-mode/ruby-text-logical-left.html
new file mode 100644 (file)
index 0000000..92a04b2
--- /dev/null
@@ -0,0 +1,44 @@
+<!DOCTYPE html>\r
+<html>\r
+    <head>\r
+        <style>\r
+            ruby { border: solid 5px cyan; }\r
+        </style>\r
+    </head>\r
+    <body>\r
+        Ruby text should be at the center of ruby base.\r
+        <div id="test1" >\r
+            <ruby>aaaaa<rt>b</rt></ruby><br>\r
+        </div>\r
+        <hr>\r
+        <div id="test2" >\r
+            <ruby>a<rt>bbbb</rt></ruby><br>\r
+        </div>\r
+        <hr>\r
+        <div id="test3" style="-webkit-writing-mode: vertical-rl;">\r
+            <ruby>aaaaa<rt>b</rt></ruby><br>\r
+        </div>\r
+        <hr>\r
+        <div id="test4" style="-webkit-writing-mode: vertical-rl;">\r
+            <ruby>a<rt>bbbb</rt></ruby><br>\r
+        </div>\r
+        <script>\r
+            setTimeout(function () {\r
+                var verticalElement = document.getElementById("test1");\r
+                verticalElement.setAttribute("style", "-webkit-writing-mode: vertical-rl;");\r
+                verticalElement = document.getElementById("test2");\r
+                verticalElement.setAttribute("style", "-webkit-writing-mode: vertical-rl;");\r
+                var horizontalElement = document.getElementById("test3");\r
+                horizontalElement.setAttribute("style", "");\r
+                horizontalElement = document.getElementById("test4");\r
+                horizontalElement.setAttribute("style", "");\r
+                if (window.testRunner) {\r
+                    testRunner.notifyDone();\r
+                }\r
+            }, 0);\r
+            if (window.testRunner) {\r
+                testRunner.waitUntilDone();\r
+            }\r
+    </script>\r
+  </body>\r
+</html>\r
index 6a16f90..9603fe2 100644 (file)
@@ -1,3 +1,23 @@
+2013-03-11  Yuki Sekiguchi  <yuki.sekiguchi@access-company.com>
+
+        Ruby text is incorrectly positioned when its writing-mode is changed to vertical after layout is done
+        https://bugs.webkit.org/show_bug.cgi?id=96592
+
+        Reviewed by Hajime Morrita.
+
+        Fixed logical left of RenderRubyText is not cleared.
+
+        This causes trouble when RenderRubyTest is laid out vertically after horizontally.
+        Horizontal layout set logical top(== y).
+        Vertical layout don't set logical left(== y).
+        RenderRubyText::y remain old one.
+        We clear old RenderRubyText::y at the first part of layout().
+
+        Test: fast/writing-mode/ruby-text-logical-left.html
+
+        * rendering/RenderRubyRun.cpp:
+        (WebCore::RenderRubyRun::layout): Reset logicalLeft not to reuse old one.
+
 2013-03-11  Lamarque V. Souza  <Lamarque.Souza@basyskom.com>
 
         [css3-text] Add partial parsing support for text-underline-position property from CSS3 Text
index e779cff..76c876c 100644 (file)
@@ -233,11 +233,13 @@ void RenderRubyRun::layout()
 {
     RenderBlock::layout();
     
-    // Place the RenderRubyText such that its bottom is flush with the lineTop of the first line of the RenderRubyBase.
     RenderRubyText* rt = rubyText();
     if (!rt)
         return;
+
+    rt->setLogicalLeft(0);
     
+    // Place the RenderRubyText such that its bottom is flush with the lineTop of the first line of the RenderRubyBase.
     LayoutUnit lastLineRubyTextBottom = rt->logicalHeight();
     LayoutUnit firstLineRubyTextTop = 0;
     RootInlineBox* rootBox = rt->lastRootBox();