Changeset 56383 in webkit
- Timestamp:
- Mar 23, 2010 12:07:38 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r56382 r56383 1 2010-03-22 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Dave Hyatt. 4 5 Web Inspector: display CSS selector source line in the styles sidebar pane. 6 7 https://bugs.webkit.org/show_bug.cgi?id=36414 8 9 This change adds a sourceLine field into the CSSStyleRule that is populated 10 from within the parser. CSSParser is now keeping track of the line numbers 11 and last selector line number that is being used while creating CSSStyleRules. 12 13 * inspector/styles-source-lines-expected.txt: Added. 14 * inspector/styles-source-lines.html: Added. 15 1 16 2010-03-22 Qi Zhang <qi.2.zhang@nokia.com> 2 17 -
trunk/WebCore/ChangeLog
r56382 r56383 1 2010-03-22 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Dave Hyatt. 4 5 Web Inspector: display CSS selector source line in the styles sidebar pane. 6 7 https://bugs.webkit.org/show_bug.cgi?id=36414 8 9 This change adds a sourceLine field into the CSSStyleRule that is populated 10 from within the parser. CSSParser is now keeping track of the line numbers 11 and last selector line number that is being used while creating CSSStyleRules. 12 13 Test: inspector/styles-source-lines.html 14 15 * css/CSSGrammar.y: 16 * css/CSSParser.cpp: 17 (WebCore::CSSParser::CSSParser): 18 (WebCore::CSSParser::lex): 19 (WebCore::CSSParser::countLines): 20 (WebCore::CSSParser::createStyleRule): 21 * css/CSSParser.h: 22 (WebCore::CSSParser::updateLastSelectorLine): 23 * css/CSSStyleRule.cpp: 24 (WebCore::CSSStyleRule::CSSStyleRule): 25 * css/CSSStyleRule.h: 26 (WebCore::CSSStyleRule::create): 27 (WebCore::CSSStyleRule::sourceLine): 28 * css/tokenizer.flex: 29 * inspector/InspectorDOMAgent.cpp: 30 (WebCore::InspectorDOMAgent::buildObjectForRule): 31 * inspector/front-end/DOMAgent.js: 32 (WebInspector.CSSStyleDeclaration.parseRule): 33 * inspector/front-end/StylesSidebarPane.js: 34 (WebInspector.StylePropertiesSection): 35 1 36 2010-03-22 Qi Zhang <qi.2.zhang@nokia.com> 2 37 -
trunk/WebCore/css/CSSGrammar.y
r56187 r56383 787 787 $$->shrink(0); 788 788 $$->append(p->sinkFloatingSelector($1)); 789 p->updateLastSelectorLine(); 789 790 } 790 791 } … … 794 795 $$ = $1; 795 796 $$->append(p->sinkFloatingSelector($4)); 797 p->updateLastSelectorLine(); 796 798 } else 797 799 $$ = 0; -
trunk/WebCore/css/CSSParser.cpp
r56167 r56383 144 144 , m_data(0) 145 145 , yy_start(1) 146 , m_line(0) 147 , m_lastSelectorLine(0) 146 148 , m_allowImportRules(true) 147 149 , m_allowVariablesRules(true) … … 4693 4695 YYSTYPE* yylval = static_cast<YYSTYPE*>(yylvalWithoutType); 4694 4696 int length; 4695 4697 4696 4698 lex(); 4697 4699 … … 4918 4920 } 4919 4921 4922 void CSSParser::countLines() 4923 { 4924 for (UChar* current = yytext; current < yytext + yyleng; ++current) { 4925 if (*current == '\n') 4926 ++m_line; 4927 } 4928 } 4929 4920 4930 CSSSelector* CSSParser::createFloatingSelector() 4921 4931 { … … 5087 5097 CSSStyleRule* result = 0; 5088 5098 if (selectors) { 5089 RefPtr<CSSStyleRule> rule = CSSStyleRule::create(m_styleSheet );5099 RefPtr<CSSStyleRule> rule = CSSStyleRule::create(m_styleSheet, m_lastSelectorLine); 5090 5100 rule->adoptSelectorVector(*selectors); 5091 5101 if (m_hasFontFaceOnlyValues) -
trunk/WebCore/css/CSSParser.h
r55576 r56383 196 196 void addUnresolvedProperty(int propId, bool important); 197 197 void invalidBlockHit(); 198 198 199 199 Vector<CSSSelector*>* reusableSelectorVector() { return &m_reusableSelectorVector; } 200 201 void updateLastSelectorLine() { m_lastSelectorLine = m_line; } 200 202 201 203 bool m_strict; … … 228 230 int token() { return yyTok; } 229 231 UChar* text(int* length); 232 void countLines(); 230 233 int lex(); 231 234 … … 254 257 int yyTok; 255 258 int yy_start; 259 int m_line; 260 int m_lastSelectorLine; 256 261 257 262 bool m_allowImportRules; -
trunk/WebCore/css/CSSStyleRule.cpp
r39441 r56383 28 28 namespace WebCore { 29 29 30 CSSStyleRule::CSSStyleRule(CSSStyleSheet* parent )30 CSSStyleRule::CSSStyleRule(CSSStyleSheet* parent, int sourceLine) 31 31 : CSSRule(parent) 32 , m_sourceLine(sourceLine) 32 33 { 33 34 } -
trunk/WebCore/css/CSSStyleRule.h
r39441 r56383 35 35 class CSSStyleRule : public CSSRule { 36 36 public: 37 static PassRefPtr<CSSStyleRule> create(CSSStyleSheet* parent )37 static PassRefPtr<CSSStyleRule> create(CSSStyleSheet* parent, int sourceLine) 38 38 { 39 return adoptRef(new CSSStyleRule(parent ));39 return adoptRef(new CSSStyleRule(parent, sourceLine)); 40 40 } 41 41 virtual ~CSSStyleRule(); … … 59 59 virtual void addSubresourceStyleURLs(ListHashSet<KURL>& urls); 60 60 61 int sourceLine() { return m_sourceLine; } 62 61 63 private: 62 CSSStyleRule(CSSStyleSheet* parent );64 CSSStyleRule(CSSStyleSheet* parent, int sourceLine); 63 65 64 66 virtual bool isStyleRule() { return true; } … … 69 71 RefPtr<CSSMutableStyleDeclaration> m_style; 70 72 CSSSelectorList m_selectorList; 73 int m_sourceLine; 71 74 }; 72 75 -
trunk/WebCore/css/tokenizer.flex
r45919 r56383 29 29 %% 30 30 31 \/\*[^*]*\*+([^/*][^*]*\*+)*\/ /* ignore comments */31 \/\*[^*]*\*+([^/*][^*]*\*+)*\/ {countLines(); /* ignore comments */ } 32 32 33 [ \t\r\n\f]+ { yyTok = WHITESPACE; return yyTok;}33 [ \t\r\n\f]+ {countLines(); yyTok = WHITESPACE; return yyTok;} 34 34 35 35 "<!--" {yyTok = SGML_CD; return yyTok;} -
trunk/WebCore/inspector/InspectorDOMAgent.cpp
r56353 r56383 1103 1103 result.set("selectorText", rule->selectorText()); 1104 1104 result.set("cssText", rule->cssText()); 1105 result.set("sourceLine", rule->sourceLine()); 1105 1106 if (parentStyleSheet) { 1106 1107 ScriptObject parentStyleSheetValue = m_frontend->newScriptObject(); -
trunk/WebCore/inspector/front-end/DOMAgent.js
r56161 r56383 551 551 rule.isUser = payload.isUser; 552 552 rule.isViaInspector = payload.isViaInspector; 553 rule.sourceLine = payload.sourceLine; 553 554 if (payload.parentStyleSheet) 554 555 rule.parentStyleSheet = { href: payload.parentStyleSheet.href }; -
trunk/WebCore/inspector/front-end/StylesSidebarPane.js
r56237 r56383 491 491 if (this.styleRule.parentStyleSheet && this.styleRule.parentStyleSheet.href) { 492 492 var url = this.styleRule.parentStyleSheet.href; 493 subtitle = WebInspector.linkifyURL(url, WebInspector.displayNameForURL(url)); 494 this.subtitleElement.addStyleClass("file"); 493 this.subtitleElement.appendChild(WebInspector.linkifyResourceAsNode(url, "resources", this.rule.sourceLine + 1)); 495 494 } else if (isUserAgent) 496 495 subtitle = WebInspector.UIString("user agent stylesheet"); … … 504 503 if (isInherited) 505 504 this.element.addStyleClass("show-inherited"); 506 this.subtitle = subtitle; 505 if (subtitle) 506 this.subtitle = subtitle; 507 507 } 508 508
Note: See TracChangeset
for help on using the changeset viewer.