Summary: | offsetTop/offsetLeft for elements with "position:fixed" set is affected by the page scrolling offsets | ||
---|---|---|---|
Product: | [Applications] konqueror | Reporter: | Vasil Dinkov <vasko_dinkov> |
Component: | kjs | Assignee: | Konqueror Developers <konq-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | germain, vasko_dinkov |
Priority: | NOR | ||
Version: | 4.2.1 | ||
Target Milestone: | --- | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Vasil Dinkov
2009-03-21 13:09:08 UTC
well, I implemented the draft specification, http://www.w3.org/TR/cssom-view/#offset-attributes so unless there's a mistake in the specification, that's how it's going to behave from now on.. "The offsetTop attribute, when called on element A, must return the value that is the result of the following algorithm: [...] If the offsetParent of element A is null or the HTML body element return the distance, as number of CSS pixels, between the top border edge of element A and the canvas origin and stop this algorithm." offsetParent is indeed null for fixed position elements: "The offsetParent attribute, when called on element A, must return the element determined by the following algorithm: If any of the following holds true return null and stop this algorithm: [...] The computed value of the position property for element A is fixed. " I could raise this point on w3c lists I suppose. Hmm, you are right that it's currently working according to this draft specification.
> I could raise this point on w3c lists I suppose.
Since it is working the opposite way in all other browsers (and has been working like that for years), I guess it's really worth it raising the question on the W3C lists.
hmm, actually the in-progress draft of CSSOM-view doesn't contain the 'canvas origin' wording anymore, rather returns the x/y-coordinate of the element (i.e. within the containing block) which is consistent with the legacy behaviour - so that was probably an oversight. http://dev.w3.org/csswg/cssom-view/#offset-attributes will fix shortly. SVN commit 944736 by ggarand: adapt to correction in draft cssom-view specification. position:fixed objects where returning an offsetLeft/Top relative to the canvas origin instead of relative to their pseudo containing-block - the viewport. BUG: 187787 M +4 -9 render_object.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=944736 SVN commit 944740 by ggarand: I'll special case 'position:fixed' elements after all, otherwise the computation for other positioned elements isn't compatible with Gecko. Better safe than sorry. CCBUG: 187787 M +16 -4 render_object.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=944740 SVN commit 944743 by ggarand: automatically merged revision 944736: adapt to correction in draft cssom-view specification. position:fixed objects where returning an offsetLeft/Top relative to the canvas origin instead of relative to their pseudo containing-block - the viewport. BUG: 187787 M +4 -9 render_object.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=944743 SVN commit 944744 by ggarand: automatically merged revision 944740: I'll special case 'position:fixed' elements after all, otherwise the computation for other positioned elements isn't compatible with Gecko. Better safe than sorry. CCBUG: 187787 M +16 -4 render_object.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=944744 |