Closed
Bug 94855
Opened 23 years ago
Closed 23 years ago
getComputedStyle; absolute and relative positioned elements
Categories
(Core :: DOM: CSS Object Model, defect)
Core
DOM: CSS Object Model
Tracking
()
RESOLVED
FIXED
mozilla0.9.7
People
(Reporter: andorxor, Assigned: bzbarsky)
References
(Depends on 1 open bug)
Details
Attachments
(1 file)
1.84 KB,
text/html
|
Details |
I think the behaviour of Mozilla's implementation of DOM2's getComputedStyle is inconsistent. Look at bug #93437 to read about the intended behaviour of getComputedStyle. Presuming the following pseudo document: <div id="layer1" style="position: absolute;"> layer 1 <div id="layer2" style="position: see below;">layer 2</div> </div> getComputedStyle will return the following values for layer2's "top" property: - position set to "absolute": "top" relative to the containing block, ie. "top" relative to layer1 - position set to "relative" or position set to "static": "top" relative to the viewport If the position is set to "relative" shouldn't getComputedStyle return zero? If the position is set to "relative" shouldn't getComputedStyle return "top" relative to where it would be if statically positioned? Does the specified behaviour allow to findout the relative position of a statically positioned element with respect to its containing block not using proprietary offsetLeft/Top properties)? [Missing feature?]
Reporter | ||
Comment 1•23 years ago
|
||
Comment 2•23 years ago
|
||
The computed value of 'top' for 'layer2' in the example quoted inline above should be the distance from the top of 'layer2' when 'position' is 'absolute', '0' when 'position' is 'relative', and 'auto' if 'position' is 'static' (since if 'position' is 'static' then there is no computation to complete for 'top').
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee | ||
Comment 3•23 years ago
|
||
I'll take this; working on this stuff right now.
Assignee: jst → bzbarsky
Assignee | ||
Comment 4•23 years ago
|
||
OK. I've got some thoughts on a partial fix. It will not be completely correct. To be precise, we will return incorrect values when auto margins/padding are involved. Fixing that would require hooks into layout which is bug 106154. Other than that we should be able to get decent computed values. ETA a few weeks, I would say.
Hooks into layout? I want to move nsComputedDOMStyle back into layout one of these days...
Assignee | ||
Comment 6•23 years ago
|
||
That would be awesome. That's by far the most logical place for it to live given the sort of things it needs access to. As it is, I'll just be doing my own calculations for percentages, I guess. And fixing logic errors like bug 84599, of course.
Assignee | ||
Comment 7•23 years ago
|
||
Fixed with checkin for bug 84599. Follow-up bug 109253 filed on coming up with a spec and implementation of positioning properties for statically positioned elements.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•