[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

apavlov at chromium.org apavlov at chromium.org
Mon Feb 21 00:09:13 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit c79f65172ec185c2df3a119ec7b63a8c15542f03
Author: apavlov at chromium.org <apavlov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jan 28 15:48:00 2011 +0000

    2011-01-28  Alexander Pavlov  <apavlov at chromium.org>
    
            Reviewed by Yury Semikhatsky.
    
            Web Inspector: syntax highlight inline JS and CSS in HTML resources
            https://bugs.webkit.org/show_bug.cgi?id=30831
    
            * inspector/front-end/SourceHTMLTokenizer.js:
            (WebInspector.SourceHTMLTokenizer):
            (WebInspector.SourceHTMLTokenizer.prototype.set line):
            (WebInspector.SourceHTMLTokenizer.prototype.nextToken):
            * inspector/front-end/SourceHTMLTokenizer.re2js:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76943 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 7a571ec..71eae31 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -2,6 +2,19 @@
 
         Reviewed by Yury Semikhatsky.
 
+        Web Inspector: syntax highlight inline JS and CSS in HTML resources
+        https://bugs.webkit.org/show_bug.cgi?id=30831
+
+        * inspector/front-end/SourceHTMLTokenizer.js:
+        (WebInspector.SourceHTMLTokenizer):
+        (WebInspector.SourceHTMLTokenizer.prototype.set line):
+        (WebInspector.SourceHTMLTokenizer.prototype.nextToken):
+        * inspector/front-end/SourceHTMLTokenizer.re2js:
+
+2011-01-28  Alexander Pavlov  <apavlov at chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
         Web Inspector: [STYLES] Up/Down-suggestion breaks an existing keyword
         https://bugs.webkit.org/show_bug.cgi?id=53295
 
diff --git a/Source/WebCore/inspector/front-end/SourceHTMLTokenizer.js b/Source/WebCore/inspector/front-end/SourceHTMLTokenizer.js
index cfbc44f..48c5bd4 100644
--- a/Source/WebCore/inspector/front-end/SourceHTMLTokenizer.js
+++ b/Source/WebCore/inspector/front-end/SourceHTMLTokenizer.js
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Thu Feb 25 21:44:55 2010 */
+/* Generated by re2c 0.13.5 on Fri Jan 28 18:32:27 2011 */
 /*
  * Copyright (C) 2009 Google Inc. All rights reserved.
  *
@@ -67,7 +67,8 @@ WebInspector.SourceHTMLTokenizer = function()
         ATTRIBUTE_VALUE: 2,
         LINKIFY: 4,
         A_NODE: 8,
-        SCRIPT: 16
+        SCRIPT: 16,
+        STYLE: 32
     };
 
     this.initialCondition = { lexCondition: this._lexConditions.INITIAL, parseCondition: this._parseConditions.INITIAL };
@@ -82,6 +83,12 @@ WebInspector.SourceHTMLTokenizer.prototype = {
                 this._internalJavaScriptTokenizer.line = line.substring(0, match.index);
             } else
                 this._internalJavaScriptTokenizer.line = line;
+        } else if (this._internalCSSTokenizer) {
+            var match = /<\/style/i.exec(line);
+            if (match) {
+                this._internalCSSTokenizer.line = line.substring(0, match.index);
+            } else
+                this._internalCSSTokenizer.line = line;
         }
         this._line = line;
     },
@@ -146,6 +153,18 @@ WebInspector.SourceHTMLTokenizer.prototype = {
                 return result;
             } else if (cursor !== this._line.length)
                 delete this._internalJavaScriptTokenizer;
+        } else if (this._internalCSSTokenizer) {
+            // Re-set line to force </style> detection first.
+            this.line = this._line;
+            if (cursor !== this._internalCSSTokenizer._line.length) {
+                // Tokenizer is stateless, so restore its condition before tokenizing and save it after.
+                this._internalCSSTokenizer.condition = this._condition.internalCSSTokenizerCondition;
+                var result = this._internalCSSTokenizer.nextToken(cursor);
+                this.tokenType = this._internalCSSTokenizer.tokenType;
+                this._condition.internalCSSTokenizerCondition = this._internalCSSTokenizer.condition;
+                return result;
+            } else if (cursor !== this._line.length)
+                delete this._internalCSSTokenizer;
         }
 
         var cursorOnEnter = cursor;
@@ -331,8 +350,8 @@ case 39:
 case 40:
             this.setLexCondition(this._lexConditions.TAG);
             {
-                    if (this._condition.parseCondition & this._parseConditions.SCRIPT) {
-                        // Do not tokenize script tag contents, keep lexer state although processing "<".
+                    if (this._condition.parseCondition & (this._parseConditions.SCRIPT | this._parseConditions.STYLE)) {
+                        // Do not tokenize script and style tag contents, keep lexer state, even though processing "<".
                         this.setLexCondition(this._lexConditions.INITIAL);
                         this.tokenType = null;
                         return cursor;
@@ -345,13 +364,21 @@ case 40:
 case 41:
             yyaccept = 0;
             yych = this._charAt(YYMARKER = ++cursor);
-            if (yych == 'S') { gotoCase = 68; continue; };
-            if (yych == 's') { gotoCase = 68; continue; };
+            if (yych == 'S') { gotoCase = 73; continue; };
+            if (yych == 's') { gotoCase = 73; continue; };
             { gotoCase = 40; continue; };
 case 42:
             yych = this._charAt(++cursor);
-            if (yych == 'C') { gotoCase = 62; continue; };
-            if (yych == 'c') { gotoCase = 62; continue; };
+            if (yych <= 'T') {
+                if (yych == 'C') { gotoCase = 62; continue; };
+                if (yych >= 'T') { gotoCase = 63; continue; };
+            } else {
+                if (yych <= 'c') {
+                    if (yych >= 'c') { gotoCase = 62; continue; };
+                } else {
+                    if (yych == 't') { gotoCase = 63; continue; };
+                }
+            }
 case 43:
             cursor = YYMARKER;
             { gotoCase = 40; continue; };
@@ -421,56 +448,113 @@ case 59:
             { this.tokenType = "html-comment"; return cursor; }
 case 62:
             yych = this._charAt(++cursor);
-            if (yych == 'R') { gotoCase = 63; continue; };
-            if (yych != 'r') { gotoCase = 43; continue; };
+            if (yych == 'R') { gotoCase = 68; continue; };
+            if (yych == 'r') { gotoCase = 68; continue; };
+            { gotoCase = 43; continue; };
 case 63:
             yych = this._charAt(++cursor);
-            if (yych == 'I') { gotoCase = 64; continue; };
-            if (yych != 'i') { gotoCase = 43; continue; };
+            if (yych == 'Y') { gotoCase = 64; continue; };
+            if (yych != 'y') { gotoCase = 43; continue; };
 case 64:
             yych = this._charAt(++cursor);
-            if (yych == 'P') { gotoCase = 65; continue; };
-            if (yych != 'p') { gotoCase = 43; continue; };
+            if (yych == 'L') { gotoCase = 65; continue; };
+            if (yych != 'l') { gotoCase = 43; continue; };
 case 65:
             yych = this._charAt(++cursor);
-            if (yych == 'T') { gotoCase = 66; continue; };
-            if (yych != 't') { gotoCase = 43; continue; };
+            if (yych == 'E') { gotoCase = 66; continue; };
+            if (yych != 'e') { gotoCase = 43; continue; };
 case 66:
             ++cursor;
             this.setLexCondition(this._lexConditions.TAG);
             {
-                    if (this._condition.parseCondition & this._parseConditions.SCRIPT) {
-                        // Do not tokenize script tag contents, keep lexer state although processing "<".
+                    if (this._condition.parseCondition & this._parseConditions.STYLE) {
+                        // Do not tokenize style tag contents, keep lexer state, even though processing "<".
                         this.setLexCondition(this._lexConditions.INITIAL);
                         this.tokenType = null;
                         return cursor;
                     }
                     this.tokenType = "html-tag";
-                    this._condition.parseCondition = this._parseConditions.SCRIPT;
+                    this._condition.parseCondition = this._parseConditions.STYLE;
                     this._setExpectingAttribute();
                     return cursor;
                 }
 case 68:
             yych = this._charAt(++cursor);
-            if (yych == 'C') { gotoCase = 69; continue; };
-            if (yych != 'c') { gotoCase = 43; continue; };
+            if (yych == 'I') { gotoCase = 69; continue; };
+            if (yych != 'i') { gotoCase = 43; continue; };
 case 69:
             yych = this._charAt(++cursor);
-            if (yych == 'R') { gotoCase = 70; continue; };
-            if (yych != 'r') { gotoCase = 43; continue; };
+            if (yych == 'P') { gotoCase = 70; continue; };
+            if (yych != 'p') { gotoCase = 43; continue; };
 case 70:
             yych = this._charAt(++cursor);
-            if (yych == 'I') { gotoCase = 71; continue; };
-            if (yych != 'i') { gotoCase = 43; continue; };
+            if (yych == 'T') { gotoCase = 71; continue; };
+            if (yych != 't') { gotoCase = 43; continue; };
 case 71:
+            ++cursor;
+            this.setLexCondition(this._lexConditions.TAG);
+            {
+                    if (this._condition.parseCondition & this._parseConditions.SCRIPT) {
+                        // Do not tokenize script tag contents, keep lexer state, even though processing "<".
+                        this.setLexCondition(this._lexConditions.INITIAL);
+                        this.tokenType = null;
+                        return cursor;
+                    }
+                    this.tokenType = "html-tag";
+                    this._condition.parseCondition = this._parseConditions.SCRIPT;
+                    this._setExpectingAttribute();
+                    return cursor;
+                }
+case 73:
+            yych = this._charAt(++cursor);
+            if (yych <= 'T') {
+                if (yych == 'C') { gotoCase = 75; continue; };
+                if (yych <= 'S') { gotoCase = 43; continue; };
+            } else {
+                if (yych <= 'c') {
+                    if (yych <= 'b') { gotoCase = 43; continue; };
+                    { gotoCase = 75; continue; };
+                } else {
+                    if (yych != 't') { gotoCase = 43; continue; };
+                }
+            }
+            yych = this._charAt(++cursor);
+            if (yych == 'Y') { gotoCase = 81; continue; };
+            if (yych == 'y') { gotoCase = 81; continue; };
+            { gotoCase = 43; continue; };
+case 75:
+            yych = this._charAt(++cursor);
+            if (yych == 'R') { gotoCase = 76; continue; };
+            if (yych != 'r') { gotoCase = 43; continue; };
+case 76:
+            yych = this._charAt(++cursor);
+            if (yych == 'I') { gotoCase = 77; continue; };
+            if (yych != 'i') { gotoCase = 43; continue; };
+case 77:
             yych = this._charAt(++cursor);
-            if (yych == 'P') { gotoCase = 72; continue; };
+            if (yych == 'P') { gotoCase = 78; continue; };
             if (yych != 'p') { gotoCase = 43; continue; };
-case 72:
+case 78:
             yych = this._charAt(++cursor);
-            if (yych == 'T') { gotoCase = 73; continue; };
+            if (yych == 'T') { gotoCase = 79; continue; };
             if (yych != 't') { gotoCase = 43; continue; };
-case 73:
+case 79:
+            ++cursor;
+            this.setLexCondition(this._lexConditions.TAG);
+            {
+                    this.tokenType = "html-tag";
+                    this._condition.parseCondition = this._parseConditions.INITIAL;
+                    return cursor;
+                }
+case 81:
+            yych = this._charAt(++cursor);
+            if (yych == 'L') { gotoCase = 82; continue; };
+            if (yych != 'l') { gotoCase = 43; continue; };
+case 82:
+            yych = this._charAt(++cursor);
+            if (yych == 'E') { gotoCase = 83; continue; };
+            if (yych != 'e') { gotoCase = 43; continue; };
+case 83:
             ++cursor;
             this.setLexCondition(this._lexConditions.TAG);
             {
@@ -482,78 +566,78 @@ case 73:
 case this.case_SSTRING:
             yych = this._charAt(cursor);
             if (yych <= '\f') {
-                if (yych == '\n') { gotoCase = 79; continue; };
-                { gotoCase = 78; continue; };
+                if (yych == '\n') { gotoCase = 89; continue; };
+                { gotoCase = 88; continue; };
             } else {
-                if (yych <= '\r') { gotoCase = 79; continue; };
-                if (yych == '\'') { gotoCase = 81; continue; };
-                { gotoCase = 78; continue; };
+                if (yych <= '\r') { gotoCase = 89; continue; };
+                if (yych == '\'') { gotoCase = 91; continue; };
+                { gotoCase = 88; continue; };
             }
-case 77:
+case 87:
             { return this._stringToken(cursor); }
-case 78:
+case 88:
             yych = this._charAt(++cursor);
-            { gotoCase = 85; continue; };
-case 79:
+            { gotoCase = 95; continue; };
+case 89:
             ++cursor;
             { this.tokenType = null; return cursor; }
-case 81:
+case 91:
             ++cursor;
-case 82:
+case 92:
             this.setLexCondition(this._lexConditions.TAG);
             { return this._stringToken(cursor, true); }
-case 83:
+case 93:
             yych = this._charAt(++cursor);
-            { gotoCase = 82; continue; };
-case 84:
+            { gotoCase = 92; continue; };
+case 94:
             ++cursor;
             yych = this._charAt(cursor);
-case 85:
+case 95:
             if (yych <= '\f') {
-                if (yych == '\n') { gotoCase = 77; continue; };
-                { gotoCase = 84; continue; };
+                if (yych == '\n') { gotoCase = 87; continue; };
+                { gotoCase = 94; continue; };
             } else {
-                if (yych <= '\r') { gotoCase = 77; continue; };
-                if (yych == '\'') { gotoCase = 83; continue; };
-                { gotoCase = 84; continue; };
+                if (yych <= '\r') { gotoCase = 87; continue; };
+                if (yych == '\'') { gotoCase = 93; continue; };
+                { gotoCase = 94; continue; };
             }
 /* *********************************** */
 case this.case_TAG:
             yych = this._charAt(cursor);
             if (yych <= '&') {
                 if (yych <= '\r') {
-                    if (yych == '\n') { gotoCase = 90; continue; };
-                    if (yych >= '\r') { gotoCase = 90; continue; };
+                    if (yych == '\n') { gotoCase = 100; continue; };
+                    if (yych >= '\r') { gotoCase = 100; continue; };
                 } else {
                     if (yych <= ' ') {
-                        if (yych >= ' ') { gotoCase = 90; continue; };
+                        if (yych >= ' ') { gotoCase = 100; continue; };
                     } else {
-                        if (yych == '"') { gotoCase = 92; continue; };
+                        if (yych == '"') { gotoCase = 102; continue; };
                     }
                 }
             } else {
                 if (yych <= '>') {
                     if (yych <= ';') {
-                        if (yych <= '\'') { gotoCase = 93; continue; };
+                        if (yych <= '\'') { gotoCase = 103; continue; };
                     } else {
-                        if (yych <= '<') { gotoCase = 90; continue; };
-                        if (yych <= '=') { gotoCase = 94; continue; };
-                        { gotoCase = 96; continue; };
+                        if (yych <= '<') { gotoCase = 100; continue; };
+                        if (yych <= '=') { gotoCase = 104; continue; };
+                        { gotoCase = 106; continue; };
                     }
                 } else {
                     if (yych <= '[') {
-                        if (yych >= '[') { gotoCase = 90; continue; };
+                        if (yych >= '[') { gotoCase = 100; continue; };
                     } else {
-                        if (yych == ']') { gotoCase = 90; continue; };
+                        if (yych == ']') { gotoCase = 100; continue; };
                     }
                 }
             }
             ++cursor;
             yych = this._charAt(cursor);
-            { gotoCase = 109; continue; };
-case 89:
+            { gotoCase = 119; continue; };
+case 99:
             {
-                    if (this._condition.parseCondition === this._parseConditions.SCRIPT) {
+                    if (this._condition.parseCondition === this._parseConditions.SCRIPT || this._condition.parseCondition === this._parseConditions.STYLE) {
                         // Fall through if expecting attributes.
                         this.tokenType = null;
                         return cursor;
@@ -580,18 +664,18 @@ case 89:
                         this.tokenType = null;
                     return cursor;
                 }
-case 90:
+case 100:
             ++cursor;
             { this.tokenType = null; return cursor; }
-case 92:
+case 102:
             yyaccept = 0;
             yych = this._charAt(YYMARKER = ++cursor);
-            { gotoCase = 105; continue; };
-case 93:
+            { gotoCase = 115; continue; };
+case 103:
             yyaccept = 0;
             yych = this._charAt(YYMARKER = ++cursor);
-            { gotoCase = 99; continue; };
-case 94:
+            { gotoCase = 109; continue; };
+case 104:
             ++cursor;
             {
                     if (this._isExpectingAttribute())
@@ -599,7 +683,7 @@ case 94:
                     this.tokenType = null;
                     return cursor;
                 }
-case 96:
+case 106:
             ++cursor;
             this.setLexCondition(this._lexConditions.INITIAL);
             {
@@ -613,68 +697,77 @@ case 96:
                         return cursor;
                     }
 
+                    if (this._condition.parseCondition & this._parseConditions.STYLE) {
+                        if (!this._internalCSSTokenizer) {
+                            this._internalCSSTokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer("text/css");
+                            this._condition.internalCSSTokenizerCondition = this._internalCSSTokenizer.initialCondition;
+                        }
+                        // Do not tokenize style tag contents.
+                        return cursor;
+                    }
+
                     this._condition.parseCondition = this._parseConditions.INITIAL;
                     return cursor;
                 }
-case 98:
+case 108:
             ++cursor;
             yych = this._charAt(cursor);
-case 99:
+case 109:
             if (yych <= '\f') {
-                if (yych != '\n') { gotoCase = 98; continue; };
+                if (yych != '\n') { gotoCase = 108; continue; };
             } else {
-                if (yych <= '\r') { gotoCase = 100; continue; };
-                if (yych == '\'') { gotoCase = 102; continue; };
-                { gotoCase = 98; continue; };
+                if (yych <= '\r') { gotoCase = 110; continue; };
+                if (yych == '\'') { gotoCase = 112; continue; };
+                { gotoCase = 108; continue; };
             }
-case 100:
+case 110:
             ++cursor;
             this.setLexCondition(this._lexConditions.SSTRING);
             { return this._stringToken(cursor); }
-case 102:
+case 112:
             ++cursor;
             { return this._stringToken(cursor, true); }
-case 104:
+case 114:
             ++cursor;
             yych = this._charAt(cursor);
-case 105:
+case 115:
             if (yych <= '\f') {
-                if (yych != '\n') { gotoCase = 104; continue; };
+                if (yych != '\n') { gotoCase = 114; continue; };
             } else {
-                if (yych <= '\r') { gotoCase = 106; continue; };
-                if (yych == '"') { gotoCase = 102; continue; };
-                { gotoCase = 104; continue; };
+                if (yych <= '\r') { gotoCase = 116; continue; };
+                if (yych == '"') { gotoCase = 112; continue; };
+                { gotoCase = 114; continue; };
             }
-case 106:
+case 116:
             ++cursor;
             this.setLexCondition(this._lexConditions.DSTRING);
             { return this._stringToken(cursor); }
-case 108:
+case 118:
             ++cursor;
             yych = this._charAt(cursor);
-case 109:
+case 119:
             if (yych <= '"') {
                 if (yych <= '\r') {
-                    if (yych == '\n') { gotoCase = 89; continue; };
-                    if (yych <= '\f') { gotoCase = 108; continue; };
-                    { gotoCase = 89; continue; };
+                    if (yych == '\n') { gotoCase = 99; continue; };
+                    if (yych <= '\f') { gotoCase = 118; continue; };
+                    { gotoCase = 99; continue; };
                 } else {
-                    if (yych == ' ') { gotoCase = 89; continue; };
-                    if (yych <= '!') { gotoCase = 108; continue; };
-                    { gotoCase = 89; continue; };
+                    if (yych == ' ') { gotoCase = 99; continue; };
+                    if (yych <= '!') { gotoCase = 118; continue; };
+                    { gotoCase = 99; continue; };
                 }
             } else {
                 if (yych <= '>') {
-                    if (yych == '\'') { gotoCase = 89; continue; };
-                    if (yych <= ';') { gotoCase = 108; continue; };
-                    { gotoCase = 89; continue; };
+                    if (yych == '\'') { gotoCase = 99; continue; };
+                    if (yych <= ';') { gotoCase = 118; continue; };
+                    { gotoCase = 99; continue; };
                 } else {
                     if (yych <= '[') {
-                        if (yych <= 'Z') { gotoCase = 108; continue; };
-                        { gotoCase = 89; continue; };
+                        if (yych <= 'Z') { gotoCase = 118; continue; };
+                        { gotoCase = 99; continue; };
                     } else {
-                        if (yych == ']') { gotoCase = 89; continue; };
-                        { gotoCase = 108; continue; };
+                        if (yych == ']') { gotoCase = 99; continue; };
+                        { gotoCase = 118; continue; };
                     }
                 }
             }
diff --git a/Source/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js b/Source/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js
index 44c62b3..769e984 100644
--- a/Source/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js
+++ b/Source/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js
@@ -66,7 +66,8 @@ WebInspector.SourceHTMLTokenizer = function()
         ATTRIBUTE_VALUE: 2,
         LINKIFY: 4,
         A_NODE: 8,
-        SCRIPT: 16
+        SCRIPT: 16,
+        STYLE: 32
     };
 
     this.initialCondition = { lexCondition: this._lexConditions.INITIAL, parseCondition: this._parseConditions.INITIAL };
@@ -81,6 +82,12 @@ WebInspector.SourceHTMLTokenizer.prototype = {
                 this._internalJavaScriptTokenizer.line = line.substring(0, match.index);
             } else
                 this._internalJavaScriptTokenizer.line = line;
+        } else if (this._internalCSSTokenizer) {
+            var match = /<\/style/i.exec(line);
+            if (match) {
+                this._internalCSSTokenizer.line = line.substring(0, match.index);
+            } else
+                this._internalCSSTokenizer.line = line;
         }
         this._line = line;
     },
@@ -145,6 +152,18 @@ WebInspector.SourceHTMLTokenizer.prototype = {
                 return result;
             } else if (cursor !== this._line.length)
                 delete this._internalJavaScriptTokenizer;
+        } else if (this._internalCSSTokenizer) {
+            // Re-set line to force </style> detection first.
+            this.line = this._line;
+            if (cursor !== this._internalCSSTokenizer._line.length) {
+                // Tokenizer is stateless, so restore its condition before tokenizing and save it after.
+                this._internalCSSTokenizer.condition = this._condition.internalCSSTokenizerCondition;
+                var result = this._internalCSSTokenizer.nextToken(cursor);
+                this.tokenType = this._internalCSSTokenizer.tokenType;
+                this._condition.internalCSSTokenizerCondition = this._internalCSSTokenizer.condition;
+                return result;
+            } else if (cursor !== this._line.length)
+                delete this._internalCSSTokenizer;
         }
 
         var cursorOnEnter = cursor;
@@ -175,6 +194,9 @@ WebInspector.SourceHTMLTokenizer.prototype = {
                 ScriptStart = "<" [Ss] [Cc] [Rr] [Ii] [Pp] [Tt];
                 ScriptEnd = "</" [Ss] [Cc] [Rr] [Ii] [Pp] [Tt];
 
+                StyleStart = "<" [Ss] [Tt] [Yy] [Ll] [Ee];
+                StyleEnd = "</" [Ss] [Tt] [Yy] [Ll] [Ee];
+
                 LT = "<" | "</";
                 GT = ">";
                 EqualSign = "=";
@@ -201,7 +223,7 @@ WebInspector.SourceHTMLTokenizer.prototype = {
                 <INITIAL> ScriptStart => TAG
                 {
                     if (this._condition.parseCondition & this._parseConditions.SCRIPT) {
-                        // Do not tokenize script tag contents, keep lexer state although processing "<".
+                        // Do not tokenize script tag contents, keep lexer state, even though processing "<".
                         this.setLexCondition(this._lexConditions.INITIAL);
                         this.tokenType = null;
                         return cursor;
@@ -219,10 +241,31 @@ WebInspector.SourceHTMLTokenizer.prototype = {
                     return cursor;
                 }
 
+                <INITIAL> StyleStart => TAG
+                {
+                    if (this._condition.parseCondition & this._parseConditions.STYLE) {
+                        // Do not tokenize style tag contents, keep lexer state, even though processing "<".
+                        this.setLexCondition(this._lexConditions.INITIAL);
+                        this.tokenType = null;
+                        return cursor;
+                    }
+                    this.tokenType = "html-tag";
+                    this._condition.parseCondition = this._parseConditions.STYLE;
+                    this._setExpectingAttribute();
+                    return cursor;
+                }
+
+                <INITIAL> StyleEnd => TAG
+                {
+                    this.tokenType = "html-tag";
+                    this._condition.parseCondition = this._parseConditions.INITIAL;
+                    return cursor;
+                }
+
                 <INITIAL> LT => TAG
                 {
-                    if (this._condition.parseCondition & this._parseConditions.SCRIPT) {
-                        // Do not tokenize script tag contents, keep lexer state although processing "<".
+                    if (this._condition.parseCondition & (this._parseConditions.SCRIPT | this._parseConditions.STYLE)) {
+                        // Do not tokenize script and style tag contents, keep lexer state, even though processing "<".
                         this.setLexCondition(this._lexConditions.INITIAL);
                         this.tokenType = null;
                         return cursor;
@@ -245,6 +288,15 @@ WebInspector.SourceHTMLTokenizer.prototype = {
                         return cursor;
                     }
 
+                    if (this._condition.parseCondition & this._parseConditions.STYLE) {
+                        if (!this._internalCSSTokenizer) {
+                            this._internalCSSTokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer("text/css");
+                            this._condition.internalCSSTokenizerCondition = this._internalCSSTokenizer.initialCondition;
+                        }
+                        // Do not tokenize style tag contents.
+                        return cursor;
+                    }
+
                     this._condition.parseCondition = this._parseConditions.INITIAL;
                     return cursor;
                 }
@@ -267,7 +319,7 @@ WebInspector.SourceHTMLTokenizer.prototype = {
 
                 <TAG> Identifier
                 {
-                    if (this._condition.parseCondition === this._parseConditions.SCRIPT) {
+                    if (this._condition.parseCondition === this._parseConditions.SCRIPT || this._condition.parseCondition === this._parseConditions.STYLE) {
                         // Fall through if expecting attributes.
                         this.tokenType = null;
                         return cursor;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list