RESOLVED INVALID Bug 12114
Clearing a float with an element that floats causes problem with next float in the opposite direction
https://bugs.webkit.org/show_bug.cgi?id=12114
Summary Clearing a float with an element that floats causes problem with next float i...
Dan Richman
Reported 2007-01-04 13:33:43 PST
If you have an element set to float:right; and you follow it with another element set to clear:right; float:right; and then follow those first two elements with a third element set to float:left; the third element will not float next to the first element, even though it is not being cleared. This bug is also present when the float directions are reversed from the example described above.
Attachments
Test case of the clearing bug. (1.20 KB, text/html)
2007-01-04 13:36 PST, Dan Richman
no flags
Patch that does left/right y-computations separately. (5.15 KB, patch)
2007-01-04 14:41 PST, Dave Hyatt
aroben: review+
Patch that backs out this behavior and reverts to old behavior (while keeping code cleanup) (2.54 KB, patch)
2007-01-05 13:08 PST, Dave Hyatt
mitz: review+
Dan Richman
Comment 1 2007-01-04 13:36:15 PST
Created attachment 12224 [details] Test case of the clearing bug.
Dan Richman
Comment 2 2007-01-04 13:39:47 PST
See the following link for a more real-world example of this bug: http://level39.com/clearing-bug/layout.html
Dave Hyatt
Comment 3 2007-01-04 14:41:46 PST
Created attachment 12229 [details] Patch that does left/right y-computations separately. This patch makes sure the "don't go above the previous float" rule treats left and right separately.
Adam Roben (:aroben)
Comment 4 2007-01-04 14:48:29 PST
Comment on attachment 12229 [details] Patch that does left/right y-computations separately. + FloatingObject* lastFloat = f; Might as well initialize this to f->prev() to save an unnecessary pass through the while loop. r=me
Dave Hyatt
Comment 5 2007-01-04 15:14:39 PST
Fixed.
L. David Baron
Comment 6 2007-01-05 07:40:36 PST
This bug is invalid. The previous behavior was correct. CSS2 9.5.1 rule 5 says: The outer top of a floating box may not be higher than the outer top of any block or floated box generated by an element earlier in the source document. (Below the rules, it says: References to other elements in these rules refer only to other elements in the same block formatting context as the float.) http://www.w3.org/TR/CSS21/visuren.html#float-position
Dan Richman
Comment 7 2007-01-05 09:04:54 PST
Can we get clarification on this?
Dave Hyatt
Comment 8 2007-01-05 12:45:53 PST
Yeah, rule 5 is clear. I missed that. This bug was invalid. Will attach a new patch that backs out the behavior but retains the code cleanup.
Dave Hyatt
Comment 9 2007-01-05 12:46:52 PST
For what it's worth, I do like the behavior I just implemented. Too bad it doesn't match the spec. :(
Dave Hyatt
Comment 10 2007-01-05 13:08:32 PST
Created attachment 12246 [details] Patch that backs out this behavior and reverts to old behavior (while keeping code cleanup)
mitz
Comment 11 2007-01-05 13:11:30 PST
Comment on attachment 12246 [details] Patch that backs out this behavior and reverts to old behavior (while keeping code cleanup) r=me
Dave Hyatt
Comment 12 2007-01-05 13:14:19 PST
Ok fixed.
Note You need to log in before you can comment on or make changes to this bug.