Title: [181528] releases/WebKitGTK/webkit-2.8
Revision
181528
Author
[email protected]
Date
2015-03-16 01:42:25 -0700 (Mon, 16 Mar 2015)

Log Message

Merge r181387 - Inline block children do not have correct baselines if their children are also block elements
https://bugs.webkit.org/show_bug.cgi?id=142559

Patch by Myles C. Maxfield <[email protected]> on 2015-03-11
Reviewed by Darin Adler.

Source/WebCore:

Perform the same computation on child block elements as child inline elements.

Test: fast/text/baseline-inline-block-block-children.html

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::inlineBlockBaseline):

LayoutTests:

* fast/text/baseline-inline-block-block-children-expected.html: Added.
* fast/text/baseline-inline-block-block-children.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog (181527 => 181528)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog	2015-03-16 08:16:23 UTC (rev 181527)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog	2015-03-16 08:42:25 UTC (rev 181528)
@@ -1,3 +1,13 @@
+2015-03-11  Myles C. Maxfield  <[email protected]>
+
+        Inline block children do not have correct baselines if their children are also block elements
+        https://bugs.webkit.org/show_bug.cgi?id=142559
+
+        Reviewed by Darin Adler.
+
+        * fast/text/baseline-inline-block-block-children-expected.html: Added.
+        * fast/text/baseline-inline-block-block-children.html: Added.
+
 2015-03-09  Myles C. Maxfield  <[email protected]>
 
         REGRESSION(r176978): Inline-blocks with overflowing contents have ascents that are too large

Added: releases/WebKitGTK/webkit-2.8/LayoutTests/fast/text/baseline-inline-block-block-children-expected.html (0 => 181528)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/fast/text/baseline-inline-block-block-children-expected.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/fast/text/baseline-inline-block-block-children-expected.html	2015-03-16 08:42:25 UTC (rev 181528)
@@ -0,0 +1,7 @@
+This tests that block children of overflow: scroll have the correct baseline calculated.<br>
+<div style="display: inline-block; background: green;">
+    <div style="height: 150px; width: 200px; overflow: scroll;">
+        Overflow with<br>overflow: scroll<br>M<br>M<br>M<br>M<br>M<br>M<br>M<br>M<br>M<br>M<br>M
+    </div>
+</div>
+Baseline

Added: releases/WebKitGTK/webkit-2.8/LayoutTests/fast/text/baseline-inline-block-block-children.html (0 => 181528)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/fast/text/baseline-inline-block-block-children.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/fast/text/baseline-inline-block-block-children.html	2015-03-16 08:42:25 UTC (rev 181528)
@@ -0,0 +1,7 @@
+This tests that block children of overflow: scroll have the correct baseline calculated.<br>
+<div style="display: inline-block; background: green;">
+    <div style="height: 150px; width: 200px; overflow: scroll;">
+        <div>Overflow with<br>overflow: scroll</div>M<br>M<br>M<br>M<br>M<br>M<br>M<br>M<br>M<br>M<br>M
+    </div>
+</div>
+Baseline

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog (181527 => 181528)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog	2015-03-16 08:16:23 UTC (rev 181527)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog	2015-03-16 08:42:25 UTC (rev 181528)
@@ -1,3 +1,17 @@
+2015-03-11  Myles C. Maxfield  <[email protected]>
+
+        Inline block children do not have correct baselines if their children are also block elements
+        https://bugs.webkit.org/show_bug.cgi?id=142559
+
+        Reviewed by Darin Adler.
+
+        Perform the same computation on child block elements as child inline elements.
+
+        Test: fast/text/baseline-inline-block-block-children.html
+
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::inlineBlockBaseline):
+
 2015-03-11  Carlos Alberto Lopez Perez  <[email protected]>
 
         [CMake][GStreamer] Building EFL or GTK with ENABLE_VIDEO and without ENABLE_WEB_AUDIO is broken.

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderBlockFlow.cpp (181527 => 181528)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderBlockFlow.cpp	2015-03-16 08:16:23 UTC (rev 181527)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderBlockFlow.cpp	2015-03-16 08:42:25 UTC (rev 181528)
@@ -3002,27 +3002,28 @@
     if (isWritingModeRoot() && !isRubyRun())
         return -1;
 
-    if (!childrenInline())
-        return RenderBlock::inlineBlockBaseline(lineDirection);
-
-    if (!hasLines()) {
-        if (!hasLineIfEmpty())
-            return -1;
-        const FontMetrics& fontMetrics = firstLineStyle().fontMetrics();
-        return fontMetrics.ascent()
-             + (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes) - fontMetrics.height()) / 2
-             + (lineDirection == HorizontalLine ? borderTop() + paddingTop() : borderRight() + paddingRight());
-    }
-
     // Note that here we only take the left and bottom into consideration. Our caller takes the right and top into consideration.
     float boxHeight = lineDirection == HorizontalLine ? height() + m_marginBox.bottom() : width() + m_marginBox.left();
     float lastBaseline;
-    if (auto simpleLineLayout = this->simpleLineLayout())
-        lastBaseline = SimpleLineLayout::computeFlowLastLineBaseline(*this, *simpleLineLayout);
+    if (!childrenInline())
+        lastBaseline = RenderBlock::inlineBlockBaseline(lineDirection);
     else {
-        bool isFirstLine = lastRootBox() == firstRootBox();
-        const RenderStyle& style = isFirstLine ? firstLineStyle() : this->style();
-        lastBaseline = lastRootBox()->logicalTop() + style.fontMetrics().ascent(lastRootBox()->baselineType());
+        if (!hasLines()) {
+            if (!hasLineIfEmpty())
+                return -1;
+            const auto& fontMetrics = firstLineStyle().fontMetrics();
+            return fontMetrics.ascent()
+                + (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes) - fontMetrics.height()) / 2
+                + (lineDirection == HorizontalLine ? borderTop() + paddingTop() : borderRight() + paddingRight());
+        }
+
+        if (auto simpleLineLayout = this->simpleLineLayout())
+            lastBaseline = SimpleLineLayout::computeFlowLastLineBaseline(*this, *simpleLineLayout);
+        else {
+            bool isFirstLine = lastRootBox() == firstRootBox();
+            const auto& style = isFirstLine ? firstLineStyle() : this->style();
+            lastBaseline = lastRootBox()->logicalTop() + style.fontMetrics().ascent(lastRootBox()->baselineType());
+        }
     }
     // According to the CSS spec http://www.w3.org/TR/CSS21/visudet.html, we shouldn't be performing this min, but should
     // instead be returning boxHeight directly. However, we feel that a min here is better behavior (and is consistent
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to