Bug 19149

Summary: A position fixed node's offsetParent should return null
Product: WebKit Reporter: Gérard Talbot <browserbugs2>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: hyatt, pennig, rik
Priority: P2 Keywords: InRadar
Version: 525.x (Safari 3.1)   
Hardware: PC   
OS: Windows XP   
URL: http://www.gtalbot.org/BrowserBugsSection/MSIE8Bugs/CSSOM-offsetParent-prop.html#ThirdTest
Attachments:
Description Flags
Fix for offsetParent, offsetTop, and offsetLeft
pennig: review-
Fix for offsetParent, offsetTop, and offsetLeft pennig: review-

Description Gérard Talbot 2008-05-20 12:11:22 PDT
CSSOM View Module, offsetParent attribute clearly states that 
offsetParent of nodeA when nodeA is a position: fixed element should return
null.

"
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. 
"
http://www.w3.org/TR/cssom-view/#offset-attributes

Steps to reproduce:
1- Load provided URL
2- Click the [return document.getElementById("PositionFixedElem").offsetParent]
button

Actual results in Safari 3.1.1 build 525.17.0 under XP Pro SP3:
document.getElementById("PositionFixedElem").offsetParent = [object
HTMLBodyElement]

Expected results:
document.getElementById("PositionFixedElem").offsetParent = null

Notes:
- Internet Explorer 7, Internet Explorer 8 beta 1 and Opera 9.50 will return
null.
- I have filed a similar bug at
https://bugzilla.mozilla.org/show_bug.cgi?id=434678

I have searched for a duplicate and did not find one. 
I have not checked the testcase with a webkit trunk nightly build (526+).
Comment 1 steven.moore 2009-01-14 10:48:43 PST
I'm seeing this too. WebKit nightly from 13 Jan 2009, OS X 10.5.6.
Comment 2 Matt Pennig 2009-01-15 07:44:24 PST
<rdar://problem/6497927>
Comment 3 Matt Pennig 2009-01-17 17:08:35 PST
Created attachment 26829 [details]
Fix for offsetParent, offsetTop, and offsetLeft
Comment 4 Matt Pennig 2009-01-18 09:47:46 PST
Created attachment 26834 [details]
Fix for offsetParent, offsetTop, and offsetLeft
Comment 5 Anthony Ricaud 2009-02-23 14:26:10 PST
The testcase is working on my nightly (r41121). I've bisected it between r40738 and r40771. http://trac.webkit.org/changeset/40769 may be the revision responsible (I don't understand the patch but it has offsetParent in the summary).

Bug 24097 was fixed as a regression because of this change. One of them is therefore invalid.
Comment 6 Matt Pennig 2009-02-27 12:05:47 PST
This bug was fixed in changeset http://trac.webkit.org/changeset/40769 but there were no tests to make sure that offsetParent of a fixed element was null. Bug 24107 fixes a related issue caused by the above changeset. In the included patch, there are a number of tests which have coverage on this bug.
Comment 7 Gérard Talbot 2009-06-14 11:56:51 PDT
When I try the provided testcase with latest stable release Safari 4.0 build 530.17, I get expected results.

Resolving as FIXED

Thank you Matt!

regards, Gérard