Bug 12114 - Clearing a float with an element that floats causes problem with next float in the opposite direction
: Clearing a float with an element that floats causes problem with next float i...
Status: RESOLVED INVALID
: WebKit
CSS
: 420+
: Macintosh Mac OS X 10.4
: P2 Major
Assigned To:
: http://level39.com/clearing-bug/
: HasReduction
:
: 9610
  Show dependency treegraph
 
Reported: 2007-01-04 13:33 PST by
Modified: 2007-03-15 07:29 PST (History)


Attachments
Test case of the clearing bug. (1.20 KB, text/html)
2007-01-04 13:36 PST, Dan Richman
no flags Details
Patch that does left/right y-computations separately. (5.15 KB, patch)
2007-01-04 14:41 PST, Dave Hyatt
aroben: review+
Review Patch | Details | Formatted Diff | Diff
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+
Review Patch | Details | Formatted Diff | Diff


Note

You need to log in before you can comment on or make changes to this bug.


Description From 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.
------- Comment #1 From 2007-01-04 13:36:15 PST -------
Created an attachment (id=12224) [details]
Test case of the clearing bug.
------- Comment #2 From 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
------- Comment #3 From 2007-01-04 14:41:46 PST -------
Created an attachment (id=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 #4 From 2007-01-04 14:48:29 PST -------
(From update of attachment 12229 [details])
+    FloatingObject* lastFloat = f;

   Might as well initialize this to f->prev() to save an unnecessary pass through the while loop.

   r=me
------- Comment #5 From 2007-01-04 15:14:39 PST -------
Fixed.
------- Comment #6 From 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
------- Comment #7 From 2007-01-05 09:04:54 PST -------
Can we get clarification on this?
------- Comment #8 From 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.
------- Comment #9 From 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. :(
------- Comment #10 From 2007-01-05 13:08:32 PST -------
Created an attachment (id=12246) [details]
Patch that backs out this behavior and reverts to old behavior (while keeping code cleanup)
------- Comment #11 From 2007-01-05 13:11:30 PST -------
(From update of attachment 12246 [details])
r=me
------- Comment #12 From 2007-01-05 13:14:19 PST -------
Ok fixed.