Title: [149450] trunk
Revision
149450
Author
[email protected]
Date
2013-05-01 13:37:04 -0700 (Wed, 01 May 2013)

Log Message

Incorrect layout for blocks containing ideographs with -webkit-linebox-contain: glyphs, font, inline-box.
https://bugs.webkit.org/show_bug.cgi?id=115478.

Reviewed by Dave Hyatt.

Source/WebCore: 

Test: fast/block/lineboxcontain/block-with-ideographs.xhtml

When computing ascent and descent we need to take into account
the baseline type. RootInlineBox::ascentAndDescentForBox failed
to do that in few cases.

* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::ascentAndDescentForBox):

LayoutTests: 

* fast/block/lineboxcontain/block-with-ideographs.xhtml: Added.
* platform/mac/fast/block/lineboxcontain/block-with-ideographs-expected.txt: Added.
* platform/mac/fast/block/lineboxcontain/block-with-ideographs-expected.png : Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (149449 => 149450)


--- trunk/LayoutTests/ChangeLog	2013-05-01 20:28:27 UTC (rev 149449)
+++ trunk/LayoutTests/ChangeLog	2013-05-01 20:37:04 UTC (rev 149450)
@@ -1,3 +1,14 @@
+2013-05-01  Enrica Casucci  <[email protected]>
+
+        Incorrect layout for blocks containing ideographs with -webkit-linebox-contain: glyphs, font, inline-box.
+        https://bugs.webkit.org/show_bug.cgi?id=115478.
+
+        Reviewed by Dave Hyatt.
+
+        * fast/block/lineboxcontain/block-with-ideographs.xhtml: Added.
+        * platform/mac/fast/block/lineboxcontain/block-with-ideographs-expected.txt: Added.
+        * platform/mac/fast/block/lineboxcontain/block-with-ideographs-expected.png : Added.
+
 2013-05-01  Per-Erik Brodin  <[email protected]>
 
         EventSource: Loss of reconnect time precision due to integer division

Added: trunk/LayoutTests/fast/block/lineboxcontain/block-with-ideographs.xhtml (0 => 149450)


--- trunk/LayoutTests/fast/block/lineboxcontain/block-with-ideographs.xhtml	                        (rev 0)
+++ trunk/LayoutTests/fast/block/lineboxcontain/block-with-ideographs.xhtml	2013-05-01 20:37:04 UTC (rev 149450)
@@ -0,0 +1,16 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+	<body style="font-size: 48px;">
+        <div style="-webkit-line-box-contain: block glyphs;">
+            <div style="-webkit-writing-mode:vertical-lr; border: solid red 1px">為<ruby>櫻</ruby>田</div>
+            <div style="border: solid green 1px">為<ruby>櫻</ruby>田</div>
+        </div>
+        <div style="-webkit-line-box-contain: block font;">
+            <div style="-webkit-writing-mode:vertical-lr; border: solid red 1px">為<ruby>櫻</ruby>田</div>
+            <div style="border: solid green 1px">為<ruby>櫻</ruby>田</div>
+        </div>
+        <div style="-webkit-line-box-contain: block inline-box;">
+            <div style="-webkit-writing-mode:vertical-lr; border: solid red 1px">為<ruby>櫻</ruby>田</div>
+            <div style="border: solid green 1px">為<ruby>櫻</ruby>田</div>
+        </div>
+    </body>
+</html>

Added: trunk/LayoutTests/platform/mac/fast/block/lineboxcontain/block-with-ideographs-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/fast/block/lineboxcontain/block-with-ideographs-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/fast/block/lineboxcontain/block-with-ideographs-expected.txt (0 => 149450)


--- trunk/LayoutTests/platform/mac/fast/block/lineboxcontain/block-with-ideographs-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/block/lineboxcontain/block-with-ideographs-expected.txt	2013-05-01 20:37:04 UTC (rev 149450)
@@ -0,0 +1,68 @@
+layer at (0,0) size 785x625
+  RenderView at (0,0) size 785x600
+layer at (0,0) size 785x625
+  RenderBlock {html} at (0,0) size 785x625
+    RenderBody {body} at (8,8) size 769x609
+      RenderBlock {div} at (0,0) size 769x203
+        RenderBlock {div} at (0,0) size 57x146 [border: (1px solid #FF0000)]
+          RenderText {#text} at (1,1) size 55x48
+            text run at (1,1) width 48: "\x{70BA}"
+          RenderRuby (inline) {ruby} at (0,0) size 55x48
+            RenderRubyRun (anonymous) at (1,49) size 55x48
+              RenderRubyBase (anonymous) at (0,0) size 55x48
+                RenderText {#text} at (0,0) size 55x48
+                  text run at (0,0) width 48: "\x{6AFB}"
+          RenderText {#text} at (1,97) size 55x48
+            text run at (1,97) width 48: "\x{7530}"
+        RenderBlock {div} at (0,146) size 769x57 [border: (1px solid #008000)]
+          RenderText {#text} at (1,1) size 48x55
+            text run at (1,1) width 48: "\x{70BA}"
+          RenderRuby (inline) {ruby} at (0,0) size 48x55
+            RenderRubyRun (anonymous) at (49,1) size 48x55
+              RenderRubyBase (anonymous) at (0,0) size 48x55
+                RenderText {#text} at (0,0) size 48x55
+                  text run at (0,0) width 48: "\x{6AFB}"
+          RenderText {#text} at (97,1) size 48x55
+            text run at (97,1) width 48: "\x{7530}"
+      RenderBlock {div} at (0,203) size 769x203
+        RenderBlock {div} at (0,0) size 57x146 [border: (1px solid #FF0000)]
+          RenderText {#text} at (1,1) size 55x48
+            text run at (1,1) width 48: "\x{70BA}"
+          RenderRuby (inline) {ruby} at (0,0) size 55x48
+            RenderRubyRun (anonymous) at (1,49) size 55x48
+              RenderRubyBase (anonymous) at (0,0) size 55x48
+                RenderText {#text} at (0,0) size 55x48
+                  text run at (0,0) width 48: "\x{6AFB}"
+          RenderText {#text} at (1,97) size 55x48
+            text run at (1,97) width 48: "\x{7530}"
+        RenderBlock {div} at (0,146) size 769x57 [border: (1px solid #008000)]
+          RenderText {#text} at (1,1) size 48x55
+            text run at (1,1) width 48: "\x{70BA}"
+          RenderRuby (inline) {ruby} at (0,0) size 48x55
+            RenderRubyRun (anonymous) at (49,1) size 48x55
+              RenderRubyBase (anonymous) at (0,0) size 48x55
+                RenderText {#text} at (0,0) size 48x55
+                  text run at (0,0) width 48: "\x{6AFB}"
+          RenderText {#text} at (97,1) size 48x55
+            text run at (97,1) width 48: "\x{7530}"
+      RenderBlock {div} at (0,406) size 769x203
+        RenderBlock {div} at (0,0) size 57x146 [border: (1px solid #FF0000)]
+          RenderText {#text} at (1,1) size 55x48
+            text run at (1,1) width 48: "\x{70BA}"
+          RenderRuby (inline) {ruby} at (0,0) size 55x48
+            RenderRubyRun (anonymous) at (1,49) size 55x48
+              RenderRubyBase (anonymous) at (0,0) size 55x48
+                RenderText {#text} at (0,0) size 55x48
+                  text run at (0,0) width 48: "\x{6AFB}"
+          RenderText {#text} at (1,97) size 55x48
+            text run at (1,97) width 48: "\x{7530}"
+        RenderBlock {div} at (0,146) size 769x57 [border: (1px solid #008000)]
+          RenderText {#text} at (1,1) size 48x55
+            text run at (1,1) width 48: "\x{70BA}"
+          RenderRuby (inline) {ruby} at (0,0) size 48x55
+            RenderRubyRun (anonymous) at (49,1) size 48x55
+              RenderRubyBase (anonymous) at (0,0) size 48x55
+                RenderText {#text} at (0,0) size 48x55
+                  text run at (0,0) width 48: "\x{6AFB}"
+          RenderText {#text} at (97,1) size 48x55
+            text run at (97,1) width 48: "\x{7530}"

Modified: trunk/Source/WebCore/ChangeLog (149449 => 149450)


--- trunk/Source/WebCore/ChangeLog	2013-05-01 20:28:27 UTC (rev 149449)
+++ trunk/Source/WebCore/ChangeLog	2013-05-01 20:37:04 UTC (rev 149450)
@@ -1,3 +1,19 @@
+2013-05-01  Enrica Casucci  <[email protected]>
+
+        Incorrect layout for blocks containing ideographs with -webkit-linebox-contain: glyphs, font, inline-box.
+        https://bugs.webkit.org/show_bug.cgi?id=115478.
+
+        Reviewed by Dave Hyatt.
+
+        Test: fast/block/lineboxcontain/block-with-ideographs.xhtml
+
+        When computing ascent and descent we need to take into account
+        the baseline type. RootInlineBox::ascentAndDescentForBox failed
+        to do that in few cases.
+
+        * rendering/RootInlineBox.cpp:
+        (WebCore::RootInlineBox::ascentAndDescentForBox):
+
 2013-05-01  Anders Carlsson  <[email protected]>
 
         Add LocalStorageDatabase class

Modified: trunk/Source/WebCore/rendering/RootInlineBox.cpp (149449 => 149450)


--- trunk/Source/WebCore/rendering/RootInlineBox.cpp	2013-05-01 20:28:27 UTC (rev 149449)
+++ trunk/Source/WebCore/rendering/RootInlineBox.cpp	2013-05-01 20:37:04 UTC (rev 149450)
@@ -843,8 +843,8 @@
     }
     
     if (includeFontForBox(box) && !setUsedFont) {
-        int fontAscent = box->renderer()->style(isFirstLineStyle())->fontMetrics().ascent();
-        int fontDescent = box->renderer()->style(isFirstLineStyle())->fontMetrics().descent();
+        int fontAscent = box->renderer()->style(isFirstLineStyle())->fontMetrics().ascent(baselineType());
+        int fontDescent = box->renderer()->style(isFirstLineStyle())->fontMetrics().descent(baselineType());
         setAscentAndDescent(ascent, descent, fontAscent, fontDescent, ascentDescentSet);
         affectsAscent = fontAscent - box->logicalTop() > 0;
         affectsDescent = fontDescent + box->logicalTop() > 0; 
@@ -854,13 +854,13 @@
         setAscentAndDescent(ascent, descent, glyphOverflow->top, glyphOverflow->bottom, ascentDescentSet);
         affectsAscent = glyphOverflow->top - box->logicalTop() > 0;
         affectsDescent = glyphOverflow->bottom + box->logicalTop() > 0; 
-        glyphOverflow->top = min(glyphOverflow->top, max(0, glyphOverflow->top - box->renderer()->style(isFirstLineStyle())->fontMetrics().ascent()));
-        glyphOverflow->bottom = min(glyphOverflow->bottom, max(0, glyphOverflow->bottom - box->renderer()->style(isFirstLineStyle())->fontMetrics().descent()));
+        glyphOverflow->top = min(glyphOverflow->top, max(0, glyphOverflow->top - box->renderer()->style(isFirstLineStyle())->fontMetrics().ascent(baselineType())));
+        glyphOverflow->bottom = min(glyphOverflow->bottom, max(0, glyphOverflow->bottom - box->renderer()->style(isFirstLineStyle())->fontMetrics().descent(baselineType())));
     }
 
     if (includeMarginForBox(box)) {
-        LayoutUnit ascentWithMargin = box->renderer()->style(isFirstLineStyle())->fontMetrics().ascent();
-        LayoutUnit descentWithMargin = box->renderer()->style(isFirstLineStyle())->fontMetrics().descent();
+        LayoutUnit ascentWithMargin = box->renderer()->style(isFirstLineStyle())->fontMetrics().ascent(baselineType());
+        LayoutUnit descentWithMargin = box->renderer()->style(isFirstLineStyle())->fontMetrics().descent(baselineType());
         if (box->parent() && !box->renderer()->isText()) {
             ascentWithMargin += box->boxModelObject()->borderBefore() + box->boxModelObject()->paddingBefore() + box->boxModelObject()->marginBefore();
             descentWithMargin += box->boxModelObject()->borderAfter() + box->boxModelObject()->paddingAfter() + box->boxModelObject()->marginAfter();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to