<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[175483] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/175483">175483</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-11-03 12:03:57 -0800 (Mon, 03 Nov 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: Show Selector's Specificity
https://bugs.webkit.org/show_bug.cgi?id=138189

Patch by Joseph Pecoraro &lt;pecoraro@apple.com&gt; on 2014-11-03
Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

* inspector/protocol/CSS.json:
Create a new named type CSSSelector to include a selector's text and specificity.
The specificity tuple is optional as it may soon be made dynamic in some cases.

Source/WebCore:

Test: inspector/css/selector-specificity.html

* css/CSSSelector.h:
Remove very stale comment. '*' is a starAtom now instead of a special -1 tag.
Made the specificity masks public class constants.

* inspector/InspectorStyleSheet.h:
* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyle::buildArrayForComputedStyle):
(WebCore::InspectorStyle::styleWithProperties):
(WebCore::InspectorStyleSheet::buildObjectForStyleSheetInfo):
Drive by use release() in some cases to reduce ref count churn.

(WebCore::buildObjectForSelectorHelper):
(WebCore::selectorsFromSource):
(WebCore::InspectorStyleSheet::buildObjectForSelector):
(WebCore::InspectorStyleSheet::buildObjectForSelectorList):
Build CSSSelector objects for SelectorLists.

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Main.html:
* UserInterface/Test.html:
Add new files and strings.

* UserInterface/Models/CSSMedia.js:
Constructor functions are not needed, remove unnecessary code.

* UserInterface/Models/CSSRule.js:
(WebInspector.CSSRule.prototype.set selectors): Deleted.
This was unused and is no longer correct.

(WebInspector.CSSRule.prototype.get matchedSelectorText):
Update now that selectors are a list of objects, not just strings.

* UserInterface/Models/CSSSelector.js:
(WebInspector.CSSSelector):
(WebInspector.CSSSelector.prototype.get specificity):
New model object for protocol type CSS.CSSSelector.

* UserInterface/Models/DOMNodeStyles.js:
(WebInspector.DOMNodeStyles.prototype._parseSelectorListPayload.return):
(WebInspector.DOMNodeStyles.prototype._parseSelectorListPayload):
(WebInspector.DOMNodeStyles.prototype._parseRulePayload):
Handle parsing old and new SelectorLists.

* UserInterface/Views/CSSStyleDeclarationSection.js:
(WebInspector.CSSStyleDeclarationSection.prototype.refresh.appendSelector):
(WebInspector.CSSStyleDeclarationSection.prototype.refresh.appendSelectorText):
(WebInspector.CSSStyleDeclarationSection.prototype.refresh):
Update the code now that the list of selectors are model objects instead
of just selector text strings.

LayoutTests:

* inspector/css/matched-style-properties.html:
* inspector/css/selector-specificity-expected.txt: Added.
* inspector/css/selector-specificity.html: Copied from LayoutTests/inspector/css/matched-style-properties.html.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsinspectorcssmatchedstylepropertieshtml">trunk/LayoutTests/inspector/css/matched-style-properties.html</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorprotocolCSSjson">trunk/Source/JavaScriptCore/inspector/protocol/CSS.json</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSSelectorcpp">trunk/Source/WebCore/css/CSSSelector.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSSelectorh">trunk/Source/WebCore/css/CSSSelector.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorStyleSheetcpp">trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorStyleSheeth">trunk/Source/WebCore/inspector/InspectorStyleSheet.h</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs">trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceMainhtml">trunk/Source/WebInspectorUI/UserInterface/Main.html</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsCSSMediajs">trunk/Source/WebInspectorUI/UserInterface/Models/CSSMedia.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsCSSRulejs">trunk/Source/WebInspectorUI/UserInterface/Models/CSSRule.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsDOMNodeStylesjs">trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTesthtml">trunk/Source/WebInspectorUI/UserInterface/Test.html</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsCSSStyleDeclarationSectionjs">trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsinspectorcssselectorspecificityexpectedtxt">trunk/LayoutTests/inspector/css/selector-specificity-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorcssselectorspecificityhtml">trunk/LayoutTests/inspector/css/selector-specificity.html</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsCSSSelectorjs">trunk/Source/WebInspectorUI/UserInterface/Models/CSSSelector.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (175482 => 175483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-11-03 19:59:44 UTC (rev 175482)
+++ trunk/LayoutTests/ChangeLog        2014-11-03 20:03:57 UTC (rev 175483)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2014-11-03  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: Show Selector's Specificity
+        https://bugs.webkit.org/show_bug.cgi?id=138189
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/css/matched-style-properties.html:
+        * inspector/css/selector-specificity-expected.txt: Added.
+        * inspector/css/selector-specificity.html: Copied from LayoutTests/inspector/css/matched-style-properties.html.
+
</ins><span class="cx"> 2014-11-03  Lorenzo Tilve  &lt;ltilve@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Unreviewed gardening. Rebaseline after r175259.
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorcssmatchedstylepropertieshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/css/matched-style-properties.html (175482 => 175483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/css/matched-style-properties.html        2014-11-03 19:59:44 UTC (rev 175482)
+++ trunk/LayoutTests/inspector/css/matched-style-properties.html        2014-11-03 20:03:57 UTC (rev 175483)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx">     {
</span><span class="cx">         for (var i = 0; i &lt; nodeStyles.matchedRules.length; ++i) {
</span><span class="cx">             var rule = nodeStyles.matchedRules[i];
</span><del>-            if (rule.type != WebInspector.CSSRule.Type.Author)
</del><ins>+            if (rule.type !== WebInspector.CSSRule.Type.Author)
</ins><span class="cx">                 continue;
</span><span class="cx"> 
</span><span class="cx">             for (var j = 0; j &lt; rule.style.properties.length; ++j) {
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorcssselectorspecificityexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/css/selector-specificity-expected.txt (0 => 175483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/css/selector-specificity-expected.txt                                (rev 0)
+++ trunk/LayoutTests/inspector/css/selector-specificity-expected.txt        2014-11-03 20:03:57 UTC (rev 175483)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+Testing that selectors have expected specificity values.
+
+* (0, 0, 0)
+h1 (0, 0, 1)
+.class (0, 1, 0)
+#id (1, 0, 0)
+body h1.class-one.class-two (0, 2, 2)
+body #foo (1, 0, 1)
+body &gt; #foo (1, 0, 1)
+body &gt; #foo.a.b (1, 2, 1)
+h1::before (0, 1, 1)
+body h1::before (0, 1, 2)
+body.a h1.b::before (0, 3, 2)
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorcssselectorspecificityhtmlfromrev175482trunkLayoutTestsinspectorcssmatchedstylepropertieshtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/inspector/css/selector-specificity.html (from rev 175482, trunk/LayoutTests/inspector/css/matched-style-properties.html) (0 => 175483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/css/selector-specificity.html                                (rev 0)
+++ trunk/LayoutTests/inspector/css/selector-specificity.html        2014-11-03 20:03:57 UTC (rev 175483)
</span><span class="lines">@@ -0,0 +1,68 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+*,
+h1,
+.class,
+#id,
+body h1.class-one.class-two,
+body #foo,
+body &gt; #foo,
+body &gt; #foo.a.b,
+h1::before,
+body h1::before,
+body.a h1.b::before {
+    color: green;
+}
+&lt;/style&gt;
+&lt;script type=&quot;text/javascript&quot; src=&quot;../../http/tests/inspector/inspector-test.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+function test() {
+    var nodeStyles;
+
+    function validateSelectors()
+    {
+        for (var i = 0; i &lt; nodeStyles.matchedRules.length; ++i) {
+            var rule = nodeStyles.matchedRules[i];
+            if (rule.type !== WebInspector.CSSRule.Type.Author)
+                continue;
+
+            for (var selector of rule.selectors)
+                InspectorTest.log(selector.text + &quot; (&quot; + selector.specificity.join(&quot;, &quot;) + &quot;)&quot;);
+        }
+
+        InspectorTest.completeTest();
+    }
+
+    function onStylesRefreshed()
+    {
+        nodeStyles.removeEventListener(WebInspector.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
+        validateSelectors();
+    }
+
+    WebInspector.domTreeManager.requestDocument(function(documentNode) {
+        WebInspector.domTreeManager.querySelector(documentNode.id, &quot;#node1&quot;, function(contentNodeId) {
+            if (contentNodeId) {
+                var domNode = WebInspector.domTreeManager.nodeForId(contentNodeId);
+                nodeStyles = WebInspector.cssStyleManager.stylesForNode(domNode);
+
+                if (nodeStyles.needsRefresh)
+                    nodeStyles.addEventListener(WebInspector.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
+                else
+                    validateSelectors();
+            } else {
+                InspectorTest.log(&quot;DOM node not found.&quot;);
+                InspectorTest.completeTest();
+            }
+        });
+    });
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;runTest()&quot;&gt;
+    &lt;p&gt;Testing that selectors have expected specificity values.&lt;/p&gt;
+
+    &lt;div id=&quot;node1&quot;&gt;&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (175482 => 175483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2014-11-03 19:59:44 UTC (rev 175482)
+++ trunk/Source/JavaScriptCore/ChangeLog        2014-11-03 20:03:57 UTC (rev 175483)
</span><span class="lines">@@ -1,5 +1,16 @@
</span><span class="cx"> 2014-11-03  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Web Inspector: Show Selector's Specificity
+        https://bugs.webkit.org/show_bug.cgi?id=138189
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/protocol/CSS.json:
+        Create a new named type CSSSelector to include a selector's text and specificity.
+        The specificity tuple is optional as it may soon be made dynamic in some cases.
+
+2014-11-03  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
</ins><span class="cx">         Web Inspector: ObjC Protocol Interfaces should throw exceptions for nil arguments
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=138221
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorprotocolCSSjson"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/protocol/CSS.json (175482 => 175483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/protocol/CSS.json        2014-11-03 19:59:44 UTC (rev 175482)
+++ trunk/Source/JavaScriptCore/inspector/protocol/CSS.json        2014-11-03 20:03:57 UTC (rev 175483)
</span><span class="lines">@@ -59,10 +59,19 @@
</span><span class="cx">             &quot;description&quot;: &quot;Match data for a CSS rule.&quot;
</span><span class="cx">         },
</span><span class="cx">         {
</span><ins>+            &quot;id&quot;: &quot;CSSSelector&quot;,
+            &quot;type&quot;: &quot;object&quot;,
+            &quot;properties&quot;: [
+                { &quot;name&quot;: &quot;text&quot;, &quot;type&quot;: &quot;string&quot;, &quot;description&quot;: &quot;Canonicalized selector text.&quot; },
+                { &quot;name&quot;: &quot;specificity&quot;, &quot;optional&quot;: true, &quot;type&quot;: &quot;array&quot;, &quot;items&quot;: { &quot;type&quot;: &quot;integer&quot; }, &quot;description&quot;: &quot;Specificity (a, b, c) tuple. If missing the specificity is not known statically and may be dynamic.&quot; }
+            ],
+            &quot;description&quot;: &quot;CSS selector.&quot;
+        },
+        {
</ins><span class="cx">             &quot;id&quot;: &quot;SelectorList&quot;,
</span><span class="cx">             &quot;type&quot;: &quot;object&quot;,
</span><span class="cx">             &quot;properties&quot;: [
</span><del>-                { &quot;name&quot;: &quot;selectors&quot;, &quot;type&quot;: &quot;array&quot;, &quot;items&quot;: { &quot;type&quot;: &quot;string&quot; }, &quot;description&quot;: &quot;Selectors in the list.&quot; },
</del><ins>+                { &quot;name&quot;: &quot;selectors&quot;, &quot;type&quot;: &quot;array&quot;, &quot;items&quot;: { &quot;$ref&quot;: &quot;CSSSelector&quot; }, &quot;description&quot;: &quot;Selectors in the list.&quot; },
</ins><span class="cx">                 { &quot;name&quot;: &quot;text&quot;, &quot;type&quot;: &quot;string&quot;, &quot;description&quot;: &quot;Rule selector text.&quot; },
</span><span class="cx">                 { &quot;name&quot;: &quot;range&quot;, &quot;$ref&quot;: &quot;SourceRange&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;Rule selector range in the underlying resource (if available).&quot; }
</span><span class="cx">             ],
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (175482 => 175483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-11-03 19:59:44 UTC (rev 175482)
+++ trunk/Source/WebCore/ChangeLog        2014-11-03 20:03:57 UTC (rev 175483)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2014-11-03  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: Show Selector's Specificity
+        https://bugs.webkit.org/show_bug.cgi?id=138189
+
+        Reviewed by Timothy Hatcher.
+
+        Test: inspector/css/selector-specificity.html
+
+        * css/CSSSelector.h:
+        Remove very stale comment. '*' is a starAtom now instead of a special -1 tag.
+        Made the specificity masks public class constants.
+
+        * inspector/InspectorStyleSheet.h:
+        * inspector/InspectorStyleSheet.cpp:
+        (WebCore::InspectorStyle::buildArrayForComputedStyle):
+        (WebCore::InspectorStyle::styleWithProperties):
+        (WebCore::InspectorStyleSheet::buildObjectForStyleSheetInfo):
+        Drive by use release() in some cases to reduce ref count churn.
+
+        (WebCore::buildObjectForSelectorHelper):
+        (WebCore::selectorsFromSource):
+        (WebCore::InspectorStyleSheet::buildObjectForSelector):
+        (WebCore::InspectorStyleSheet::buildObjectForSelectorList):
+        Build CSSSelector objects for SelectorLists.
+
</ins><span class="cx"> 2014-11-03  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Move -webkit-shape-outside to the new StyleBuilder
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSSelectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSSelector.cpp (175482 => 175483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSSelector.cpp        2014-11-03 19:59:44 UTC (rev 175482)
+++ trunk/Source/WebCore/css/CSSSelector.cpp        2014-11-03 20:03:57 UTC (rev 175483)
</span><span class="lines">@@ -61,12 +61,6 @@
</span><span class="cx"> 
</span><span class="cx"> unsigned CSSSelector::specificity() const
</span><span class="cx"> {
</span><del>-    // make sure the result doesn't overflow
-    static const unsigned maxValueMask = 0xffffff;
-    static const unsigned idMask = 0xff0000;
-    static const unsigned classMask = 0xff00;
-    static const unsigned elementMask = 0xff;
-
</del><span class="cx">     if (isForPage())
</span><span class="cx">         return specificityForPage() &amp; maxValueMask;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSSelectorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSSelector.h (175482 => 175483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSSelector.h        2014-11-03 19:59:44 UTC (rev 175482)
+++ trunk/Source/WebCore/css/CSSSelector.h        2014-11-03 20:03:57 UTC (rev 175483)
</span><span class="lines">@@ -47,7 +47,10 @@
</span><span class="cx">         // checks if the 2 selectors (including sub selectors) agree.
</span><span class="cx">         bool operator==(const CSSSelector&amp;) const;
</span><span class="cx"> 
</span><del>-        // tag == -1 means apply to all elements (Selector = *)
</del><ins>+        static const unsigned maxValueMask = 0xffffff;
+        static const unsigned idMask = 0xff0000;
+        static const unsigned classMask = 0xff00;
+        static const unsigned elementMask = 0xff;
</ins><span class="cx"> 
</span><span class="cx">         unsigned specificity() const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorStyleSheetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp (175482 => 175483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp        2014-11-03 19:59:44 UTC (rev 175482)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp        2014-11-03 20:03:57 UTC (rev 175483)
</span><span class="lines">@@ -151,12 +151,12 @@
</span><span class="cx">     TextPosition start = ContentSearchUtilities::textPositionFromOffset(range.start, *lineEndings);
</span><span class="cx">     TextPosition end = ContentSearchUtilities::textPositionFromOffset(range.end, *lineEndings);
</span><span class="cx"> 
</span><del>-    RefPtr&lt;Inspector::Protocol::CSS::SourceRange&gt; result = Inspector::Protocol::CSS::SourceRange::create()
</del><ins>+    return Inspector::Protocol::CSS::SourceRange::create()
</ins><span class="cx">         .setStartLine(start.m_line.zeroBasedInt())
</span><span class="cx">         .setStartColumn(start.m_column.zeroBasedInt())
</span><span class="cx">         .setEndLine(end.m_line.zeroBasedInt())
</span><del>-        .setEndColumn(end.m_column.zeroBasedInt());
-    return result.release();
</del><ins>+        .setEndColumn(end.m_column.zeroBasedInt())
+        .release();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static PassRefPtr&lt;Inspector::Protocol::CSS::CSSMedia&gt; buildMediaObject(const MediaList* media, MediaListSource mediaListSource, const String&amp; sourceURL)
</span><span class="lines">@@ -327,7 +327,7 @@
</span><span class="cx">         RefPtr&lt;Inspector::Protocol::CSS::CSSComputedStyleProperty&gt; entry = Inspector::Protocol::CSS::CSSComputedStyleProperty::create()
</span><span class="cx">             .setName(propertyEntry.name)
</span><span class="cx">             .setValue(propertyEntry.value);
</span><del>-        result-&gt;addItem(entry);
</del><ins>+        result-&gt;addItem(entry.release());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return result.release();
</span><span class="lines">@@ -603,7 +603,7 @@
</span><span class="cx">                         RefPtr&lt;Inspector::Protocol::CSS::ShorthandEntry&gt; entry = Inspector::Protocol::CSS::ShorthandEntry::create()
</span><span class="cx">                             .setName(shorthand)
</span><span class="cx">                             .setValue(shorthandValue(shorthand));
</span><del>-                        shorthandEntries-&gt;addItem(entry);
</del><ins>+                        shorthandEntries-&gt;addItem(entry.release());
</ins><span class="cx">                     }
</span><span class="cx">                 }
</span><span class="cx">             }
</span><span class="lines">@@ -614,10 +614,10 @@
</span><span class="cx">             property-&gt;setStatus(status);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    RefPtr&lt;Inspector::Protocol::CSS::CSSStyle&gt; result = Inspector::Protocol::CSS::CSSStyle::create()
-        .setCssProperties(propertiesObject)
-        .setShorthandEntries(shorthandEntries);
-    return result.release();
</del><ins>+    return Inspector::Protocol::CSS::CSSStyle::create()
+        .setCssProperties(propertiesObject.release())
+        .setShorthandEntries(shorthandEntries.release())
+        .release();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> PassRefPtr&lt;CSSRuleSourceData&gt; InspectorStyle::extractSourceData() const
</span><span class="lines">@@ -981,53 +981,75 @@
</span><span class="cx"> 
</span><span class="cx">     Document* document = styleSheet-&gt;ownerDocument();
</span><span class="cx">     Frame* frame = document ? document-&gt;frame() : nullptr;
</span><del>-    RefPtr&lt;Inspector::Protocol::CSS::CSSStyleSheetHeader&gt; result = Inspector::Protocol::CSS::CSSStyleSheetHeader::create()
</del><ins>+    return Inspector::Protocol::CSS::CSSStyleSheetHeader::create()
</ins><span class="cx">         .setStyleSheetId(id())
</span><span class="cx">         .setOrigin(m_origin)
</span><span class="cx">         .setDisabled(styleSheet-&gt;disabled())
</span><span class="cx">         .setSourceURL(finalURL())
</span><span class="cx">         .setTitle(styleSheet-&gt;title())
</span><del>-        .setFrameId(m_pageAgent-&gt;frameId(frame));
</del><ins>+        .setFrameId(m_pageAgent-&gt;frameId(frame))
+        .release();
+}
</ins><span class="cx"> 
</span><del>-    return result.release();
</del><ins>+static PassRefPtr&lt;Inspector::Protocol::CSS::CSSSelector&gt; buildObjectForSelectorHelper(const String&amp; selectorText, unsigned specificity)
+{
+    RefPtr&lt;Inspector::Protocol::CSS::CSSSelector&gt; selector = Inspector::Protocol::CSS::CSSSelector::create()
+        .setText(selectorText);
+
+    RefPtr&lt;Inspector::Protocol::Array&lt;int&gt;&gt; tuple = Inspector::Protocol::Array&lt;int&gt;::create();
+    tuple-&gt;addItem(static_cast&lt;int&gt;((specificity &amp; CSSSelector::idMask) &gt;&gt; 16));
+    tuple-&gt;addItem(static_cast&lt;int&gt;((specificity &amp; CSSSelector::classMask) &gt;&gt; 8));
+    tuple-&gt;addItem(static_cast&lt;int&gt;(specificity &amp; CSSSelector::elementMask));
+    selector-&gt;setSpecificity(tuple.release());
+
+    return selector.release();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static PassRefPtr&lt;Inspector::Protocol::Array&lt;String&gt;&gt; selectorsFromSource(const CSSRuleSourceData* sourceData, const String&amp; sheetText)
</del><ins>+static PassRefPtr&lt;Inspector::Protocol::Array&lt;Inspector::Protocol::CSS::CSSSelector&gt;&gt; selectorsFromSource(const CSSRuleSourceData* sourceData, const String&amp; sheetText, const CSSSelectorList&amp; selectorList)
</ins><span class="cx"> {
</span><span class="cx">     DEPRECATED_DEFINE_STATIC_LOCAL(JSC::Yarr::RegularExpression, comment, (&quot;/\\*[^]*?\\*/&quot;, TextCaseSensitive, JSC::Yarr::MultilineEnabled));
</span><del>-    RefPtr&lt;Inspector::Protocol::Array&lt;String&gt;&gt; result = Inspector::Protocol::Array&lt;String&gt;::create();
</del><ins>+
+    RefPtr&lt;Inspector::Protocol::Array&lt;Inspector::Protocol::CSS::CSSSelector&gt;&gt; result = Inspector::Protocol::Array&lt;Inspector::Protocol::CSS::CSSSelector&gt;::create();
</ins><span class="cx">     const SelectorRangeList&amp; ranges = sourceData-&gt;selectorRanges;
</span><ins>+    const CSSSelector* selector = selectorList.first();
</ins><span class="cx">     for (size_t i = 0, size = ranges.size(); i &lt; size; ++i) {
</span><span class="cx">         const SourceRange&amp; range = ranges.at(i);
</span><del>-        String selector = sheetText.substring(range.start, range.length());
</del><ins>+        String selectorText = sheetText.substring(range.start, range.length());
</ins><span class="cx"> 
</span><span class="cx">         // We don't want to see any comments in the selector components, only the meaningful parts.
</span><del>-        replace(selector, comment, &quot;&quot;);
-        result-&gt;addItem(selector.stripWhiteSpace());
</del><ins>+        replace(selectorText, comment, String());
+        result-&gt;addItem(buildObjectForSelectorHelper(selectorText.stripWhiteSpace(), selector-&gt;specificity()));
+
+        selector = CSSSelectorList::next(selector);
</ins><span class="cx">     }
</span><span class="cx">     return result.release();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+PassRefPtr&lt;Inspector::Protocol::CSS::CSSSelector&gt; InspectorStyleSheet::buildObjectForSelector(const CSSSelector* selector)
+{
+    return buildObjectForSelectorHelper(selector-&gt;selectorText(), selector-&gt;specificity());
+}
+
</ins><span class="cx"> PassRefPtr&lt;Inspector::Protocol::CSS::SelectorList&gt; InspectorStyleSheet::buildObjectForSelectorList(CSSStyleRule* rule)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;CSSRuleSourceData&gt; sourceData;
</span><span class="cx">     if (ensureParsedDataReady())
</span><span class="cx">         sourceData = ruleSourceDataFor(&amp;rule-&gt;style());
</span><del>-    RefPtr&lt;Inspector::Protocol::Array&lt;String&gt;&gt; selectors;
</del><ins>+    RefPtr&lt;Inspector::Protocol::Array&lt;Inspector::Protocol::CSS::CSSSelector&gt;&gt; selectors;
</ins><span class="cx"> 
</span><span class="cx">     // This intentionally does not rely on the source data to avoid catching the trailing comments (before the declaration starting '{').
</span><span class="cx">     String selectorText = rule-&gt;selectorText();
</span><span class="cx"> 
</span><span class="cx">     if (sourceData)
</span><del>-        selectors = selectorsFromSource(sourceData.get(), m_parsedStyleSheet-&gt;text());
</del><ins>+        selectors = selectorsFromSource(sourceData.get(), m_parsedStyleSheet-&gt;text(), rule-&gt;styleRule()-&gt;selectorList());
</ins><span class="cx">     else {
</span><del>-        selectors = Inspector::Protocol::Array&lt;String&gt;::create();
</del><ins>+        selectors = Inspector::Protocol::Array&lt;Inspector::Protocol::CSS::CSSSelector&gt;::create();
</ins><span class="cx">         const CSSSelectorList&amp; selectorList = rule-&gt;styleRule()-&gt;selectorList();
</span><span class="cx">         for (const CSSSelector* selector = selectorList.first(); selector; selector = CSSSelectorList::next(selector))
</span><del>-            selectors-&gt;addItem(selector-&gt;selectorText());
</del><ins>+            selectors-&gt;addItem(buildObjectForSelector(selector));
</ins><span class="cx">     }
</span><span class="cx">     RefPtr&lt;Inspector::Protocol::CSS::SelectorList&gt; result = Inspector::Protocol::CSS::SelectorList::create()
</span><del>-        .setSelectors(selectors)
</del><ins>+        .setSelectors(selectors.release())
</ins><span class="cx">         .setText(selectorText)
</span><span class="cx">         .release();
</span><span class="cx">     if (sourceData)
</span><span class="lines">@@ -1074,10 +1096,10 @@
</span><span class="cx"> 
</span><span class="cx">     InspectorCSSId id = ruleOrStyleId(style);
</span><span class="cx">     if (id.isEmpty()) {
</span><del>-        RefPtr&lt;Inspector::Protocol::CSS::CSSStyle&gt; bogusStyle = Inspector::Protocol::CSS::CSSStyle::create()
</del><ins>+        return Inspector::Protocol::CSS::CSSStyle::create()
</ins><span class="cx">             .setCssProperties(Array&lt;Inspector::Protocol::CSS::CSSProperty&gt;::create())
</span><del>-            .setShorthandEntries(Array&lt;Inspector::Protocol::CSS::ShorthandEntry&gt;::create());
-        return bogusStyle.release();
</del><ins>+            .setShorthandEntries(Array&lt;Inspector::Protocol::CSS::ShorthandEntry&gt;::create())
+            .release();
</ins><span class="cx">     }
</span><span class="cx">     RefPtr&lt;InspectorStyle&gt; inspectorStyle = inspectorStyleForId(id);
</span><span class="cx">     RefPtr&lt;Inspector::Protocol::CSS::CSSStyle&gt; result = inspectorStyle-&gt;buildObjectForStyle();
</span><span class="lines">@@ -1175,10 +1197,8 @@
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><span class="cx">     InspectorStyleMap::iterator it = m_inspectorStyles.find(style);
</span><del>-    if (it == m_inspectorStyles.end()) {
-        RefPtr&lt;InspectorStyle&gt; inspectorStyle = InspectorStyle::create(id, style, this);
-        return inspectorStyle.release();
-    }
</del><ins>+    if (it == m_inspectorStyles.end())
+        return InspectorStyle::create(id, style, this);
</ins><span class="cx">     return it-&gt;value;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorStyleSheeth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.h (175482 => 175483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorStyleSheet.h        2014-11-03 19:59:44 UTC (rev 175482)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.h        2014-11-03 20:03:57 UTC (rev 175483)
</span><span class="lines">@@ -43,6 +43,7 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class CSSRuleList;
</span><ins>+class CSSSelector;
</ins><span class="cx"> class CSSStyleDeclaration;
</span><span class="cx"> class CSSStyleRule;
</span><span class="cx"> class CSSStyleSheet;
</span><span class="lines">@@ -243,6 +244,7 @@
</span><span class="cx">     bool resourceStyleSheetText(String* result) const;
</span><span class="cx">     bool inlineStyleSheetText(String* result) const;
</span><span class="cx">     PassRefPtr&lt;Inspector::Protocol::Array&lt;Inspector::Protocol::CSS::CSSRule&gt;&gt; buildArrayForRuleList(CSSRuleList*);
</span><ins>+    PassRefPtr&lt;Inspector::Protocol::CSS::CSSSelector&gt; buildObjectForSelector(const CSSSelector*);
</ins><span class="cx">     PassRefPtr&lt;Inspector::Protocol::CSS::SelectorList&gt; buildObjectForSelectorList(CSSStyleRule*);
</span><span class="cx"> 
</span><span class="cx">     InspectorPageAgent* m_pageAgent;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (175482 => 175483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2014-11-03 19:59:44 UTC (rev 175482)
+++ trunk/Source/WebInspectorUI/ChangeLog        2014-11-03 20:03:57 UTC (rev 175483)
</span><span class="lines">@@ -1,5 +1,45 @@
</span><span class="cx"> 2014-11-03  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Web Inspector: Show Selector's Specificity
+        https://bugs.webkit.org/show_bug.cgi?id=138189
+
+        Reviewed by Timothy Hatcher.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        * UserInterface/Main.html:
+        * UserInterface/Test.html:
+        Add new files and strings.
+
+        * UserInterface/Models/CSSMedia.js:
+        Constructor functions are not needed, remove unnecessary code.
+
+        * UserInterface/Models/CSSRule.js:
+        (WebInspector.CSSRule.prototype.set selectors): Deleted.
+        This was unused and is no longer correct.
+
+        (WebInspector.CSSRule.prototype.get matchedSelectorText):
+        Update now that selectors are a list of objects, not just strings.
+
+        * UserInterface/Models/CSSSelector.js:
+        (WebInspector.CSSSelector):
+        (WebInspector.CSSSelector.prototype.get specificity):
+        New model object for protocol type CSS.CSSSelector.
+
+        * UserInterface/Models/DOMNodeStyles.js:
+        (WebInspector.DOMNodeStyles.prototype._parseSelectorListPayload.return):
+        (WebInspector.DOMNodeStyles.prototype._parseSelectorListPayload):
+        (WebInspector.DOMNodeStyles.prototype._parseRulePayload):
+        Handle parsing old and new SelectorLists.
+
+        * UserInterface/Views/CSSStyleDeclarationSection.js:
+        (WebInspector.CSSStyleDeclarationSection.prototype.refresh.appendSelector):
+        (WebInspector.CSSStyleDeclarationSection.prototype.refresh.appendSelectorText):
+        (WebInspector.CSSStyleDeclarationSection.prototype.refresh):
+        Update the code now that the list of selectors are model objects instead
+        of just selector text strings.
+
+2014-11-03  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
</ins><span class="cx">         Web Inspector: ALTERNATE_DISPATCHERS Let the frontend know about extra agents
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=138236
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (175482 => 175483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js        2014-11-03 19:59:44 UTC (rev 175482)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js        2014-11-03 20:03:57 UTC (rev 175483)
</span><span class="lines">@@ -404,6 +404,7 @@
</span><span class="cx"> localizedStrings[&quot;Socket&quot;] = &quot;Socket&quot;;
</span><span class="cx"> localizedStrings[&quot;Sockets&quot;] = &quot;Sockets&quot;;
</span><span class="cx"> localizedStrings[&quot;Source Code&quot;] = &quot;Source Code&quot;;
</span><ins>+localizedStrings[&quot;Specificity: (%d, %d, %d) &quot;H %d&quot;] = &quot;Specificity: (%d, %d, %d) &quot;H %d&quot;;
</ins><span class="cx"> localizedStrings[&quot;Spelling&quot;] = &quot;Spelling&quot;;
</span><span class="cx"> localizedStrings[&quot;Start Playback&quot;] = &quot;Start Playback&quot;;
</span><span class="cx"> localizedStrings[&quot;Start Recording&quot;] = &quot;Start Recording&quot;;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceMainhtml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (175482 => 175483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Main.html        2014-11-03 19:59:44 UTC (rev 175482)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html        2014-11-03 20:03:57 UTC (rev 175483)
</span><span class="lines">@@ -212,6 +212,7 @@
</span><span class="cx">     &lt;script src=&quot;Models/CSSMedia.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;Models/CSSProperty.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;Models/CSSRule.js&quot;&gt;&lt;/script&gt;
</span><ins>+    &lt;script src=&quot;Models/CSSSelector.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx">     &lt;script src=&quot;Models/CSSStyleDeclaration.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;Models/CSSStyleSheet.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;Models/CallFrame.js&quot;&gt;&lt;/script&gt;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsCSSMediajs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CSSMedia.js (175482 => 175483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/CSSMedia.js        2014-11-03 19:59:44 UTC (rev 175482)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CSSMedia.js        2014-11-03 20:03:57 UTC (rev 175483)
</span><span class="lines">@@ -32,8 +32,6 @@
</span><span class="cx">     this._sourceCodeLocation = sourceCodeLocation || null;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-WebInspector.Object.addConstructorFunctions(WebInspector.CSSMedia);
-
</del><span class="cx"> WebInspector.CSSMedia.Type = {
</span><span class="cx">     MediaRule: &quot;css-media-type-media-rule&quot;,
</span><span class="cx">     ImportRule: &quot;css-media-type-import-rule&quot;,
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsCSSRulejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CSSRule.js (175482 => 175483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/CSSRule.js        2014-11-03 19:59:44 UTC (rev 175482)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CSSRule.js        2014-11-03 20:03:57 UTC (rev 175483)
</span><span class="lines">@@ -139,11 +139,6 @@
</span><span class="cx">         return this._selectors;
</span><span class="cx">     },
</span><span class="cx"> 
</span><del>-    set selectors(selectors)
-    {
-        this.selectorText = (selectors || []).join(&quot;, &quot;);
-    },
-
</del><span class="cx">     get matchedSelectorIndices()
</span><span class="cx">     {
</span><span class="cx">         return this._matchedSelectorIndices;
</span><span class="lines">@@ -178,7 +173,7 @@
</span><span class="cx">         if (&quot;_matchedSelectorText&quot; in this)
</span><span class="cx">             return this._matchedSelectorText;
</span><span class="cx"> 
</span><del>-        this._matchedSelectorText = this.matchedSelectors.join(&quot;, &quot;);
</del><ins>+        this._matchedSelectorText = this.matchedSelectors.map(function(x) { return x.text; }).join(&quot;, &quot;);
</ins><span class="cx"> 
</span><span class="cx">         return this._matchedSelectorText;
</span><span class="cx">     },
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsCSSSelectorjsfromrev175482trunkSourceWebInspectorUIUserInterfaceModelsCSSMediajs"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebInspectorUI/UserInterface/Models/CSSSelector.js (from rev 175482, trunk/Source/WebInspectorUI/UserInterface/Models/CSSMedia.js) (0 => 175483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/CSSSelector.js                                (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CSSSelector.js        2014-11-03 20:03:57 UTC (rev 175483)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.CSSSelector = function(text, specificity)
+{
+    WebInspector.Object.call(this);
+
+    console.assert(text);
+
+    this._text = text;
+    this._specificity = specificity || null;
+};
+
+WebInspector.CSSSelector.prototype = {
+    constructor: WebInspector.CSSSelector,
+    __proto__: WebInspector.Object.prototype,
+
+    // Public
+
+    get text()
+    {
+        return this._text;
+    },
+
+    get specificity()
+    {
+        return this._specificity;
+    }
+};
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsDOMNodeStylesjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js (175482 => 175483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js        2014-11-03 19:59:44 UTC (rev 175482)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js        2014-11-03 20:03:57 UTC (rev 175483)
</span><span class="lines">@@ -745,6 +745,29 @@
</span><span class="cx">         return styleDeclaration;
</span><span class="cx">     },
</span><span class="cx"> 
</span><ins>+    _parseSelectorListPayload: function(selectorList)
+    {
+        // COMPATIBILITY (iOS 6): The payload did not have 'selectorList'.
+        if (!selectorList)
+            return [];
+
+        var selectors = selectorList.selectors;
+        if (!selectors.length)
+            return [];
+
+        // COMPATIBILITY (iOS 8): The selectorList payload was an array of selector text strings.
+        // Now they are CSSSelector objects with multiple properties.
+        if (typeof selectors[0] === &quot;string&quot;) {
+            return selectors.map(function(selectorText) {
+                return new WebInspector.CSSSelector(selectorText);
+            });
+        }
+
+        return selectors.map(function(selectorPayload) {
+            return new WebInspector.CSSSelector(selectorPayload.text, selectorPayload.specificity);
+        });
+    },
+
</ins><span class="cx">     _parseRulePayload: function(payload, matchedSelectorIndices, node, inherited, ruleOccurrences)
</span><span class="cx">     {
</span><span class="cx">         if (!payload)
</span><span class="lines">@@ -791,7 +814,7 @@
</span><span class="cx">         // COMPATIBILITY (iOS 6): The payload had 'selectorText' as a property,
</span><span class="cx">         // now it has 'selectorList' with a 'text' property. Support both here.
</span><span class="cx">         var selectorText = payload.selectorList ? payload.selectorList.text : payload.selectorText;
</span><del>-        var selectors = payload.selectorList ? payload.selectorList.selectors : [];
</del><ins>+        var selectors = this._parseSelectorListPayload(payload.selectorList);
</ins><span class="cx"> 
</span><span class="cx">         // COMPATIBILITY (iOS 6): The payload did not have 'selectorList'.
</span><span class="cx">         // Fallback to using 'sourceLine' without column information.
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTesthtml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Test.html (175482 => 175483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Test.html        2014-11-03 19:59:44 UTC (rev 175482)
+++ trunk/Source/WebInspectorUI/UserInterface/Test.html        2014-11-03 20:03:57 UTC (rev 175483)
</span><span class="lines">@@ -74,6 +74,7 @@
</span><span class="cx">     &lt;script src=&quot;Models/CSSKeywordCompletions.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;Models/CSSProperty.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;Models/CSSRule.js&quot;&gt;&lt;/script&gt;
</span><ins>+    &lt;script src=&quot;Models/CSSSelector.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx">     &lt;script src=&quot;Models/CSSStyleDeclaration.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;Models/CSSStyleSheet.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;Models/DOMNode.js&quot;&gt;&lt;/script&gt;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsCSSStyleDeclarationSectionjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js (175482 => 175483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js        2014-11-03 19:59:44 UTC (rev 175482)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js        2014-11-03 20:03:57 UTC (rev 175483)
</span><span class="lines">@@ -168,12 +168,30 @@
</span><span class="cx"> 
</span><span class="cx">         this._originElement.appendChild(document.createTextNode(&quot; \u2014 &quot;));
</span><span class="cx"> 
</span><del>-        function appendSelector(selectorText, matched)
</del><ins>+        function appendSelector(selector, matched)
</ins><span class="cx">         {
</span><ins>+            console.assert(selector instanceof WebInspector.CSSSelector);
+
</ins><span class="cx">             var selectorElement = document.createElement(&quot;span&quot;);
</span><ins>+            selectorElement.textContent = selector.text;
+
</ins><span class="cx">             if (matched)
</span><span class="cx">                 selectorElement.className = WebInspector.CSSStyleDeclarationSection.MatchedSelectorElementStyleClassName;
</span><ins>+
+            var specificity = selector.specificity;
+            if (specificity) {
+                var approximatedSpecificity = (specificity[0] * 100) + (specificity[1] * 10) + specificity[2];
+                selectorElement.title = WebInspector.UIString(&quot;Specificity: (%d, %d, %d) ≈ %d&quot;).format(specificity[0], specificity[1], specificity[2], approximatedSpecificity);
+            }
+
+            this._selectorElement.appendChild(selectorElement);
+        }
+
+        function appendSelectorTextKnownToMatch(selectorText)
+        {
+            var selectorElement = document.createElement(&quot;span&quot;);
</ins><span class="cx">             selectorElement.textContent = selectorText;
</span><ins>+            selectorElement.className = WebInspector.CSSStyleDeclarationSection.MatchedSelectorElementStyleClassName;
</ins><span class="cx">             this._selectorElement.appendChild(selectorElement);
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -190,7 +208,7 @@
</span><span class="cx">                         this._selectorElement.appendChild(document.createTextNode(&quot;, &quot;));
</span><span class="cx">                 }
</span><span class="cx">             } else
</span><del>-                appendSelector.call(this, this._style.ownerRule.selectorText, true);
</del><ins>+                appendSelectorTextKnownToMatch.call(this, this._style.ownerRule.selectorText);
</ins><span class="cx"> 
</span><span class="cx">             if (this._style.ownerRule.sourceCodeLocation) {
</span><span class="cx">                 var sourceCodeLink = WebInspector.createSourceCodeLocationLink(this._style.ownerRule.sourceCodeLocation, true);
</span><span class="lines">@@ -223,12 +241,12 @@
</span><span class="cx">             break;
</span><span class="cx"> 
</span><span class="cx">         case WebInspector.CSSStyleDeclaration.Type.Inline:
</span><del>-            appendSelector.call(this, WebInspector.displayNameForNode(this._style.node), true);
</del><ins>+            appendSelectorTextKnownToMatch.call(this, WebInspector.displayNameForNode(this._style.node));
</ins><span class="cx">             this._originElement.appendChild(document.createTextNode(WebInspector.UIString(&quot;Style Attribute&quot;)));
</span><span class="cx">             break;
</span><span class="cx"> 
</span><span class="cx">         case WebInspector.CSSStyleDeclaration.Type.Attribute:
</span><del>-            appendSelector.call(this, WebInspector.displayNameForNode(this._style.node), true);
</del><ins>+            appendSelectorTextKnownToMatch.call(this, WebInspector.displayNameForNode(this._style.node));
</ins><span class="cx">             this._originElement.appendChild(document.createTextNode(WebInspector.UIString(&quot;HTML Attributes&quot;)));
</span><span class="cx">             break;
</span><span class="cx">         }
</span></span></pre>
</div>
</div>

</body>
</html>