<!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>[178767] 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/178767">178767</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-01-20 16:30:36 -0800 (Tue, 20 Jan 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Web Inspector: Should show dynamic specificity values
https://bugs.webkit.org/show_bug.cgi?id=140647
Patch by Joseph Pecoraro <pecoraro@apple.com> on 2015-01-20
Reviewed by Benjamin Poulain.
Source/JavaScriptCore:
* inspector/protocol/CSS.json:
Clarify CSSSelector optional values and add "dynamic" property indicating
if the selector can be dynamic based on the element it is matched against.
Source/WebCore:
Test: inspector/css/selector-dynamic-specificity.html
* inspector/InspectorCSSAgent.h:
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::setRuleSelector):
(WebCore::InspectorCSSAgent::addRule):
(WebCore::InspectorCSSAgent::buildObjectForRule):
(WebCore::InspectorCSSAgent::buildArrayForMatchedRuleList):
When building a response for a particular element, pass the element along.
* inspector/InspectorStyleSheet.h:
* inspector/InspectorStyleSheet.cpp:
(WebCore::hasDynamicSpecificity):
(WebCore::buildObjectForSelectorHelper):
(WebCore::selectorsFromSource):
(WebCore::InspectorStyleSheet::buildObjectForSelector):
(WebCore::InspectorStyleSheet::buildObjectForSelectorList):
(WebCore::InspectorStyleSheet::buildObjectForRule):
(WebCore::InspectorStyleSheet::buildArrayForRuleList):
(WebCore::InspectorStyleSheetForInlineStyle::InspectorStyleSheetForInlineStyle):
When building a response for a Selector, include the specificity if we know
the element in context.
Source/WebInspectorUI:
For dynamic selectors, provide text in the tooltip describing that the
specificity is dynamic and may change, and pointing out the element
the current value was calculated against.
* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Models/CSSSelector.js:
(WebInspector.CSSSelector):
(WebInspector.CSSSelector.prototype.get specificity):
(WebInspector.CSSSelector.prototype.get dynamic):
* UserInterface/Models/DOMNodeStyles.js:
(WebInspector.DOMNodeStyles.prototype._parseSelectorListPayload.return):
(WebInspector.DOMNodeStyles.prototype._parseSelectorListPayload):
* UserInterface/Views/CSSStyleDeclarationSection.js:
(WebInspector.CSSStyleDeclarationSection.prototype.refresh.appendSelector):
LayoutTests:
* inspector/css/selector-dynamic-specificity-expected.txt: Added.
* inspector/css/selector-dynamic-specificity.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</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="#trunkSourceWebCoreinspectorInspectorCSSAgentcpp">trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorCSSAgenth">trunk/Source/WebCore/inspector/InspectorCSSAgent.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="#trunkSourceWebInspectorUIUserInterfaceModelsCSSSelectorjs">trunk/Source/WebInspectorUI/UserInterface/Models/CSSSelector.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsDOMNodeStylesjs">trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsCSSStyleDeclarationSectionjs">trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsinspectorcssselectordynamicspecificityexpectedtxt">trunk/LayoutTests/inspector/css/selector-dynamic-specificity-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorcssselectordynamicspecificityhtml">trunk/LayoutTests/inspector/css/selector-dynamic-specificity.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (178766 => 178767)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-01-21 00:28:33 UTC (rev 178766)
+++ trunk/LayoutTests/ChangeLog        2015-01-21 00:30:36 UTC (rev 178767)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2015-01-20 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Should show dynamic specificity values
+ https://bugs.webkit.org/show_bug.cgi?id=140647
+
+ Reviewed by Benjamin Poulain.
+
+ * inspector/css/selector-dynamic-specificity-expected.txt: Added.
+ * inspector/css/selector-dynamic-specificity.html: Added.
+
</ins><span class="cx"> 2015-01-20 Alexey Proskuryakov <ap@apple.com>
</span><span class="cx">
</span><span class="cx"> http/tests/xmlhttprequest/xmlhttprequest-responseURL.html uses an incorrect resource path
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorcssselectordynamicspecificityexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/css/selector-dynamic-specificity-expected.txt (0 => 178767)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/css/selector-dynamic-specificity-expected.txt         (rev 0)
+++ trunk/LayoutTests/inspector/css/selector-dynamic-specificity-expected.txt        2015-01-21 00:30:36 UTC (rev 178767)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+Testing that dynamic selectors have expected specificity values depending on the context node.
+
+
+p - :matches(div, article) (0, 0, 1) (dynamic)
+p - :matches(div, .foo, #bar, div#bar) (no value) (dynamic)
+p - div:nth-child(odd) (0, 1, 1)
+p - :nth-child(odd of div) (0, 1, 1) (dynamic)
+p - :nth-child(odd of div, .foo, #bar, div#bar) (no value) (dynamic)
+p - :nth-child(even of div, .foo, #bar, div#bar) (no value) (dynamic)
+p - :not(span, #missing) (1, 0, 0)
+p - :not(:not(:matches(div, .foo, #bar, div#bar))) (1, 0, 1)
+
+div - :matches(div, article) (0, 0, 1) (dynamic)
+div - :matches(div, .foo, #bar, div#bar) (0, 0, 1) (dynamic)
+div - div:nth-child(odd) (0, 1, 1)
+div - :nth-child(odd of div) (0, 1, 1) (dynamic)
+div - :nth-child(odd of div, .foo, #bar, div#bar) (0, 1, 1) (dynamic)
+div - :nth-child(even of div, .foo, #bar, div#bar) (no value) (dynamic)
+div - :not(span, #missing) (1, 0, 0)
+div - :not(:not(:matches(div, .foo, #bar, div#bar))) (1, 0, 1)
+
+.foo - :matches(div, article) (0, 0, 1) (dynamic)
+.foo - :matches(div, .foo, #bar, div#bar) (0, 1, 0) (dynamic)
+.foo - div:nth-child(odd) (0, 1, 1)
+.foo - :nth-child(odd of div) (0, 1, 1) (dynamic)
+.foo - :nth-child(odd of div, .foo, #bar, div#bar) (no value) (dynamic)
+.foo - :nth-child(even of div, .foo, #bar, div#bar) (0, 2, 0) (dynamic)
+.foo - :not(span, #missing) (1, 0, 0)
+.foo - :not(:not(:matches(div, .foo, #bar, div#bar))) (1, 0, 1)
+
+#bar - :matches(div, article) (0, 0, 1) (dynamic)
+#bar - :matches(div, .foo, #bar, div#bar) (1, 0, 1) (dynamic)
+#bar - div:nth-child(odd) (0, 1, 1)
+#bar - :nth-child(odd of div) (0, 1, 1) (dynamic)
+#bar - :nth-child(odd of div, .foo, #bar, div#bar) (1, 1, 1) (dynamic)
+#bar - :nth-child(even of div, .foo, #bar, div#bar) (no value) (dynamic)
+#bar - :not(span, #missing) (1, 0, 0)
+#bar - :not(:not(:matches(div, .foo, #bar, div#bar))) (1, 0, 1)
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorcssselectordynamicspecificityhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/css/selector-dynamic-specificity.html (0 => 178767)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/css/selector-dynamic-specificity.html         (rev 0)
+++ trunk/LayoutTests/inspector/css/selector-dynamic-specificity.html        2015-01-21 00:30:36 UTC (rev 178767)
</span><span class="lines">@@ -0,0 +1,102 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<style>
+:matches(div, article), /* dynamic, but statically always the same */
+:matches(div, .foo, #bar, div#bar), /* dynamic, changing based on matched element */
+div:nth-child(odd), /* static, no selector list */
+:nth-child(odd of div), /* dynamic, but statically always the same */
+:nth-child(odd of div, .foo, #bar, div#bar), /* dynamic, changing based on matched element */
+:nth-child(even of div, .foo, #bar, div#bar), /* dynamic, changing based on matched element */
+:not(span, #missing), /* static, maximum in list */
+:not(:not(:matches(div, .foo, #bar, div#bar))), /* static, matches() inside not() is maximized */
+* /* ignored */
+{
+ color: green;
+}
+</style>
+<script type="text/javascript" src="../../http/tests/inspector/inspector-test.js"></script>
+<script>
+function test() {
+ var nodeStyles;
+ var documentNode;
+
+ var currentSelector = null;
+ var currentStepIndex = 0;
+ var steps = ["p", "div", ".foo", "#bar"];
+
+ function validateSelectors()
+ {
+ InspectorTest.log("");
+
+ var seenRules = [];
+
+ for (var i = 0; i < nodeStyles.matchedRules.length; ++i) {
+ var rule = nodeStyles.matchedRules[i];
+ if (rule.type !== WebInspector.CSSRule.Type.Author)
+ continue;
+
+ if (seenRules.some(function(r) { return r.isEqualTo(rule); }))
+ continue;
+ seenRules.push(rule);
+
+ for (var selector of rule.selectors) {
+ if (selector.text === "*")
+ continue;
+
+ var output = currentSelector + " - " + selector.text;
+ output += selector.specificity ? " (" + selector.specificity.join(", ") + ")" : " (no value)";
+ if (selector.dynamic)
+ output += " (dynamic)";
+ InspectorTest.log(output);
+ }
+ }
+
+ runNextStep();
+ }
+
+ function onStylesRefreshed()
+ {
+ nodeStyles.removeEventListener(WebInspector.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
+ validateSelectors();
+ }
+
+ function runNextStep()
+ {
+ if (currentStepIndex >= steps.length) {
+ InspectorTest.completeTest();
+ return;
+ }
+
+ currentSelector = steps[currentStepIndex++];
+ WebInspector.domTreeManager.querySelector(documentNode.id, currentSelector, 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("DOM node not found.");
+ InspectorTest.completeTest();
+ }
+ });
+ }
+
+ WebInspector.domTreeManager.requestDocument(function(node) {
+ documentNode = node;
+ runNextStep();
+ });
+}
+</script>
+</head>
+<body onload="runTest()">
+ <p>Testing that dynamic selectors have expected specificity values depending on the context node.</p>
+
+ <div></div>
+ <div class="foo"></div>
+ <div id="bar"></div>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (178766 => 178767)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-01-21 00:28:33 UTC (rev 178766)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-01-21 00:30:36 UTC (rev 178767)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2015-01-20 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Should show dynamic specificity values
+ https://bugs.webkit.org/show_bug.cgi?id=140647
+
+ Reviewed by Benjamin Poulain.
+
+ * inspector/protocol/CSS.json:
+ Clarify CSSSelector optional values and add "dynamic" property indicating
+ if the selector can be dynamic based on the element it is matched against.
+
</ins><span class="cx"> 2015-01-20 Commit Queue <commit-queue@webkit.org>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rolling out r178751.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorprotocolCSSjson"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/protocol/CSS.json (178766 => 178767)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/protocol/CSS.json        2015-01-21 00:28:33 UTC (rev 178766)
+++ trunk/Source/JavaScriptCore/inspector/protocol/CSS.json        2015-01-21 00:30:36 UTC (rev 178767)
</span><span class="lines">@@ -63,7 +63,8 @@
</span><span class="cx"> "type": "object",
</span><span class="cx"> "properties": [
</span><span class="cx"> { "name": "text", "type": "string", "description": "Canonicalized selector text." },
</span><del>- { "name": "specificity", "optional": true, "type": "array", "items": { "type": "integer" }, "description": "Specificity (a, b, c) tuple. If missing the specificity is not known statically and may be dynamic." }
</del><ins>+ { "name": "specificity", "optional": true, "type": "array", "items": { "type": "integer" }, "description": "Specificity (a, b, c) tuple. Included if the selector is sent in response to CSS.getMatchedStylesForNode which provides a context element." },
+ { "name": "dynamic", "optional": true, "type": "boolean", "description": "Whether or not the specificity can be dynamic. Included if the selector is sent in response to CSS.getMatchedStylesForNode which provides a context element." }
</ins><span class="cx"> ],
</span><span class="cx"> "description": "CSS selector."
</span><span class="cx"> },
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (178766 => 178767)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-01-21 00:28:33 UTC (rev 178766)
+++ trunk/Source/WebCore/ChangeLog        2015-01-21 00:30:36 UTC (rev 178767)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2015-01-20 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Should show dynamic specificity values
+ https://bugs.webkit.org/show_bug.cgi?id=140647
+
+ Reviewed by Benjamin Poulain.
+
+ Test: inspector/css/selector-dynamic-specificity.html
+
+ * inspector/InspectorCSSAgent.h:
+ * inspector/InspectorCSSAgent.cpp:
+ (WebCore::InspectorCSSAgent::setRuleSelector):
+ (WebCore::InspectorCSSAgent::addRule):
+ (WebCore::InspectorCSSAgent::buildObjectForRule):
+ (WebCore::InspectorCSSAgent::buildArrayForMatchedRuleList):
+ When building a response for a particular element, pass the element along.
+
+ * inspector/InspectorStyleSheet.h:
+ * inspector/InspectorStyleSheet.cpp:
+ (WebCore::hasDynamicSpecificity):
+ (WebCore::buildObjectForSelectorHelper):
+ (WebCore::selectorsFromSource):
+ (WebCore::InspectorStyleSheet::buildObjectForSelector):
+ (WebCore::InspectorStyleSheet::buildObjectForSelectorList):
+ (WebCore::InspectorStyleSheet::buildObjectForRule):
+ (WebCore::InspectorStyleSheet::buildArrayForRuleList):
+ (WebCore::InspectorStyleSheetForInlineStyle::InspectorStyleSheetForInlineStyle):
+ When building a response for a Selector, include the specificity if we know
+ the element in context.
+
</ins><span class="cx"> 2015-01-20 Brent Fulgham <bfulgham@apple.com>
</span><span class="cx">
</span><span class="cx"> [Win] Build fix after r178760.
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorCSSAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp (178766 => 178767)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp        2015-01-21 00:28:33 UTC (rev 178766)
+++ trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp        2015-01-21 00:30:36 UTC (rev 178767)
</span><span class="lines">@@ -781,7 +781,7 @@
</span><span class="cx"> bool success = m_domAgent->history()->perform(std::make_unique<SetRuleSelectorAction>(inspectorStyleSheet, compoundId, selector), ec);
</span><span class="cx">
</span><span class="cx"> if (success)
</span><del>- result = inspectorStyleSheet->buildObjectForRule(inspectorStyleSheet->ruleForId(compoundId));
</del><ins>+ result = inspectorStyleSheet->buildObjectForRule(inspectorStyleSheet->ruleForId(compoundId), nullptr);
</ins><span class="cx"> errorString = InspectorDOMAgent::toErrorString(ec);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -808,7 +808,7 @@
</span><span class="cx">
</span><span class="cx"> InspectorCSSId ruleId = rawAction->newRuleId();
</span><span class="cx"> CSSStyleRule* rule = inspectorStyleSheet->ruleForId(ruleId);
</span><del>- result = inspectorStyleSheet->buildObjectForRule(rule);
</del><ins>+ result = inspectorStyleSheet->buildObjectForRule(rule, nullptr);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void InspectorCSSAgent::getSupportedCSSProperties(ErrorString&, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::CSS::CSSPropertyInfo>>& cssProperties)
</span><span class="lines">@@ -1016,7 +1016,7 @@
</span><span class="cx"> return origin;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<Inspector::Protocol::CSS::CSSRule> InspectorCSSAgent::buildObjectForRule(StyleRule* styleRule, StyleResolver& styleResolver)
</del><ins>+RefPtr<Inspector::Protocol::CSS::CSSRule> InspectorCSSAgent::buildObjectForRule(StyleRule* styleRule, StyleResolver& styleResolver, Element* element)
</ins><span class="cx"> {
</span><span class="cx"> if (!styleRule)
</span><span class="cx"> return nullptr;
</span><span class="lines">@@ -1027,7 +1027,7 @@
</span><span class="cx"> if (!cssomWrapper)
</span><span class="cx"> return nullptr;
</span><span class="cx"> InspectorStyleSheet* inspectorStyleSheet = bindStyleSheet(cssomWrapper->parentStyleSheet());
</span><del>- return inspectorStyleSheet ? inspectorStyleSheet->buildObjectForRule(cssomWrapper) : nullptr;
</del><ins>+ return inspectorStyleSheet ? inspectorStyleSheet->buildObjectForRule(cssomWrapper, element) : nullptr;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RefPtr<Inspector::Protocol::CSS::CSSRule> InspectorCSSAgent::buildObjectForRule(CSSStyleRule* rule)
</span><span class="lines">@@ -1037,7 +1037,7 @@
</span><span class="cx">
</span><span class="cx"> ASSERT(rule->parentStyleSheet());
</span><span class="cx"> InspectorStyleSheet* inspectorStyleSheet = bindStyleSheet(rule->parentStyleSheet());
</span><del>- return inspectorStyleSheet ? inspectorStyleSheet->buildObjectForRule(rule) : nullptr;
</del><ins>+ return inspectorStyleSheet ? inspectorStyleSheet->buildObjectForRule(rule, nullptr) : nullptr;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RefPtr<Inspector::Protocol::Array<Inspector::Protocol::CSS::RuleMatch>> InspectorCSSAgent::buildArrayForMatchedRuleList(const Vector<RefPtr<StyleRule>>& matchedRules, StyleResolver& styleResolver, Element* element)
</span><span class="lines">@@ -1048,7 +1048,7 @@
</span><span class="cx"> SelectorChecker selectorChecker(element->document());
</span><span class="cx">
</span><span class="cx"> for (auto& matchedRule : matchedRules) {
</span><del>- RefPtr<Inspector::Protocol::CSS::CSSRule> ruleObject = buildObjectForRule(matchedRule.get(), styleResolver);
</del><ins>+ RefPtr<Inspector::Protocol::CSS::CSSRule> ruleObject = buildObjectForRule(matchedRule.get(), styleResolver, element);
</ins><span class="cx"> if (!ruleObject)
</span><span class="cx"> continue;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorCSSAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorCSSAgent.h (178766 => 178767)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorCSSAgent.h        2015-01-21 00:28:33 UTC (rev 178766)
+++ trunk/Source/WebCore/inspector/InspectorCSSAgent.h        2015-01-21 00:30:36 UTC (rev 178767)
</span><span class="lines">@@ -152,7 +152,7 @@
</span><span class="cx"> InspectorStyleSheet* assertStyleSheetForId(ErrorString&, const String&);
</span><span class="cx"> Inspector::Protocol::CSS::StyleSheetOrigin detectOrigin(CSSStyleSheet* pageStyleSheet, Document* ownerDocument);
</span><span class="cx">
</span><del>- RefPtr<Inspector::Protocol::CSS::CSSRule> buildObjectForRule(StyleRule*, StyleResolver&);
</del><ins>+ RefPtr<Inspector::Protocol::CSS::CSSRule> buildObjectForRule(StyleRule*, StyleResolver&, Element*);
</ins><span class="cx"> RefPtr<Inspector::Protocol::CSS::CSSRule> buildObjectForRule(CSSStyleRule*);
</span><span class="cx"> RefPtr<Inspector::Protocol::Array<Inspector::Protocol::CSS::RuleMatch>> buildArrayForMatchedRuleList(const Vector<RefPtr<StyleRule>>&, StyleResolver&, Element*);
</span><span class="cx"> RefPtr<Inspector::Protocol::CSS::CSSStyle> buildObjectForAttributesStyle(Element*);
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorStyleSheetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp (178766 => 178767)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp        2015-01-21 00:28:33 UTC (rev 178766)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp        2015-01-21 00:30:36 UTC (rev 178767)
</span><span class="lines">@@ -996,27 +996,58 @@
</span><span class="cx"> .release();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static Ref<Inspector::Protocol::CSS::CSSSelector> buildObjectForSelectorHelper(const String& selectorText, const CSSSelector& selector)
</del><ins>+static bool hasDynamicSpecificity(const CSSSelector& simpleSelector)
</ins><span class="cx"> {
</span><ins>+ // It is possible that these can have a static specificity if each selector in the list has
+ // equal specificity, but lets always report that they can be dynamic.
+ for (const CSSSelector* selector = &simpleSelector; selector; selector = selector->tagHistory()) {
+ if (selector->match() == CSSSelector::PseudoClass) {
+ CSSSelector::PseudoClassType pseudoClassType = selector->pseudoClassType();
+ if (pseudoClassType == CSSSelector::PseudoClassMatches)
+ return true;
+ if (pseudoClassType == CSSSelector::PseudoClassNthChild || pseudoClassType == CSSSelector::PseudoClassNthLastChild) {
+ if (selector->selectorList())
+ return true;
+ return false;
+ }
+ }
+ }
+
+ return false;
+}
+
+static Ref<Inspector::Protocol::CSS::CSSSelector> buildObjectForSelectorHelper(const String& selectorText, const CSSSelector& selector, Element* element)
+{
</ins><span class="cx"> auto inspectorSelector = Inspector::Protocol::CSS::CSSSelector::create()
</span><span class="cx"> .setText(selectorText)
</span><span class="cx"> .release();
</span><span class="cx">
</span><del>- bool ok;
- unsigned specificity = selector.staticSpecificity(ok);
</del><ins>+ if (element) {
+ bool dynamic = hasDynamicSpecificity(selector);
+ if (dynamic)
+ inspectorSelector->setDynamic(true);
</ins><span class="cx">
</span><del>- if (ok) {
- auto tuple = Inspector::Protocol::Array<int>::create();
- tuple->addItem(static_cast<int>((specificity & CSSSelector::idMask) >> 16));
- tuple->addItem(static_cast<int>((specificity & CSSSelector::classMask) >> 8));
- tuple->addItem(static_cast<int>(specificity & CSSSelector::elementMask));
- inspectorSelector->setSpecificity(WTF::move(tuple));
</del><ins>+ SelectorChecker::CheckingContext context(SelectorChecker::Mode::CollectingRules);
+ SelectorChecker selectorChecker(element->document());
+
+ unsigned specificity;
+ bool okay = selectorChecker.match(&selector, element, context, specificity);
+ if (!okay)
+ specificity = selector.staticSpecificity(okay);
+
+ if (okay) {
+ auto tuple = Inspector::Protocol::Array<int>::create();
+ tuple->addItem(static_cast<int>((specificity & CSSSelector::idMask) >> 16));
+ tuple->addItem(static_cast<int>((specificity & CSSSelector::classMask) >> 8));
+ tuple->addItem(static_cast<int>(specificity & CSSSelector::elementMask));
+ inspectorSelector->setSpecificity(WTF::move(tuple));
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return WTF::move(inspectorSelector);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static Ref<Inspector::Protocol::Array<Inspector::Protocol::CSS::CSSSelector>> selectorsFromSource(const CSSRuleSourceData* sourceData, const String& sheetText, const CSSSelectorList& selectorList)
</del><ins>+static Ref<Inspector::Protocol::Array<Inspector::Protocol::CSS::CSSSelector>> selectorsFromSource(const CSSRuleSourceData* sourceData, const String& sheetText, const CSSSelectorList& selectorList, Element* element)
</ins><span class="cx"> {
</span><span class="cx"> DEPRECATED_DEFINE_STATIC_LOCAL(JSC::Yarr::RegularExpression, comment, ("/\\*[^]*?\\*/", TextCaseSensitive, JSC::Yarr::MultilineEnabled));
</span><span class="cx">
</span><span class="lines">@@ -1029,19 +1060,19 @@
</span><span class="cx">
</span><span class="cx"> // We don't want to see any comments in the selector components, only the meaningful parts.
</span><span class="cx"> replace(selectorText, comment, String());
</span><del>- result->addItem(buildObjectForSelectorHelper(selectorText.stripWhiteSpace(), *selector));
</del><ins>+ result->addItem(buildObjectForSelectorHelper(selectorText.stripWhiteSpace(), *selector, element));
</ins><span class="cx">
</span><span class="cx"> selector = CSSSelectorList::next(selector);
</span><span class="cx"> }
</span><span class="cx"> return WTF::move(result);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Ref<Inspector::Protocol::CSS::CSSSelector> InspectorStyleSheet::buildObjectForSelector(const CSSSelector* selector)
</del><ins>+Ref<Inspector::Protocol::CSS::CSSSelector> InspectorStyleSheet::buildObjectForSelector(const CSSSelector* selector, Element* element)
</ins><span class="cx"> {
</span><del>- return buildObjectForSelectorHelper(selector->selectorText(), *selector);
</del><ins>+ return buildObjectForSelectorHelper(selector->selectorText(), *selector, element);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-Ref<Inspector::Protocol::CSS::SelectorList> InspectorStyleSheet::buildObjectForSelectorList(CSSStyleRule* rule)
</del><ins>+Ref<Inspector::Protocol::CSS::SelectorList> InspectorStyleSheet::buildObjectForSelectorList(CSSStyleRule* rule, Element* element)
</ins><span class="cx"> {
</span><span class="cx"> RefPtr<CSSRuleSourceData> sourceData;
</span><span class="cx"> if (ensureParsedDataReady())
</span><span class="lines">@@ -1052,12 +1083,12 @@
</span><span class="cx"> String selectorText = rule->selectorText();
</span><span class="cx">
</span><span class="cx"> if (sourceData)
</span><del>- selectors = selectorsFromSource(sourceData.get(), m_parsedStyleSheet->text(), rule->styleRule().selectorList());
</del><ins>+ selectors = selectorsFromSource(sourceData.get(), m_parsedStyleSheet->text(), rule->styleRule().selectorList(), element);
</ins><span class="cx"> else {
</span><span class="cx"> selectors = Inspector::Protocol::Array<Inspector::Protocol::CSS::CSSSelector>::create();
</span><span class="cx"> const CSSSelectorList& selectorList = rule->styleRule().selectorList();
</span><span class="cx"> for (const CSSSelector* selector = selectorList.first(); selector; selector = CSSSelectorList::next(selector))
</span><del>- selectors->addItem(buildObjectForSelector(selector));
</del><ins>+ selectors->addItem(buildObjectForSelector(selector, element));
</ins><span class="cx"> }
</span><span class="cx"> auto result = Inspector::Protocol::CSS::SelectorList::create()
</span><span class="cx"> .setSelectors(selectors.release())
</span><span class="lines">@@ -1068,14 +1099,14 @@
</span><span class="cx"> return WTF::move(result);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<Inspector::Protocol::CSS::CSSRule> InspectorStyleSheet::buildObjectForRule(CSSStyleRule* rule)
</del><ins>+RefPtr<Inspector::Protocol::CSS::CSSRule> InspectorStyleSheet::buildObjectForRule(CSSStyleRule* rule, Element* element)
</ins><span class="cx"> {
</span><span class="cx"> CSSStyleSheet* styleSheet = pageStyleSheet();
</span><span class="cx"> if (!styleSheet)
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><span class="cx"> auto result = Inspector::Protocol::CSS::CSSRule::create()
</span><del>- .setSelectorList(buildObjectForSelectorList(rule))
</del><ins>+ .setSelectorList(buildObjectForSelectorList(rule, element))
</ins><span class="cx"> .setSourceLine(rule->styleRule().sourceLine())
</span><span class="cx"> .setOrigin(m_origin)
</span><span class="cx"> .setStyle(buildObjectForStyle(&rule->style()))
</span><span class="lines">@@ -1435,7 +1466,7 @@
</span><span class="cx"> collectFlatRules(WTF::move(refRuleList), &rules);
</span><span class="cx">
</span><span class="cx"> for (unsigned i = 0, size = rules.size(); i < size; ++i)
</span><del>- result->addItem(buildObjectForRule(rules.at(i).get()));
</del><ins>+ result->addItem(buildObjectForRule(rules.at(i).get(), nullptr));
</ins><span class="cx">
</span><span class="cx"> return WTF::move(result);
</span><span class="cx"> }
</span><span class="lines">@@ -1464,7 +1495,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> InspectorStyleSheetForInlineStyle::InspectorStyleSheetForInlineStyle(InspectorPageAgent* pageAgent, const String& id, RefPtr<Element>&& element, Inspector::Protocol::CSS::StyleSheetOrigin origin, Listener* listener)
</span><del>- : InspectorStyleSheet(pageAgent, id, nullptr, origin, "", listener)
</del><ins>+ : InspectorStyleSheet(pageAgent, id, nullptr, origin, String(), listener)
</ins><span class="cx"> , m_element(WTF::move(element))
</span><span class="cx"> , m_ruleSourceData(nullptr)
</span><span class="cx"> , m_isStyleTextValid(false)
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorStyleSheeth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.h (178766 => 178767)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorStyleSheet.h        2015-01-21 00:28:33 UTC (rev 178766)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.h        2015-01-21 00:30:36 UTC (rev 178767)
</span><span class="lines">@@ -50,7 +50,6 @@
</span><span class="cx"> class Element;
</span><span class="cx"> class InspectorPageAgent;
</span><span class="cx"> class InspectorStyleSheet;
</span><del>-class Node;
</del><span class="cx">
</span><span class="cx"> #if ENABLE(INSPECTOR)
</span><span class="cx">
</span><span class="lines">@@ -194,7 +193,7 @@
</span><span class="cx"> CSSStyleRule* ruleForId(const InspectorCSSId&) const;
</span><span class="cx"> RefPtr<Inspector::Protocol::CSS::CSSStyleSheetBody> buildObjectForStyleSheet();
</span><span class="cx"> RefPtr<Inspector::Protocol::CSS::CSSStyleSheetHeader> buildObjectForStyleSheetInfo();
</span><del>- RefPtr<Inspector::Protocol::CSS::CSSRule> buildObjectForRule(CSSStyleRule*);
</del><ins>+ RefPtr<Inspector::Protocol::CSS::CSSRule> buildObjectForRule(CSSStyleRule*, Element*);
</ins><span class="cx"> RefPtr<Inspector::Protocol::CSS::CSSStyle> buildObjectForStyle(CSSStyleDeclaration*);
</span><span class="cx"> bool setStyleText(const InspectorCSSId&, const String& text, String* oldText, ExceptionCode&);
</span><span class="cx"> bool setPropertyText(const InspectorCSSId&, unsigned propertyIndex, const String& text, bool overwrite, String* oldPropertyText, ExceptionCode&);
</span><span class="lines">@@ -239,8 +238,8 @@
</span><span class="cx"> bool resourceStyleSheetText(String* result) const;
</span><span class="cx"> bool inlineStyleSheetText(String* result) const;
</span><span class="cx"> Ref<Inspector::Protocol::Array<Inspector::Protocol::CSS::CSSRule>> buildArrayForRuleList(CSSRuleList*);
</span><del>- Ref<Inspector::Protocol::CSS::CSSSelector> buildObjectForSelector(const CSSSelector*);
- Ref<Inspector::Protocol::CSS::SelectorList> buildObjectForSelectorList(CSSStyleRule*);
</del><ins>+ Ref<Inspector::Protocol::CSS::CSSSelector> buildObjectForSelector(const CSSSelector*, Element*);
+ Ref<Inspector::Protocol::CSS::SelectorList> buildObjectForSelectorList(CSSStyleRule*, Element*);
</ins><span class="cx">
</span><span class="cx"> InspectorPageAgent* m_pageAgent;
</span><span class="cx"> String m_id;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (178766 => 178767)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2015-01-21 00:28:33 UTC (rev 178766)
+++ trunk/Source/WebInspectorUI/ChangeLog        2015-01-21 00:30:36 UTC (rev 178767)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2015-01-20 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Should show dynamic specificity values
+ https://bugs.webkit.org/show_bug.cgi?id=140647
+
+ Reviewed by Benjamin Poulain.
+
+ For dynamic selectors, provide text in the tooltip describing that the
+ specificity is dynamic and may change, and pointing out the element
+ the current value was calculated against.
+
+ * Localizations/en.lproj/localizedStrings.js:
+ * UserInterface/Models/CSSSelector.js:
+ (WebInspector.CSSSelector):
+ (WebInspector.CSSSelector.prototype.get specificity):
+ (WebInspector.CSSSelector.prototype.get dynamic):
+ * UserInterface/Models/DOMNodeStyles.js:
+ (WebInspector.DOMNodeStyles.prototype._parseSelectorListPayload.return):
+ (WebInspector.DOMNodeStyles.prototype._parseSelectorListPayload):
+ * UserInterface/Views/CSSStyleDeclarationSection.js:
+ (WebInspector.CSSStyleDeclarationSection.prototype.refresh.appendSelector):
+
</ins><span class="cx"> 2015-01-19 Saam Barati <saambarati1@gmail.com>
</span><span class="cx">
</span><span class="cx"> Web Inspector: Provide a front end for JSC's Control Flow Profiler
</span></span></pre></div>
<a id="trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (178766 => 178767)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js        2015-01-21 00:28:33 UTC (rev 178766)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js        2015-01-21 00:30:36 UTC (rev 178767)
</span><span class="lines">@@ -148,6 +148,9 @@
</span><span class="cx"> localizedStrings["Done"] = "Done";
</span><span class="cx"> localizedStrings["Download Web Archive"] = "Download Web Archive";
</span><span class="cx"> localizedStrings["Duration"] = "Duration";
</span><ins>+localizedStrings["Dynamically calculated for the parent element"] = "Dynamically calculated for the parent element";
+localizedStrings["Dynamically calculated for the selected element"] = "Dynamically calculated for the selected element";
+localizedStrings["Dynamically calculated for the selected element and did not match"] = "Dynamically calculated for the selected element and did not match";
</ins><span class="cx"> localizedStrings["Edit Attribute"] = "Edit Attribute";
</span><span class="cx"> localizedStrings["Edit Breakpoint &"] = "Edit Breakpoint &";
</span><span class="cx"> localizedStrings["Edit Text"] = "Edit Text";
</span><span class="lines">@@ -411,6 +414,7 @@
</span><span class="cx"> localizedStrings["Sockets"] = "Sockets";
</span><span class="cx"> localizedStrings["Source Code"] = "Source Code";
</span><span class="cx"> localizedStrings["Specificity: (%d, %d, %d) "H %d"] = "Specificity: (%d, %d, %d) "H %d";
</span><ins>+localizedStrings["Specificity: No value for selected element"] = "Specificity: No value for selected element";
</ins><span class="cx"> localizedStrings["Spelling"] = "Spelling";
</span><span class="cx"> localizedStrings["Start Playback"] = "Start Playback";
</span><span class="cx"> localizedStrings["Start Recording"] = "Start Recording";
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsCSSSelectorjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CSSSelector.js (178766 => 178767)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/CSSSelector.js        2015-01-21 00:28:33 UTC (rev 178766)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CSSSelector.js        2015-01-21 00:30:36 UTC (rev 178767)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-WebInspector.CSSSelector = function(text, specificity)
</del><ins>+WebInspector.CSSSelector = function(text, specificity, dynamic)
</ins><span class="cx"> {
</span><span class="cx"> WebInspector.Object.call(this);
</span><span class="cx">
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx">
</span><span class="cx"> this._text = text;
</span><span class="cx"> this._specificity = specificity || null;
</span><ins>+ this._dynamic = dynamic || false;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> WebInspector.CSSSelector.prototype = {
</span><span class="lines">@@ -47,5 +48,10 @@
</span><span class="cx"> get specificity()
</span><span class="cx"> {
</span><span class="cx"> return this._specificity;
</span><ins>+ },
+
+ get dynamic()
+ {
+ return this._dynamic;
</ins><span class="cx"> }
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsDOMNodeStylesjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js (178766 => 178767)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js        2015-01-21 00:28:33 UTC (rev 178766)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js        2015-01-21 00:30:36 UTC (rev 178767)
</span><span class="lines">@@ -770,7 +770,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return selectors.map(function(selectorPayload) {
</span><del>- return new WebInspector.CSSSelector(selectorPayload.text, selectorPayload.specificity);
</del><ins>+ return new WebInspector.CSSSelector(selectorPayload.text, selectorPayload.specificity, selectorPayload.dynamic);
</ins><span class="cx"> });
</span><span class="cx"> },
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsCSSStyleDeclarationSectionjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js (178766 => 178767)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js        2015-01-21 00:28:33 UTC (rev 178766)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js        2015-01-21 00:30:36 UTC (rev 178767)
</span><span class="lines">@@ -181,7 +181,20 @@
</span><span class="cx"> var specificity = selector.specificity;
</span><span class="cx"> if (specificity) {
</span><span class="cx"> var approximatedSpecificity = (specificity[0] * 100) + (specificity[1] * 10) + specificity[2];
</span><del>- selectorElement.title = WebInspector.UIString("Specificity: (%d, %d, %d) ≈ %d").format(specificity[0], specificity[1], specificity[2], approximatedSpecificity);
</del><ins>+ var tooltip = WebInspector.UIString("Specificity: (%d, %d, %d) ≈ %d").format(specificity[0], specificity[1], specificity[2], approximatedSpecificity);
+ if (selector.dynamic) {
+ tooltip += "\n";
+ if (this._style.inherited)
+ tooltip += WebInspector.UIString("Dynamically calculated for the parent element");
+ else
+ tooltip += WebInspector.UIString("Dynamically calculated for the selected element");
+ }
+ selectorElement.title = tooltip;
+ } else if (selector.dynamic) {
+ var tooltip = WebInspector.UIString("Specificity: No value for selected element");
+ tooltip += "\n";
+ tooltip += WebInspector.UIString("Dynamically calculated for the selected element and did not match");
+ selectorElement.title = tooltip;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> this._selectorElement.appendChild(selectorElement);
</span></span></pre>
</div>
</div>
</body>
</html>