Web Inspector: Should show dynamic specificity values
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Jan 2015 00:30:36 +0000 (00:30 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Jan 2015 00:30:36 +0000 (00:30 +0000)
commita9e43ece1c2e1a407f965cbb06de4c08377cd464
treeddf0234c0f298b3aff4eea02c530c80255d9e7a3
parentdea62277e3cf43eac8ca5ded22aaf1efa7a9844b
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@178767 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/css/selector-dynamic-specificity-expected.txt [new file with mode: 0644]
LayoutTests/inspector/css/selector-dynamic-specificity.html [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/protocol/CSS.json
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorCSSAgent.cpp
Source/WebCore/inspector/InspectorCSSAgent.h
Source/WebCore/inspector/InspectorStyleSheet.cpp
Source/WebCore/inspector/InspectorStyleSheet.h
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/UserInterface/Models/CSSSelector.js
Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js
Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js