Regression r130057: incorrect block pref width for alternating InlineFlow and inline...
authorleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Oct 2012 21:29:31 +0000 (21:29 +0000)
committerleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Oct 2012 21:29:31 +0000 (21:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=99194

Reviewed by Eric Seidel.

Source/WebCore:

Correctly breaking lines after inline replaced elements that follow inline flows. Previously, alternating
these two types of elements would cause us to increase our preferred width forever.

Test: fast/block/block-with-inline-replaced-children-in-inline-flows.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computeInlinePreferredLogicalWidths):

LayoutTests:

* fast/block/block-with-inline-replaced-children-in-inline-flows-expected.html: Added.
* fast/block/block-with-inline-replaced-children-in-inline-flows.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/block/block-with-inline-replaced-children-in-inline-flows-expected.html [new file with mode: 0644]
LayoutTests/fast/block/block-with-inline-replaced-children-in-inline-flows.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.cpp

index 278cb6dddab7d91870a064e0e7063125db00ae86..9f21262f955e63c8cae6a8cdce1f855f2743de73 100644 (file)
@@ -1,3 +1,13 @@
+2012-10-15  Levi Weintraub  <leviw@chromium.org>
+
+        Regression r130057: incorrect block pref width for alternating InlineFlow and inline Replaced
+        https://bugs.webkit.org/show_bug.cgi?id=99194
+
+        Reviewed by Eric Seidel.
+
+        * fast/block/block-with-inline-replaced-children-in-inline-flows-expected.html: Added.
+        * fast/block/block-with-inline-replaced-children-in-inline-flows.html: Added.
+
 2012-10-15  Emil A Eklund  <eae@chromium.org>
 
         Revert rounding change in RenderTable::paintObject
diff --git a/LayoutTests/fast/block/block-with-inline-replaced-children-in-inline-flows-expected.html b/LayoutTests/fast/block/block-with-inline-replaced-children-in-inline-flows-expected.html
new file mode 100644 (file)
index 0000000..f6803a1
--- /dev/null
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<style>
+span {
+       padding-left: 30px;
+}
+img {
+       width: 50px;
+       height: 50px;
+}
+</style>
+<body>
+<div>Test for Bugzilla bug:<a href="https://bugs.webkit.org/show_bug.cgi?id=99194"> 99194</a> Regression r130057: incorrect block pref width for alternating InlineFlow and inline Replaced.</div>
+<div>This test verifies that we properly calculate block preferred widths when we have repeated inline replaced elements wrapped in InlineFlows.</div>
+<div style="width: 80px; border: 1px solid black;">
+    <span style=""><img src="resources/50x50.gif"/></span><span><img src="resources/50x50.gif"/></span>
+</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/fast/block/block-with-inline-replaced-children-in-inline-flows.html b/LayoutTests/fast/block/block-with-inline-replaced-children-in-inline-flows.html
new file mode 100644 (file)
index 0000000..aea154b
--- /dev/null
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<style>
+span > span {
+       padding-left: 30px;
+}
+img {
+       width: 50px;
+       height: 50px;
+}
+</style>
+<body>
+<div>Test for Bugzilla bug:<a href="https://bugs.webkit.org/show_bug.cgi?id=99194"> 99194</a> Regression r130057: incorrect block pref width for alternating InlineFlow and inline Replaced.</div>
+<div>This test verifies that we properly calculate block preferred widths when we have repeated inline replaced elements wrapped in InlineFlows.</div>
+<div style="width: 50px">
+    <span style="float: left; border: 1px solid black;">
+        <span style=""><img src="resources/50x50.gif"/></span><span><img src="resources/50x50.gif"/></span>
+    </span>
+</div>
+</body>
+</html>
\ No newline at end of file
index d34a7db21f14d21fe38a21a213759e63b6116db4..db7411ea9cae7431b34ec367b663f8a0271ffc06 100644 (file)
@@ -1,3 +1,18 @@
+2012-10-15  Levi Weintraub  <leviw@chromium.org>
+
+        Regression r130057: incorrect block pref width for alternating InlineFlow and inline Replaced
+        https://bugs.webkit.org/show_bug.cgi?id=99194
+
+        Reviewed by Eric Seidel.
+
+        Correctly breaking lines after inline replaced elements that follow inline flows. Previously, alternating
+        these two types of elements would cause us to increase our preferred width forever.
+
+        Test: fast/block/block-with-inline-replaced-children-in-inline-flows.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::computeInlinePreferredLogicalWidths):
+
 2012-10-15  Emil A Eklund  <eae@chromium.org>
 
         Revert rounding change in RenderTable::paintObject
index 55b9345d2933968c44c9645f03b7e6d0490d7c45..50dbefdaedff06e0b8b7c8f458e89819e014cbef 100755 (executable)
@@ -5914,6 +5914,11 @@ void RenderBlock::computeInlinePreferredLogicalWidths()
                     inlineMin = 0;
                 }
 
+                if (autoWrap && canBreakReplacedElement && isPrevChildInlineFlow) {
+                    updatePreferredWidth(m_minPreferredLogicalWidth, inlineMin);
+                    inlineMin = 0;
+                }
+
                 // We are no longer stripping whitespace at the start of
                 // a line.
                 if (!child->isFloating()) {