[Webkit-unassigned] [Bug 24511] New: Computed style margins calculated incorrectly for sized elements.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Mar 11 04:54:47 PDT 2009


           Summary: Computed style margins calculated incorrectly for sized
           Product: WebKit
           Version: 420+
          Platform: PC
        OS/Version: Mac OS X 10.5
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: HTML DOM
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: nigelw at forwardcomputers.co.uk

This affects Safari 4 beta, and Chrome 0.4

When an element is explicitly sized within another sized element, so that there
is empty space to its right, the *computed style* returned for the inner
element's margin-right value is the width of that empty space.

This is not correct. That's just empty space.

To illustrate, I have included a very simple  test page.

It uses the ExtJs library just as a vehicle to get the computed style. It has
an Element class which encapsulates a DOM element, and this offers a getMargins
method which requests the *computed" style for the element.

To run this example, download the ExtJs SDK. Drop this page into examples/<any

On Webkit based browsers, the red DIV reports its left+right margin total to be

On Firefox, it is correctly reported as zero.

<title>Margin bug</title>
<script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../../ext-all.js"></script>
<script type="text/javascript">
Ext.onReady(function() {
        var inner = Ext.get("inner");
        var m = inner.getMargins('lr');
        inner.update('My left+right margins are ' + m);
<div id="outer" style="height:300px;width:500px;border:1px solid black">
        <div id="inner" style="height:200px;width:200px;background-color:red">

Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

More information about the webkit-unassigned mailing list