Closed Bug 271990 Opened 20 years ago Closed 20 years ago

Right floats don't line up in a shrink-to-fit abs.pos. (breaks layout of menus/tabs/buttons at www.mozilla.org)

Categories

(Core :: Layout: Positioned, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: MatsPalmgren_bugz, Assigned: MatsPalmgren_bugz)

References

()

Details

(Keywords: regression, testcase)

Attachments

(6 files, 1 obsolete file)

Floats don't line up in a shrink-to-fit abs.pos.
This is a followup from bug 201897 comment 69.
Attached file Testcase #1 (obsolete) —
Attached file Testcase #2
Attachment #167187 - Attachment is obsolete: true
Before reflow: availWidth=1073741824 aContainingBlockWidth=-1
After 1st reflow: kidDesiredSize.width=560 kidDesiredSize.mMaxElementWidth=280
availWidth=14350
Before reflow: availWidth=560 aContainingBlockWidth=14350
After 2nd reflow: kidDesiredSize.width=560
float:left seems to work:

Before reflow: availWidth=1073741824 aContainingBlockWidth=-1
After 1st reflow: kidDesiredSize.width=840 kidDesiredSize.mMaxElementWidth=280
availWidth=14350
Before reflow: availWidth=840 aContainingBlockWidth=14350
After 2nd reflow: kidDesiredSize.width=840
I think the reported preferred width of 560 is wrong in an unconstrained reflow.
Maybe the following block has something to do with it?
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/layout/html/base/src/nsBlockReflowContext.cpp&rev=1.124&mark=439-459#435

(mSpace.width==NS_UNCONSTRAINEDSIZE on the 1st reflow there)
Summary: Floats don't line up in a shrink-to-fit abs.pos. → Right floats don't line up in a shrink-to-fit abs.pos.
Attached file Trace
Attached patch wallpaperSplinter Review
FWIW, this fixes the problem...
Isn't mAvailSpaceRect.XMost() be NS_UNCONSTRAINEDSIZE for an unconstrained reflow?
Sometimes, see attachment 167204 [details] (which is without the wallpaper).
Why was the second float ok but not the third?

You should never do arithmetic on NS_UNCONSTRAINEDSIZE.
(In reply to comment #11)
> Why was the second float ok but not the third?

Don't know yet...

> You should never do arithmetic on NS_UNCONSTRAINEDSIZE.

That I do know - but it still fixes the problem ;-)
Attached file Trace 2
It seems the problem occurs when setting psd->mRightEdge = NS_UNCONSTRAINEDSIZE

in nsLineLayout::UpdateBand(), it seems placing right floats after that isn't
working...
Attached patch wallpaper 2Splinter Review
Here is another wallpaper that seems to fix the problem also...
In nsLineLayout::UpdateBand() we are not really doing anything "to advance" in
the case when psd->mRightEdge is set to NS_UNCONSTRAINEDSIZE.
So this patch is just a wild guess... maybe there is code somewhere that
reasons
along the line of "hey, we tried to place a float but we didn't advance on the
line so let's move to the next line" ... or something...
Comment on attachment 167224 [details] [diff] [review]
wallpaper 2

Note that this triggers a CRAZY_WIDTH(xmost) check in
nsBlockFrame::PostPlaceLine() though:
Area(ul)(3)@0x87801fc: line=0x878f1d8 xmost=1073741824
Area(li)(3)@0x87808e0: line=0x8780a68 xmost=1073743154
...
*** Bug 272099 has been marked as a duplicate of this bug. ***
*** Bug 272197 has been marked as a duplicate of this bug. ***
*** Bug 272601 has been marked as a duplicate of this bug. ***
*** Bug 272391 has been marked as a duplicate of this bug. ***
*** Bug 272734 has been marked as a duplicate of this bug. ***
Tweaking summary in the hope that it will reduce the number of dupes filed.
Summary: Right floats don't line up in a shrink-to-fit abs.pos. → Right floats don't line up in a shrink-to-fit abs.pos. (breaks menus at www.mozilla.org)
*** Bug 272770 has been marked as a duplicate of this bug. ***
*** Bug 272831 has been marked as a duplicate of this bug. ***
*** Bug 272887 has been marked as a duplicate of this bug. ***
Flags: blocking1.8a6?
*** Bug 272909 has been marked as a duplicate of this bug. ***
*** Bug 273000 has been marked as a duplicate of this bug. ***
*** Bug 273005 has been marked as a duplicate of this bug. ***
*** Bug 273204 has been marked as a duplicate of this bug. ***
*** Bug 273219 has been marked as a duplicate of this bug. ***
*** Bug 273331 has been marked as a duplicate of this bug. ***
*** Bug 273362 has been marked as a duplicate of this bug. ***
Summary: Right floats don't line up in a shrink-to-fit abs.pos. (breaks menus at www.mozilla.org) → Right floats don't line up in a shrink-to-fit abs.pos. (breaks menus/tabs at www.mozilla.org)
Tweaking the subject again along the dupes.
Summary: Right floats don't line up in a shrink-to-fit abs.pos. (breaks menus/tabs at www.mozilla.org) → Right floats don't line up in a shrink-to-fit abs.pos. (breaks layout of menus/tabs/buttons at www.mozilla.org)
This is working in the latest nightly Firefox build on Windows 2004-12-06-08-trunk
The buttons on www.mozilla.org are lined up correctly.
Yes, this was fixed by the "Patch rev. 10" in bug 201897, which was checked in
2004-12-05 16:27.
Status: NEW → RESOLVED
Closed: 20 years ago
Flags: blocking1.8a6?
Resolution: --- → FIXED
verified per my comment #34
Status: RESOLVED → VERIFIED
*** Bug 273430 has been marked as a duplicate of this bug. ***
*** Bug 273443 has been marked as a duplicate of this bug. ***
*** Bug 273559 has been marked as a duplicate of this bug. ***
*** Bug 273629 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: