Closed Bug 10485 Opened 25 years ago Closed 25 years ago

inherit on w/h on abs pos elements

Categories

(Core :: Layout, defect, P3)

x86
Linux
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: dbaron, Assigned: troy)

References

()

Details

(Keywords: css2, Whiteboard: need to contact the WG for clarification)

The inherit keyword doesn't work correctly on width and height for absolutely positioned elements. It should inherit from the parent, not the containing block. See the above test. This shows I can catch bugs reading code. I actually noticed it reading code about a month and a half ago, and wrote a note to myself to test it (since the code doesn't always do what I think...). Hopefully I can actually work through my "to do" list...
Hmm, I don't agree with the assertion that the width should be inherited from the parent instead of the containing block. Yes, section 6.2.1 of the CSS2 spec says "... 'inherit', which means that, for a given element, the property takes the same computed value as the property for the element's parent" However, 10.2 when referring to percentage values says "Specifies a percentage width. The percentage is calculated with respect to the width of the generated box's containing block." If we're going to be consistent, then shouldn't 'inherit' also be with respect to the containing block? My interpretation of the spec was that 6.2.1 was generic and hence didn't take into specific scenarios like positioned elements. Cc'ing Peter as well. This is an interesting issue that I think needs clarification in the spec
I think 6.2.1 means what it says - since the idea is to make CSS more logically complete by allowing one to specify (or re-specify) the inheritance that is the default for many properties. I think it *always* refers to the parent. But we can see what Peter says...
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → REMIND
Marking this REMIND until we get a resolution on what the expected behavior should be
Status: RESOLVED → VERIFIED
Marking as verified remind
Summary: inherit on w/h on abs pos elements → {css2} inherit on w/h on abs pos elements
Status: VERIFIED → REOPENED
I feel quite strongly that this is really a bug. I think the 'inherit' keyword always refers to the parent in the document tree, and I haven't seen any evidence to the contrary. Since it doesn't show up on anybody's bug list in the VERIFIED REMIND state, I'm reopening it. Furthermore, this is actually one place where the explicit inherit keyword could be quite useful - in combination with left: auto or top: auto. The inherit keyword could be used to give one dimension of an absolutely positioned element the same dimenions as its non-positioned parent. This could be useful for things such as marginal notes.
Assignee: troy → peterl
Status: REOPENED → NEW
Resolution: REMIND → ---
Then the bug has to go to Peter, so we can get the style working group to rule on this and then clarify the spec.
Reassigning peterl's bugs to myself.
Whiteboard: need to contact the WG for clarification
IMO, this bug has been fixed.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago25 years ago
Resolution: --- → FIXED
Correct: it was fixed on Sep 8 as a side effect of another fix in version 3.80 / 3.83 of nsCSSStyleRule.cpp. The log says "Added optimization in SetCoord to not set inherit value if value can be computed locally". I think that Peter knew what he was doing when using the parent's value to compute the inherited value and I concur with David that it is the way it should work. Marking fixed.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Status: REOPENED → ASSIGNED
Re-opening bug and assigning to Troy. At the W3C meeting last week it was agreed that David is correct and that 'width' and 'height' should inherit from the parent and not the containing block. No one was thrilled with this, but it was consistent with the way 'inherit' works for every ither property The change Pierre mentions may fix some of the cases, but there's still the case where the value is still 'inherit' and the HTML reflow state code has to compute it. That code is still using the containing block's computed values which is wrong
Assignee: pierre → troy
Status: ASSIGNED → NEW
Status: NEW → ASSIGNED
Keywords: css2
Migrating from {css2} to css2 keyword. The {css1}, {css2}, {css3} and {css-moz} radars should now be considered deprecated in favour of keywords. I am *really* sorry about the spam...
Summary: {css2} inherit on w/h on abs pos elements → inherit on w/h on abs pos elements
Target Milestone: M15 → M17
This is now fixed, and as agreed at the W3C CSS WG meeting a value of 'inherit' for 'width' or 'height' inherits the value from the content parent and not from the absolute containing block
Status: ASSIGNED → RESOLVED
Closed: 25 years ago25 years ago
Resolution: --- → FIXED
Fixed in the July 14th build.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.