Closed
Bug 235558
Opened 21 years ago
Closed 19 years ago
using max-width and overflow CSS properties on a div cause wrong height to be calculated
Categories
(Core :: Layout: Block and Inline, defect, P2)
Tracking
()
RESOLVED
FIXED
People
(Reporter: flo, Assigned: roc)
References
Details
(Keywords: regression, testcase)
Attachments
(4 files, 1 obsolete file)
1.45 KB,
text/html
|
Details | |
5.34 KB,
patch
|
dbaron
:
review+
dbaron
:
superreview+
chofmann
:
approval1.7b+
|
Details | Diff | Splinter Review |
1.47 KB,
text/html
|
Details | |
1.51 KB,
patch
|
dbaron
:
review+
dbaron
:
superreview+
asa
:
approval1.7+
|
Details | Diff | Splinter Review |
User-Agent: Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 if i assign to an absolutely positioned DIV element the max-width property via CSS (no width or height properties set), and override the defalt 'overflow' setting by either 'hidden' or 'scroll', the height is set incorrectly to only the first line of the content. expected result: width should be set to max-width, height should not be constrained (since not set) it seems that this is a regression, since i am absolutely sure that this worked in 1.5. Reproducible: Always Steps to Reproduce: 1. load the attached testcase 2. the first and fourth box are laid out incorrectly, because bothe are using max-width and overflow properties 3. the second and third box are laid out correctly. 4. details in the css definitions for the four elements Actual Results: first and fourth box are laid out incorrectly (calculated height is to small, only showing the first line). the fourth box shows paradoxically a *horizontal* scrollbar, when it should show none or (with too small height) a vertical. Expected Results: all four boxes should be laid out identically
Reporter | ||
Comment 1•21 years ago
|
||
added testcase
Assignee | ||
Comment 2•21 years ago
|
||
Weird. Must be a reflow problem, but I'll take it.
Assignee: nobody → roc
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: regression
Priority: -- → P2
Assignee | ||
Comment 3•20 years ago
|
||
Okay, unsurprisingly the problem is that nsGfxScrollFrame doesn't handle max-width/max-height very well. The problem in the testcase box 1 is simple: the computed width and height are NS_INTRINSICSIZE, so in nsGfxScrollFrame;:GetPrefSize we don't pass any width or height constraints down to the scrolled block, so it reflows itself all into one line and returns a preferred height of one line. nsGfxScrollFrame returns that as its preferred height. But, later in nsBoxFrame we actually apply the max-width and oops, the block doesn't fit on one line anymore. This patch refactors the GetPrefSize logic a little bit. We distinguish between the computed size of the scrollframe, if any, and the maximum size (the computed size if known, otherwise the CSS max if there is one). The maximum size is what we pass down as the width/height constraints for reflowing the block. That fixes all aspects of this testcase nicely. Metacomment: nsGfxScrollFrame really wants to be a block-like thing, not a XUL box.
Assignee | ||
Updated•20 years ago
|
Attachment #143089 -
Flags: superreview?(dbaron)
Attachment #143089 -
Flags: review?(dbaron)
Assignee | ||
Comment 4•20 years ago
|
||
Slightly better fix. Passing a height constraint to the scrolled block just confuses it because it thinks we're printing (see especially nsBlockReflowState constructor). So let's disable that.
Attachment #143089 -
Attachment is obsolete: true
Assignee | ||
Updated•20 years ago
|
Attachment #143089 -
Flags: superreview?(dbaron)
Attachment #143089 -
Flags: review?(dbaron)
Assignee | ||
Updated•20 years ago
|
Attachment #143090 -
Flags: superreview?(dbaron)
Attachment #143090 -
Flags: review?(dbaron)
Assignee | ||
Comment 5•20 years ago
|
||
This extends the provided testcase (thanks!! for that) with max-height on the DIVs. Use Ctrl+ and Ctrl- to grow and shrink the text to see everything working in its full glory.
Assignee | ||
Comment 6•20 years ago
|
||
Another layout regression fix that I would like to have in 1.7b, although we could probably slip it in between 1.7b and 1.7final without losing too much sleep.
Flags: blocking1.7b?
Comment on attachment 143090 [details] [diff] [review] fix #2 r+sr=dbaron. I may try to comment on the patch at a later date, but for now we're probably better off just getting it in so it gets tested.
Attachment #143090 -
Flags: superreview?(dbaron)
Attachment #143090 -
Flags: superreview+
Attachment #143090 -
Flags: review?(dbaron)
Attachment #143090 -
Flags: review+
Assignee | ||
Comment 8•20 years ago
|
||
Comment on attachment 143090 [details] [diff] [review] fix #2 layout regression, needs 1.7b exposure
Attachment #143090 -
Flags: approval1.7b?
Comment 9•20 years ago
|
||
Comment on attachment 143090 [details] [diff] [review] fix #2 a=chofmann for 1.7b
Attachment #143090 -
Flags: approval1.7b? → approval1.7b+
Assignee | ||
Comment 10•20 years ago
|
||
checked in
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Comment 11•20 years ago
|
||
This seems to be causing bug 237622... the fact that simply setting overflow:hidden on a div changes its dimensions after this patch is bad.
Updated•20 years ago
|
Flags: blocking1.7b?
Assignee | ||
Comment 12•20 years ago
|
||
Without major changes, I think it's impossible for us to simultaneously handle A) float or any block with CSS max-width, with overflow:hidden, width:auto, height:auto, intrinsincally narrower than its container, that contains width:auto child blocks (i.e., where the float/block needs to be reflowed with NS_UNCONSTRAINEDSIZE available width to get its preferred size) and B) float or any block with CSS max-width, with overflow:hidden, width:auto, height:auto, intrinsincally wider than its container and needing wrapping (i.e., where the float/block needs to be reflowed with some fixed available width to get its preferred size) The fix in this bug switched us from doing A correctly to doing B correctly. This backout will switch us back to doing A correctly and B incorrectly.
Assignee | ||
Comment 13•20 years ago
|
||
Comment on attachment 144629 [details] [diff] [review] backout David, I'm not sure that this is the right thing to do, but it's really a policy decision I don't feel qualified to make. We're backed into a bit of a corner here and I think we have to choose one bug to ship with.
Attachment #144629 -
Flags: superreview?(dbaron)
Attachment #144629 -
Flags: review?(dbaron)
Attachment #144629 -
Flags: superreview?(dbaron)
Attachment #144629 -
Flags: superreview+
Attachment #144629 -
Flags: review?(dbaron)
Attachment #144629 -
Flags: review+
Assignee | ||
Updated•20 years ago
|
Attachment #144629 -
Flags: approval1.7?
Comment 14•20 years ago
|
||
Comment on attachment 144629 [details] [diff] [review] backout a=asa (on behalf of drivers) for checkin to 1.7
Attachment #144629 -
Flags: approval1.7? → approval1.7+
Assignee | ||
Comment 15•20 years ago
|
||
Backout checked in.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee | ||
Comment 16•20 years ago
|
||
A real fix to this will require major changes to nsGfxScrollFrame. I think we're going to have to separate it into nsXULScrollFrame that behaves like a XUL box, and nsHTMLScrollFrame that behaves like an HTML block. The change will be painful but ultimately will simplify things, I think (especially if you include the hacks currently in nsBoxToBlockAdapter). I'd like to get to this in 1.8a because until it's done we're stuck with some fairly serious layout bugs, like this one.
Comment 17•20 years ago
|
||
FYI, We're being slammed about this on on ZDNet, http://news.zdnet.com/2100-9588-5438955.html
Comment 18•20 years ago
|
||
That doesn't seem like the same bug to me.
Assignee | ||
Comment 19•19 years ago
|
||
Both of these are completely fixed by my upcoming patch in bug 240276.
Comment 20•19 years ago
|
||
Testcase fails for me with Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050422 Firefox/1.0+ Testcase works for me with Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050428 Firefox/1.0+ Resolved Fixed by bug 240276 & comment 20
Status: REOPENED → RESOLVED
Closed: 20 years ago → 19 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•