Title: [120724] branches/chromium/1132
- Revision
- 120724
- Author
- [email protected]
- Date
- 2012-06-19 09:37:17 -0700 (Tue, 19 Jun 2012)
Log Message
Merge 118297 - REGRESSION (115573): Incorrect rounding of margins for floats
https://bugs.webkit.org/show_bug.cgi?id=87319
Reviewed by Eric Seidel.
Source/WebCore:
In RenderBlock::computeInlinePreferredLogicalWidths we used a float to
accumulate margins for floating children while the children themselves
represent their margins as LayoutUnits. Due to lack of rounding this can
cause the block to be too small at certain certain zoom levels, causing
unwanted wrapping.
This patch changes computeInlinePreferredLogicalWidths to use a
LayoutUnit to accumulate the margins and thus ensures that the margin
values are rounded the same way.
Test: fast/block/float/floats-with-margin-should-not-wrap.html
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computeInlinePreferredLogicalWidths):
LayoutTests:
Add new test ensuring that using margins with floats doesn't cause
undesired wrapping.
* fast/block/float/floats-with-margin-should-not-wrap-expected.html: Added.
* fast/block/float/floats-with-margin-should-not-wrap.html: Added.
[email protected]
Modified Paths
Added Paths
Diff
Copied: branches/chromium/1132/LayoutTests/fast/block/float/floats-with-margin-should-not-wrap-expected.html (from rev 118297, trunk/LayoutTests/fast/block/float/floats-with-margin-should-not-wrap-expected.html) (0 => 120724)
--- branches/chromium/1132/LayoutTests/fast/block/float/floats-with-margin-should-not-wrap-expected.html (rev 0)
+++ branches/chromium/1132/LayoutTests/fast/block/float/floats-with-margin-should-not-wrap-expected.html 2012-06-19 16:37:17 UTC (rev 120724)
@@ -0,0 +1,22 @@
+<!DOCTYPE>
+<html>
+<head>
+<style>
+ body { zoom: 150%; }
+ .container { float: left; position: relative; left: -1px; }
+ .container > div { float: left; width: 19px; background: orange; }
+ .bottom { clear: both; }
+</style>
+</head>
+<body>
+
+<div class="container">
+ <div>1</div>
+ <div>2</div>
+ <div style="width: 20px;">3</div>
+</div>
+
+<div class="bottom">The three blocks above should all be on the same line.</div>
+
+</body>
+</html>
Copied: branches/chromium/1132/LayoutTests/fast/block/float/floats-with-margin-should-not-wrap.html (from rev 118297, trunk/LayoutTests/fast/block/float/floats-with-margin-should-not-wrap.html) (0 => 120724)
--- branches/chromium/1132/LayoutTests/fast/block/float/floats-with-margin-should-not-wrap.html (rev 0)
+++ branches/chromium/1132/LayoutTests/fast/block/float/floats-with-margin-should-not-wrap.html 2012-06-19 16:37:17 UTC (rev 120724)
@@ -0,0 +1,22 @@
+<!DOCTYPE>
+<html>
+<head>
+<style>
+ body { zoom: 150%; }
+ .container { float: left; }
+ .container > div { float: left; width: 20px; margin-left: -1px; background: orange; }
+ .bottom { clear: both; }
+</style>
+</head>
+<body>
+
+<div class="container">
+ <div>1</div>
+ <div>2</div>
+ <div>3</div>
+</div>
+
+<div class="bottom">The three blocks above should all be on the same line.</div>
+
+</body>
+</html>
Modified: branches/chromium/1132/Source/WebCore/rendering/RenderBlock.cpp (120723 => 120724)
--- branches/chromium/1132/Source/WebCore/rendering/RenderBlock.cpp 2012-06-19 16:21:43 UTC (rev 120723)
+++ branches/chromium/1132/Source/WebCore/rendering/RenderBlock.cpp 2012-06-19 16:37:17 UTC (rev 120724)
@@ -5498,7 +5498,7 @@
child->setPreferredLogicalWidthsDirty(false);
} else {
// Inline replaced elts add in their margins to their min/max values.
- float margins = 0;
+ LayoutUnit margins = 0;
Length startMargin = childStyle->marginStart();
Length endMargin = childStyle->marginEnd();
if (startMargin.isFixed())
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes