Bug 15869 - misalignment because of float:left of <div> tag
Summary: misalignment because of float:left of <div> tag
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL: http://rc.9you.com/info_car_01.html
Keywords: HasReduction
Depends on:
Blocks:
 
Reported: 2007-11-06 21:10 PST by Anantha Keesara
Modified: 2009-08-13 17:41 PDT (History)
2 users (show)

See Also:


Attachments
reduced testcase (388 bytes, text/html)
2007-11-06 21:11 PST, Anantha Keesara
no flags Details
screenshot (174.29 KB, image/gif)
2007-11-06 21:12 PST, Anantha Keesara
no flags Details
reduced test case #2 (572 bytes, text/html)
2008-03-04 23:52 PST, Robert Blaut
no flags Details
Use computed width for float avoidance and unify the rules across parsing modes (297.99 KB, patch)
2009-08-13 12:51 PDT, mitz
simon.fraser: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anantha Keesara 2007-11-06 21:10:16 PST
I .Steps:
-----------
1. Go to: http://rc.9you.com/info_car_01.html

II. Issue:
-----------------
Notice that the contents are outside of the frame. See the screenshot.

III. Other browsers:
--------------------
Only IE gets it right. safari webkit version: 27433
Comment 1 Anantha Keesara 2007-11-06 21:11:31 PST
Created attachment 17082 [details]
reduced testcase
Comment 2 Anantha Keesara 2007-11-06 21:12:21 PST
Created attachment 17083 [details]
screenshot
Comment 3 Robert Blaut 2008-03-04 23:52:14 PST
Created attachment 19544 [details]
reduced test case #2

This test case is pretty interesting if you run it in Gecko. Setting 2px border in Gecko imply proper table positioning :D. The first example is incorrectly rendered. Webkit r30780 fails in both cases.  The latter shows incorrect overflow table outside a parent DIV. Presto (Opera 9.50) correctly displays both cases.

Definitely bug.
Comment 4 Robert Blaut 2008-03-04 23:53:42 PST
This is Live DOM Viewer version of the test case #2
Comment 6 mitz 2008-03-05 00:06:33 PST
This is one of two or three bugs about this quirk. See RenderBlock.cpp:2820.
Comment 7 Robert Blaut 2008-03-05 00:31:39 PST
(In reply to comment #6)
> This is one of two or three bugs about this quirk. See RenderBlock.cpp:2820.
> 

But reduced test case #2 is in strict mode (CSS1Compat) and the issue is still visible. 
Comment 8 mitz 2008-03-05 11:51:36 PST
Yup, there also seems to be an exception for percent-width objects, while on the other hand table widths are computed as if tables always clear floats.
Comment 9 mitz 2009-08-13 12:51:17 PDT
Created attachment 34774 [details]
Use computed width for float avoidance and unify the rules across parsing modes

This appears to match Firefox and IE8 with the exceptions that in Firefox, <hr>s just overflow instead of clearing the float, and in IE, the <hr>’s percent sizes are computed relative to the available width next to the float (so 100% or less never needs to clear the float).
Comment 10 Darin Adler 2009-08-13 13:37:34 PDT
Comment on attachment 34774 [details]
Use computed width for float avoidance and unify the rules across parsing modes

> +        (WebCore::RenderBlock::getClearDelta): Changed to apply the same float
> +            avoisame logic in strict mode and in compatibility mode, which

avoisame -> avoidance

> -    // Do not allow tables to wrap in quirks or even in almost strict mode 
> -    // (ebay on the PLT, finance.yahoo.com in the real world, versiontracker.com forces even almost strict mode not to work)

Did you try these test sites?

>      int result = clearSet ? max(0, bottom - yPos) : 0;
> -    if (!result && child->avoidsFloats() && child->style()->width().isFixed() && 
> -        child->minPrefWidth() > lineWidth(yPos, false) && child->minPrefWidth() <= availableWidth() && 
> -        document()->inStrictMode())   
> -        result = max(0, floatBottom() - yPos);
> +    if (!result && child->avoidsFloats()) {
> +        int oldYPos = child->y();
> +        int oldWidth = child->width();
> +        child->setY(yPos);
> +        child->calcWidth();
> +        if (child->width() > lineWidth(yPos, false) && child->minPrefWidth() <= availableWidth())
> +            result = max(0, floatBottom() - yPos);
> +        child->setY(oldYPos);
> +        child->setWidth(oldWidth);
> +    }

I'd love to say r=me, but this may be a little out of my league. Probably needs a Hyatt review or some other layout expert.
Comment 11 Simon Fraser (smfr) 2009-08-13 13:41:46 PDT
Comment on attachment 34774 [details]
Use computed width for float avoidance and unify the rules across parsing modes

> Index: WebCore/ChangeLog
> ===================================================================

> +        * rendering/RenderBlock.cpp:
> +        (WebCore::RenderBlock::getClearDelta): Changed to apply the same float
> +            avoisame logic in strict mode and in compatibility mode, which

Avoidance?
Comment 12 mitz 2009-08-13 17:35:29 PDT
(In reply to comment #10)
 
> > -    // Do not allow tables to wrap in quirks or even in almost strict mode 
> > -    // (ebay on the PLT, finance.yahoo.com in the real world, versiontracker.com forces even almost strict mode not to work)
> 
> Did you try these test sites?

VersionTracker and Yahoo! Finance in their current form appear to be unaffected by the change. The version of ebay on the PLT is affected, and with the change it looks like it looks in Firefox 3.5. The current version of ebay is unaffected as far as I can tell.
Comment 13 mitz 2009-08-13 17:41:36 PDT
Fixed in <http://trac.webkit.org/projects/webkit/changeset/47255>.