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.
Created attachment 12224 [details] Test case of the clearing bug.
See the following link for a more real-world example of this bug: http://level39.com/clearing-bug/layout.html
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.
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
Fixed.
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
Can we get clarification on this?
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.
For what it's worth, I do like the behavior I just implemented. Too bad it doesn't match the spec. :(
Created attachment 12246 [details] Patch that backs out this behavior and reverts to old behavior (while keeping code cleanup)
Comment on attachment 12246 [details] Patch that backs out this behavior and reverts to old behavior (while keeping code cleanup) r=me
Ok fixed.