WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
15880
computed style height and width reflect border box dimensions
https://bugs.webkit.org/show_bug.cgi?id=15880
Summary
computed style height and width reflect border box dimensions
Marcus Better
Reported
2007-11-07 01:44:17 PST
In border-box mode, the computed height and width attributes give the border-box dimensions. This is contrary to Firefox which returns the content-box dimensions. I leave it to you to decide which is correct.
Attachments
Test case
(871 bytes, text/html)
2007-11-07 01:46 PST
,
Marcus Better
no flags
Details
Result with WebKit r27433
(16.04 KB, image/png)
2007-11-07 01:51 PST
,
Marcus Better
no flags
Details
Result with Firefox 2.0.0.9
(19.73 KB, image/png)
2007-11-07 01:52 PST
,
Marcus Better
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Marcus Better
Comment 1
2007-11-07 01:46:36 PST
Created
attachment 17103
[details]
Test case The test case shows the width and height properties of the computed style. You can also check this with the Web Inspector. An interesting detail is that the Web Inspector gets confused: If you inspect the square DIV in the test case and look at the "Metrics" pane, it will show the box as if its contents were 50x50, excluding borders and padding. This is incorrect because the border-box is in fact 50x50 (as it should be).
Marcus Better
Comment 2
2007-11-07 01:51:45 PST
Created
attachment 17104
[details]
Result with WebKit
r27433
Marcus Better
Comment 3
2007-11-07 01:52:06 PST
Created
attachment 17105
[details]
Result with Firefox 2.0.0.9
Robert Blaut
Comment 4
2008-02-14 05:55:11 PST
Opera behaves identically as Webkit.
Shane Stephens
Comment 5
2011-06-15 20:34:58 PDT
I *think* WebKit gets this right, and Firefox wrong, as by using getComputedStyle you're dumping the CSS-specified values directly and not a derived value. However I'm not sufficiently sure to close this bug, so I'll email www-style to ask for an answer as to which is the correct behaviour. Regardless of the answer to this, the inspector's behavior is clearly incorrect and should have a bug filed against it.
Tab Atkins
Comment 6
2011-10-19 21:08:22 PDT
Firefox is wrong. When "box-sizing:border-box" is set, the 'width' and 'height' properties control the size of the border box, not the content box. Thus, our behavior (of returning the size of the border box) is correct.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug