Bug 187787 - offsetTop/offsetLeft for elements with "position:fixed" set is affected by the page scrolling offsets
Summary: offsetTop/offsetLeft for elements with "position:fixed" set is affected by th...
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: kjs (show other bugs)
Version: 4.2.1
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-21 13:09 UTC by Vasil Dinkov
Modified: 2009-03-26 02:24 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vasil Dinkov 2009-03-21 13:09:08 UTC
Version:            (using KDE 4.2.1)
OS:                Linux
Installed from:    Ubuntu Packages

I must say I am not sure if this is startards-compliant behavior or not but all other browsers (including Konqueror 3.5.x) behave the opposite way (i.e. for fixed positioned elements offsetTop/offsetLeft are not affected when the page is scrolled) so I suppose this is in fact a bug.

Testcase:

http://www.smartmenus.org/down/konqueror/bugs/position-fixed-offsetTop-offsetLeft-page-scrolling-offsets.html
Comment 1 Germain Garand 2009-03-21 15:06:34 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.
Comment 2 Vasil Dinkov 2009-03-23 00:12:10 UTC
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.
Comment 3 Germain Garand 2009-03-24 03:37:12 UTC
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.
Comment 4 Germain Garand 2009-03-26 02:07:10 UTC
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
Comment 5 Germain Garand 2009-03-26 02:07:36 UTC
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
Comment 6 Germain Garand 2009-03-26 02:21:39 UTC
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
Comment 7 Germain Garand 2009-03-26 02:24:42 UTC
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