Bug 15539 - border is not taken in account with offsetLeft/Top in border-box mode
Summary: border is not taken in account with offsetLeft/Top in border-box mode
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 523.x (Safari 3)
Hardware: Mac (Intel) OS X 10.4
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-17 05:29 PDT by Marcus Better
Modified: 2021-09-09 07:06 PDT (History)
1 user (show)

See Also:


Attachments
Test case (2.15 KB, text/html)
2007-10-17 05:32 PDT, Marcus Better
no flags Details
The result on Firefox 2.0.0.7 (26.25 KB, image/png)
2007-10-17 05:34 PDT, Marcus Better
no flags Details
The result on WebKit r26570 (54.04 KB, image/png)
2007-10-17 05:38 PDT, Marcus Better
no flags Details
Corrected test case (2.15 KB, text/html)
2007-10-17 07:09 PDT, Marcus Better
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marcus Better 2007-10-17 05:29:54 PDT
Bug #14722 notes that WebKit does not include the border of the offsetParent in the offsetLeft/Top values for an element, in order to imitate Mozilla's behaviour. However there is one case where Mozilla does include the border (and WebKit doesn't), and that is when the parent element has -moz-box-sizing border-box. WebKit should do this too if it wants to follow Mozilla.
Comment 1 Marcus Better 2007-10-17 05:32:31 PDT
Created attachment 16699 [details]
Test case

The test case checks the offsetLeft/Top of a div whose parent has box-sizing set to border-box.
Comment 2 Marcus Better 2007-10-17 05:34:33 PDT
Created attachment 16700 [details]
The result on Firefox 2.0.0.7

This shows that the border of div1 is included in offsetLeft/Top.
Comment 3 Marcus Better 2007-10-17 05:38:15 PDT
Created attachment 16701 [details]
The result on WebKit r26570

This shows that WebKit does not include the border of div1 in the offsetLeft/Top.
Comment 4 Marcus Better 2007-10-17 07:09:13 PDT
Created attachment 16705 [details]
Corrected test case

There was a minor bug in the test case that doesn't affect the results.
Comment 5 Dave Hyatt 2007-10-17 11:47:30 PDT
I see no reason why box-sizing should affect the values returned by offsetLeft/Top.  This sounds like a bug in Mozilla to me.


Comment 6 Marcus Better 2007-10-18 01:02:58 PDT
(In reply to comment #5)
> I see no reason why box-sizing should affect the values returned by
> offsetLeft/Top.  This sounds like a bug in Mozilla to me.

Could be. Internet Explorer 7 behaves like WebKit here. I'll see if I can find more information.
Comment 7 Marcus Better 2007-10-18 02:38:44 PDT
Filed a bug for Mozilla: https://bugzilla.mozilla.org/show_bug.cgi?id=400258
Comment 8 Martin Robinson 2021-09-09 07:06:37 PDT
The behavior in Firefox, Chromium, and WebKit all match now. The Gecko bug was fixed. I think we can close this.