Changeset 52439 in webkit


Ignore:
Timestamp:
Dec 21, 2009 3:00:06 AM (14 years ago)
Author:
pfeldman@chromium.org
Message:

2009-12-20 Pavel Feldman <pfeldman@chromium.org>

Reviewed by Eric Seidel.

Web Inspector: extract syntax highlighters into separate files.

https://bugs.webkit.org/show_bug.cgi?id=32803

  • WebCore.gypi:
  • WebCore.vcproj/WebCore.vcproj:
  • inspector/front-end/CSSSourceSyntaxHighlighter.js: Added. (WebInspector.CSSSourceSyntaxHighlighter):
  • inspector/front-end/JavaScriptSourceSyntaxHighlighter.js: Added. (WebInspector.JavaScriptSourceSyntaxHighlighter): (WebInspector.JavaScriptSourceSyntaxHighlighter.):
  • inspector/front-end/SourceFrame.js:
  • inspector/front-end/SourceSyntaxHighlighter.js: Added. (WebInspector.SourceSyntaxHighlighter): (WebInspector.SourceSyntaxHighlighter.prototype.createSpan): (WebInspector.SourceSyntaxHighlighter.prototype.process.processChunk): (WebInspector.SourceSyntaxHighlighter.prototype.process.moveToNextLine): (WebInspector.SourceSyntaxHighlighter.prototype.process): (WebInspector.SourceSyntaxHighlighter.prototype.lex): (WebInspector.SourceSyntaxHighlighter.prototype.appendNonToken): (WebInspector.SourceSyntaxHighlighter.prototype.syntaxHighlightNode):
  • inspector/front-end/WebKit.qrc:
  • inspector/front-end/inspector.html:
Location:
trunk/WebCore
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r52438 r52439  
     12009-12-20  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Web Inspector: extract syntax highlighters into separate files.
     6
     7        https://bugs.webkit.org/show_bug.cgi?id=32803
     8
     9        * WebCore.gypi:
     10        * WebCore.vcproj/WebCore.vcproj:
     11        * inspector/front-end/CSSSourceSyntaxHighlighter.js: Added.
     12        (WebInspector.CSSSourceSyntaxHighlighter):
     13        * inspector/front-end/JavaScriptSourceSyntaxHighlighter.js: Added.
     14        (WebInspector.JavaScriptSourceSyntaxHighlighter):
     15        (WebInspector.JavaScriptSourceSyntaxHighlighter.):
     16        * inspector/front-end/SourceFrame.js:
     17        * inspector/front-end/SourceSyntaxHighlighter.js: Added.
     18        (WebInspector.SourceSyntaxHighlighter):
     19        (WebInspector.SourceSyntaxHighlighter.prototype.createSpan):
     20        (WebInspector.SourceSyntaxHighlighter.prototype.process.processChunk):
     21        (WebInspector.SourceSyntaxHighlighter.prototype.process.moveToNextLine):
     22        (WebInspector.SourceSyntaxHighlighter.prototype.process):
     23        (WebInspector.SourceSyntaxHighlighter.prototype.lex):
     24        (WebInspector.SourceSyntaxHighlighter.prototype.appendNonToken):
     25        (WebInspector.SourceSyntaxHighlighter.prototype.syntaxHighlightNode):
     26        * inspector/front-end/WebKit.qrc:
     27        * inspector/front-end/inspector.html:
     28
    1292009-12-18  Julien Chaffraix  <jchaffraix@pleyo.com>
    230
  • trunk/WebCore/WebCore.gypi

    r52213 r52439  
    36583658            'inspector/front-end/ContextMenu.js',
    36593659            'inspector/front-end/CookieItemsView.js',
     3660            'inspector/front-end/CSSSourceSyntaxHighlighter.js',
    36603661            'inspector/front-end/Database.js',
    36613662            'inspector/front-end/DatabaseQueryView.js',
     
    36763677            'inspector/front-end/InjectedScriptAccess.js',
    36773678            'inspector/front-end/inspector.js',
     3679            'inspector/front-end/JavaScriptSourceSyntaxHighlighter.js',
    36783680            'inspector/front-end/KeyboardShortcut.js',
    36793681            'inspector/front-end/MetricsSidebarPane.js',
     
    37023704            'inspector/front-end/SidebarTreeElement.js',
    37033705            'inspector/front-end/SourceFrame.js',
     3706            'inspector/front-end/SourceSyntaxHighlighter.js',
    37043707            'inspector/front-end/SourceView.js',
    37053708            'inspector/front-end/StatusBarButton.js',
  • trunk/WebCore/WebCore.vcproj/WebCore.vcproj

    r52149 r52439  
    4245742457                                </File>
    4245842458                                <File
     42459                                        RelativePath="..\inspector\front-end\CSSSourceSyntaxHighlighter.js"
     42460                                        >
     42461                                </File>
     42462                                <File
    4245942463                                        RelativePath="..\inspector\front-end\Database.js"
    4246042464                                        >
     
    4253742541                                </File>
    4253842542                                <File
     42543                                        RelativePath="..\inspector\front-end\JavaScriptSourceSyntaxHighlighter.js"
     42544                                        >
     42545                                </File>
     42546                                <File
    4253942547                                        RelativePath="..\inspector\front-end\MetricsSidebarPane.js"
    4254042548                                        >
     
    4263442642                                <File
    4263542643                                        RelativePath="..\inspector\front-end\SourceFrame.js"
     42644                                        >
     42645                                </File>
     42646                                <File
     42647                                        RelativePath="..\inspector\front-end\SourceSyntaxHighlighter.js"
    4263642648                                        >
    4263742649                                </File>
  • trunk/WebCore/inspector/front-end/SourceFrame.js

    r52099 r52439  
    737737
    738738WebInspector.SourceFrame.prototype.__proto__ = WebInspector.Object.prototype;
    739 
    740 WebInspector.SourceSyntaxHighlighter = function(table, sourceFrame)
    741 {
    742     this.table = table;
    743     this.sourceFrame = sourceFrame;
    744 }
    745 
    746 WebInspector.SourceSyntaxHighlighter.prototype = {
    747     createSpan: function(content, className)
    748     {
    749         var span = document.createElement("span");
    750         span.className = className;
    751         span.appendChild(document.createTextNode(content));
    752         return span;
    753     },
    754 
    755     process: function()
    756     {
    757         // Split up the work into chunks so we don't block the
    758         // UI thread while processing.
    759 
    760         var rows = this.table.rows;
    761         var rowsLength = rows.length;
    762         const tokensPerChunk = 100;
    763         const lineLengthLimit = 20000;
    764        
    765         var boundProcessChunk = processChunk.bind(this);
    766         var processChunkInterval = setInterval(boundProcessChunk, 25);
    767         boundProcessChunk();
    768        
    769         function processChunk()
    770         {
    771             for (var i = 0; i < tokensPerChunk; i++) {
    772                 if (this.cursor >= this.lineCode.length)
    773                     moveToNextLine.call(this);
    774                 if (this.lineIndex >= rowsLength) {
    775                     this.sourceFrame.dispatchEventToListeners("syntax highlighting complete");
    776                     return;
    777                 }
    778                 if (this.cursor > lineLengthLimit) {
    779                     var codeFragment = this.lineCode.substring(this.cursor);
    780                     this.nonToken += codeFragment;
    781                     this.cursor += codeFragment.length;
    782                 }
    783 
    784                 this.lex();
    785             }
    786         }
    787        
    788         function moveToNextLine()
    789         {
    790             this.appendNonToken();
    791            
    792             var row = rows[this.lineIndex];
    793             var line = row ? row.cells[1] : null;
    794             if (line && this.newLine) {
    795                 line.removeChildren();
    796                
    797                 if (this.messageBubble)
    798                     this.newLine.appendChild(this.messageBubble);
    799                
    800                 line.parentNode.insertBefore(this.newLine, line);
    801                 line.parentNode.removeChild(line);
    802                
    803                 this.newLine = null;
    804             }
    805             this.lineIndex++;
    806             if (this.lineIndex >= rowsLength && processChunkInterval) {
    807                 clearInterval(processChunkInterval);
    808                 this.sourceFrame.dispatchEventToListeners("syntax highlighting complete");
    809                 return;
    810             }
    811             row = rows[this.lineIndex];
    812             line = row ? row.cells[1] : null;
    813            
    814             this.messageBubble = null;
    815             if (line.lastChild && line.lastChild.nodeType === Node.ELEMENT_NODE && line.lastChild.hasStyleClass("webkit-html-message-bubble")) {
    816                 this.messageBubble = line.lastChild;
    817                 line.removeChild(this.messageBubble);
    818             }
    819 
    820             this.lineCode = line.textContent;
    821             this.newLine = line.cloneNode(false);
    822             this.cursor = 0;
    823             if (!line)
    824                 moveToNextLine();
    825         }
    826     },
    827    
    828     lex: function()
    829     {
    830         var token = null;
    831         var codeFragment = this.lineCode.substring(this.cursor);
    832        
    833         for (var i = 0; i < this.rules.length; i++) {
    834             var rule = this.rules[i];
    835             var ruleContinueStateCondition = typeof rule.continueStateCondition === "undefined" ? this.ContinueState.None : rule.continueStateCondition;
    836             if (this.continueState === ruleContinueStateCondition) {
    837                 if (typeof rule.lexStateCondition !== "undefined" && this.lexState !== rule.lexStateCondition)
    838                     continue;
    839                 var match = rule.pattern.exec(codeFragment);
    840                 if (match) {
    841                     token = match[0];
    842                     if (token) {
    843                         if (!rule.dontAppendNonToken)
    844                             this.appendNonToken();
    845                         return rule.action.call(this, token);
    846                     }
    847                 }
    848             }
    849         }
    850         this.nonToken += codeFragment[0];
    851         this.cursor++;
    852     },
    853    
    854     appendNonToken: function ()
    855     {
    856         if (this.nonToken.length > 0) {
    857             this.newLine.appendChild(document.createTextNode(this.nonToken));
    858             this.nonToken = "";
    859         }
    860     },
    861    
    862     syntaxHighlightNode: function(node)
    863     {
    864         this.lineCode = node.textContent;
    865         node.removeChildren();
    866         this.newLine = node;
    867         this.cursor = 0;
    868         while (true) {
    869             if (this.cursor >= this.lineCode.length) {
    870                 var codeFragment = this.lineCode.substring(this.cursor);
    871                 this.nonToken += codeFragment;
    872                 this.cursor += codeFragment.length;
    873                 this.appendNonToken();
    874                 this.newLine = null;
    875                 return;
    876             }
    877 
    878             this.lex();
    879         }
    880     }
    881 }
    882 
    883 WebInspector.CSSSourceSyntaxHighlighter = function(table, sourceFrame) {
    884     WebInspector.SourceSyntaxHighlighter.call(this, table, sourceFrame);
    885 
    886     this.LexState = {
    887         Initial: 1,
    888         DeclarationProperty: 2,
    889         DeclarationValue: 3,
    890         AtMedia: 4,
    891         AtRule: 5,
    892         AtKeyframes: 6
    893     };
    894     this.ContinueState = {
    895         None: 0,
    896         Comment: 1
    897     };
    898    
    899     this.nonToken = "";
    900     this.cursor = 0;
    901     this.lineIndex = -1;
    902     this.lineCode = "";
    903     this.newLine = null;
    904     this.lexState = this.LexState.Initial;
    905     this.continueState = this.ContinueState.None;
    906    
    907     const urlPattern = /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i;
    908     const stringPattern = /^(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')/i;
    909     const identPattern = /^-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*/i;
    910     const startBlockPattern = /^{/i;
    911     const endBlockPattern = /^}/i;
    912     this.rules = [{
    913         pattern: /^\/\*[^\*]*\*+([^\/*][^*]*\*+)*\//i,
    914         action: commentAction
    915     }, {
    916         pattern: /^(?:\/\*(?:[^\*]|\*[^\/])*)/i,
    917         action: commentStartAction
    918     }, {
    919         pattern: /^(?:(?:[^\*]|\*[^\/])*\*+\/)/i,
    920         action: commentEndAction,
    921         continueStateCondition: this.ContinueState.Comment
    922     }, {
    923         pattern: /^.*/i,
    924         action: commentMiddleAction,
    925         continueStateCondition: this.ContinueState.Comment
    926     }, {
    927         pattern: /^(?:(?:-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*|\*)(?:#-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*|\.-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*|\[\s*-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*\s*(?:(?:=|~=|\|=)\s*(?:-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*|(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*'))\s*)?\]|:(?:-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*|-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*\(\s*(?:-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*\s*)?\)))*|(?:#-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*|\.-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*|\[\s*-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*\s*(?:(?:=|~=|\|=)\s*(?:-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*|(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*'))\s*)?\]|:(?:-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*|-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*\(\s*(?:-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*\s*)?\)))+)/i,
    928         action: selectorAction,
    929         lexStateCondition: this.LexState.Initial
    930     }, {
    931         pattern: startBlockPattern,
    932         action: startRulesetBlockAction,
    933         lexStateCondition: this.LexState.Initial,
    934         dontAppendNonToken: true
    935     }, {
    936         pattern: identPattern,
    937         action: propertyAction,
    938         lexStateCondition: this.LexState.DeclarationProperty,
    939         dontAppendNonToken: true
    940     }, {
    941         pattern: /^:/i,
    942         action: declarationColonAction,
    943         lexStateCondition: this.LexState.DeclarationProperty,
    944         dontAppendNonToken: true
    945     }, {
    946         pattern: /^(?:#(?:[\da-f]{6}|[\da-f]{3})|rgba\(\s*(?:\d+|\d*\.\d+)%?\s*,\s*(?:\d+|\d*\.\d+)%?\s*,\s*(?:\d+|\d*\.\d+)%?\s*,\s*(?:\d+|\d*\.\d+)%?\s*\)|hsla\(\s*(?:\d+|\d*\.\d+)%?\s*,\s*(?:\d+|\d*\.\d+)%?\s*,\s*(?:\d+|\d*\.\d+)%?\s*,\s*(?:\d+|\d*\.\d+)%?\s*\)|rgb\(\s*(?:\d+|\d*\.\d+)%?\s*,\s*(?:\d+|\d*\.\d+)%?\s*,\s*(?:\d+|\d*\.\d+)%?\s*\)|hsl\(\s*(?:\d+|\d*\.\d+)%?\s*,\s*(?:\d+|\d*\.\d+)%?\s*,\s*(?:\d+|\d*\.\d+)%?\s*\))/i,
    947         action: colorAction,
    948         lexStateCondition: this.LexState.DeclarationValue
    949     }, {
    950         pattern: /^(?:-?(?:\d+|\d*\.\d+)(?:em|rem|__qem|ex|px|cm|mm|in|pt|pc|deg|rad|grad|turn|ms|s|Hz|kHz|%)?)/i,
    951         action: numvalueAction,
    952         lexStateCondition: this.LexState.DeclarationValue
    953     }, {
    954         pattern: urlPattern,
    955         action: urlAction,
    956         lexStateCondition: this.LexState.DeclarationValue
    957     }, {
    958         pattern: stringPattern,
    959         action: stringAction,
    960         lexStateCondition: this.LexState.DeclarationValue
    961     }, {
    962         pattern: /^!\s*important/i,
    963         action: importantAction,
    964         lexStateCondition: this.LexState.DeclarationValue
    965     }, {
    966         pattern: identPattern,
    967         action: valueIdentAction,
    968         lexStateCondition: this.LexState.DeclarationValue,
    969         dontAppendNonToken: true
    970     }, {
    971         pattern: /^;/i,
    972         action: declarationSemicolonAction,
    973         lexStateCondition: this.LexState.DeclarationValue,
    974         dontAppendNonToken: true
    975     }, {
    976         pattern: endBlockPattern,
    977         action: endRulesetBlockAction,
    978         lexStateCondition: this.LexState.DeclarationProperty,
    979         dontAppendNonToken: true
    980     }, {
    981         pattern: endBlockPattern,
    982         action: endRulesetBlockAction,
    983         lexStateCondition: this.LexState.DeclarationValue,
    984         dontAppendNonToken: true
    985     }, {
    986         pattern: /^@media/i,
    987         action: atMediaAction,
    988         lexStateCondition: this.LexState.Initial
    989     }, {
    990         pattern: startBlockPattern,
    991         action: startAtMediaBlockAction,
    992         lexStateCondition: this.LexState.AtMedia,
    993         dontAppendNonToken: true
    994     }, {
    995         pattern: /^@-webkit-keyframes/i,
    996         action: atKeyframesAction,
    997         lexStateCondition: this.LexState.Initial
    998     }, {
    999         pattern: startBlockPattern,
    1000         action: startAtMediaBlockAction,
    1001         lexStateCondition: this.LexState.AtKeyframes,
    1002         dontAppendNonToken: true
    1003     }, {
    1004         pattern: /^@-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*/i,
    1005         action: atRuleAction,
    1006         lexStateCondition: this.LexState.Initial
    1007     }, {
    1008         pattern: /^;/i,
    1009         action: endAtRuleAction,
    1010         lexStateCondition: this.LexState.AtRule
    1011     }, {
    1012         pattern: urlPattern,
    1013         action: urlAction,
    1014         lexStateCondition: this.LexState.AtRule
    1015     }, {
    1016         pattern: stringPattern,
    1017         action: stringAction,
    1018         lexStateCondition: this.LexState.AtRule
    1019     }, {
    1020         pattern: stringPattern,
    1021         action: stringAction,
    1022         lexStateCondition: this.LexState.AtKeyframes
    1023     }, {
    1024         pattern: identPattern,
    1025         action: atRuleIdentAction,
    1026         lexStateCondition: this.LexState.AtRule,
    1027         dontAppendNonToken: true
    1028     }, {
    1029         pattern: identPattern,
    1030         action: atRuleIdentAction,
    1031         lexStateCondition: this.LexState.AtMedia,
    1032         dontAppendNonToken: true
    1033     }, {
    1034         pattern: startBlockPattern,
    1035         action: startAtRuleBlockAction,
    1036         lexStateCondition: this.LexState.AtRule,
    1037         dontAppendNonToken: true
    1038     }];
    1039    
    1040     function commentAction(token)
    1041     {
    1042         this.cursor += token.length;
    1043         this.newLine.appendChild(this.createSpan(token, "webkit-css-comment"));
    1044     }
    1045    
    1046     function commentStartAction(token)
    1047     {
    1048         this.cursor += token.length;
    1049         this.newLine.appendChild(this.createSpan(token, "webkit-css-comment"));
    1050         this.continueState = this.ContinueState.Comment;
    1051     }
    1052    
    1053     function commentEndAction(token)
    1054     {
    1055         this.cursor += token.length;
    1056         this.newLine.appendChild(this.createSpan(token, "webkit-css-comment"));
    1057         this.continueState = this.ContinueState.None;
    1058     }
    1059 
    1060     function commentMiddleAction(token)
    1061     {
    1062         this.cursor += token.length;
    1063         this.newLine.appendChild(this.createSpan(token, "webkit-css-comment"));
    1064     }
    1065    
    1066     function selectorAction(token)
    1067     {
    1068         this.cursor += token.length;
    1069         this.newLine.appendChild(this.createSpan(token, "webkit-css-selector"));
    1070     }
    1071    
    1072     function startRulesetBlockAction(token)
    1073     {
    1074         this.cursor += token.length;
    1075         this.nonToken += token;
    1076         this.lexState = this.LexState.DeclarationProperty;
    1077     }
    1078    
    1079     function endRulesetBlockAction(token)
    1080     {
    1081         this.cursor += token.length;
    1082         this.nonToken += token;
    1083         this.lexState = this.LexState.Initial;
    1084     }
    1085    
    1086     const propertyKeywords = {
    1087         "background": true,
    1088         "background-attachment": true,
    1089         "background-clip": true,
    1090         "background-color": true,
    1091         "background-image": true,
    1092         "background-origin": true,
    1093         "background-position": true,
    1094         "background-position-x": true,
    1095         "background-position-y": true,
    1096         "background-repeat": true,
    1097         "background-repeat-x": true,
    1098         "background-repeat-y": true,
    1099         "background-size": true,
    1100         "border": true,
    1101         "border-bottom": true,
    1102         "border-bottom-color": true,
    1103         "border-bottom-left-radius": true,
    1104         "border-bottom-right-radius": true,
    1105         "border-bottom-style": true,
    1106         "border-bottom-width": true,
    1107         "border-collapse": true,
    1108         "border-color": true,
    1109         "border-left": true,
    1110         "border-left-color": true,
    1111         "border-left-style": true,
    1112         "border-left-width": true,
    1113         "border-radius": true,
    1114         "border-right": true,
    1115         "border-right-color": true,
    1116         "border-right-style": true,
    1117         "border-right-width": true,
    1118         "border-spacing": true,
    1119         "border-style": true,
    1120         "border-top": true,
    1121         "border-top-color": true,
    1122         "border-top-left-radius": true,
    1123         "border-top-right-radius": true,
    1124         "border-top-style": true,
    1125         "border-top-width": true,
    1126         "border-width": true,
    1127         "bottom": true,
    1128         "caption-side": true,
    1129         "clear": true,
    1130         "clip": true,
    1131         "color": true,
    1132         "content": true,
    1133         "counter-increment": true,
    1134         "counter-reset": true,
    1135         "cursor": true,
    1136         "direction": true,
    1137         "display": true,
    1138         "empty-cells": true,
    1139         "float": true,
    1140         "font": true,
    1141         "font-family": true,
    1142         "font-size": true,
    1143         "font-stretch": true,
    1144         "font-style": true,
    1145         "font-variant": true,
    1146         "font-weight": true,
    1147         "height": true,
    1148         "left": true,
    1149         "letter-spacing": true,
    1150         "line-height": true,
    1151         "list-style": true,
    1152         "list-style-image": true,
    1153         "list-style-position": true,
    1154         "list-style-type": true,
    1155         "margin": true,
    1156         "margin-bottom": true,
    1157         "margin-left": true,
    1158         "margin-right": true,
    1159         "margin-top": true,
    1160         "max-height": true,
    1161         "max-width": true,
    1162         "min-height": true,
    1163         "min-width": true,
    1164         "opacity": true,
    1165         "orphans": true,
    1166         "outline": true,
    1167         "outline-color": true,
    1168         "outline-offset": true,
    1169         "outline-style": true,
    1170         "outline-width": true,
    1171         "overflow": true,
    1172         "overflow-x": true,
    1173         "overflow-y": true,
    1174         "padding": true,
    1175         "padding-bottom": true,
    1176         "padding-left": true,
    1177         "padding-right": true,
    1178         "padding-top": true,
    1179         "page": true,
    1180         "page-break-after": true,
    1181         "page-break-before": true,
    1182         "page-break-inside": true,
    1183         "pointer-events": true,
    1184         "position": true,
    1185         "quotes": true,
    1186         "resize": true,
    1187         "right": true,
    1188         "size": true,
    1189         "src": true,
    1190         "table-layout": true,
    1191         "text-align": true,
    1192         "text-decoration": true,
    1193         "text-indent": true,
    1194         "text-line-through": true,
    1195         "text-line-through-color": true,
    1196         "text-line-through-mode": true,
    1197         "text-line-through-style": true,
    1198         "text-line-through-width": true,
    1199         "text-overflow": true,
    1200         "text-overline": true,
    1201         "text-overline-color": true,
    1202         "text-overline-mode": true,
    1203         "text-overline-style": true,
    1204         "text-overline-width": true,
    1205         "text-rendering": true,
    1206         "text-shadow": true,
    1207         "text-transform": true,
    1208         "text-underline": true,
    1209         "text-underline-color": true,
    1210         "text-underline-mode": true,
    1211         "text-underline-style": true,
    1212         "text-underline-width": true,
    1213         "top": true,
    1214         "unicode-bidi": true,
    1215         "unicode-range": true,
    1216         "vertical-align": true,
    1217         "visibility": true,
    1218         "white-space": true,
    1219         "widows": true,
    1220         "width": true,
    1221         "word-break": true,
    1222         "word-spacing": true,
    1223         "word-wrap": true,
    1224         "z-index": true,
    1225         "zoom": true,
    1226         "-webkit-animation": true,
    1227         "-webkit-animation-delay": true,
    1228         "-webkit-animation-direction": true,
    1229         "-webkit-animation-duration": true,
    1230         "-webkit-animation-iteration-count": true,
    1231         "-webkit-animation-name": true,
    1232         "-webkit-animation-play-state": true,
    1233         "-webkit-animation-timing-function": true,
    1234         "-webkit-appearance": true,
    1235         "-webkit-backface-visibility": true,
    1236         "-webkit-background-clip": true,
    1237         "-webkit-background-composite": true,
    1238         "-webkit-background-origin": true,
    1239         "-webkit-background-size": true,
    1240         "-webkit-binding": true,
    1241         "-webkit-border-fit": true,
    1242         "-webkit-border-horizontal-spacing": true,
    1243         "-webkit-border-image": true,
    1244         "-webkit-border-radius": true,
    1245         "-webkit-border-vertical-spacing": true,
    1246         "-webkit-box-align": true,
    1247         "-webkit-box-direction": true,
    1248         "-webkit-box-flex": true,
    1249         "-webkit-box-flex-group": true,
    1250         "-webkit-box-lines": true,
    1251         "-webkit-box-ordinal-group": true,
    1252         "-webkit-box-orient": true,
    1253         "-webkit-box-pack": true,
    1254         "-webkit-box-reflect": true,
    1255         "-webkit-box-shadow": true,
    1256         "-webkit-box-sizing": true,
    1257         "-webkit-column-break-after": true,
    1258         "-webkit-column-break-before": true,
    1259         "-webkit-column-break-inside": true,
    1260         "-webkit-column-count": true,
    1261         "-webkit-column-gap": true,
    1262         "-webkit-column-rule": true,
    1263         "-webkit-column-rule-color": true,
    1264         "-webkit-column-rule-style": true,
    1265         "-webkit-column-rule-width": true,
    1266         "-webkit-column-width": true,
    1267         "-webkit-columns": true,
    1268         "-webkit-font-size-delta": true,
    1269         "-webkit-font-smoothing": true,
    1270         "-webkit-highlight": true,
    1271         "-webkit-line-break": true,
    1272         "-webkit-line-clamp": true,
    1273         "-webkit-margin-bottom-collapse": true,
    1274         "-webkit-margin-collapse": true,
    1275         "-webkit-margin-start": true,
    1276         "-webkit-margin-top-collapse": true,
    1277         "-webkit-marquee": true,
    1278         "-webkit-marquee-direction": true,
    1279         "-webkit-marquee-increment": true,
    1280         "-webkit-marquee-repetition": true,
    1281         "-webkit-marquee-speed": true,
    1282         "-webkit-marquee-style": true,
    1283         "-webkit-mask": true,
    1284         "-webkit-mask-attachment": true,
    1285         "-webkit-mask-box-image": true,
    1286         "-webkit-mask-clip": true,
    1287         "-webkit-mask-composite": true,
    1288         "-webkit-mask-image": true,
    1289         "-webkit-mask-origin": true,
    1290         "-webkit-mask-position": true,
    1291         "-webkit-mask-position-x": true,
    1292         "-webkit-mask-position-y": true,
    1293         "-webkit-mask-repeat": true,
    1294         "-webkit-mask-repeat-x": true,
    1295         "-webkit-mask-repeat-y": true,
    1296         "-webkit-mask-size": true,
    1297         "-webkit-match-nearest-mail-blockquote-color": true,
    1298         "-webkit-nbsp-mode": true,
    1299         "-webkit-padding-start": true,
    1300         "-webkit-perspective": true,
    1301         "-webkit-perspective-origin": true,
    1302         "-webkit-perspective-origin-x": true,
    1303         "-webkit-perspective-origin-y": true,
    1304         "-webkit-rtl-ordering": true,
    1305         "-webkit-text-decorations-in-effect": true,
    1306         "-webkit-text-fill-color": true,
    1307         "-webkit-text-security": true,
    1308         "-webkit-text-size-adjust": true,
    1309         "-webkit-text-stroke": true,
    1310         "-webkit-text-stroke-color": true,
    1311         "-webkit-text-stroke-width": true,
    1312         "-webkit-transform": true,
    1313         "-webkit-transform-origin": true,
    1314         "-webkit-transform-origin-x": true,
    1315         "-webkit-transform-origin-y": true,
    1316         "-webkit-transform-origin-z": true,
    1317         "-webkit-transform-style": true,
    1318         "-webkit-transition": true,
    1319         "-webkit-transition-delay": true,
    1320         "-webkit-transition-duration": true,
    1321         "-webkit-transition-property": true,
    1322         "-webkit-transition-timing-function": true,
    1323         "-webkit-user-drag": true,
    1324         "-webkit-user-modify": true,
    1325         "-webkit-user-select": true,
    1326         "-webkit-variable-declaration-block": true
    1327     };
    1328     function propertyAction(token)
    1329     {
    1330         this.cursor += token.length;
    1331         if (token in propertyKeywords) {
    1332             this.appendNonToken.call(this);
    1333             this.newLine.appendChild(this.createSpan(token, "webkit-css-property"));
    1334         } else
    1335             this.nonToken += token;
    1336     }
    1337    
    1338     function declarationColonAction(token)
    1339     {
    1340         this.cursor += token.length;
    1341         this.nonToken += token;
    1342         this.lexState = this.LexState.DeclarationValue;
    1343     }
    1344 
    1345     const valueKeywords = {
    1346         "inherit": true,
    1347         "initial": true,
    1348         "none": true,
    1349         "hidden": true,
    1350         "inset": true,
    1351         "groove": true,
    1352         "ridge": true,
    1353         "outset": true,
    1354         "dotted": true,
    1355         "dashed": true,
    1356         "solid": true,
    1357         "double": true,
    1358         "caption": true,
    1359         "icon": true,
    1360         "menu": true,
    1361         "message-box": true,
    1362         "small-caption": true,
    1363         "-webkit-mini-control": true,
    1364         "-webkit-small-control": true,
    1365         "-webkit-control": true,
    1366         "status-bar": true,
    1367         "italic": true,
    1368         "oblique": true,
    1369         "all": true,
    1370         "small-caps": true,
    1371         "normal": true,
    1372         "bold": true,
    1373         "bolder": true,
    1374         "lighter": true,
    1375         "xx-small": true,
    1376         "x-small": true,
    1377         "small": true,
    1378         "medium": true,
    1379         "large": true,
    1380         "x-large": true,
    1381         "xx-large": true,
    1382         "-webkit-xxx-large": true,
    1383         "smaller": true,
    1384         "larger": true,
    1385         "wider": true,
    1386         "narrower": true,
    1387         "ultra-condensed": true,
    1388         "extra-condensed": true,
    1389         "condensed": true,
    1390         "semi-condensed": true,
    1391         "semi-expanded": true,
    1392         "expanded": true,
    1393         "extra-expanded": true,
    1394         "ultra-expanded": true,
    1395         "serif": true,
    1396         "sans-serif": true,
    1397         "cursive": true,
    1398         "fantasy": true,
    1399         "monospace": true,
    1400         "-webkit-body": true,
    1401         "aqua": true,
    1402         "black": true,
    1403         "blue": true,
    1404         "fuchsia": true,
    1405         "gray": true,
    1406         "green": true,
    1407         "lime": true,
    1408         "maroon": true,
    1409         "navy": true,
    1410         "olive": true,
    1411         "orange": true,
    1412         "purple": true,
    1413         "red": true,
    1414         "silver": true,
    1415         "teal": true,
    1416         "white": true,
    1417         "yellow": true,
    1418         "transparent": true,
    1419         "-webkit-link": true,
    1420         "-webkit-activelink": true,
    1421         "activeborder": true,
    1422         "activecaption": true,
    1423         "appworkspace": true,
    1424         "background": true,
    1425         "buttonface": true,
    1426         "buttonhighlight": true,
    1427         "buttonshadow": true,
    1428         "buttontext": true,
    1429         "captiontext": true,
    1430         "graytext": true,
    1431         "highlight": true,
    1432         "highlighttext": true,
    1433         "inactiveborder": true,
    1434         "inactivecaption": true,
    1435         "inactivecaptiontext": true,
    1436         "infobackground": true,
    1437         "infotext": true,
    1438         "match": true,
    1439         "menutext": true,
    1440         "scrollbar": true,
    1441         "threeddarkshadow": true,
    1442         "threedface": true,
    1443         "threedhighlight": true,
    1444         "threedlightshadow": true,
    1445         "threedshadow": true,
    1446         "window": true,
    1447         "windowframe": true,
    1448         "windowtext": true,
    1449         "-webkit-focus-ring-color": true,
    1450         "currentcolor": true,
    1451         "grey": true,
    1452         "-webkit-text": true,
    1453         "repeat": true,
    1454         "repeat-x": true,
    1455         "repeat-y": true,
    1456         "no-repeat": true,
    1457         "clear": true,
    1458         "copy": true,
    1459         "source-over": true,
    1460         "source-in": true,
    1461         "source-out": true,
    1462         "source-atop": true,
    1463         "destination-over": true,
    1464         "destination-in": true,
    1465         "destination-out": true,
    1466         "destination-atop": true,
    1467         "xor": true,
    1468         "plus-darker": true,
    1469         "plus-lighter": true,
    1470         "baseline": true,
    1471         "middle": true,
    1472         "sub": true,
    1473         "super": true,
    1474         "text-top": true,
    1475         "text-bottom": true,
    1476         "top": true,
    1477         "bottom": true,
    1478         "-webkit-baseline-middle": true,
    1479         "-webkit-auto": true,
    1480         "left": true,
    1481         "right": true,
    1482         "center": true,
    1483         "justify": true,
    1484         "-webkit-left": true,
    1485         "-webkit-right": true,
    1486         "-webkit-center": true,
    1487         "outside": true,
    1488         "inside": true,
    1489         "disc": true,
    1490         "circle": true,
    1491         "square": true,
    1492         "decimal": true,
    1493         "decimal-leading-zero": true,
    1494         "lower-roman": true,
    1495         "upper-roman": true,
    1496         "lower-greek": true,
    1497         "lower-alpha": true,
    1498         "lower-latin": true,
    1499         "upper-alpha": true,
    1500         "upper-latin": true,
    1501         "hebrew": true,
    1502         "armenian": true,
    1503         "georgian": true,
    1504         "cjk-ideographic": true,
    1505         "hiragana": true,
    1506         "katakana": true,
    1507         "hiragana-iroha": true,
    1508         "katakana-iroha": true,
    1509         "inline": true,
    1510         "block": true,
    1511         "list-item": true,
    1512         "run-in": true,
    1513         "compact": true,
    1514         "inline-block": true,
    1515         "table": true,
    1516         "inline-table": true,
    1517         "table-row-group": true,
    1518         "table-header-group": true,
    1519         "table-footer-group": true,
    1520         "table-row": true,
    1521         "table-column-group": true,
    1522         "table-column": true,
    1523         "table-cell": true,
    1524         "table-caption": true,
    1525         "-webkit-box": true,
    1526         "-webkit-inline-box": true,
    1527         "-wap-marquee": true,
    1528         "auto": true,
    1529         "crosshair": true,
    1530         "default": true,
    1531         "pointer": true,
    1532         "move": true,
    1533         "vertical-text": true,
    1534         "cell": true,
    1535         "context-menu": true,
    1536         "alias": true,
    1537         "progress": true,
    1538         "no-drop": true,
    1539         "not-allowed": true,
    1540         "-webkit-zoom-in": true,
    1541         "-webkit-zoom-out": true,
    1542         "e-resize": true,
    1543         "ne-resize": true,
    1544         "nw-resize": true,
    1545         "n-resize": true,
    1546         "se-resize": true,
    1547         "sw-resize": true,
    1548         "s-resize": true,
    1549         "w-resize": true,
    1550         "ew-resize": true,
    1551         "ns-resize": true,
    1552         "nesw-resize": true,
    1553         "nwse-resize": true,
    1554         "col-resize": true,
    1555         "row-resize": true,
    1556         "text": true,
    1557         "wait": true,
    1558         "help": true,
    1559         "all-scroll": true,
    1560         "-webkit-grab": true,
    1561         "-webkit-grabbing": true,
    1562         "ltr": true,
    1563         "rtl": true,
    1564         "capitalize": true,
    1565         "uppercase": true,
    1566         "lowercase": true,
    1567         "visible": true,
    1568         "collapse": true,
    1569         "above": true,
    1570         "absolute": true,
    1571         "always": true,
    1572         "avoid": true,
    1573         "below": true,
    1574         "bidi-override": true,
    1575         "blink": true,
    1576         "both": true,
    1577         "close-quote": true,
    1578         "crop": true,
    1579         "cross": true,
    1580         "embed": true,
    1581         "fixed": true,
    1582         "hand": true,
    1583         "hide": true,
    1584         "higher": true,
    1585         "invert": true,
    1586         "landscape": true,
    1587         "level": true,
    1588         "line-through": true,
    1589         "local": true,
    1590         "loud": true,
    1591         "lower": true,
    1592         "-webkit-marquee": true,
    1593         "mix": true,
    1594         "no-close-quote": true,
    1595         "no-open-quote": true,
    1596         "nowrap": true,
    1597         "open-quote": true,
    1598         "overlay": true,
    1599         "overline": true,
    1600         "portrait": true,
    1601         "pre": true,
    1602         "pre-line": true,
    1603         "pre-wrap": true,
    1604         "relative": true,
    1605         "scroll": true,
    1606         "separate": true,
    1607         "show": true,
    1608         "static": true,
    1609         "thick": true,
    1610         "thin": true,
    1611         "underline": true,
    1612         "-webkit-nowrap": true,
    1613         "stretch": true,
    1614         "start": true,
    1615         "end": true,
    1616         "reverse": true,
    1617         "horizontal": true,
    1618         "vertical": true,
    1619         "inline-axis": true,
    1620         "block-axis": true,
    1621         "single": true,
    1622         "multiple": true,
    1623         "forwards": true,
    1624         "backwards": true,
    1625         "ahead": true,
    1626         "up": true,
    1627         "down": true,
    1628         "slow": true,
    1629         "fast": true,
    1630         "infinite": true,
    1631         "slide": true,
    1632         "alternate": true,
    1633         "read-only": true,
    1634         "read-write": true,
    1635         "read-write-plaintext-only": true,
    1636         "element": true,
    1637         "ignore": true,
    1638         "intrinsic": true,
    1639         "min-intrinsic": true,
    1640         "clip": true,
    1641         "ellipsis": true,
    1642         "discard": true,
    1643         "dot-dash": true,
    1644         "dot-dot-dash": true,
    1645         "wave": true,
    1646         "continuous": true,
    1647         "skip-white-space": true,
    1648         "break-all": true,
    1649         "break-word": true,
    1650         "space": true,
    1651         "after-white-space": true,
    1652         "checkbox": true,
    1653         "radio": true,
    1654         "push-button": true,
    1655         "square-button": true,
    1656         "button": true,
    1657         "button-bevel": true,
    1658         "default-button": true,
    1659         "list-button": true,
    1660         "listbox": true,
    1661         "listitem": true,
    1662         "media-fullscreen-button": true,
    1663         "media-mute-button": true,
    1664         "media-play-button": true,
    1665         "media-seek-back-button": true,
    1666         "media-seek-forward-button": true,
    1667         "media-rewind-button": true,
    1668         "media-return-to-realtime-button": true,
    1669         "media-slider": true,
    1670         "media-sliderthumb": true,
    1671         "media-volume-slider-container": true,
    1672         "media-volume-slider": true,
    1673         "media-volume-sliderthumb": true,
    1674         "media-controls-background": true,
    1675         "media-current-time-display": true,
    1676         "media-time-remaining-display": true,
    1677         "menulist": true,
    1678         "menulist-button": true,
    1679         "menulist-text": true,
    1680         "menulist-textfield": true,
    1681         "slider-horizontal": true,
    1682         "slider-vertical": true,
    1683         "sliderthumb-horizontal": true,
    1684         "sliderthumb-vertical": true,
    1685         "caret": true,
    1686         "searchfield": true,
    1687         "searchfield-decoration": true,
    1688         "searchfield-results-decoration": true,
    1689         "searchfield-results-button": true,
    1690         "searchfield-cancel-button": true,
    1691         "textfield": true,
    1692         "textarea": true,
    1693         "caps-lock-indicator": true,
    1694         "round": true,
    1695         "border": true,
    1696         "border-box": true,
    1697         "content": true,
    1698         "content-box": true,
    1699         "padding": true,
    1700         "padding-box": true,
    1701         "contain": true,
    1702         "cover": true,
    1703         "logical": true,
    1704         "visual": true,
    1705         "lines": true,
    1706         "running": true,
    1707         "paused": true,
    1708         "flat": true,
    1709         "preserve-3d": true,
    1710         "ease": true,
    1711         "linear": true,
    1712         "ease-in": true,
    1713         "ease-out": true,
    1714         "ease-in-out": true,
    1715         "document": true,
    1716         "reset": true,
    1717         "visiblePainted": true,
    1718         "visibleFill": true,
    1719         "visibleStroke": true,
    1720         "painted": true,
    1721         "fill": true,
    1722         "stroke": true,
    1723         "antialiased": true,
    1724         "subpixel-antialiased": true,
    1725         "optimizeSpeed": true,
    1726         "optimizeLegibility": true,
    1727         "geometricPrecision": true
    1728     };
    1729     function valueIdentAction(token) {
    1730         this.cursor += token.length;
    1731         if (token in valueKeywords) {
    1732             this.appendNonToken.call(this);
    1733             this.newLine.appendChild(this.createSpan(token, "webkit-css-keyword"));
    1734         } else
    1735             this.nonToken += token;
    1736     }
    1737 
    1738     function numvalueAction(token)
    1739     {
    1740         this.cursor += token.length;
    1741         this.newLine.appendChild(this.createSpan(token, "webkit-css-number"));
    1742     }
    1743    
    1744     function declarationSemicolonAction(token)
    1745     {
    1746         this.cursor += token.length;
    1747         this.nonToken += token;
    1748         this.lexState = this.LexState.DeclarationProperty;
    1749     }
    1750    
    1751     function urlAction(token)
    1752     {
    1753         this.cursor += token.length;
    1754         this.newLine.appendChild(this.createSpan(token, "webkit-css-url"));
    1755     }
    1756    
    1757     function stringAction(token)
    1758     {
    1759         this.cursor += token.length;
    1760         this.newLine.appendChild(this.createSpan(token, "webkit-css-string"));
    1761     }
    1762    
    1763     function colorAction(token)
    1764     {
    1765         this.cursor += token.length;
    1766         this.newLine.appendChild(this.createSpan(token, "webkit-css-color"));
    1767     }
    1768    
    1769     function importantAction(token)
    1770     {
    1771         this.cursor += token.length;
    1772         this.newLine.appendChild(this.createSpan(token, "webkit-css-important"));
    1773     }
    1774    
    1775     function atMediaAction(token)
    1776     {
    1777         this.cursor += token.length;
    1778         this.newLine.appendChild(this.createSpan(token, "webkit-css-at-rule"));
    1779         this.lexState = this.LexState.AtMedia;
    1780     }
    1781    
    1782     function startAtMediaBlockAction(token)
    1783     {
    1784         this.cursor += token.length;
    1785         this.nonToken += token;
    1786         this.lexState = this.LexState.Initial;
    1787     }
    1788    
    1789     function atKeyframesAction(token)
    1790     {
    1791         this.cursor += token.length;
    1792         this.newLine.appendChild(this.createSpan(token, "webkit-css-at-rule"));
    1793         this.lexState = this.LexState.AtKeyframes;
    1794     }
    1795    
    1796     function startAtKeyframesBlockAction(token)
    1797     {
    1798         this.cursor += token.length;
    1799         this.nonToken += token;
    1800         this.lexState = this.LexState.Initial;
    1801     }
    1802    
    1803     function atRuleAction(token) {
    1804         this.cursor += token.length;
    1805         this.newLine.appendChild(this.createSpan(token, "webkit-css-at-rule"));
    1806         this.lexState = this.LexState.AtRule;
    1807     }
    1808    
    1809     function endAtRuleAction(token) {
    1810         this.cursor += token.length;
    1811         this.nonToken += token;
    1812         this.lexState = this.LexState.Initial;
    1813     }
    1814    
    1815     function startAtRuleBlockAction(token)
    1816     {
    1817         this.cursor += token.length;
    1818         this.nonToken += token;
    1819         this.lexState = this.LexState.DeclarationProperty;
    1820     }
    1821    
    1822     const mediaTypes = ["all", "aural", "braille", "embossed", "handheld", "print", "projection", "screen", "tty", "tv"];
    1823     function atRuleIdentAction(token) {
    1824         this.cursor += token.length;
    1825         if (mediaTypes.indexOf(token) === -1)
    1826             this.nonToken += token;
    1827         else {
    1828             this.appendNonToken.call(this);
    1829             this.newLine.appendChild(this.createSpan(token, "webkit-css-keyword"));
    1830         }
    1831     }
    1832 }
    1833 
    1834 WebInspector.CSSSourceSyntaxHighlighter.prototype.__proto__ = WebInspector.SourceSyntaxHighlighter.prototype;
    1835 
    1836 WebInspector.JavaScriptSourceSyntaxHighlighter = function(table, sourceFrame) {
    1837     WebInspector.SourceSyntaxHighlighter.call(this, table, sourceFrame);
    1838 
    1839     this.LexState = {
    1840         Initial: 1,
    1841         DivisionAllowed: 2,
    1842     };
    1843     this.ContinueState = {
    1844         None: 0,
    1845         Comment: 1,
    1846         SingleQuoteString: 2,
    1847         DoubleQuoteString: 3,
    1848         RegExp: 4
    1849     };
    1850    
    1851     this.nonToken = "";
    1852     this.cursor = 0;
    1853     this.lineIndex = -1;
    1854     this.lineCode = "";
    1855     this.newLine = null;
    1856     this.lexState = this.LexState.Initial;
    1857     this.continueState = this.ContinueState.None;
    1858    
    1859     this.rules = [{
    1860         pattern: /^(?:\/\/.*)/,
    1861         action: singleLineCommentAction
    1862     }, {
    1863         pattern: /^(?:\/\*(?:[^\*]|\*[^\/])*\*+\/)/,
    1864         action: multiLineSingleLineCommentAction
    1865     }, {
    1866         pattern: /^(?:\/\*(?:[^\*]|\*[^\/])*)/,
    1867         action: multiLineCommentStartAction
    1868     }, {
    1869         pattern: /^(?:(?:[^\*]|\*[^\/])*\*+\/)/,
    1870         action: multiLineCommentEndAction,
    1871         continueStateCondition: this.ContinueState.Comment
    1872     }, {
    1873         pattern: /^.*/,
    1874         action: multiLineCommentMiddleAction,
    1875         continueStateCondition: this.ContinueState.Comment
    1876     }, {
    1877         pattern: /^(?:(?:0|[1-9]\d*)\.\d+?(?:[eE](?:\d+|\+\d+|-\d+))?|\.\d+(?:[eE](?:\d+|\+\d+|-\d+))?|(?:0|[1-9]\d*)(?:[eE](?:\d+|\+\d+|-\d+))?|0x[0-9a-fA-F]+|0X[0-9a-fA-F]+)/,
    1878         action: numericLiteralAction
    1879     }, {
    1880         pattern: /^(?:"(?:[^"\\]|\\(?:['"\bfnrtv]|[^'"\bfnrtv0-9xu]|0|x[0-9a-fA-F][0-9a-fA-F]|(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])))*"|'(?:[^'\\]|\\(?:['"\bfnrtv]|[^'"\bfnrtv0-9xu]|0|x[0-9a-fA-F][0-9a-fA-F]|(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])))*')/,
    1881         action: stringLiteralAction
    1882     }, {
    1883         pattern: /^(?:'(?:[^'\\]|\\(?:['"\bfnrtv]|[^'"\bfnrtv0-9xu]|0|x[0-9a-fA-F][0-9a-fA-F]|(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])))*)\\$/,
    1884         action: singleQuoteStringStartAction
    1885     }, {
    1886         pattern: /^(?:(?:[^'\\]|\\(?:['"\bfnrtv]|[^'"\bfnrtv0-9xu]|0|x[0-9a-fA-F][0-9a-fA-F]|(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])))*')/,
    1887         action: singleQuoteStringEndAction,
    1888         continueStateCondition: this.ContinueState.SingleQuoteString
    1889     }, {
    1890         pattern: /^(?:(?:[^'\\]|\\(?:['"\bfnrtv]|[^'"\bfnrtv0-9xu]|0|x[0-9a-fA-F][0-9a-fA-F]|(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])))*)\\$/,
    1891         action: singleQuoteStringMiddleAction,
    1892         continueStateCondition: this.ContinueState.SingleQuoteString
    1893     }, {
    1894         pattern: /^(?:"(?:[^"\\]|\\(?:['"\bfnrtv]|[^'"\bfnrtv0-9xu]|0|x[0-9a-fA-F][0-9a-fA-F]|(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])))*)\\$/,
    1895         action: doubleQuoteStringStartAction
    1896     }, {
    1897         pattern: /^(?:(?:[^"\\]|\\(?:['"\bfnrtv]|[^'"\bfnrtv0-9xu]|0|x[0-9a-fA-F][0-9a-fA-F]|(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])))*")/,
    1898         action: doubleQuoteStringEndAction,
    1899         continueStateCondition: this.ContinueState.DoubleQuoteString
    1900     }, {
    1901         pattern: /^(?:(?:[^"\\]|\\(?:['"\bfnrtv]|[^'"\bfnrtv0-9xu]|0|x[0-9a-fA-F][0-9a-fA-F]|(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])))*)\\$/,
    1902         action: doubleQuoteStringMiddleAction,
    1903         continueStateCondition: this.ContinueState.DoubleQuoteString
    1904     }, {
    1905         pattern: /^(?:(?:[a-zA-Z]|[$_]|\\(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]))(?:(?:[a-zA-Z]|[$_]|\\(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]))|[0-9])*)/,
    1906         action: identOrKeywordAction
    1907     }, {
    1908         pattern: /^\)/,
    1909         action: rightParenAction,
    1910         dontAppendNonToken: true
    1911     }, {
    1912         pattern: /^(?:<=|>=|===|==|!=|!==|\+\+|\-\-|<<|>>|>>>|&&|\|\||\+=|\-=|\*=|%=|<<=|>>=|>>>=|&=|\|=|^=|[{}\(\[\]\.;,<>\+\-\*%&\|\^!~\?:=])/,
    1913         action: punctuatorAction,
    1914         dontAppendNonToken: true
    1915     }, {
    1916         pattern: /^(?:\/=?)/,
    1917         action: divPunctuatorAction,
    1918         lexStateCondition: this.LexState.DivisionAllowed,
    1919         dontAppendNonToken: true
    1920     }, {
    1921         pattern: /^(?:\/(?:(?:\\.)|[^\\*\/])(?:(?:\\.)|[^\\/])*\/(?:(?:[a-zA-Z]|[$_]|\\(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]))|[0-9])*)/,
    1922         action: regExpLiteralAction
    1923     }, {
    1924         pattern: /^(?:\/(?:(?:\\.)|[^\\*\/])(?:(?:\\.)|[^\\/])*)\\$/,
    1925         action: regExpStartAction
    1926     }, {
    1927         pattern: /^(?:(?:(?:\\.)|[^\\/])*\/(?:(?:[a-zA-Z]|[$_]|\\(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]))|[0-9])*)/,
    1928         action: regExpEndAction,
    1929         continueStateCondition: this.ContinueState.RegExp
    1930     }, {
    1931         pattern: /^(?:(?:(?:\\.)|[^\\/])*)\\$/,
    1932         action: regExpMiddleAction,
    1933         continueStateCondition: this.ContinueState.RegExp
    1934     }];
    1935    
    1936     function singleLineCommentAction(token)
    1937     {
    1938         this.cursor += token.length;
    1939         this.newLine.appendChild(this.createSpan(token, "webkit-javascript-comment"));
    1940     }
    1941    
    1942     function multiLineSingleLineCommentAction(token)
    1943     {
    1944         this.cursor += token.length;
    1945         this.newLine.appendChild(this.createSpan(token, "webkit-javascript-comment"));
    1946     }
    1947    
    1948     function multiLineCommentStartAction(token)
    1949     {
    1950         this.cursor += token.length;
    1951         this.newLine.appendChild(this.createSpan(token, "webkit-javascript-comment"));
    1952         this.continueState = this.ContinueState.Comment;
    1953     }
    1954    
    1955     function multiLineCommentEndAction(token)
    1956     {
    1957         this.cursor += token.length;
    1958         this.newLine.appendChild(this.createSpan(token, "webkit-javascript-comment"));
    1959         this.continueState = this.ContinueState.None;
    1960     }
    1961    
    1962     function multiLineCommentMiddleAction(token)
    1963     {
    1964         this.cursor += token.length;
    1965         this.newLine.appendChild(this.createSpan(token, "webkit-javascript-comment"));
    1966     }
    1967    
    1968     function numericLiteralAction(token)
    1969     {
    1970         this.cursor += token.length;
    1971         this.newLine.appendChild(this.createSpan(token, "webkit-javascript-number"));
    1972         this.lexState = this.LexState.DivisionAllowed;
    1973     }
    1974    
    1975     function stringLiteralAction(token)
    1976     {
    1977         this.cursor += token.length;
    1978         this.newLine.appendChild(this.createSpan(token, "webkit-javascript-string"));
    1979         this.lexState = this.LexState.Initial;
    1980     }
    1981    
    1982     function singleQuoteStringStartAction(token)
    1983     {
    1984         this.cursor += token.length;
    1985         this.newLine.appendChild(this.createSpan(token, "webkit-javascript-string"));
    1986         this.continueState = this.ContinueState.SingleQuoteString;
    1987     }
    1988    
    1989     function singleQuoteStringEndAction(token)
    1990     {
    1991         this.cursor += token.length;
    1992         this.newLine.appendChild(this.createSpan(token, "webkit-javascript-string"));
    1993         this.continueState = this.ContinueState.None;
    1994     }
    1995    
    1996     function singleQuoteStringMiddleAction(token)
    1997     {
    1998         this.cursor += token.length;
    1999         this.newLine.appendChild(this.createSpan(token, "webkit-javascript-string"));
    2000     }
    2001    
    2002     function doubleQuoteStringStartAction(token)
    2003     {
    2004         this.cursor += token.length;
    2005         this.newLine.appendChild(this.createSpan(token, "webkit-javascript-string"));
    2006         this.continueState = this.ContinueState.DoubleQuoteString;
    2007     }
    2008    
    2009     function doubleQuoteStringEndAction(token)
    2010     {
    2011         this.cursor += token.length;
    2012         this.newLine.appendChild(this.createSpan(token, "webkit-javascript-string"));
    2013         this.continueState = this.ContinueState.None;
    2014     }
    2015    
    2016     function doubleQuoteStringMiddleAction(token)
    2017     {
    2018         this.cursor += token.length;
    2019         this.newLine.appendChild(this.createSpan(token, "webkit-javascript-string"));
    2020     }
    2021    
    2022     function regExpLiteralAction(token)
    2023     {
    2024         this.cursor += token.length;
    2025         this.newLine.appendChild(this.createSpan(token, "webkit-javascript-regexp"));
    2026         this.lexState = this.LexState.Initial;
    2027     }
    2028 
    2029     function regExpStartAction(token)
    2030     {
    2031         this.cursor += token.length;
    2032         this.newLine.appendChild(this.createSpan(token, "webkit-javascript-regexp"));
    2033         this.continueState = this.ContinueState.RegExp;
    2034     }
    2035 
    2036     function regExpEndAction(token)
    2037     {
    2038         this.cursor += token.length;
    2039         this.newLine.appendChild(this.createSpan(token, "webkit-javascript-regexp"));
    2040         this.continueState = this.ContinueState.None;
    2041     }
    2042 
    2043     function regExpMiddleAction(token)
    2044     {
    2045         this.cursor += token.length;
    2046         this.newLine.appendChild(this.createSpan(token, "webkit-javascript-regexp"));
    2047     }
    2048    
    2049     const keywords = {
    2050         "null": true,
    2051         "true": true,
    2052         "false": true,
    2053         "break": true,
    2054         "case": true,
    2055         "catch": true,
    2056         "const": true,
    2057         "default": true,
    2058         "finally": true,
    2059         "for": true,
    2060         "instanceof": true,
    2061         "new": true,
    2062         "var": true,
    2063         "continue": true,
    2064         "function": true,
    2065         "return": true,
    2066         "void": true,
    2067         "delete": true,
    2068         "if": true,
    2069         "this": true,
    2070         "do": true,
    2071         "while": true,
    2072         "else": true,
    2073         "in": true,
    2074         "switch": true,
    2075         "throw": true,
    2076         "try": true,
    2077         "typeof": true,
    2078         "debugger": true,
    2079         "class": true,
    2080         "enum": true,
    2081         "export": true,
    2082         "extends": true,
    2083         "import": true,
    2084         "super": true,
    2085         "get": true,
    2086         "set": true
    2087     };
    2088     function identOrKeywordAction(token)
    2089     {
    2090         this.cursor += token.length;
    2091        
    2092         if (token in keywords) {
    2093             this.newLine.appendChild(this.createSpan(token, "webkit-javascript-keyword"));
    2094             this.lexState = this.LexState.Initial;
    2095         } else {
    2096             var identElement = this.createSpan(token, "webkit-javascript-ident");
    2097             identElement.addEventListener("mouseover", showDatatip, false);
    2098             this.newLine.appendChild(identElement);
    2099             this.lexState = this.LexState.DivisionAllowed;
    2100         }
    2101     }
    2102    
    2103     function showDatatip(event) {
    2104         if (!WebInspector.panels.scripts || !WebInspector.panels.scripts.paused)
    2105             return;
    2106 
    2107         var node = event.target;
    2108         var parts = [node.textContent];
    2109         while (node.previousSibling && node.previousSibling.textContent === ".") {
    2110             node = node.previousSibling.previousSibling;
    2111             if (!node || !node.hasStyleClass("webkit-javascript-ident"))
    2112                 break;
    2113             parts.unshift(node.textContent);
    2114         }
    2115 
    2116         var expression = parts.join(".");
    2117 
    2118         WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression, false, "console", callback);
    2119         function callback(result, exception)
    2120         {
    2121             if (exception)
    2122                 return;
    2123             event.target.setAttribute("title", result.description);
    2124             event.target.addEventListener("mouseout", onmouseout, false);
    2125            
    2126             function onmouseout(event)
    2127             {
    2128                 event.target.removeAttribute("title");
    2129                 event.target.removeEventListener("mouseout", onmouseout, false);
    2130             }
    2131         }
    2132     }
    2133    
    2134     function divPunctuatorAction(token)
    2135     {
    2136         this.cursor += token.length;
    2137         this.nonToken += token;
    2138         this.lexState = this.LexState.Initial;
    2139     }
    2140    
    2141     function rightParenAction(token)
    2142     {
    2143         this.cursor += token.length;
    2144         this.nonToken += token;
    2145         this.lexState = this.LexState.DivisionAllowed;
    2146     }
    2147    
    2148     function punctuatorAction(token)
    2149     {
    2150         this.cursor += token.length;
    2151         this.nonToken += token;
    2152         this.lexState = this.LexState.Initial;
    2153     }
    2154 }
    2155 
    2156 WebInspector.JavaScriptSourceSyntaxHighlighter.prototype.__proto__ = WebInspector.SourceSyntaxHighlighter.prototype;
  • trunk/WebCore/inspector/front-end/WebKit.qrc

    r52170 r52439  
    1414    <file>ContextMenu.js</file>
    1515    <file>CookieItemsView.js</file>
     16    <file>CSSSourceSyntaxHighlighter.js</file>
    1617    <file>Database.js</file>
    1718    <file>DatabaseQueryView.js</file>
     
    3233    <file>InspectorBackendStub.js</file>
    3334    <file>InspectorFrontendHostStub.js</file>
     35    <file>JavaScriptSourceSyntaxHighlighter.js</file>
    3436    <file>KeyboardShortcut.js</file>
    3537    <file>MetricsSidebarPane.js</file>
     
    5860    <file>SidebarTreeElement.js</file>
    5961    <file>SourceFrame.js</file>
     62    <file>SourceSyntaxHighlighter.js</file>
    6063    <file>SourceView.js</file>
    6164    <file>StatusBarButton.js</file>
  • trunk/WebCore/inspector/front-end/inspector.html

    r52149 r52439  
    8787    <script type="text/javascript" src="ResourceView.js"></script>
    8888    <script type="text/javascript" src="SourceFrame.js"></script>
     89    <script type="text/javascript" src="SourceSyntaxHighlighter.js"></script>
     90    <script type="text/javascript" src="CSSSourceSyntaxHighlighter.js"></script>
     91    <script type="text/javascript" src="JavaScriptSourceSyntaxHighlighter.js"></script>
    8992    <script type="text/javascript" src="SourceView.js"></script>
    9093    <script type="text/javascript" src="FontView.js"></script>
Note: See TracChangeset for help on using the changeset viewer.