Changeset 175483 in webkit
- Timestamp:
- Nov 3, 2014 12:03:57 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 17 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r175480 r175483 1 2014-11-03 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Show Selector's Specificity 4 https://bugs.webkit.org/show_bug.cgi?id=138189 5 6 Reviewed by Timothy Hatcher. 7 8 * inspector/css/matched-style-properties.html: 9 * inspector/css/selector-specificity-expected.txt: Added. 10 * inspector/css/selector-specificity.html: Copied from LayoutTests/inspector/css/matched-style-properties.html. 11 1 12 2014-11-03 Lorenzo Tilve <ltilve@igalia.com> 2 13 -
trunk/LayoutTests/inspector/css/matched-style-properties.html
r173406 r175483 36 36 for (var i = 0; i < nodeStyles.matchedRules.length; ++i) { 37 37 var rule = nodeStyles.matchedRules[i]; 38 if (rule.type != WebInspector.CSSRule.Type.Author)38 if (rule.type !== WebInspector.CSSRule.Type.Author) 39 39 continue; 40 40 -
trunk/LayoutTests/inspector/css/selector-specificity.html
r175482 r175483 3 3 <head> 4 4 <style> 5 div#node1 { 6 BACKGROUND-COLOR:blue; 7 COLOR:white; 8 border-STYLE:solid; 9 BORDER-width:0; 10 position:absolute; 11 ToP:0; 12 lEfT:0; 5 *, 6 h1, 7 .class, 8 #id, 9 body h1.class-one.class-two, 10 body #foo, 11 body > #foo, 12 body > #foo.a.b, 13 h1::before, 14 body h1::before, 15 body.a h1.b::before { 16 color: green; 13 17 } 14 18 </style> … … 18 22 var nodeStyles; 19 23 20 function validatePropertyName(name) 21 { 22 if (typeof name != "string") { 23 InspectorTest.log("Unexpected property name type: " + typeof name); 24 return false; 25 } 26 27 if (name.toLowerCase() != name) { 28 InspectorTest.log("Property name contains uppercase characters: " + name); 29 return false; 30 } 31 return true; 32 } 33 34 function validateStyles() 24 function validateSelectors() 35 25 { 36 26 for (var i = 0; i < nodeStyles.matchedRules.length; ++i) { 37 27 var rule = nodeStyles.matchedRules[i]; 38 if (rule.type != WebInspector.CSSRule.Type.Author)28 if (rule.type !== WebInspector.CSSRule.Type.Author) 39 29 continue; 40 30 41 for (var j = 0; j < rule.style.properties.length; ++j) { 42 var property = rule.style.properties[j]; 43 44 if (property.anonymous) 45 continue; 46 47 if (validatePropertyName(property.name)) 48 InspectorTest.log("Property valid: " + property.name); 49 } 31 for (var selector of rule.selectors) 32 InspectorTest.log(selector.text + " (" + selector.specificity.join(", ") + ")"); 50 33 } 51 34 … … 56 39 { 57 40 nodeStyles.removeEventListener(WebInspector.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this); 58 validateS tyles();41 validateSelectors(); 59 42 } 60 43 … … 68 51 nodeStyles.addEventListener(WebInspector.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this); 69 52 else 70 validateS tyles();53 validateSelectors(); 71 54 } else { 72 55 InspectorTest.log("DOM node not found."); … … 79 62 </head> 80 63 <body onload="runTest()"> 81 <p>Testing that the author rules returned by CSSStyleManager.stylesForNode have lowercase property names regardless of CSS source formatting.</p>64 <p>Testing that selectors have expected specificity values.</p> 82 65 83 66 <div id="node1"></div> -
trunk/Source/JavaScriptCore/ChangeLog
r175479 r175483 1 2014-11-03 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Show Selector's Specificity 4 https://bugs.webkit.org/show_bug.cgi?id=138189 5 6 Reviewed by Timothy Hatcher. 7 8 * inspector/protocol/CSS.json: 9 Create a new named type CSSSelector to include a selector's text and specificity. 10 The specificity tuple is optional as it may soon be made dynamic in some cases. 11 1 12 2014-11-03 Joseph Pecoraro <pecoraro@apple.com> 2 13 -
trunk/Source/JavaScriptCore/inspector/protocol/CSS.json
r174906 r175483 60 60 }, 61 61 { 62 "id": "CSSSelector", 63 "type": "object", 64 "properties": [ 65 { "name": "text", "type": "string", "description": "Canonicalized selector text." }, 66 { "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." } 67 ], 68 "description": "CSS selector." 69 }, 70 { 62 71 "id": "SelectorList", 63 72 "type": "object", 64 73 "properties": [ 65 { "name": "selectors", "type": "array", "items": { " type": "string" }, "description": "Selectors in the list." },74 { "name": "selectors", "type": "array", "items": { "$ref": "CSSSelector" }, "description": "Selectors in the list." }, 66 75 { "name": "text", "type": "string", "description": "Rule selector text." }, 67 76 { "name": "range", "$ref": "SourceRange", "optional": true, "description": "Rule selector range in the underlying resource (if available)." } -
trunk/Source/WebCore/ChangeLog
r175481 r175483 1 2014-11-03 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Show Selector's Specificity 4 https://bugs.webkit.org/show_bug.cgi?id=138189 5 6 Reviewed by Timothy Hatcher. 7 8 Test: inspector/css/selector-specificity.html 9 10 * css/CSSSelector.h: 11 Remove very stale comment. '*' is a starAtom now instead of a special -1 tag. 12 Made the specificity masks public class constants. 13 14 * inspector/InspectorStyleSheet.h: 15 * inspector/InspectorStyleSheet.cpp: 16 (WebCore::InspectorStyle::buildArrayForComputedStyle): 17 (WebCore::InspectorStyle::styleWithProperties): 18 (WebCore::InspectorStyleSheet::buildObjectForStyleSheetInfo): 19 Drive by use release() in some cases to reduce ref count churn. 20 21 (WebCore::buildObjectForSelectorHelper): 22 (WebCore::selectorsFromSource): 23 (WebCore::InspectorStyleSheet::buildObjectForSelector): 24 (WebCore::InspectorStyleSheet::buildObjectForSelectorList): 25 Build CSSSelector objects for SelectorLists. 26 1 27 2014-11-03 Chris Dumez <cdumez@apple.com> 2 28 -
trunk/Source/WebCore/css/CSSSelector.cpp
r175453 r175483 62 62 unsigned CSSSelector::specificity() const 63 63 { 64 // make sure the result doesn't overflow65 static const unsigned maxValueMask = 0xffffff;66 static const unsigned idMask = 0xff0000;67 static const unsigned classMask = 0xff00;68 static const unsigned elementMask = 0xff;69 70 64 if (isForPage()) 71 65 return specificityForPage() & maxValueMask; -
trunk/Source/WebCore/css/CSSSelector.h
r175446 r175483 48 48 bool operator==(const CSSSelector&) const; 49 49 50 // tag == -1 means apply to all elements (Selector = *) 50 static const unsigned maxValueMask = 0xffffff; 51 static const unsigned idMask = 0xff0000; 52 static const unsigned classMask = 0xff00; 53 static const unsigned elementMask = 0xff; 51 54 52 55 unsigned specificity() const; -
trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp
r174892 r175483 152 152 TextPosition end = ContentSearchUtilities::textPositionFromOffset(range.end, *lineEndings); 153 153 154 RefPtr<Inspector::Protocol::CSS::SourceRange> result =Inspector::Protocol::CSS::SourceRange::create()154 return Inspector::Protocol::CSS::SourceRange::create() 155 155 .setStartLine(start.m_line.zeroBasedInt()) 156 156 .setStartColumn(start.m_column.zeroBasedInt()) 157 157 .setEndLine(end.m_line.zeroBasedInt()) 158 .setEndColumn(end.m_column.zeroBasedInt()) ;159 return result.release();158 .setEndColumn(end.m_column.zeroBasedInt()) 159 .release(); 160 160 } 161 161 … … 328 328 .setName(propertyEntry.name) 329 329 .setValue(propertyEntry.value); 330 result->addItem(entry );330 result->addItem(entry.release()); 331 331 } 332 332 … … 604 604 .setName(shorthand) 605 605 .setValue(shorthandValue(shorthand)); 606 shorthandEntries->addItem(entry );606 shorthandEntries->addItem(entry.release()); 607 607 } 608 608 } … … 615 615 } 616 616 617 RefPtr<Inspector::Protocol::CSS::CSSStyle> result =Inspector::Protocol::CSS::CSSStyle::create()618 .setCssProperties(propertiesObject )619 .setShorthandEntries(shorthandEntries );620 return result.release();617 return Inspector::Protocol::CSS::CSSStyle::create() 618 .setCssProperties(propertiesObject.release()) 619 .setShorthandEntries(shorthandEntries.release()) 620 .release(); 621 621 } 622 622 … … 982 982 Document* document = styleSheet->ownerDocument(); 983 983 Frame* frame = document ? document->frame() : nullptr; 984 RefPtr<Inspector::Protocol::CSS::CSSStyleSheetHeader> result =Inspector::Protocol::CSS::CSSStyleSheetHeader::create()984 return Inspector::Protocol::CSS::CSSStyleSheetHeader::create() 985 985 .setStyleSheetId(id()) 986 986 .setOrigin(m_origin) … … 988 988 .setSourceURL(finalURL()) 989 989 .setTitle(styleSheet->title()) 990 .setFrameId(m_pageAgent->frameId(frame)); 991 992 return result.release(); 993 } 994 995 static PassRefPtr<Inspector::Protocol::Array<String>> selectorsFromSource(const CSSRuleSourceData* sourceData, const String& sheetText) 990 .setFrameId(m_pageAgent->frameId(frame)) 991 .release(); 992 } 993 994 static PassRefPtr<Inspector::Protocol::CSS::CSSSelector> buildObjectForSelectorHelper(const String& selectorText, unsigned specificity) 995 { 996 RefPtr<Inspector::Protocol::CSS::CSSSelector> selector = Inspector::Protocol::CSS::CSSSelector::create() 997 .setText(selectorText); 998 999 RefPtr<Inspector::Protocol::Array<int>> tuple = Inspector::Protocol::Array<int>::create(); 1000 tuple->addItem(static_cast<int>((specificity & CSSSelector::idMask) >> 16)); 1001 tuple->addItem(static_cast<int>((specificity & CSSSelector::classMask) >> 8)); 1002 tuple->addItem(static_cast<int>(specificity & CSSSelector::elementMask)); 1003 selector->setSpecificity(tuple.release()); 1004 1005 return selector.release(); 1006 } 1007 1008 static PassRefPtr<Inspector::Protocol::Array<Inspector::Protocol::CSS::CSSSelector>> selectorsFromSource(const CSSRuleSourceData* sourceData, const String& sheetText, const CSSSelectorList& selectorList) 996 1009 { 997 1010 DEPRECATED_DEFINE_STATIC_LOCAL(JSC::Yarr::RegularExpression, comment, ("/\\*[^]*?\\*/", TextCaseSensitive, JSC::Yarr::MultilineEnabled)); 998 RefPtr<Inspector::Protocol::Array<String>> result = Inspector::Protocol::Array<String>::create(); 1011 1012 RefPtr<Inspector::Protocol::Array<Inspector::Protocol::CSS::CSSSelector>> result = Inspector::Protocol::Array<Inspector::Protocol::CSS::CSSSelector>::create(); 999 1013 const SelectorRangeList& ranges = sourceData->selectorRanges; 1014 const CSSSelector* selector = selectorList.first(); 1000 1015 for (size_t i = 0, size = ranges.size(); i < size; ++i) { 1001 1016 const SourceRange& range = ranges.at(i); 1002 String selector = sheetText.substring(range.start, range.length());1017 String selectorText = sheetText.substring(range.start, range.length()); 1003 1018 1004 1019 // We don't want to see any comments in the selector components, only the meaningful parts. 1005 replace(selector, comment, ""); 1006 result->addItem(selector.stripWhiteSpace()); 1020 replace(selectorText, comment, String()); 1021 result->addItem(buildObjectForSelectorHelper(selectorText.stripWhiteSpace(), selector->specificity())); 1022 1023 selector = CSSSelectorList::next(selector); 1007 1024 } 1008 1025 return result.release(); 1026 } 1027 1028 PassRefPtr<Inspector::Protocol::CSS::CSSSelector> InspectorStyleSheet::buildObjectForSelector(const CSSSelector* selector) 1029 { 1030 return buildObjectForSelectorHelper(selector->selectorText(), selector->specificity()); 1009 1031 } 1010 1032 … … 1014 1036 if (ensureParsedDataReady()) 1015 1037 sourceData = ruleSourceDataFor(&rule->style()); 1016 RefPtr<Inspector::Protocol::Array< String>> selectors;1038 RefPtr<Inspector::Protocol::Array<Inspector::Protocol::CSS::CSSSelector>> selectors; 1017 1039 1018 1040 // This intentionally does not rely on the source data to avoid catching the trailing comments (before the declaration starting '{'). … … 1020 1042 1021 1043 if (sourceData) 1022 selectors = selectorsFromSource(sourceData.get(), m_parsedStyleSheet->text() );1044 selectors = selectorsFromSource(sourceData.get(), m_parsedStyleSheet->text(), rule->styleRule()->selectorList()); 1023 1045 else { 1024 selectors = Inspector::Protocol::Array< String>::create();1046 selectors = Inspector::Protocol::Array<Inspector::Protocol::CSS::CSSSelector>::create(); 1025 1047 const CSSSelectorList& selectorList = rule->styleRule()->selectorList(); 1026 1048 for (const CSSSelector* selector = selectorList.first(); selector; selector = CSSSelectorList::next(selector)) 1027 selectors->addItem( selector->selectorText());1049 selectors->addItem(buildObjectForSelector(selector)); 1028 1050 } 1029 1051 RefPtr<Inspector::Protocol::CSS::SelectorList> result = Inspector::Protocol::CSS::SelectorList::create() 1030 .setSelectors(selectors )1052 .setSelectors(selectors.release()) 1031 1053 .setText(selectorText) 1032 1054 .release(); … … 1075 1097 InspectorCSSId id = ruleOrStyleId(style); 1076 1098 if (id.isEmpty()) { 1077 RefPtr<Inspector::Protocol::CSS::CSSStyle> bogusStyle =Inspector::Protocol::CSS::CSSStyle::create()1099 return Inspector::Protocol::CSS::CSSStyle::create() 1078 1100 .setCssProperties(Array<Inspector::Protocol::CSS::CSSProperty>::create()) 1079 .setShorthandEntries(Array<Inspector::Protocol::CSS::ShorthandEntry>::create()) ;1080 return bogusStyle.release();1101 .setShorthandEntries(Array<Inspector::Protocol::CSS::ShorthandEntry>::create()) 1102 .release(); 1081 1103 } 1082 1104 RefPtr<InspectorStyle> inspectorStyle = inspectorStyleForId(id); … … 1176 1198 1177 1199 InspectorStyleMap::iterator it = m_inspectorStyles.find(style); 1178 if (it == m_inspectorStyles.end()) { 1179 RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(id, style, this); 1180 return inspectorStyle.release(); 1181 } 1200 if (it == m_inspectorStyles.end()) 1201 return InspectorStyle::create(id, style, this); 1182 1202 return it->value; 1183 1203 } -
trunk/Source/WebCore/inspector/InspectorStyleSheet.h
r175355 r175483 44 44 45 45 class CSSRuleList; 46 class CSSSelector; 46 47 class CSSStyleDeclaration; 47 48 class CSSStyleRule; … … 244 245 bool inlineStyleSheetText(String* result) const; 245 246 PassRefPtr<Inspector::Protocol::Array<Inspector::Protocol::CSS::CSSRule>> buildArrayForRuleList(CSSRuleList*); 247 PassRefPtr<Inspector::Protocol::CSS::CSSSelector> buildObjectForSelector(const CSSSelector*); 246 248 PassRefPtr<Inspector::Protocol::CSS::SelectorList> buildObjectForSelectorList(CSSStyleRule*); 247 249 -
trunk/Source/WebInspectorUI/ChangeLog
r175478 r175483 1 2014-11-03 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Show Selector's Specificity 4 https://bugs.webkit.org/show_bug.cgi?id=138189 5 6 Reviewed by Timothy Hatcher. 7 8 * Localizations/en.lproj/localizedStrings.js: 9 * UserInterface/Main.html: 10 * UserInterface/Test.html: 11 Add new files and strings. 12 13 * UserInterface/Models/CSSMedia.js: 14 Constructor functions are not needed, remove unnecessary code. 15 16 * UserInterface/Models/CSSRule.js: 17 (WebInspector.CSSRule.prototype.set selectors): Deleted. 18 This was unused and is no longer correct. 19 20 (WebInspector.CSSRule.prototype.get matchedSelectorText): 21 Update now that selectors are a list of objects, not just strings. 22 23 * UserInterface/Models/CSSSelector.js: 24 (WebInspector.CSSSelector): 25 (WebInspector.CSSSelector.prototype.get specificity): 26 New model object for protocol type CSS.CSSSelector. 27 28 * UserInterface/Models/DOMNodeStyles.js: 29 (WebInspector.DOMNodeStyles.prototype._parseSelectorListPayload.return): 30 (WebInspector.DOMNodeStyles.prototype._parseSelectorListPayload): 31 (WebInspector.DOMNodeStyles.prototype._parseRulePayload): 32 Handle parsing old and new SelectorLists. 33 34 * UserInterface/Views/CSSStyleDeclarationSection.js: 35 (WebInspector.CSSStyleDeclarationSection.prototype.refresh.appendSelector): 36 (WebInspector.CSSStyleDeclarationSection.prototype.refresh.appendSelectorText): 37 (WebInspector.CSSStyleDeclarationSection.prototype.refresh): 38 Update the code now that the list of selectors are model objects instead 39 of just selector text strings. 40 1 41 2014-11-03 Joseph Pecoraro <pecoraro@apple.com> 2 42 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r174216 r175483 405 405 localizedStrings["Sockets"] = "Sockets"; 406 406 localizedStrings["Source Code"] = "Source Code"; 407 localizedStrings["Specificity: (%d, %d, %d) ≈ %d"] = "Specificity: (%d, %d, %d) ≈ %d"; 407 408 localizedStrings["Spelling"] = "Spelling"; 408 409 localizedStrings["Start Playback"] = "Start Playback"; -
trunk/Source/WebInspectorUI/UserInterface/Main.html
r174926 r175483 213 213 <script src="Models/CSSProperty.js"></script> 214 214 <script src="Models/CSSRule.js"></script> 215 <script src="Models/CSSSelector.js"></script> 215 216 <script src="Models/CSSStyleDeclaration.js"></script> 216 217 <script src="Models/CSSStyleSheet.js"></script> -
trunk/Source/WebInspectorUI/UserInterface/Models/CSSMedia.js
r164543 r175483 33 33 }; 34 34 35 WebInspector.Object.addConstructorFunctions(WebInspector.CSSMedia);36 37 35 WebInspector.CSSMedia.Type = { 38 36 MediaRule: "css-media-type-media-rule", -
trunk/Source/WebInspectorUI/UserInterface/Models/CSSRule.js
r164543 r175483 140 140 }, 141 141 142 set selectors(selectors)143 {144 this.selectorText = (selectors || []).join(", ");145 },146 147 142 get matchedSelectorIndices() 148 143 { … … 179 174 return this._matchedSelectorText; 180 175 181 this._matchedSelectorText = this.matchedSelectors. join(", ");176 this._matchedSelectorText = this.matchedSelectors.map(function(x) { return x.text; }).join(", "); 182 177 183 178 return this._matchedSelectorText; -
trunk/Source/WebInspectorUI/UserInterface/Models/CSSSelector.js
r175482 r175483 1 1 /* 2 * Copyright (C) 201 3Apple Inc. All rights reserved.2 * Copyright (C) 2014 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 WebInspector.CSS Media = function(type, text, sourceCodeLocation)26 WebInspector.CSSSelector = function(text, specificity) 27 27 { 28 28 WebInspector.Object.call(this); 29 29 30 this._type = type || null; 31 this._text = text || ""; 32 this._sourceCodeLocation = sourceCodeLocation || null; 30 console.assert(text); 31 32 this._text = text; 33 this._specificity = specificity || null; 33 34 }; 34 35 35 WebInspector.Object.addConstructorFunctions(WebInspector.CSSMedia); 36 37 WebInspector.CSSMedia.Type = { 38 MediaRule: "css-media-type-media-rule", 39 ImportRule: "css-media-type-import-rule", 40 LinkedStyleSheet: "css-media-type-linked-stylesheet", 41 InlineStyleSheet: "css-media-type-inline-stylesheet" 42 }; 43 44 WebInspector.CSSMedia.prototype = { 45 constructor: WebInspector.CSSMedia, 36 WebInspector.CSSSelector.prototype = { 37 constructor: WebInspector.CSSSelector, 38 __proto__: WebInspector.Object.prototype, 46 39 47 40 // Public 48 49 get type()50 {51 return this._type;52 },53 41 54 42 get text() … … 57 45 }, 58 46 59 get s ourceCodeLocation()47 get specificity() 60 48 { 61 return this._s ourceCodeLocation;49 return this._specificity; 62 50 } 63 51 }; 64 65 WebInspector.CSSMedia.prototype.__proto__ = WebInspector.Object.prototype; -
trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js
r173492 r175483 746 746 }, 747 747 748 _parseSelectorListPayload: function(selectorList) 749 { 750 // COMPATIBILITY (iOS 6): The payload did not have 'selectorList'. 751 if (!selectorList) 752 return []; 753 754 var selectors = selectorList.selectors; 755 if (!selectors.length) 756 return []; 757 758 // COMPATIBILITY (iOS 8): The selectorList payload was an array of selector text strings. 759 // Now they are CSSSelector objects with multiple properties. 760 if (typeof selectors[0] === "string") { 761 return selectors.map(function(selectorText) { 762 return new WebInspector.CSSSelector(selectorText); 763 }); 764 } 765 766 return selectors.map(function(selectorPayload) { 767 return new WebInspector.CSSSelector(selectorPayload.text, selectorPayload.specificity); 768 }); 769 }, 770 748 771 _parseRulePayload: function(payload, matchedSelectorIndices, node, inherited, ruleOccurrences) 749 772 { … … 792 815 // now it has 'selectorList' with a 'text' property. Support both here. 793 816 var selectorText = payload.selectorList ? payload.selectorList.text : payload.selectorText; 794 var selectors = payload.selectorList ? payload.selectorList.selectors : [];817 var selectors = this._parseSelectorListPayload(payload.selectorList); 795 818 796 819 // COMPATIBILITY (iOS 6): The payload did not have 'selectorList'. -
trunk/Source/WebInspectorUI/UserInterface/Test.html
r173992 r175483 75 75 <script src="Models/CSSProperty.js"></script> 76 76 <script src="Models/CSSRule.js"></script> 77 <script src="Models/CSSSelector.js"></script> 77 78 <script src="Models/CSSStyleDeclaration.js"></script> 78 79 <script src="Models/CSSStyleSheet.js"></script> -
trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js
r164543 r175483 169 169 this._originElement.appendChild(document.createTextNode(" \u2014 ")); 170 170 171 function appendSelector(selectorText, matched) 171 function appendSelector(selector, matched) 172 { 173 console.assert(selector instanceof WebInspector.CSSSelector); 174 175 var selectorElement = document.createElement("span"); 176 selectorElement.textContent = selector.text; 177 178 if (matched) 179 selectorElement.className = WebInspector.CSSStyleDeclarationSection.MatchedSelectorElementStyleClassName; 180 181 var specificity = selector.specificity; 182 if (specificity) { 183 var approximatedSpecificity = (specificity[0] * 100) + (specificity[1] * 10) + specificity[2]; 184 selectorElement.title = WebInspector.UIString("Specificity: (%d, %d, %d) ≈ %d").format(specificity[0], specificity[1], specificity[2], approximatedSpecificity); 185 } 186 187 this._selectorElement.appendChild(selectorElement); 188 } 189 190 function appendSelectorTextKnownToMatch(selectorText) 172 191 { 173 192 var selectorElement = document.createElement("span"); 174 if (matched)175 selectorElement.className = WebInspector.CSSStyleDeclarationSection.MatchedSelectorElementStyleClassName;176 193 selectorElement.textContent = selectorText; 194 selectorElement.className = WebInspector.CSSStyleDeclarationSection.MatchedSelectorElementStyleClassName; 177 195 this._selectorElement.appendChild(selectorElement); 178 196 } … … 191 209 } 192 210 } else 193 appendSelector .call(this, this._style.ownerRule.selectorText, true);211 appendSelectorTextKnownToMatch.call(this, this._style.ownerRule.selectorText); 194 212 195 213 if (this._style.ownerRule.sourceCodeLocation) { … … 224 242 225 243 case WebInspector.CSSStyleDeclaration.Type.Inline: 226 appendSelector .call(this, WebInspector.displayNameForNode(this._style.node), true);244 appendSelectorTextKnownToMatch.call(this, WebInspector.displayNameForNode(this._style.node)); 227 245 this._originElement.appendChild(document.createTextNode(WebInspector.UIString("Style Attribute"))); 228 246 break; 229 247 230 248 case WebInspector.CSSStyleDeclaration.Type.Attribute: 231 appendSelector .call(this, WebInspector.displayNameForNode(this._style.node), true);249 appendSelectorTextKnownToMatch.call(this, WebInspector.displayNameForNode(this._style.node)); 232 250 this._originElement.appendChild(document.createTextNode(WebInspector.UIString("HTML Attributes"))); 233 251 break;
Note: See TracChangeset
for help on using the changeset viewer.