Bug 79046

Summary: width of overflow:hidden blocks is wrong when their margins overlap floats
Product: WebKit Reporter: Dave Hyatt <hyatt>
Component: Layout and RenderingAssignee: Dave Hyatt <hyatt>
Status: RESOLVED FIXED    
Severity: Normal CC: browserbugs2, dglazkov, phiw2, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch mitz: review+, webkit.review.bot: commit-queue-

Description Dave Hyatt 2012-02-20 14:39:22 PST
width of overflow:hidden blocks is wrong when their margins overlap floats. There are a couple of cases that we get wrong, but they all basically boil down to the fact that we need to stop thinking about shrinking to avoid floats as reducing the available content width and instead start thinking about it as reducing the object's width instead.
Comment 1 Dave Hyatt 2012-02-20 14:40:09 PST
The relevant thread for discussion is:

http://lists.w3.org/Archives/Public/www-style/2012Feb/0954.html

See additional tests mentioned here:

http://lists.w3.org/Archives/Public/www-style/2012Feb/1007.html
Comment 2 Dave Hyatt 2012-02-20 14:54:33 PST
Created attachment 127854 [details]
Patch
Comment 3 mitz 2012-02-20 15:13:52 PST
Comment on attachment 127854 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=127854&action=review

> Source/WebCore/rendering/RenderBox.cpp:1261
> +        LayoutUnit offsetFromLogicalTopOfRegion = region ? region->offsetFromLogicalTopOfFirstPage() - offsetFromLogicalTopOfFirstPage : 0;

No need to test region here.

> LayoutTests/fast/block/float/centered-float-avoidance-complexity.html:69
> +  <h3>The orange stripe has 'overflow: auto', 'margin-left: auto' and 'margin-right: auto'<br> The lime stripes are floats with various width (topmost is 0, bottommost is 150px)<br>The wrapping container has a solid silver border.</h3>

This text is lying about the margins of the orange stripe. Might as well get it right.
Comment 4 WebKit Review Bot 2012-02-20 15:37:42 PST
Comment on attachment 127854 [details]
Patch

Attachment 127854 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/11546579

New failing tests:
fast/forms/float-before-fieldset.html
fast/block/float/centered-float-avoidance-complexity.html
fast/block/float/shrink-to-avoid-float-complexity.html
Comment 5 Philippe Wittenbergh 2012-02-20 16:46:53 PST
fwiw, older bug on this: bug 19123.
Comment 6 Gérard Talbot 2012-02-20 20:00:36 PST
(In reply to comment #3)

> > LayoutTests/fast/block/float/centered-float-avoidance-complexity.html:69
> > +  <h3>The orange stripe has 'overflow: auto', 'margin-left: auto' and 'margin-right: auto'<br>

> This text is lying about the margins of the orange stripe.

I fixed that error in 

http://www.gtalbot.org/BrowserBugsSection/css21testsuite/Floats-And-BFCs-With-Margins-AG.html

Gérard
Comment 7 Dave Hyatt 2012-02-21 09:17:44 PST
Fixed in r108364.
Comment 8 Dave Hyatt 2012-02-21 09:18:45 PST
*** Bug 19123 has been marked as a duplicate of this bug. ***