Closed Bug 47613 Opened 25 years ago Closed 22 years ago

inheritance for fixed positioned elements is incorrect [FIX POS]

Categories

(Core :: Layout, defect, P3)

defect

Tracking

()

RESOLVED WORKSFORME
Future

People

(Reporter: dbaron, Assigned: attinasi)

Details

(Keywords: css2, Whiteboard: [Hixie-P2] [nsbeta3-])

Attachments

(1 file)

In bug 45631, Robert O'Callahan wrote: >Except there is one big problem: fixed-position elements inherit the property >from the viewport, not from their true parents. In fact, this is currently true >of all the inherited percentage styles that depend on layout (top, left, right, >bottom, width, height, max-width, max-height, min-width, min-height, and maybe >others). This is a serious bug that will not be easy to fix. It should be filed >seperately if it isn't filed already. There was a bug, like the one you describe for fixed position elements, for absolutely positioned elements, and it was a one-line fix. Troy thought that that was the way inherit should have worked when he wrote the code.
Keywords: correctness, css2
The other bug was bug 10485.
Actually, I think that was a 776-line fix: http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=all&branch=HEAD&bra nchtype=match&dir=&file=&filetype=match&who=troy&whotype=regexp&sortby=Date&hour s=2&date=explicit&mindate=04%2F15%2F00+21%3A00&maxdate=04%2F15%2F00+21%3A10&cvsr oot=%2Fcvsroot Some of that code may be reusable here, but I think the whole approach here is actually pretty ugly. It duplicates so much logic from other places to reconstruct the layout state of the other frames, and doesn't even seem to completely solve the problem (e.g. doesn't seem to handle percentage padding or multiple levels of inheritance). I think a better approach would be -- ensure absolute frames are always reflowed after their placeholders -- have placeholder frame reflow record the necessary reflow state information that the absolutely positioned frame is going to need, and then attach that information to the frame as a frame property -- have absolutely-positioned frame reflow read the necessary information from the attachment and then remove the attachment We'd also need to modify reflow command dispatching so that when a reflow is requested on a frame, we also request reflow on all absolutely-positioned frames whose placeholders are below the requested frame. Similarly, all absolutely-positioned frames below the requested frame also need to have their placeholders reflowed. These can be done without scanning the entire subtree of the requested frame, by taking advantage of the fact that fixed frames are all children of the viewport and all other absolute frames have the same containing block as their placeholders. This is probably not worth doing before Mozilla 1.0.
Troy checked in all of the changes to the "new" CSS spec on absolute positioning at the same time, plus that fix. It really was just a tiny piece of it...
David: If you want this fixed the only ways are to (a) do it yourself and get a= and r=, or (b) nominate for nsbeta3. I'm not entirely sure I understand the bug here though. The properties Robert lists are not -- initially -- inherited. Do you mean the % are based on the viewport? Or the inherited value is inherited as an actual value are recomputed against the viewport? Or what?
Keywords: nsbeta3
Whiteboard: easy fix?
Actually I think I lied. This is working, but only partially. I will attach a testcase. Notice how "height" is actually inherited properly into the fixed-position element. However, "top" is not. The "text-indent" isn't inherited properly either, although there are bugs in the trunk that will stop you from seeing the real bug. I don't understand how this works at all. I will have to study the code some more.
Marc ?
Assignee: clayton → attinasi
Accepting this bug: there are some real problems in that fun little testcase... Will investigate...
Status: NEW → ASSIGNED
Marking nsbeta3-: not critical for this release.
Whiteboard: easy fix? → [nsbeta3-]
Target Milestone: --- → Future
Summary: inheritance for fixed positioned elements is incorrect → inheritance for fixed positioned elements is incorrect [FIX POS]
Whiteboard: [nsbeta3-] → [Hixie-P2] [nsbeta3-]
This seems to work for me (though the testcase is not very clear on what should happen). Most likely, this got fixed when fixed-pos reflow and abs-pos reflow got merged (bug 179683). Or am I missing something?
It looks like "top" is inheriting as "0". Is that right? What is the value of the "top" property on the green DIV, given that it's not absolutely positioned? The text indentation is NOT working properly. It should be inheriting the computed value of the text-indent, which is 20% of the 200px parent element width, i.e. 40px. Instead it looks like we're indenting by 20% of the viewport width.
If it's not positioned, the computed value is just the specified value. Which is not set in this case. Setting a "top" on the div inherits correctly. Text-indent is bug 45631, no?
yeah. OK. Great! :-)
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: