Closed Bug 98579 Opened 24 years ago Closed 24 years ago

bottom and right don't work if height and/or width not specified

Categories

(Core :: Layout, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla0.9.5

People

(Reporter: millennium, Assigned: dbaron)

References

Details

Attachments

(3 files)

From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.3+) Gecko/20010906 BuildID: 2001090603 When using fixed positioning, if an element's height is not explicitly set, then the bottom: property does not work. The element is either not rendered at all, or it is rendered somewhere offscreen (I can't tell which). See the attachment for details. Reproducible: Always Steps to Reproduce: 1. Load the attachment (postest.html). The yellow box will start statically-positioned. 2. Click "Absolute" to change the box's positioning to absolute. 3. Observe the position of the yellow box. 4. Click "Fixed" to change the box's positioning to fixed. 5. Observe the position of the yellow box. Actual Results: In absolute positioning, the box moves near the bottom of the screen, but not ten pixels from the right or bottom, as it should. In fixed positioning, the yellow box does not appear to be rendered at all; it does not appear in the window. Expected Results: The yellow box moves to a position where it is ten pixels from the bottom and ten pixels from the right of the window. This should apply whether the positioning is absolute or fixed.
Status: UNCONFIRMED → NEW
Ever confirmed: true
We're really sending it off into the middle of nowhere: Fixed-list< Area(p)(11)@0x8311804 [view=0x8312a48] {1073741824,1073742016,7068,768} [state=00c02104] sc=0x8311888(i=4,b=0)<
Component: Style System → Layout
The problem seems to be that nsHTMLReflowState::InitAbsoluteConstraints sets mComputedOffsets.{left,top} to NS_AUTOOFFSET, and we just end up using that value as a number: if (leftIsAuto) { mComputedOffsets.left = NS_AUTOOFFSET; // solve for 'left' } else { mComputedOffsets.right = NS_AUTOOFFSET; // solve for 'right' }
URL: http://(not applicable; see attachment)
This patch fixes the immediate problem here. However, the differences between ReflowAbsoluteFrame and ReflowFixedFrame suggest to me that there are some other problems lurking here -- perhaps some bugs in ReflowFixedFrame, or perhaps some unneeded code in ReflowAbsoluteFrame, or at code that won't be needed if we find a better way to reposition views. (Here's yet another case of weird frames moving after view positioning stuff.)
Status: NEW → ASSIGNED
Keywords: review
Priority: -- → P2
Target Milestone: --- → mozilla0.9.5
The changes you've made look fine; r= or sr=waterson, whichever helps. Given the current way we do views (which actually seems more reasonable to me now that kmcclusk has explained it to me), I think that ViewportFrame::ReflowFixedFrame really ought to call nsContainerFrame::PositionChildViews (or, perhaps we ought to modify nsContainerFrame::SyncFrameViewAfterReflow to do so). It does seem that if the kid's left or top should move during reflow (can it? perhaps not?), we may end up with a situation where a child view could be positioned incorrectly. The same is almost certainly true in nsAbsoluteContainingBlock::ReflowAbsoluteFrame. I'll go ahead and try to concoct test cases to illustrate the problems.
Filed bug 99978 for above issue.
Comment on attachment 49466 [details] [diff] [review] fix for this problem sr=attinasi
Attachment #49466 - Flags: superreview+
Fix checked in 2001-09-17 16:55 PDT.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
*** Bug 102425 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

Creator:
Created:
Updated:
Size: