<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>19828</bug_id>
          
          <creation_ts>2008-06-30 11:17:51 -0700</creation_ts>
          <short_desc>Computed style for margin right is incorrect.</short_desc>
          <delta_ts>2009-03-02 15:42:23 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows XP</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>HasReduction</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Erik Arvidsson">erik.arvidsson</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>Humberto.Madeira</cc>
    
    <cc>pbakaus</cc>
    
    <cc>webkit</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>84760</commentid>
    <comment_count>0</comment_count>
    <who name="Erik Arvidsson">erik.arvidsson</who>
    <bug_when>2008-06-30 11:17:51 -0700</bug_when>
    <thetext>The computed style value for margin right is not correct and it does not match Firefox nor Opera.

el.style.marginRight = &apos;10px&apos;;
document.defaultView.getComputedStyle(el, &apos;&apos;).marginRight // != 10px

The value returned seems to be related to the computed distance between the offsetParent right edge and the right border of the element.  However it is not equal to:

el.offsetParent.clientWidth - el.offsetLeft - el.offsetWidth

Test case coming.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84761</commentid>
    <comment_count>1</comment_count>
      <attachid>22008</attachid>
    <who name="Erik Arvidsson">erik.arvidsson</who>
    <bug_when>2008-06-30 11:19:01 -0700</bug_when>
    <thetext>Created attachment 22008
The computed margin should be 10px

Sometimes a reload is required to get the faulty margin value.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99931</commentid>
    <comment_count>2</comment_count>
    <who name="Paul Bakaus">pbakaus</who>
    <bug_when>2008-11-24 03:12:28 -0800</bug_when>
    <thetext>I can confirm this for all platforms. Additionally, this only happens if margin right is set through stylesheets - if set using inline styles, the correct value is reported.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104557</commentid>
    <comment_count>3</comment_count>
    <who name="Robert Blaut">webkit</who>
    <bug_when>2009-01-06 05:09:40 -0800</bug_when>
    <thetext>CSS 2.1 specification says: &quot;The following constraints must hold among the used values of the other properties:
&apos;margin-left&apos; + &apos;border-left-width&apos; + &apos;padding-left&apos; + &apos;width&apos; + &apos;padding-right&apos; + &apos;border-right-width&apos; + &apos;margin-right&apos; + scrollbar width (if any) = width of containing block&quot;

[...]

If all of the above have a computed value other than &apos;auto&apos;, the values are said to be &quot;over-constrained&quot; and one of the used values will have to be different from its computed value. If the &apos;direction&apos; property of the containing block has the value &apos;ltr&apos;, the specified value of &apos;margin-right&apos; is ignored and the value is calculated so as to make the equality true. If the value of &apos;direction&apos; is &apos;rtl&apos;, this happens to &apos;margin-left&apos; instead.&quot;

&lt;http://www.w3.org/TR/CSS21/visudet.html#blockwidth&gt;

In my opinion WebKit correctly prints other than 10px *computed* value. Firefox is wrong in this case. 

Check attached test case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104558</commentid>
    <comment_count>4</comment_count>
      <attachid>26458</attachid>
    <who name="Robert Blaut">webkit</who>
    <bug_when>2009-01-06 05:10:01 -0800</bug_when>
    <thetext>Created attachment 26458
test case</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104559</commentid>
    <comment_count>5</comment_count>
    <who name="Robert Blaut">webkit</who>
    <bug_when>2009-01-06 05:11:24 -0800</bug_when>
    <thetext>This bug report is invalid.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111914</commentid>
    <comment_count>6</comment_count>
    <who name="Humberto Madeira">Humberto.Madeira</who>
    <bug_when>2009-03-02 15:42:23 -0800</bug_when>
    <thetext>I believe this bug was rejected because the specification is being misread. 

The specification speaks of &quot;computed values&quot; and &quot;used values&quot; as being distinct from each other. 

e.g. in section 10.3
 &quot;(The value used for layout is sometimes referred to as the used value.) In principle, the values used are the same as the computed values, with &apos;auto&apos; replaced by some suitable value, and percentages calculated based on the containing block, but there are exceptions.&quot;

With respect to the constraints, they refer to the &quot;used values&quot; and not the computed values.

e.g. in section 10.3.3 
&quot;The following constraints must hold among the used values of the other properties:

&apos;margin-left&apos; + &apos;border-left-width&apos; + &apos;padding-left&apos; + &apos;width&apos; + &apos;padding-right&apos; + &apos;border-right-width&apos; + &apos;margin-right&apos; + scrollbar width (if any) = width of containing block&quot;

So according to the specification, the computed values are under no constraints of any sort other than the usual CSS precedence rules.  It is the &quot;used values&quot;, which are used for layout purposes, that are constrained.

I believe, after a closer look at the specification, that this bug is actually valid.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>22008</attachid>
            <date>2008-06-30 11:19:01 -0700</date>
            <delta_ts>2008-06-30 11:19:01 -0700</delta_ts>
            <desc>The computed margin should be 10px</desc>
            <filename>temp3.html</filename>
            <type>text/html</type>
            <size>384</size>
            <attacher name="Erik Arvidsson">erik.arvidsson</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8aGVhZD4KPHRpdGxlPjwvdGl0bGU+CjxzdHlsZT4KCiN0
ZXN0IHsKICBiYWNrZ3JvdW5kOiByZWQ7CiAgd2lkdGg6IDEwZW07CiAgbWFyZ2luOiAxMHB4Owp9
Cgo8L3N0eWxlPgo8L2hlYWQ+Cjxib2R5PgoKPGRpdiBpZD0idGVzdCI+SGk8L2Rpdj4KPGRpdiBp
ZD0ib3V0Ij48L2Rpdj4KCjxzY3JpcHQ+Cgp2YXIgZWwgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJ
ZCgndGVzdCcpOwp2YXIgb3V0ID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ291dCcpOwpvdXQu
aW5uZXJIVE1MID0gZG9jdW1lbnQuZGVmYXVsdFZpZXcuZ2V0Q29tcHV0ZWRTdHlsZShlbCwgJycp
Lm1hcmdpblJpZ2h0OwoKPC9zY3JpcHQ+Cgo8L2JvZHk+CjwvaHRtbD4K
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>26458</attachid>
            <date>2009-01-06 05:10:01 -0800</date>
            <delta_ts>2009-01-06 05:10:01 -0800</delta_ts>
            <desc>test case</desc>
            <filename>test-page.html</filename>
            <type>text/html</type>
            <size>841</size>
            <attacher name="Robert Blaut">webkit</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8aGVhZD4KPHRpdGxlPjwvdGl0bGU+CjxzdHlsZT4KCiN0
ZXN0IHsKICBiYWNrZ3JvdW5kOiByZWQ7CiAgd2lkdGg6IDUwcHg7CiAgbWFyZ2luOiAxMHB4Owog
Ym9yZGVyOiAwOwpwYWRkaW5nOjA7Cn0KCiNjb250IHtib3JkZXI6IDA7CnBhZGRpbmc6MDsKd2lk
dGg6MTAwcHg7CmJhY2tncm91bmQtY29sb3I6IGJsdWU7fQo8L3N0eWxlPgo8L2hlYWQ+Cjxib2R5
PgoKPGRpdiBpZD0iY29udCI+PGRpdiBpZD0idGVzdCI+SGk8L2Rpdj48L2Rpdj4KPGRpdiBpZD0i
b3V0Ij48L2Rpdj4KPHA+J21hcmdpbi1sZWZ0JyArICdib3JkZXItbGVmdC13aWR0aCcgKyAncGFk
ZGluZy1sZWZ0JyArICd3aWR0aCcgKyAncGFkZGluZ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