Changeset 122114 in webkit
- Timestamp:
- Jul 9, 2012 10:30:38 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/inspector/syntax-highlight-css-expected.txt
r103231 r122114 5 5 @import url(style.css);: webkit-css-at-rule,*,webkit-css-keyword,* 6 6 @import url("style.css") projection, tv;: webkit-css-at-rule,*,webkit-css-keyword,*,webkit-css-string,*,webkit-css-keyword,*,webkit-css-keyword,* 7 @import "/css/fireball_unicode.css"; html {}: webkit-css-at-rule,*,webkit-css-string,*,webkit-css-selector,* 8 @media screen { body { color: red; } }: webkit-css-at-rule,*,webkit-css-keyword,*,webkit- css-selector,*,webkit-css-property,*,webkit-css-color,*9 @font-face { font-family: "MyHelvetica"; }: webkit-css-at-rule,*,webkit- css-property,*,webkit-css-string,*10 p { color: color; red: red; color: #000; color: #FFF; color: #123AbC; color: #faebfe; color:papayawhip; }: webkit-css-selector,*,webkit- css-property,*,webkit-css-color,*,webkit-css-property,*,webkit-css-color,*,webkit-css-property,*,webkit-css-color,*,webkit-css-property,*,webkit-css-color,*,webkit-css-property,*,webkit-css-color,*,webkit-css-property,*,webkit-css-color,*11 p { margin: -10px !important; }: webkit-css-selector,*,webkit- css-property,*,webkit-css-number,*,webkit-css-important,*7 @import "/css/fireball_unicode.css"; html {}: webkit-css-at-rule,*,webkit-css-string,*,webkit-css-selector,*,webkit-block-start,webkit-block-end 8 @media screen { body { color: red; } }: webkit-css-at-rule,*,webkit-css-keyword,*,webkit-block-start,*,webkit-css-selector,*,webkit-block-start,*,webkit-css-property,*,webkit-css-color,*,webkit-block-end,*,webkit-block-end 9 @font-face { font-family: "MyHelvetica"; }: webkit-css-at-rule,*,webkit-block-start,*,webkit-css-property,*,webkit-css-string,*,webkit-block-end 10 p { color: color; red: red; color: #000; color: #FFF; color: #123AbC; color: #faebfe; color:papayawhip; }: webkit-css-selector,*,webkit-block-start,*,webkit-css-property,*,webkit-css-color,*,webkit-css-property,*,webkit-css-color,*,webkit-css-property,*,webkit-css-color,*,webkit-css-property,*,webkit-css-color,*,webkit-css-property,*,webkit-css-color,*,webkit-css-property,*,webkit-css-color,*,webkit-block-end 11 p { margin: -10px !important; }: webkit-css-selector,*,webkit-block-start,*,webkit-css-property,*,webkit-css-number,*,webkit-css-important,*,webkit-block-end 12 12 -
trunk/LayoutTests/inspector/syntax-highlight-javascript-expected.txt
r86554 r122114 16 16 / 17 17 */foo: webkit-javascript-ident,webkit-javascript-comment,,webkit-javascript-comment,,webkit-javascript-comment,webkit-javascript-ident 18 {0: true}: *,webkit-javascript-number,*,webkit-javascript-keyword,*18 {0: true}: webkit-block-start,webkit-javascript-number,*,webkit-javascript-keyword,webkit-block-end 19 19 var toString;: webkit-javascript-keyword,*,webkit-javascript-ident,* 20 20 -
trunk/Source/WebCore/ChangeLog
r122110 r122114 1 2012-07-09 Pavel Feldman <pfeldman@chromium.org> 2 3 Web Inspector: unindent line ending block upon { hit. 4 https://bugs.webkit.org/show_bug.cgi?id=90795 5 6 Reviewed by Vsevolod Vlasov. 7 8 Added block-start / block-end markup into the highlighter. 9 10 * inspector/front-end/SourceCSSTokenizer.js: 11 (WebInspector.SourceCSSTokenizer.prototype.nextToken): 12 * inspector/front-end/SourceCSSTokenizer.re2js: 13 * inspector/front-end/SourceJavaScriptTokenizer.js: 14 (WebInspector.SourceJavaScriptTokenizer.prototype.nextToken): 15 * inspector/front-end/SourceJavaScriptTokenizer.re2js: 16 * inspector/front-end/TextEditor.js: 17 (WebInspector.TextEditorMainPanel.prototype._applyDomUpdates): 18 (WebInspector.TextEditorMainPanel.prototype._unindentAfterBlock): 19 1 20 2012-07-09 Sheriff Bot <webkit.review.bot@gmail.com> 2 21 -
trunk/Source/WebCore/inspector/front-end/SourceCSSTokenizer.js
r114880 r122114 1 /* Generated by re2c 0.13.5 on Mon Dec 19 17:28:29 2011*/1 /* Generated by re2c 0.13.5 on Mon Jul 9 19:31:30 2012 */ 2 2 /* 3 3 * Copyright (C) 2009 Google Inc. All rights reserved. … … 34 34 /* 35 35 re2c -isc Source/WebCore/inspector/front-end/SourceCSSTokenizer.re2js \ 36 | sed 's|^yy\([^:]*\)*\:|case \1:|' \ 37 | sed 's|[*]cursor[+][+]|this._charAt(cursor++)|' \ 38 | sed 's|[[*][+][+]cursor|this._charAt(++cursor)|' \ 39 | sed 's|[*]cursor|this._charAt(cursor)|' \ 40 | sed 's|yych = \*\([^;]*\)|yych = this._charAt\1|' \ 41 | sed 's|{ gotoCase = \([^; continue; };]*\)|{ gotoCase = \1; continue; }|' \ 42 | sed 's|unsigned\ int|var|' \ 43 | sed 's|var\ yych|case 1: case 1: var yych|' > Source/WebCore/inspector/front-end/SourceCSSTokenizer.js 36 | sed 's|^yy\([^:]*\)*\:|case \1:|' \ 37 | sed 's|[*]cursor[+][+]|this._charAt(cursor++)|' \ 38 | sed 's|[[*][+][+]cursor|this._charAt(++cursor)|' \ 39 | sed 's|[*]cursor|this._charAt(cursor)|' \ 40 | sed 's|yych = \*\([^;]*\)|yych = this._charAt\1|' \ 41 | sed 's|{ gotoCase = \([^; continue; };]*\)|{ gotoCase = \1; continue; }|' \ 42 | sed 's|yych <= \(0x[0-9a-fA-F]*\)|yych \<\= String.fromCharCode(\1)|' \ 43 | sed 's|unsigned\ int|var|' \ 44 | sed 's|var\ yych|case 1: case 1: var yych|' > Source/WebCore/inspector/front-end/SourceCSSTokenizer.js 44 45 */ 45 46 … … 649 650 ++cursor; 650 651 { 651 this.tokenType = null;652 this.tokenType = "block-start"; 652 653 if (this._condition.parseCondition === this._parseConditions.AT_MEDIA_RULE) 653 654 this._condition.parseCondition = this._parseConditions.INITIAL; … … 659 660 ++cursor; 660 661 { 661 this.tokenType = null;662 this.tokenType = "block-end"; 662 663 this._condition.parseCondition = this._parseConditions.INITIAL; 663 664 return cursor; -
trunk/Source/WebCore/inspector/front-end/SourceCSSTokenizer.re2js
r114880 r122114 33 33 /* 34 34 re2c -isc Source/WebCore/inspector/front-end/SourceCSSTokenizer.re2js \ 35 | sed 's|^yy\([^:]*\)*\:|case \1:|' \ 36 | sed 's|[*]cursor[+][+]|this._charAt(cursor++)|' \ 37 | sed 's|[[*][+][+]cursor|this._charAt(++cursor)|' \ 38 | sed 's|[*]cursor|this._charAt(cursor)|' \ 39 | sed 's|yych = \*\([^;]*\)|yych = this._charAt\1|' \ 40 | sed 's|goto case \([^;]*\)|{ gotoCase = \1; continue; }|' \ 41 | sed 's|unsigned\ int|var|' \ 42 | sed 's|var\ yych|case 1: var yych|' > Source/WebCore/inspector/front-end/SourceCSSTokenizer.js 35 | sed 's|^yy\([^:]*\)*\:|case \1:|' \ 36 | sed 's|[*]cursor[+][+]|this._charAt(cursor++)|' \ 37 | sed 's|[[*][+][+]cursor|this._charAt(++cursor)|' \ 38 | sed 's|[*]cursor|this._charAt(cursor)|' \ 39 | sed 's|yych = \*\([^;]*\)|yych = this._charAt\1|' \ 40 | sed 's|goto case \([^;]*\)|{ gotoCase = \1; continue; }|' \ 41 | sed 's|yych <= \(0x[0-9a-fA-F]*\)|yych \<\= String.fromCharCode(\1)|' \ 42 | sed 's|unsigned\ int|var|' \ 43 | sed 's|var\ yych|case 1: var yych|' > Source/WebCore/inspector/front-end/SourceCSSTokenizer.js 43 44 */ 44 45 … … 212 213 <INITIAL> OpenCurlyBracket 213 214 { 214 this.tokenType = null;215 this.tokenType = "block-start"; 215 216 if (this._condition.parseCondition === this._parseConditions.AT_MEDIA_RULE) 216 217 this._condition.parseCondition = this._parseConditions.INITIAL; … … 222 223 <INITIAL> CloseCurlyBracket 223 224 { 224 this.tokenType = null;225 this.tokenType = "block-end"; 225 226 this._condition.parseCondition = this._parseConditions.INITIAL; 226 227 return cursor; -
trunk/Source/WebCore/inspector/front-end/SourceFrame.js
r121957 r122114 170 170 this._lineToHighlight = line; 171 171 this._innerHighlightLineIfNeeded(); 172 this._textEditor.setSelection(WebInspector.TextRange.createFromLocation(line, 0)); 172 173 }, 173 174 -
trunk/Source/WebCore/inspector/front-end/SourceJavaScriptTokenizer.js
r108331 r122114 1 /* Generated by re2c 0.13.5 on Fri May 13 20:01:13 2011*/1 /* Generated by re2c 0.13.5 on Mon Jul 9 18:23:02 2012 */ 2 2 /* 3 3 * Copyright (C) 2009 Google Inc. All rights reserved. … … 30 30 */ 31 31 32 // Generate js file as follows: 33 // 34 // re2c -isc WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js \ 35 // | sed 's|^yy\([^:]*\)*\:|case \1:|' \ 36 // | sed 's|[*]cursor[+][+]|this._charAt(cursor++)|' \ 37 // | sed 's|[[*][+][+]cursor|this._charAt(++cursor)|' \ 38 // | sed 's|[*]cursor|this._charAt(cursor)|' \ 39 // | sed 's|yych = \*\([^;]*\)|yych = this._charAt\1|' \ 40 // | sed 's|{ gotoCase = \([^; continue; };]*\)|{ gotoCase = \1; continue; }|' \ 41 // | sed 's|yych <= \(0x[0-9a-fA-f]+\)|yych <= String.fromCharCode(\1)|' \ 42 // | sed 's|unsigned\ int|var|' \ 43 // | sed 's|var\ yych|case 1: case 1: var yych|' 32 /* 33 * Generate js file as follows: 34 re2c -isc Source/WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js \ 35 | sed 's|^yy\([^:]*\)*\:|case \1:|' \ 36 | sed 's|[*]cursor[+][+]|this._charAt(cursor++)|' \ 37 | sed 's|[[*][+][+]cursor|this._charAt(++cursor)|' \ 38 | sed 's|[*]cursor|this._charAt(cursor)|' \ 39 | sed 's|yych = \*\([^;]*\)|yych = this._charAt\1|' \ 40 | sed 's|{ gotoCase = \([^; continue; };]*\)|{ gotoCase = \1; continue; }|' \ 41 | sed 's|yych <= \(0x[0-9a-fA-F]*\)|yych \<\= String.fromCharCode(\1)|' \ 42 | sed 's|unsigned\ int|var|' \ 43 | sed 's|var\ yych|case 1: case 1: var yych|' 44 */ 44 45 45 46 /** … … 91 92 switch (gotoCase) 92 93 // Following comment is replaced with generated state machine. 93 94 94 95 { 95 96 case 1: var yych; … … 244 245 case 18: 245 246 this.setLexCondition(this._lexConditions.NODIV); 246 { this.tokenType = null; return cursor; } 247 { 248 var token = this._line.charAt(cursorOnEnter); 249 if (token === "{") 250 this.tokenType = "block-start"; 251 else if (token === "}") 252 this.tokenType = "block-end"; 253 else this.tokenType = null; 254 return cursor; 255 } 247 256 case 19: 248 257 yyaccept = 0; … … 1175 1184 if ((yych = this._charAt(cursor)) == '=') { gotoCase = 260; continue; }; 1176 1185 case 139: 1177 { this.tokenType = null; return cursor; } 1186 { 1187 var token = this._line.charAt(cursorOnEnter); 1188 if (token === "{") 1189 this.tokenType = "block-start"; 1190 else if (token === "}") 1191 this.tokenType = "block-end"; 1192 else this.tokenType = null; 1193 return cursor; 1194 } 1178 1195 case 140: 1179 1196 yyaccept = 0; -
trunk/Source/WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js
r108331 r122114 29 29 */ 30 30 31 // Generate js file as follows: 32 // 33 // re2c -isc Source/WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js \ 34 // | sed 's|^yy\([^:]*\)*\:|case \1:|' \ 35 // | sed 's|[*]cursor[+][+]|this._charAt(cursor++)|' \ 36 // | sed 's|[[*][+][+]cursor|this._charAt(++cursor)|' \ 37 // | sed 's|[*]cursor|this._charAt(cursor)|' \ 38 // | sed 's|yych = \*\([^;]*\)|yych = this._charAt\1|' \ 39 // | sed 's|goto case \([^;]*\)|{ gotoCase = \1; continue; }|' \ 40 // | sed 's|yych <= \(0x[0-9a-fA-f]*\)|yych <= String.fromCharCode(\1)|' \ 41 // | sed 's|unsigned\ int|var|' \ 42 // | sed 's|var\ yych|case 1: var yych|' 31 /* 32 * Generate js file as follows: 33 re2c -isc Source/WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js \ 34 | sed 's|^yy\([^:]*\)*\:|case \1:|' \ 35 | sed 's|[*]cursor[+][+]|this._charAt(cursor++)|' \ 36 | sed 's|[[*][+][+]cursor|this._charAt(++cursor)|' \ 37 | sed 's|[*]cursor|this._charAt(cursor)|' \ 38 | sed 's|yych = \*\([^;]*\)|yych = this._charAt\1|' \ 39 | sed 's|goto case \([^;]*\)|{ gotoCase = \1; continue; }|' \ 40 | sed 's|yych <= \(0x[0-9a-fA-F]*\)|yych \<\= String.fromCharCode(\1)|' \ 41 | sed 's|unsigned\ int|var|' \ 42 | sed 's|var\ yych|case 1: var yych|' > Source/WebCore/inspector/front-end/SourceJavaScriptTokenizer.js 43 */ 43 44 44 45 /** … … 178 179 } 179 180 <DIV,NODIV> RightParen => DIV { this.tokenType = null; return cursor; } 180 <DIV,NODIV> Punctuation => NODIV { this.tokenType = null; return cursor; } 181 <DIV,NODIV> Punctuation => NODIV 182 { 183 var token = this._line.charAt(cursorOnEnter); 184 if (token === "{") 185 this.tokenType = "block-start"; 186 else if (token === "}") 187 this.tokenType = "block-end"; 188 else this.tokenType = null; 189 return cursor; 190 } 181 191 <DIV> Division => NODIV { this.tokenType = null; return cursor; } 182 192 <*> [^] { this.tokenType = null; return cursor; } -
trunk/Source/WebCore/inspector/front-end/TextEditor.js
r121984 r122114 2192 2192 } 2193 2193 2194 if (lines.length === 1 && lines[0] === "}" && oldRange.isEmpty() && selection.isEmpty() && !this._textModel.line(oldRange.endLine).trim()) 2195 this._unindentAfterBlock(oldRange, selection); 2196 2194 2197 // This is a "foreign" call outside of this class. Should be before we delete the dirty lines flag. 2195 2198 this._enterTextChangeMode(); … … 2203 2206 2204 2207 this._exitTextChangeMode(oldRange, newRange); 2208 }, 2209 2210 /** 2211 * @param {WebInspector.TextRange} oldRange 2212 * @param {WebInspector.TextRange} selection 2213 */ 2214 _unindentAfterBlock: function(oldRange, selection) 2215 { 2216 var nestingLevel = 1; 2217 for (var i = oldRange.endLine; i >= 0; --i) { 2218 var attribute = this._textModel.getAttribute(i, "highlight"); 2219 if (!attribute) 2220 continue; 2221 var columnNumbers = Object.keys(attribute).reverse(); 2222 for (var j = 0; j < columnNumbers.length; ++j) { 2223 var column = columnNumbers[j]; 2224 if (attribute[column].tokenType === "block-start") { 2225 if (!(--nestingLevel)) { 2226 var lineContent = this._textModel.line(i); 2227 var blockOffset = lineContent.length - lineContent.trimLeft().length; 2228 if (blockOffset < oldRange.startColumn) { 2229 oldRange.startColumn = blockOffset; 2230 selection.startColumn = blockOffset + 1; 2231 selection.endColumn = blockOffset + 1; 2232 } 2233 return; 2234 } 2235 } 2236 if (attribute[column].tokenType === "block-end") 2237 ++nestingLevel; 2238 } 2239 } 2205 2240 }, 2206 2241
Note: See TracChangeset
for help on using the changeset viewer.