<?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>139750</bug_id>
          
          <creation_ts>2014-12-17 15:04:33 -0800</creation_ts>
          <short_desc>Web Inspector: show user agent style properties as shorthand if it looks better than longhand</short_desc>
          <delta_ts>2026-01-12 09:02:40 -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>Web Inspector</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Joseph Pecoraro">joepeck</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bburg</cc>
    
    <cc>graouts</cc>
    
    <cc>inspector-bugzilla-changes</cc>
    
    <cc>jonowells</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1056557</commentid>
    <comment_count>0</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2014-12-17 15:04:33 -0800</bug_when>
    <thetext>* SUMMARY
&lt;body&gt; shows unexpected UserAgent margin styles (one non-implicit, others implicit). I would expect them all to be the same, the reason User Agent stylesheet says &quot;margin: 8px&quot;.

* STEPS TO REPRODUCE
1. Inspect &lt;body&gt; in data:text/html,&lt;body&gt;
2. Show Rules in Styles details sidebar
  =&gt; &quot;margin&quot; values shown in unexpected way

* ACTUAL RESULTS:
display: block;     /* non-implicit */
margin-top: 8px;    /* non-implicit */
margin-right: 8px;  /* implicit */
margin-bottom: 8px; /* implicit */
margin-left: 8px;   /* implicit */

* EXPECTED RESULTS:
display: block;     /* non-implicit */
margin: 8px;        /* non-implicit */</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1056558</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2014-12-17 15:04:49 -0800</bug_when>
    <thetext>&lt;rdar://problem/19285473&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1056563</commentid>
    <comment_count>2</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2014-12-17 15:19:46 -0800</bug_when>
    <thetext>Looks like an issue with the backend reply for CSS.getMatchedStylesForNode dealing with shorthanded entries. For &quot;margin: 8px&quot; it sends some of the long-hands as implicit.

frontend: {
    &quot;method&quot;: &quot;CSS.getMatchedStylesForNode&quot;,
    &quot;params&quot;: {
        &quot;nodeId&quot;: 8,
        &quot;includePseudo&quot;: true,
        &quot;includeInherited&quot;: true
    },
    &quot;id&quot;: 52
}

backend: {
    &quot;result&quot;: {
        &quot;matchedCSSRules&quot;: [{
            &quot;rule&quot;: {
                &quot;selectorList&quot;: {
                    &quot;selectors&quot;: [{
                        &quot;text&quot;: &quot;body&quot;,
                        &quot;specificity&quot;: [0, 0, 1]
                    }],
                    &quot;text&quot;: &quot;body&quot;
                },
                &quot;sourceLine&quot;: 0,
                &quot;origin&quot;: &quot;user-agent&quot;,
                &quot;style&quot;: {
                    &quot;cssProperties&quot;: [{
                        &quot;name&quot;: &quot;display&quot;,
                        &quot;value&quot;: &quot;block&quot;
                    }, {
                        &quot;name&quot;: &quot;margin-top&quot;,
                        &quot;value&quot;: &quot;8px&quot;
                    }, {
                        &quot;name&quot;: &quot;margin-right&quot;,
                        &quot;value&quot;: &quot;8px&quot;,
                        &quot;implicit&quot;: true
                    }, {
                        &quot;name&quot;: &quot;margin-bottom&quot;,
                        &quot;value&quot;: &quot;8px&quot;,
                        &quot;implicit&quot;: true
                    }, {
                        &quot;name&quot;: &quot;margin-left&quot;,
                        &quot;value&quot;: &quot;8px&quot;,
                        &quot;implicit&quot;: true
                    }],
                    &quot;shorthandEntries&quot;: [{
                        &quot;name&quot;: &quot;margin&quot;,
                        &quot;value&quot;: &quot;8px&quot;
                    }],
                    &quot;styleId&quot;: {
                        &quot;styleSheetId&quot;: &quot;4&quot;,
                        &quot;ordinal&quot;: 2
                    },
                    &quot;width&quot;: &quot;&quot;,
                    &quot;height&quot;: &quot;&quot;
                }
            },
            &quot;matchingSelectors&quot;: [0]
        }],
        ...
    },
    &quot;id&quot;: 52
}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1059197</commentid>
    <comment_count>3</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2015-01-06 15:55:59 -0800</bug_when>
    <thetext>This is especially ugly for something like &lt;textarea&gt;!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1059202</commentid>
    <comment_count>4</comment_count>
    <who name="Timothy Hatcher">timothy</who>
    <bug_when>2015-01-06 16:04:33 -0800</bug_when>
    <thetext>I agree we should just show margin: 8px here. We don&apos;t need to show the long-hands.

The backend reporting &quot;implicit&quot; is correct here. The only value specified specifically is margin-top. The rest are implied from that one value.

For example: margin: 8px 4px; would yield margin-top and margin-right with 8px and 4px, and the margin-bottom and margin-left would be implicit.

What use to do was show the shorthand, with the long-hands expandable under it. I&apos;m not sure we should do that again, and just show the shorthand by itself.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1059208</commentid>
    <comment_count>5</comment_count>
    <who name="Timothy Hatcher">timothy</who>
    <bug_when>2015-01-06 16:11:33 -0800</bug_when>
    <thetext>We don&apos;t have the original source for the user agent rules, which causes us to synthesize the source.

We just need to be smarter and the long-hands that are covered by the shorthandEntries list when synthesizing the source.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1059222</commentid>
    <comment_count>6</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2015-01-06 16:32:21 -0800</bug_when>
    <thetext>(In reply to comment #4)
&gt; The backend reporting &quot;implicit&quot; is correct here. The only value specified
&gt; specifically is margin-top. The rest are implied from that one value.

I don&apos;t think that is true. The User-Agent styles are:

    /* Source/WebCore/css/html.css */
    body {
        display: block;
        margin: 8px
    }

margin-top is no more specified then margin-left or the others. In my opinion they should either all be implicit or not.

I guess I don&apos;t understand why WebKit says otherwise:

    var list = document.defaultView.getMatchedCSSRules(document.body);
    var rule = list[2];
    var decl = rule.style;
    rule.cssText; // &quot;body { font-family: Verdana, Arial, Helvetica; font-size: 12px; padding: 0px 5px; margin: 0px; }&quot;
    decl.isPropertyImplicit(&quot;margin&quot;); // false
    decl.isPropertyImplicit(&quot;margin-top&quot;) // false
    decl.isPropertyImplicit(&quot;margin-left&quot;) // true
    decl.isPropertyImplicit(&quot;margin-right&quot;) // true
    decl.isPropertyImplicit(&quot;margin-bottom&quot;) // true

I guess I don&apos;t actually know why something is considered implicit, or there is a bug.


&gt; For example: margin: 8px 4px; would yield margin-top and margin-right with
&gt; 8px and 4px, and the margin-bottom and margin-left would be implicit.
&gt; 
&gt; What use to do was show the shorthand, with the long-hands expandable under
&gt; it. I&apos;m not sure we should do that again, and just show the shorthand by
&gt; itself.

I agree with just showing the shorthand.

--

Here is an interesting case. Is there ever a case with ambiguity like this?

    div {
        margin: 5px;
        margin-right: 10px;
    }

If there is a case like this in non-author styles, I think we should be unambiguous, and probably list everything.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1059228</commentid>
    <comment_count>7</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2015-01-06 16:49:31 -0800</bug_when>
    <thetext>After chatting with Timothy Hatcher on IRC.

Implicit properties are ones not present in the shorthand. e.g. in &quot;margin: 5px&quot; only &quot;top&quot; is present and the rest are implicit, whereas in &quot;margin: 5px 5px 5px 5px&quot; they are all present.

In that case, there are a few changes here.

- I don&apos;t think showing transparent &quot;implicit&quot; values is useful data in the &quot;Rules&quot; section of the Styles sidebar. We should drop that.

- We should show the best user visible string to the user
  - if a longhand value is overridden by author styles, show all longhand values to show exactly what is overridden
  - otherwise, it is safe to show the shorthand, but perhaps only show shorthands for simple properties like &quot;margin/padding&quot;, not &quot;font/background&quot; which are more complicated for developers to remember exactly what it set

See related:
&lt;https://webkit.org/b/140154&gt; Web Inspector: Expected UserAgent styles to be crossed-out if overridden</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1059258</commentid>
    <comment_count>8</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2015-01-06 18:12:35 -0800</bug_when>
    <thetext>Addressing transparency with:
&lt;https://webkit.org/b/140161&gt; Web Inspector: Do not style implicit CSS properties in the Style Rules section

Leaving this open to handle the actual logic for shorthand vs longhand.

Also, it appears we are over-loading the term &quot;implicit&quot;, which makes this even more confusing, but that is also a separate issue.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>