floating parent does not size correctly with floating child using negative margin

VERIFIED FIXED in mozilla1.9beta5

Status

()

Core
Layout: Floats
P1
normal
VERIFIED FIXED
10 years ago
10 years ago

People

(Reporter: xtc4uall, Assigned: roc)

Tracking

({regression, testcase})

Trunk
mozilla1.9beta5
x86
Windows XP
regression, testcase
Points:
---
Bug Flags:
blocking1.9 +

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(6 attachments)

(Reporter)

Description

10 years ago
Created attachment 309882 [details]
screenshot of regressed rendering

after implementation of the reflow branch to trunk the rendering of http://www.vobis.com/shop.html seems to have regressed (see screenshot #1).

the site is valid, but has some css errors.

it works with Fx2 and Fx3-pre-a1 builds prior to reflow-branch-merging (like firefox-3.0a1.en-US.win32-2006-12-06-07).
(Reporter)

Comment 1

10 years ago
Created attachment 309884 [details]
testcase

thanks to polidobj for providing the testcase
(Reporter)

Comment 2

10 years ago
Created attachment 309885 [details]
screenshot of rendering the testcase

screenshot of rendering the testcase with Fx3, latest WebKit, Opera 9.5alpha
(thanks to phiw13)

Comment 3

10 years ago
Note: without 'overflow:hidden' on the outside, wrapping div, the test case renders the same in Gecko 1.9 and WebKit.
Flags: blocking1.9?

Updated

10 years ago
(Reporter)

Comment 4

10 years ago
Created attachment 310561 [details]
testcase rendering: MSIE8 beta 1, Opera 9.5 build 9841, Webkit r31109, Fx3 (2008031905)
I find it odd that the overflow style has an effect, given that the div should be shrink-wrapping anyway.  I'd think the pref width (which includes the margins) would just be that 305px width even with overflow:visible....
This seems like something we should fix, and it shouldn't be that hard. Who wants it?
Flags: blocking1.9? → blocking1.9+
Priority: -- → P1
So I guess what happens here is that nsIFrame::InlinePrefWidthData::ForceBreak accumulates the widths of all floats and then adds the result into the line width. So the large negative margin on the purple float "pulls back" the pref-width of the line to something fairly small, ensuring that the red float gets cut off.

IMHO it would make more sense and be more compatible (looking at that testcase rendering, thanks!) to just ignore floats that don't change the available space.
Created attachment 311118 [details] [diff] [review]
fix?

This fixes this testcase, making our rendering compatible with MSIE8 and Opera. And I think it makes sense. Running reftests now.
Assignee: nobody → roc
Status: NEW → ASSIGNED
Attachment #311118 - Flags: superreview?(dbaron)
Attachment #311118 - Flags: review?(dbaron)
Reftests pass.
Whiteboard: [needs review]
Whiteboard: [needs review] → [needs review dbaron]
--> P2, this doesn't block the beta
Priority: P1 → P2
Target Milestone: --- → mozilla1.9
Mike, this could have some web-compat fallout, so if we _can_ take it for the beta, we really should...
Created attachment 311300 [details] [diff] [review]
fix with reftest
I think we should get this into beta5 if we possibly can
I'll make this P1 again in the hope someone notices the above comments :-)
Priority: P2 → P1
We've noticed: waiting on dbaron's review ...
Comment on attachment 311118 [details] [diff] [review]
fix?

r+sr=dbaron
Attachment #311118 - Flags: superreview?(dbaron)
Attachment #311118 - Flags: superreview+
Attachment #311118 - Flags: review?(dbaron)
Attachment #311118 - Flags: review+
Comment on attachment 311300 [details] [diff] [review]
fix with reftest

a1.9b5=beltzner based on dbaron's review of above
Attachment #311300 - Flags: approval1.9b5+
Whiteboard: [needs review dbaron]
Keywords: checkin-needed
Checking in layout/generic/nsFrame.cpp;
/cvsroot/mozilla/layout/generic/nsFrame.cpp,v  <--  nsFrame.cpp
new revision: 3.791; previous revision: 3.790
done
RCS file: /cvsroot/mozilla/layout/reftests/bugs/423385-1-ref.html,v
done
Checking in layout/reftests/bugs/423385-1-ref.html;
/cvsroot/mozilla/layout/reftests/bugs/423385-1-ref.html,v  <--  423385-1-ref.html
initial revision: 1.1
done
RCS file: /cvsroot/mozilla/layout/reftests/bugs/423385-1.html,v
done
Checking in layout/reftests/bugs/423385-1.html;
/cvsroot/mozilla/layout/reftests/bugs/423385-1.html,v  <--  423385-1.html
initial revision: 1.1
done
Checking in layout/reftests/bugs/reftest.list;
/cvsroot/mozilla/layout/reftests/bugs/reftest.list,v  <--  reftest.list
new revision: 1.410; previous revision: 1.409
done
Status: ASSIGNED → RESOLVED
Last Resolved: 10 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: mozilla1.9 → mozilla1.9beta5
REFTEST UNEXPECTED FAIL: file:///builds/slave/trunk_centos5/mozilla/layout/reftests/pixel-rounding/border-height-5.html
REFTEST UNEXPECTED FAIL: file:///builds/slave/trunk_centos5/mozilla/layout/reftests/pixel-rounding/border-height-6.html
REFTEST UNEXPECTED FAIL: file:///builds/slave/trunk_centos5/mozilla/layout/reftests/pixel-rounding/border-width-5.html
REFTEST UNEXPECTED FAIL: file:///builds/slave/trunk_centos5/mozilla/layout/reftests/pixel-rounding/border-width-6.html

Failed on Linux and Win32... seems to pass on Mac, though. Backed out patch and the reftest.list addition.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Broken reftests? Bad patch? At this point I'd like someone to reiterate the *need* to have this in the beta, as we're blocking on it, and we shipped 4 betas without it and didn't even relnote or get a lot of dupes.
(In reply to comment #19)
> REFTEST UNEXPECTED FAIL:
> file:///builds/slave/trunk_centos5/mozilla/layout/reftests/pixel-rounding/border-height-5.html
> REFTEST UNEXPECTED FAIL:
> file:///builds/slave/trunk_centos5/mozilla/layout/reftests/pixel-rounding/border-height-6.html
> REFTEST UNEXPECTED FAIL:
> file:///builds/slave/trunk_centos5/mozilla/layout/reftests/pixel-rounding/border-width-5.html
> REFTEST UNEXPECTED FAIL:
> file:///builds/slave/trunk_centos5/mozilla/layout/reftests/pixel-rounding/border-width-6.html
> 
> Failed on Linux and Win32... seems to pass on Mac, though. Backed out patch and
> the reftest.list addition.
> 

Aren't these due to bug 417178?
Keywords: checkin-needed
Relanded.

Checking in layout/generic/nsFrame.cpp;
/cvsroot/mozilla/layout/generic/nsFrame.cpp,v  <--  nsFrame.cpp
new revision: 3.793; previous revision: 3.792
done
Checking in layout/reftests/bugs/reftest.list;
/cvsroot/mozilla/layout/reftests/bugs/reftest.list,v  <--  reftest.list
new revision: 1.414; previous revision: 1.413
done
Status: REOPENED → RESOLVED
Last Resolved: 10 years ago10 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
(Reporter)

Comment 23

10 years ago
with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b5pre) Gecko/2008032605 Firefox/3.0.0.0 ID:2008032605 testcase is rendered like MSIE8 beta1/Opera 9.5 build 9841 and http://www.vobis.com/shop.html looks fine too => VERIFIED FIXED

roc = my hero :D
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.