Changeset 53846 in webkit
- Timestamp:
- Jan 26, 2010 2:18:50 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 added
- 6 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r53845 r53846 1 2010-01-26 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Timothy Hatcher. 4 5 Web Inspector: Implement HTML and CSS highlighters. 6 7 https://bugs.webkit.org/show_bug.cgi?id=34144 8 9 * WebCore.gypi: 10 * WebCore.vcproj/WebCore.vcproj: 11 * inspector/front-end/JavaScriptTokenizer.js: Removed. 12 * inspector/front-end/JavaScriptTokenizer.re2js: Removed. 13 * inspector/front-end/SourceCSSTokenizer.js: Added. 14 (WebInspector.SourceCSSTokenizer): 15 (WebInspector.SourceCSSTokenizer.prototype._stringToken): 16 (WebInspector.SourceCSSTokenizer.prototype._isPropertyValue): 17 (WebInspector.SourceCSSTokenizer.prototype.nextToken): 18 * inspector/front-end/SourceCSSTokenizer.re2js: Added. 19 * inspector/front-end/SourceHTMLTokenizer.js: Added. 20 (WebInspector.SourceHTMLTokenizer): 21 (WebInspector.SourceHTMLTokenizer.prototype._stringToken): 22 (WebInspector.SourceHTMLTokenizer.prototype.nextToken): 23 * inspector/front-end/SourceHTMLTokenizer.re2js: Added. 24 * inspector/front-end/SourceJavaScriptTokenizer.js: Added. 25 (WebInspector.SourceJavaScriptTokenizer): 26 (WebInspector.SourceJavaScriptTokenizer.prototype.nextToken): 27 * inspector/front-end/SourceJavaScriptTokenizer.re2js: Added. 28 * inspector/front-end/TextEditorHighlighter.js: 29 (WebInspector.TextEditorHighlighter): 30 (WebInspector.TextEditorHighlighter.prototype._highlightLines): 31 (WebInspector.TextEditorHighlighter.Tokenizer): 32 (WebInspector.TextEditorHighlighter.Tokenizer.prototype.set line): 33 (WebInspector.TextEditorHighlighter.Tokenizer.prototype.set condition): 34 (WebInspector.TextEditorHighlighter.Tokenizer.prototype.get condition): 35 (WebInspector.TextEditorHighlighter.Tokenizer.prototype.hasCondition): 36 (WebInspector.TextEditorHighlighter.Tokenizer.prototype.getLexCondition): 37 (WebInspector.TextEditorHighlighter.Tokenizer.prototype.setLexCondition): 38 (WebInspector.TextEditorHighlighter.Tokenizer.prototype._charAt): 39 * inspector/front-end/WebKit.qrc: 40 * inspector/front-end/inspector.html: 41 1 42 2010-01-26 Simon Hausmann <simon.hausmann@nokia.com> 2 43 -
trunk/WebCore/WebCore.gypi
r53795 r53846 3708 3708 'inspector/front-end/inspector.js', 3709 3709 'inspector/front-end/JavaScriptSourceSyntaxHighlighter.js', 3710 'inspector/front-end/JavaScriptTokenizer.js',3711 3710 'inspector/front-end/KeyboardShortcut.js', 3712 3711 'inspector/front-end/MetricsSidebarPane.js', … … 3735 3734 'inspector/front-end/SidebarPane.js', 3736 3735 'inspector/front-end/SidebarTreeElement.js', 3736 'inspector/front-end/SourceCSSTokenizer.js', 3737 3737 'inspector/front-end/SourceFrame.js', 3738 3738 'inspector/front-end/SourceFrame2.js', 3739 'inspector/front-end/SourceHTMLTokenizer.js', 3740 'inspector/front-end/SourceJavaScriptTokenizer.js', 3739 3741 'inspector/front-end/SourceSyntaxHighlighter.js', 3740 3742 'inspector/front-end/SourceView.js', -
trunk/WebCore/WebCore.vcproj/WebCore.vcproj
r53795 r53846 42925 42925 </File> 42926 42926 <File 42927 RelativePath="..\inspector\front-end\JavaScriptTokenizer.js"42928 >42929 </File>42930 <File42931 42927 RelativePath="..\inspector\front-end\MetricsSidebarPane.js" 42932 42928 > … … 43029 43025 </File> 43030 43026 <File 43027 RelativePath="..\inspector\front-end\SourceCSSTokenizer.js" 43028 > 43029 </File> 43030 <File 43031 43031 RelativePath="..\inspector\front-end\SourceFrame.js" 43032 43032 > … … 43034 43034 <File 43035 43035 RelativePath="..\inspector\front-end\SourceFrame2.js" 43036 > 43037 </File> 43038 <File 43039 RelativePath="..\inspector\front-end\SourceHTMLTokenizer.js" 43040 > 43041 </File> 43042 <File 43043 RelativePath="..\inspector\front-end\SourceJavaScriptTokenizer.js" 43036 43044 > 43037 43045 </File> -
trunk/WebCore/inspector/front-end/SourceJavaScriptTokenizer.js
r53845 r53846 1 /* Generated by re2c 0.13.5 on Fri Jan 8 14:49:182010 */1 /* Generated by re2c 0.13.5 on Tue Jan 26 01:16:33 2010 */ 2 2 /* 3 3 * Copyright (C) 2009 Google Inc. All rights reserved. … … 32 32 // Generate js file as follows: 33 33 // 34 // re2c -isc WebCore/inspector/front-end/ JavaScriptTokenizer.re2js \34 // re2c -isc WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js \ 35 35 // | sed 's|^yy\([^:]*\)*\:|case \1:|' \ 36 36 // | sed 's|[*]cursor[+][+]|this._charAt(cursor++)|' \ … … 42 42 // | sed 's|var\ yych|case 1: case 1: var yych|' 43 43 44 WebInspector. JavaScriptTokenizer = function()44 WebInspector.SourceJavaScriptTokenizer = function() 45 45 { 46 this._tokens = []; 46 WebInspector.TextEditorHighlighter.Tokenizer.call(this); 47 47 48 this._keywords = [ 48 49 "null", "true", "false", "break", "case", "catch", "const", "default", "finally", "for", … … 52 53 ].keySet(); 53 54 54 this._ conditions = {55 this._lexConditions = { 55 56 DIV: 0, 56 57 NODIV: 1, … … 68 69 this.case_REGEX = 1005; 69 70 70 this.initialCondition = this._conditions.NODIV; 71 this.condition = this.initialCondition; 71 this.initialCondition = { lexCondition: this._lexConditions.NODIV } 72 72 } 73 73 74 WebInspector.JavaScriptTokenizer.prototype = { 75 76 set line(line) { 77 this._line = line; 78 }, 79 80 getCondition: function() 81 { 82 return this.condition; 83 }, 84 85 setCondition: function(condition) 86 { 87 this.condition = condition; 88 }, 89 90 _charAt: function(cursor) 91 { 92 return cursor < this._line.length ? this._line.charAt(cursor) : "\n"; 93 }, 94 74 WebInspector.SourceJavaScriptTokenizer.prototype = { 95 75 nextToken: function(cursor) 96 76 { … … 104 84 case 1: var yych; 105 85 var yyaccept = 0; 106 if (this.get Condition() < 3) {107 if (this.get Condition() < 1) {86 if (this.getLexCondition() < 3) { 87 if (this.getLexCondition() < 1) { 108 88 { gotoCase = this.case_DIV; continue; }; 109 89 } else { 110 if (this.get Condition() < 2) {90 if (this.getLexCondition() < 2) { 111 91 { gotoCase = this.case_NODIV; continue; }; 112 92 } else { … … 115 95 } 116 96 } else { 117 if (this.get Condition() < 4) {97 if (this.getLexCondition() < 4) { 118 98 { gotoCase = this.case_DSTRING; continue; }; 119 99 } else { 120 if (this.get Condition() < 5) {100 if (this.getLexCondition() < 5) { 121 101 { gotoCase = this.case_SSTRING; continue; }; 122 102 } else { … … 138 118 } 139 119 case 2: 140 { this.tokenType = " comment"; return cursor; }120 { this.tokenType = "js-comment"; return cursor; } 141 121 case 3: 142 122 yyaccept = 0; … … 153 133 case 7: 154 134 ++cursor; 155 this.set Condition(this._conditions.NODIV);156 { this.tokenType = " comment"; return cursor; }135 this.setLexCondition(this._lexConditions.NODIV); 136 { this.tokenType = "js-comment"; return cursor; } 157 137 case 9: 158 138 ++cursor; … … 252 232 if ((yych = this._charAt(cursor)) == '=') { gotoCase = 115; continue; }; 253 233 case 18: 254 this.set Condition(this._conditions.NODIV);234 this.setLexCondition(this._lexConditions.NODIV); 255 235 { this.tokenType = null; return cursor; } 256 236 case 19: … … 268 248 var token = this._line.substring(cursorOnEnter, cursor); 269 249 if (token in this._keywords) 270 this.tokenType = " keyword";250 this.tokenType = "js-keyword"; 271 251 else 272 252 this.tokenType = null; … … 323 303 } 324 304 case 33: 325 this.set Condition(this._conditions.NODIV);305 this.setLexCondition(this._lexConditions.NODIV); 326 306 { this.tokenType = null; return cursor; } 327 307 case 34: … … 344 324 } 345 325 case 35: 346 { this.tokenType = " number"; return cursor; }326 { this.tokenType = "js-number"; return cursor; } 347 327 case 36: 348 328 yyaccept = 3; … … 657 637 if (yych != '\r') { gotoCase = 80; continue; }; 658 638 case 82: 659 { this.tokenType = " comment"; return cursor; }639 { this.tokenType = "js-comment"; return cursor; } 660 640 case 83: 661 641 ++cursor; … … 666 646 case 85: 667 647 ++cursor; 668 this.set Condition(this._conditions.COMMENT);669 { this.tokenType = " comment"; return cursor; }648 this.setLexCondition(this._lexConditions.COMMENT); 649 { this.tokenType = "js-comment"; return cursor; } 670 650 case 87: 671 651 ++cursor; 672 { this.tokenType = " comment"; return cursor; }652 { this.tokenType = "js-comment"; return cursor; } 673 653 case 89: 674 654 yyaccept = 3; … … 763 743 case 98: 764 744 ++cursor; 765 { this.tokenType = " string"; return cursor; }745 { this.tokenType = "js-string"; return cursor; } 766 746 case 100: 767 747 ++cursor; … … 779 759 case 101: 780 760 ++cursor; 781 this.set Condition(this._conditions.SSTRING);782 { this.tokenType = " string"; return cursor; }761 this.setLexCondition(this._lexConditions.SSTRING); 762 { this.tokenType = "js-string"; return cursor; } 783 763 case 103: 784 764 ++cursor; … … 889 869 case 110: 890 870 ++cursor; 891 this.set Condition(this._conditions.DSTRING);892 { this.tokenType = " string"; return cursor; }871 this.setLexCondition(this._lexConditions.DSTRING); 872 { this.tokenType = "js-string"; return cursor; } 893 873 case 112: 894 874 ++cursor; … … 947 927 } 948 928 case 118: 949 { this.tokenType = " string"; return cursor; }929 { this.tokenType = "js-string"; return cursor; } 950 930 case 119: 951 931 yyaccept = 0; … … 959 939 ++cursor; 960 940 case 123: 961 this.set Condition(this._conditions.NODIV);962 { this.tokenType = " string"; return cursor; }941 this.setLexCondition(this._lexConditions.NODIV); 942 { this.tokenType = "js-string"; return cursor; } 963 943 case 124: 964 944 yyaccept = 1; … … 1196 1176 { gotoCase = 170; continue; }; 1197 1177 case 142: 1198 this.set Condition(this._conditions.DIV);1178 this.setLexCondition(this._lexConditions.DIV); 1199 1179 { 1200 1180 var token = this._line.substring(cursorOnEnter, cursor); 1201 1181 if (token in this._keywords) 1202 this.tokenType = " keyword";1182 this.tokenType = "js-keyword"; 1203 1183 else 1204 1184 this.tokenType = null; … … 1225 1205 case 147: 1226 1206 ++cursor; 1227 this.set Condition(this._conditions.DIV);1207 this.setLexCondition(this._lexConditions.DIV); 1228 1208 { this.tokenType = null; return cursor; } 1229 1209 case 149: … … 1288 1268 } 1289 1269 case 155: 1290 this.set Condition(this._conditions.DIV);1291 { this.tokenType = " number"; return cursor; }1270 this.setLexCondition(this._lexConditions.DIV); 1271 { this.tokenType = "js-number"; return cursor; } 1292 1272 case 156: 1293 1273 yyaccept = 2; … … 1648 1628 if (yych != '\r') { gotoCase = 204; continue; }; 1649 1629 case 206: 1650 { this.tokenType = " comment"; return cursor; }1630 { this.tokenType = "js-comment"; return cursor; } 1651 1631 case 207: 1652 1632 ++cursor; … … 1657 1637 case 209: 1658 1638 ++cursor; 1659 this.set Condition(this._conditions.COMMENT);1660 { this.tokenType = " comment"; return cursor; }1639 this.setLexCondition(this._lexConditions.COMMENT); 1640 { this.tokenType = "js-comment"; return cursor; } 1661 1641 case 211: 1662 1642 ++cursor; 1663 { this.tokenType = " comment"; return cursor; }1643 { this.tokenType = "js-comment"; return cursor; } 1664 1644 case 213: 1665 1645 ++cursor; … … 1697 1677 if (yych != '\r') { gotoCase = 213; continue; }; 1698 1678 case 217: 1699 this.set Condition(this._conditions.REGEX);1700 { this.tokenType = " regex"; return cursor; }1679 this.setLexCondition(this._lexConditions.REGEX); 1680 { this.tokenType = "js-regex"; return cursor; } 1701 1681 case 218: 1702 1682 ++cursor; … … 1730 1710 if (yych == 'm') { gotoCase = 220; continue; }; 1731 1711 } 1732 { this.tokenType = " regex"; return cursor; }1712 { this.tokenType = "js-regex"; return cursor; } 1733 1713 case 223: 1734 1714 ++cursor; … … 1921 1901 case 243: 1922 1902 ++cursor; 1923 { this.tokenType = " string"; return cursor; }1903 { this.tokenType = "js-string"; return cursor; } 1924 1904 case 245: 1925 1905 ++cursor; … … 1937 1917 case 246: 1938 1918 ++cursor; 1939 this.set Condition(this._conditions.SSTRING);1940 { this.tokenType = " string"; return cursor; }1919 this.setLexCondition(this._lexConditions.SSTRING); 1920 { this.tokenType = "js-string"; return cursor; } 1941 1921 case 248: 1942 1922 ++cursor; … … 2047 2027 case 255: 2048 2028 ++cursor; 2049 this.set Condition(this._conditions.DSTRING);2050 { this.tokenType = " string"; return cursor; }2029 this.setLexCondition(this._lexConditions.DSTRING); 2030 { this.tokenType = "js-string"; return cursor; } 2051 2031 case 257: 2052 2032 ++cursor; … … 2111 2091 } 2112 2092 case 263: 2113 { this.tokenType = " regex"; return cursor; }2093 { this.tokenType = "js-regex"; return cursor; } 2114 2094 case 264: 2115 2095 yyaccept = 0; … … 2125 2105 { gotoCase = 278; continue; }; 2126 2106 case 268: 2127 this.set Condition(this._conditions.NODIV);2128 { this.tokenType = " regex"; return cursor; }2107 this.setLexCondition(this._lexConditions.NODIV); 2108 { this.tokenType = "js-regex"; return cursor; } 2129 2109 case 269: 2130 2110 yyaccept = 1; … … 2270 2250 } 2271 2251 case 285: 2272 { this.tokenType = " string"; return cursor; }2252 { this.tokenType = "js-string"; return cursor; } 2273 2253 case 286: 2274 2254 yyaccept = 0; … … 2282 2262 ++cursor; 2283 2263 case 290: 2284 this.set Condition(this._conditions.NODIV);2285 { this.tokenType = " string"; return cursor; }2264 this.setLexCondition(this._lexConditions.NODIV); 2265 { this.tokenType = "js-string"; return cursor; } 2286 2266 case 291: 2287 2267 yyaccept = 1; … … 2433 2413 } 2434 2414 } 2415 2416 WebInspector.SourceJavaScriptTokenizer.prototype.__proto__ = WebInspector.TextEditorHighlighter.Tokenizer.prototype; -
trunk/WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js
r53845 r53846 31 31 // Generate js file as follows: 32 32 // 33 // re2c -isc WebCore/inspector/front-end/ JavaScriptTokenizer.re2js \33 // re2c -isc WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js \ 34 34 // | sed 's|^yy\([^:]*\)*\:|case \1:|' \ 35 35 // | sed 's|[*]cursor[+][+]|this._charAt(cursor++)|' \ … … 41 41 // | sed 's|var\ yych|case 1: var yych|' 42 42 43 WebInspector. JavaScriptTokenizer = function()43 WebInspector.SourceJavaScriptTokenizer = function() 44 44 { 45 this._tokens = []; 45 WebInspector.TextEditorHighlighter.Tokenizer.call(this); 46 46 47 this._keywords = [ 47 48 "null", "true", "false", "break", "case", "catch", "const", "default", "finally", "for", … … 51 52 ].keySet(); 52 53 53 this._ conditions = {54 this._lexConditions = { 54 55 DIV: 0, 55 56 NODIV: 1, … … 67 68 this.case_REGEX = 1005; 68 69 69 this.initialCondition = this._conditions.NODIV; 70 this.condition = this.initialCondition; 70 this.initialCondition = { lexCondition: this._lexConditions.NODIV } 71 71 } 72 72 73 WebInspector.JavaScriptTokenizer.prototype = { 74 75 set line(line) { 76 this._line = line; 77 }, 78 79 getCondition: function() 80 { 81 return this.condition; 82 }, 83 84 setCondition: function(condition) 85 { 86 this.condition = condition; 87 }, 88 89 _charAt: function(cursor) 90 { 91 return cursor < this._line.length ? this._line.charAt(cursor) : "\n"; 92 }, 93 73 WebInspector.SourceJavaScriptTokenizer.prototype = { 94 74 nextToken: function(cursor) 95 75 { … … 102 82 re2c:define:YYCTYPE = "var"; 103 83 re2c:define:YYCURSOR = cursor; 104 re2c:define:YYGETCONDITION = "this.get Condition";105 re2c:define:YYSETCONDITION = "this.set Condition";84 re2c:define:YYGETCONDITION = "this.getLexCondition"; 85 re2c:define:YYSETCONDITION = "this.setLexCondition"; 106 86 re2c:condprefix = "case this.case_"; 107 re2c:condenumprefix = "this._ conditions.";87 re2c:condenumprefix = "this._lexConditions."; 108 88 re2c:yyfill:enable = 0; 109 89 re2c:labelprefix = "case "; … … 145 125 DoubleStringStart = "\"" DoubleStringContent "\\" [\r\n]; 146 126 DoubleStringEnd = DoubleStringContent "\""; 147 SingleStringStart = " \'" SingleStringContent "\\" [\r\n];148 SingleStringEnd = SingleStringContent " \'";127 SingleStringStart = "'" SingleStringContent "\\" [\r\n]; 128 SingleStringEnd = SingleStringContent "'"; 149 129 150 130 BackslashSequence = "\\" [^\r\n]; … … 157 137 RegexEnd = RegexContent "/" [igm]*; 158 138 159 <DIV,NODIV> LineComment { this.tokenType = " comment"; return cursor; }160 <DIV,NODIV> Comment { this.tokenType = " comment"; return cursor; }161 <DIV,NODIV> CommentStart => COMMENT { this.tokenType = " comment"; return cursor; }162 <COMMENT> CommentContent => COMMENT { this.tokenType = " comment"; return cursor; }163 <COMMENT> CommentEnd => NODIV { this.tokenType = " comment"; return cursor; }139 <DIV,NODIV> LineComment { this.tokenType = "js-comment"; return cursor; } 140 <DIV,NODIV> Comment { this.tokenType = "js-comment"; return cursor; } 141 <DIV,NODIV> CommentStart => COMMENT { this.tokenType = "js-comment"; return cursor; } 142 <COMMENT> CommentContent => COMMENT { this.tokenType = "js-comment"; return cursor; } 143 <COMMENT> CommentEnd => NODIV { this.tokenType = "js-comment"; return cursor; } 164 144 165 <DIV,NODIV> StringLiteral { this.tokenType = " string"; return cursor; }166 <DIV,NODIV> DoubleStringStart => DSTRING { this.tokenType = " string"; return cursor; }167 <DSTRING> DoubleStringContent => DSTRING { this.tokenType = " string"; return cursor; }168 <DSTRING> DoubleStringEnd => NODIV { this.tokenType = " string"; return cursor; }169 <DIV,NODIV> SingleStringStart => SSTRING { this.tokenType = " string"; return cursor; }170 <SSTRING> SingleStringContent => SSTRING { this.tokenType = " string"; return cursor; }171 <SSTRING> SingleStringEnd => NODIV { this.tokenType = " string"; return cursor; }145 <DIV,NODIV> StringLiteral { this.tokenType = "js-string"; return cursor; } 146 <DIV,NODIV> DoubleStringStart => DSTRING { this.tokenType = "js-string"; return cursor; } 147 <DSTRING> DoubleStringContent => DSTRING { this.tokenType = "js-string"; return cursor; } 148 <DSTRING> DoubleStringEnd => NODIV { this.tokenType = "js-string"; return cursor; } 149 <DIV,NODIV> SingleStringStart => SSTRING { this.tokenType = "js-string"; return cursor; } 150 <SSTRING> SingleStringContent => SSTRING { this.tokenType = "js-string"; return cursor; } 151 <SSTRING> SingleStringEnd => NODIV { this.tokenType = "js-string"; return cursor; } 172 152 173 <NODIV> Regex { this.tokenType = " regex"; return cursor; }174 <NODIV> RegexStart => REGEX { this.tokenType = " regex"; return cursor; }175 <REGEX> RegexContent => REGEX { this.tokenType = " regex"; return cursor; }176 <REGEX> RegexEnd => NODIV { this.tokenType = " regex"; return cursor; }153 <NODIV> Regex { this.tokenType = "js-regex"; return cursor; } 154 <NODIV> RegexStart => REGEX { this.tokenType = "js-regex"; return cursor; } 155 <REGEX> RegexContent => REGEX { this.tokenType = "js-regex"; return cursor; } 156 <REGEX> RegexEnd => NODIV { this.tokenType = "js-regex"; return cursor; } 177 157 178 <DIV,NODIV> NumericLiteral => DIV { this.tokenType = " number"; return cursor; }158 <DIV,NODIV> NumericLiteral => DIV { this.tokenType = "js-number"; return cursor; } 179 159 <DIV,NODIV> Identifier => DIV 180 160 { 181 161 var token = this._line.substring(cursorOnEnter, cursor); 182 162 if (token in this._keywords) 183 this.tokenType = " keyword";163 this.tokenType = "js-keyword"; 184 164 else 185 165 this.tokenType = null; … … 194 174 } 195 175 } 176 177 WebInspector.SourceJavaScriptTokenizer.prototype.__proto__ = WebInspector.TextEditorHighlighter.Tokenizer.prototype; -
trunk/WebCore/inspector/front-end/TextEditorHighlighter.js
r53795 r53846 33 33 { 34 34 this._textModel = textModel; 35 this._tokenizer = new WebInspector. JavaScriptTokenizer();35 this._tokenizer = new WebInspector.SourceCSSTokenizer(); 36 36 37 37 this._styles = []; 38 this._styles["comment"] = "rgb(0, 116, 0)"; 39 this._styles["string"] = "rgb(196, 26, 22)"; 40 this._styles["regex"] = "rgb(196, 26, 22)"; 41 this._styles["keyword"] = "rgb(170, 13, 145)"; 42 this._styles["number"] = "rgb(28, 0, 207)"; 38 39 this._styles["css-comment"] = "rgb(0, 116, 0)"; 40 this._styles["css-params"] = "rgb(7, 144, 154)"; 41 this._styles["css-string"] = "rgb(7, 144, 154)"; 42 this._styles["css-keyword"] = "rgb(7, 144, 154)"; 43 this._styles["css-number"] = "rgb(50, 0, 255)"; 44 this._styles["css-property"] = "rgb(200, 0, 0)"; 45 this._styles["css-at-rule"] = "rgb(200, 0, 0)"; 46 this._styles["css-selector"] = "rgb(0, 0, 0)"; 47 this._styles["css-important"] = "rgb(200, 0, 180)"; 48 49 /* Keep this in sync with inspector.css and view-source.css */ 50 this._styles["html-tag"] = "rgb(136, 18, 128)"; 51 this._styles["html-attr-name"] = "rgb(153, 69, 0)"; 52 this._styles["html-attr-value"] = "rgb(26, 26, 166)"; 53 this._styles["html-comment"] = "rgb(35, 110, 37)"; 54 this._styles["html-doctype"] = "rgb(192, 192, 192)"; 55 56 this._styles["js-comment"] = "rgb(0, 116, 0)"; 57 this._styles["js-string"] = "rgb(196, 26, 22)"; 58 this._styles["js-regex"] = "rgb(196, 26, 22)"; 59 this._styles["js-keyword"] = "rgb(170, 13, 145)"; 60 this._styles["js-number"] = "rgb(28, 0, 207)"; 43 61 44 62 this._damageCallback = damageCallback; … … 147 165 148 166 var nextLineState = this._textModel.getAttribute(i + 1, "highlighter-state"); 149 if (nextLineState && nextLineState.preCondition === state.postCondition) {167 if (nextLineState && this._tokenizer.hasCondition(nextLineState.preCondition)) { 150 168 // Following lines are up to date, no need re-highlight. 151 169 this._damageCallback(startLine, i + 1); … … 169 187 } 170 188 } 189 190 WebInspector.TextEditorHighlighter.Tokenizer = function() 191 { 192 } 193 194 WebInspector.TextEditorHighlighter.Tokenizer.prototype = { 195 set line(line) { 196 this._line = line; 197 }, 198 199 set condition(condition) 200 { 201 this._lexCondition = condition.lexCondition; 202 this._parseCondition = condition.parseCondition; 203 }, 204 205 get condition() 206 { 207 return { lexCondition: this._lexCondition, parseCondition: this._parseCondition }; 208 }, 209 210 hasCondition: function(condition) 211 { 212 return this._lexCondition === condition.lexCondition && this._parseCondition === condition.parseCondition; 213 }, 214 215 getLexCondition: function() 216 { 217 return this._lexCondition; 218 }, 219 220 setLexCondition: function(lexCondition) 221 { 222 this._lexCondition = lexCondition; 223 }, 224 225 _charAt: function(cursor) 226 { 227 return cursor < this._line.length ? this._line.charAt(cursor) : "\n"; 228 } 229 } -
trunk/WebCore/inspector/front-end/WebKit.qrc
r53795 r53846 37 37 <file>InspectorFrontendHostStub.js</file> 38 38 <file>JavaScriptSourceSyntaxHighlighter.js</file> 39 <file>JavaScriptTokenizer.js</file>40 39 <file>KeyboardShortcut.js</file> 41 40 <file>MetricsSidebarPane.js</file> … … 64 63 <file>SidebarPane.js</file> 65 64 <file>SidebarTreeElement.js</file> 65 <file>SourceCSSTokenizer.js</file> 66 66 <file>SourceFrame.js</file> 67 67 <file>SourceFrame2.js</file> 68 <file>SourceHTMLTokenizer.js</file> 69 <file>SourceJavaScriptTokenizer.js</file> 68 70 <file>SourceSyntaxHighlighter.js</file> 69 71 <file>SourceView.js</file> -
trunk/WebCore/inspector/front-end/inspector.html
r53795 r53846 101 101 <script type="text/javascript" src="TextEditor.js"></script> 102 102 <script type="text/javascript" src="TextEditorHighlighter.js"></script> 103 <script type="text/javascript" src="JavaScriptTokenizer.js"></script> 103 <script type="text/javascript" src="SourceCSSTokenizer.js"></script> 104 <script type="text/javascript" src="SourceHTMLTokenizer.js"></script> 105 <script type="text/javascript" src="SourceJavaScriptTokenizer.js"></script> 104 106 <script type="text/javascript" src="SourceView.js"></script> 105 107 <script type="text/javascript" src="FontView.js"></script>
Note: See TracChangeset
for help on using the changeset viewer.