Closed Bug 145141 Opened 22 years ago Closed 22 years ago

DIVs with relative positioning and hidden overflow incorrectly affects the page layout

Categories

(Core :: Layout, defect, P3)

x86
All
defect

Tracking

()

RESOLVED DUPLICATE of bug 172896
mozilla1.3alpha

People

(Reporter: roger, Assigned: karnaze)

References

()

Details

(Keywords: testcase, topembed+, Whiteboard: [adt2] [ETA Needed] [PATCH])

Attachments

(4 files, 1 obsolete file)

When moving an element inside a DIV with relative position and hidden overflow,
it causes the inner element to be clipped by the outter DIV, but the inner
element affects the DOM around the outter DIV.
table: yellow
relative DIV: blue
absolute DIV inside relative DIV: green

the green DIV is hidden by the blue DIV, but it affects the table as if the
overflow was visible. Moving the green DIV will reflow the table.

Expected, the green DIV shouldn't affect elements outside the blue DIV clipping
area.
Changing QA Contact
QA Contact: petersen → moied
Peter, 

have you seen this cases? The clipped area of a DIV is pushing content to the
bottom or to the right. 
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
Keywords: testcase
I doubt the clipping has anything to do with this.
This is a general bug with tables and relative positioning (probably a
duplicate), which should never affect the position of the table.  The problem is
that the tables are using mOverflowArea for layout, when it should really only
be used for painting/event targetting optimization.  Instead, table cells should
be using some notion of a block formatting context that they contain (i.e.,
containing blocks and floats, similar to what floaters do for their own content,
where they use the space manager's YMost() if it's lower than the bottom of the
block inside.).
-> Karnaze
Assignee: attinasi → karnaze
Target Milestone: --- → Future
Attached file minimum testcase
Added doron to the cc and a minimun testcase to this bug since this fix is
needed  for AOL Brasil, specifically in the Mapafacil service in Brazil
(http://www.mapafacil.com.br). 
Fixing either bug 46893 *or* bug 46257 should fix the main issue in this bug
(although there's an additional bug with the first testcase changing
horizontally the first two times the user presses one of the buttons).  Setting
dependency on both, even though that seems to suggest logical and rather than
logical or.
Depends on: 46257, 46893
I'm using the latest Phoenix nightly (Gecko/20021013), and have found a script
of mine that worked fine in Mozilla 1.1 Final but not this pre-1.2b engine.

The URL is http://www.twinhelix.com/dhtml/scripts/hvscroll.html for the
original script, but it's pretty complicated. I've attached a minimal example
to this bug.

Summary: I've nested divs in a table cell, the outer one is relatively
positioned and has overflow: hidden set on it, and the inner one is absolutely
positioned (normally moves inside the outer, this is fine when I test it). All
is well until you execute style.visibility = 'visible'; on the inner one, which
causes the table cell containing the divs to shrink.

If it's unrelated I'll file a new BugZilla report (sorry, this is my first bug,
still finding the ropes :), but it seems to be the same kind of problem. If
it's possible to fix this by 1.2 final it would be great as otherwise I'll have
to code in another layer of workarounds in my script.
If you know of websites affected by this please add them to this bug. 
Keywords: topembed
http://www.norwegianbastard.net/

exhibits the same bug mentioned by Angus Turnbull. The problem here is simply
that the body has overflow set to hidden and all content is absolutely
positioned. The spec *clearly* states that if you set position:absolute for an
element in a  non-positioned containing box (that would be the body in this
case), the containing block is no longer the non-positioned box. Thus, the
absolutely positioned divs should not be considered overflow.

The bug is confirmed in the latest nightly build (2002110208).

As I said, the spec is quite clear:

C.f. http://www.w3.org/TR/CSS21/visudet.html#containing-block-details

Quote: "If we position "div1":

#div1 { position: absolute; left: 50px; top: 50px }

its containing block is no longer "body"; it becomes the initial containing
block (since there are no other positioned ancestor boxes). "

Sincerely,

Krister
comment 11 and comment 13 seem unrelated both to this bug report and to each
other, and should be filed as separate bugs.
Regarding comment #13: you're absolutely right that the BODY is not the
containing block for the positioned element. However, I believe the spec wants
'overflow:hidden' to apply to *all* children of BODY, not just the children for
which BODY is the containing block, although I admit there is a slight ambiguity
in the spec about this.

(dbaron, did you get any feedback from the WG on this?)
Yes, the latter comments seem to be more appropriately applicable to bug 170011
(my initial search did not turn up this bug report, since it is quite vague in
its formulation).

Robert: "However, I believe the spec wants 'overflow:hidden' to apply to *all*
children of BODY, not just the children for which BODY is the containing block,
although I admit there is a slight ambiguity in the spec about this."

This would seem, however, to be irrelevant for this bug. The spec (the part I
quoted) specifically state that the absolutely positioned div is to be
considered contained by, not BODY, but the "initial containing block" (which
wouldn't be a child of BODY).

Additionally, even if the 'overflow: hidden' applies to the absolutely
positioned div itself, the div should still be shown: its contents aren't
overflowing its dimensions (since width and height are defaul -> auto, which
implies - at minimum (depending on spec version and interpretation) -
"shrink-wrapping" of the content).

Sincerely,

Krister
Please discuss things related to comment 13 on bug 170011, not here.
Marking topembed+ as per topembed triage
Keywords: topembedtopembed+
Keywords: nsbeta1
Whiteboard: [adt2] [ETA Needed]
Status: NEW → ASSIGNED
Whiteboard: [adt2] [ETA Needed] → [adt2] [ETA Needed] [PATCH]
Target Milestone: Future → mozilla1.3alpha
Attached patch patch to fix the bug (obsolete) — Splinter Review
The patch in bug 172896 may fix this also (I'm not sure) but it still has some
problems, and this patch also appears to fix the problem mentioned in comment
#9.
The patch in bug 172896 may fix this also (I'm not sure) but it still has some
problems, and this patch also appears to fix the problem mentioned in comment
#9.
Comment on attachment 105886 [details] [diff] [review]
patch to fix the bug

bugzilla was so slow, I guess I hit submit twice.
Attachment #105886 - Attachment is obsolete: true
Attachment #105887 - Flags: superreview?(kin)
Attachment #105887 - Flags: review?(alexsavulov)
I have patches in another bug which take OVERFLOW_HIDDEN into account for the
overflow area, and clean up some other issues besides. The necessary and
sufficient solution to this problem here is to not use the overflow area for layout.
roc, since this bug is topembed+ (and requests ETA in the status field), could
you please dup it against your bug and mark yours topembed+. If you don't use
the overflow area at all, then won't tables break?
I think this is really dbaron's bug since he's the one working on removing the
dependence on the overflow area. I'll defer to him.
bug 172896 is about not using the overflow area for layout, and I found only one
minor problem in the regression tests (the max-element-size and max-width
computation already includes overflowing blocks, so all that needs doing is
accounting for floats).  roc's patch is I think bug 170330 (which fixes what
attachment 105887 [details] [diff] [review] does, but in a more general way), which I suspect will fix bug
46257.  See the dependency tree.  As I said in comment 9 / comment 10, either
one of those will fix this bug.

I don't understand what the first change in attachment 105887 [details] [diff] [review] is, though.
The 1st part of attachment 105887 [details] [diff] [review] was necessary (probably because of the other
changes), so that the mes would get calculated while exercising attachment
84011 [details]. Without it, mes was deadbeef.
Let's not do this patch. Let's focus on dbaron's fix.

*** This bug has been marked as a duplicate of 172896 ***
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
Comment on attachment 105887 [details] [diff] [review]
patch to fix the bug

clearing request for reviews.
Attachment #105887 - Flags: superreview?(kin)
Attachment #105887 - Flags: review?(alexsavulov)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: