Title: [143752] branches/chromium/1410
- Revision
- 143752
- Author
- [email protected]
- Date
- 2013-02-22 10:45:07 -0800 (Fri, 22 Feb 2013)
Log Message
Merge 142659
> REGRESSION(r136967): Combination of float and clear yields to bad layout
> https://bugs.webkit.org/show_bug.cgi?id=109476
>
> Reviewed by Levi Weintraub.
>
> Source/WebCore:
>
> Test: fast/block/margin-collapse/self-collapsing-block-with-float-children.html
>
> The change made at http://trac.webkit.org/changeset/136967 only needs to worry about the first floated
> child of a self-collapsing block. The ones that follow are not affected by its margins.
>
> * rendering/RenderBlockLineLayout.cpp:
> (WebCore::RenderBlock::LineBreaker::skipLeadingWhitespace):
>
> LayoutTests:
>
> * fast/block/margin-collapse/self-collapsing-block-with-float-children-expected.txt: Added.
> * fast/block/margin-collapse/self-collapsing-block-with-float-children.html: Added.
>
[email protected]
Review URL: https://codereview.chromium.org/12335038
Modified Paths
Added Paths
Diff
Copied: branches/chromium/1410/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-float-children-expected.txt (from rev 142659, trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-float-children-expected.txt) (0 => 143752)
--- branches/chromium/1410/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-float-children-expected.txt (rev 0)
+++ branches/chromium/1410/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-float-children-expected.txt 2013-02-22 18:45:07 UTC (rev 143752)
@@ -0,0 +1,7 @@
+These words should
+PASS
+be all on the
+PASS
+same line.
+PASS
+https://bugs.webkit.org/show_bug.cgi?id=109476 : only the first floated child of a self-collapsing block needs to account for its collapsed margin.
Copied: branches/chromium/1410/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-float-children.html (from rev 142659, trunk/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-float-children.html) (0 => 143752)
--- branches/chromium/1410/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-float-children.html (rev 0)
+++ branches/chromium/1410/LayoutTests/fast/block/margin-collapse/self-collapsing-block-with-float-children.html 2013-02-22 18:45:07 UTC (rev 143752)
@@ -0,0 +1,33 @@
+<!doctype html>
+<html>
+<head>
+ <style>
+ .cleared-container {
+ font: 30px/1 Ahem;
+ clear: both;
+ list-style: none;
+ padding: 0;
+ margin: 1em 0 0;
+ }
+ .floated-child {
+ float: left;
+ width: 33.33%;
+ background: rgb(200,200,200);
+ }
+ </style>
+</head>
+<body>
+ <script src=""
+ <ul class="cleared-container">
+ <li class="floated-child" data-offset-y="30px">These words should</li>
+ <li class="floated-child" data-offset-y="30px">be all on the </li>
+ <li class="floated-child" data-offset-y="30px">same line.</li>
+ </ul>
+ <p> https://bugs.webkit.org/show_bug.cgi?id=109476 : only the first floated child of a self-collapsing block needs to account
+ for its collapsed margin. </p>
+ <script>
+ checkLayout('.floated-child');
+ </script>
+</body>
+</html>
+
Modified: branches/chromium/1410/Source/WebCore/rendering/RenderBlockLineLayout.cpp (143751 => 143752)
--- branches/chromium/1410/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2013-02-22 18:40:44 UTC (rev 143751)
+++ branches/chromium/1410/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2013-02-22 18:45:07 UTC (rev 143752)
@@ -2281,8 +2281,8 @@
}
} else if (object->isFloating()) {
// The top margin edge of a self-collapsing block that clears a float intrudes up into it by the height of the margin,
- // so in order to place this child float at the top content edge of the self-collapsing block add the margin back in before placement.
- LayoutUnit marginOffset = (m_block->isSelfCollapsingBlock() && m_block->style()->clear() && m_block->getClearDelta(m_block, LayoutUnit())) ? m_block->collapsedMarginBeforeForChild(m_block) : LayoutUnit();
+ // so in order to place this first child float at the top content edge of the self-collapsing block add the margin back in before placement.
+ LayoutUnit marginOffset = (!object->previousSibling() && m_block->isSelfCollapsingBlock() && m_block->style()->clear() && m_block->getClearDelta(m_block, LayoutUnit())) ? m_block->collapsedMarginBeforeForChild(m_block) : LayoutUnit();
LayoutUnit oldLogicalHeight = m_block->logicalHeight();
m_block->setLogicalHeight(oldLogicalHeight + marginOffset);
m_block->positionNewFloatOnLine(m_block->insertFloatingObject(toRenderBox(object)), lastFloatFromPreviousLine, lineInfo, width);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes