Diff
Modified: trunk/LayoutTests/ChangeLog (143439 => 143440)
--- trunk/LayoutTests/ChangeLog 2013-02-20 09:43:11 UTC (rev 143439)
+++ trunk/LayoutTests/ChangeLog 2013-02-20 09:44:37 UTC (rev 143440)
@@ -1,3 +1,15 @@
+2013-02-20 Andrey Lushnikov <[email protected]>
+
+ Web Inspector: highlight undefined word in _javascript_
+ https://bugs.webkit.org/show_bug.cgi?id=109585
+
+ Reviewed by Vsevolod Vlasov.
+
+ Enhance layout test to verify highlighting of global object value properties.
+
+ * inspector/syntax-highlight-_javascript_-expected.txt:
+ * inspector/syntax-highlight-_javascript_.html:
+
2013-02-20 Mike West <[email protected]>
Use EventPathWalker rather than parentNode() to normalize event targets in EventHandler.
Modified: trunk/LayoutTests/inspector/syntax-highlight-_javascript_-expected.txt (143439 => 143440)
--- trunk/LayoutTests/inspector/syntax-highlight-_javascript_-expected.txt 2013-02-20 09:43:11 UTC (rev 143439)
+++ trunk/LayoutTests/inspector/syntax-highlight-_javascript_-expected.txt 2013-02-20 09:44:37 UTC (rev 143440)
@@ -17,4 +17,7 @@
*/foo: webkit-_javascript_-ident,webkit-_javascript_-comment,,webkit-_javascript_-comment,,webkit-_javascript_-comment,webkit-_javascript_-ident
{0: true}: webkit-block-start,webkit-_javascript_-number,*,webkit-whitespace,webkit-_javascript_-keyword,webkit-block-end
var toString;: webkit-_javascript_-keyword,webkit-whitespace,webkit-_javascript_-ident,*
+var foo = undefined;: webkit-_javascript_-keyword,webkit-whitespace,webkit-_javascript_-ident,webkit-whitespace,*,webkit-whitespace,webkit-_javascript_-undef,*
+var foo = Infinity;: webkit-_javascript_-keyword,webkit-whitespace,webkit-_javascript_-ident,webkit-whitespace,*,webkit-whitespace,webkit-_javascript_-inf,*
+var foo = NaN;: webkit-_javascript_-keyword,webkit-whitespace,webkit-_javascript_-ident,webkit-whitespace,*,webkit-whitespace,webkit-_javascript_-nan,*
Modified: trunk/LayoutTests/inspector/syntax-highlight-_javascript_.html (143439 => 143440)
--- trunk/LayoutTests/inspector/syntax-highlight-_javascript_.html 2013-02-20 09:43:11 UTC (rev 143439)
+++ trunk/LayoutTests/inspector/syntax-highlight-_javascript_.html 2013-02-20 09:44:37 UTC (rev 143440)
@@ -24,6 +24,9 @@
dumpSyntaxHighlightJS("foo/**\n/\n*/foo");
dumpSyntaxHighlightJS("{0: true}");
dumpSyntaxHighlightJS("var toString;");
+ dumpSyntaxHighlightJS("var foo = undefined;");
+ dumpSyntaxHighlightJS("var foo = Infinity;");
+ dumpSyntaxHighlightJS("var foo = NaN;");
InspectorTest.completeTest();
}
Modified: trunk/Source/WebCore/ChangeLog (143439 => 143440)
--- trunk/Source/WebCore/ChangeLog 2013-02-20 09:43:11 UTC (rev 143439)
+++ trunk/Source/WebCore/ChangeLog 2013-02-20 09:44:37 UTC (rev 143440)
@@ -1,3 +1,21 @@
+2013-02-20 Andrey Lushnikov <[email protected]>
+
+ Web Inspector: highlight undefined word in _javascript_
+ https://bugs.webkit.org/show_bug.cgi?id=109585
+
+ Reviewed by Vsevolod Vlasov.
+
+ Test enhancement: inspector/syntax-highlight-_javascript_.html
+
+ Add global object value properties to tokenizer and add a css style
+ class to highlight "undefined" with gray color.
+
+ * inspector/front-end/SourceJavaScriptTokenizer.js:
+ (WebInspector.SourceJavaScriptTokenizer.prototype.nextToken):
+ * inspector/front-end/SourceJavaScriptTokenizer.re2js:
+ * inspector/front-end/inspectorSyntaxHighlight.css:
+ (.webkit-_javascript_-undef):
+
2013-02-20 Mike West <[email protected]>
Use EventPathWalker rather than parentNode() to normalize event targets in EventHandler.
Modified: trunk/Source/WebCore/inspector/front-end/SourceJavaScriptTokenizer.js (143439 => 143440)
--- trunk/Source/WebCore/inspector/front-end/SourceJavaScriptTokenizer.js 2013-02-20 09:43:11 UTC (rev 143439)
+++ trunk/Source/WebCore/inspector/front-end/SourceJavaScriptTokenizer.js 2013-02-20 09:44:37 UTC (rev 143440)
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Wed Feb 6 13:24:52 2013 */
+/* Generated by re2c 0.13.5 on Tue Feb 19 16:16:47 2013 */
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
*
@@ -77,6 +77,12 @@
"class", "enum", "export", "extends", "import", "super", "get", "set", "with"
].keySet();
+WebInspector.SourceJavaScriptTokenizer.GlobalObjectValueProperties = {
+ "NaN": "_javascript_-nan",
+ "undefined": "_javascript_-undef",
+ "Infinity": "_javascript_-inf"
+};
+
WebInspector.SourceJavaScriptTokenizer.prototype = {
createInitialCondition: function()
{
@@ -278,7 +284,9 @@
case 23:
{
var token = this._line.substring(cursorOnEnter, cursor);
- if (WebInspector.SourceJavaScriptTokenizer.Keywords[token] === true && token !== "__proto__")
+ if (WebInspector.SourceJavaScriptTokenizer.GlobalObjectValueProperties.hasOwnProperty(token))
+ this.tokenType = WebInspector.SourceJavaScriptTokenizer.GlobalObjectValueProperties[token];
+ else if (WebInspector.SourceJavaScriptTokenizer.Keywords[token] === true && token !== "__proto__")
this.tokenType = "_javascript_-keyword";
else
this.tokenType = "_javascript_-ident";
@@ -1236,7 +1244,9 @@
this.setLexCondition(this._lexConditions.DIV);
{
var token = this._line.substring(cursorOnEnter, cursor);
- if (WebInspector.SourceJavaScriptTokenizer.Keywords[token] === true && token !== "__proto__")
+ if (WebInspector.SourceJavaScriptTokenizer.GlobalObjectValueProperties.hasOwnProperty(token))
+ this.tokenType = WebInspector.SourceJavaScriptTokenizer.GlobalObjectValueProperties[token];
+ else if (WebInspector.SourceJavaScriptTokenizer.Keywords[token] === true && token !== "__proto__")
this.tokenType = "_javascript_-keyword";
else
this.tokenType = "_javascript_-ident";
Modified: trunk/Source/WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js (143439 => 143440)
--- trunk/Source/WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js 2013-02-20 09:43:11 UTC (rev 143439)
+++ trunk/Source/WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js 2013-02-20 09:44:37 UTC (rev 143440)
@@ -76,6 +76,12 @@
"class", "enum", "export", "extends", "import", "super", "get", "set", "with"
].keySet();
+WebInspector.SourceJavaScriptTokenizer.GlobalObjectValueProperties = {
+ "NaN": "_javascript_-nan",
+ "undefined": "_javascript_-undef",
+ "Infinity": "_javascript_-inf"
+};
+
WebInspector.SourceJavaScriptTokenizer.prototype = {
createInitialCondition: function()
{
@@ -173,7 +179,9 @@
<DIV,NODIV> Identifier => DIV
{
var token = this._line.substring(cursorOnEnter, cursor);
- if (WebInspector.SourceJavaScriptTokenizer.Keywords[token] === true && token !== "__proto__")
+ if (WebInspector.SourceJavaScriptTokenizer.GlobalObjectValueProperties.hasOwnProperty(token))
+ this.tokenType = WebInspector.SourceJavaScriptTokenizer.GlobalObjectValueProperties[token];
+ else if (WebInspector.SourceJavaScriptTokenizer.Keywords[token] === true && token !== "__proto__")
this.tokenType = "_javascript_-keyword";
else
this.tokenType = "_javascript_-ident";
Modified: trunk/Source/WebCore/inspector/front-end/inspectorSyntaxHighlight.css (143439 => 143440)
--- trunk/Source/WebCore/inspector/front-end/inspectorSyntaxHighlight.css 2013-02-20 09:43:11 UTC (rev 143439)
+++ trunk/Source/WebCore/inspector/front-end/inspectorSyntaxHighlight.css 2013-02-20 09:44:37 UTC (rev 143440)
@@ -50,6 +50,10 @@
color: rgb(200, 0, 180);
}
+.webkit-_javascript_-undef {
+ color: rgb(123, 123, 123);
+}
+
.webkit-_javascript_-comment {
color: rgb(0, 116, 0);
}