Changeset 54139 in webkit


Ignore:
Timestamp:
Feb 1, 2010 10:44:48 AM (14 years ago)
Author:
pfeldman@chromium.org
Message:

2010-02-01 Pavel Feldman <pfeldman@chromium.org>

Reviewed by Timothy Hatcher.

Web Inspector: Syntax highlighting in source view of
Resources pane stops half-way.

There were two problems here: (1) styles for html highlighter were not
added into the css file (they used to be injected manually in the
SourceFrame before). (2) 'Tag' needed to be lexer's state, not parser's.
Otherwise unbalanced quotes in the text nodes were matching too match
into the string tokens.

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

  • inspector/front-end/NativeTextViewer.js: (WebInspector.NativeTextViewer.prototype._createLineDivs): (WebInspector.NativeTextViewer.prototype._lineHeight): (WebInspector.NativeTextViewer.prototype.initFontMetrics):
  • inspector/front-end/SourceFrame.js: (WebInspector.SourceFrame.prototype._createEditorIfNeeded):
  • inspector/front-end/SourceHTMLTokenizer.js: (WebInspector.SourceHTMLTokenizer): (WebInspector.SourceHTMLTokenizer.prototype.nextToken):
  • inspector/front-end/SourceHTMLTokenizer.re2js:
  • inspector/front-end/TextEditor.js: (WebInspector.TextEditor.prototype.initFontMetrics): (WebInspector.TextEditor.prototype._registerShortcuts):
  • inspector/front-end/inspectorSyntaxHighlight.css:
Location:
trunk/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r54138 r54139  
     12010-02-01  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Reviewed by Timothy Hatcher.
     4
     5        Web Inspector: Syntax highlighting in source view of
     6        Resources pane stops half-way.
     7
     8        There were two problems here: (1) styles for html highlighter were not
     9        added into the css file (they used to be injected manually in the
     10        SourceFrame before). (2) 'Tag' needed to be lexer's state, not parser's.
     11        Otherwise unbalanced quotes in the text nodes were matching too match
     12        into the string tokens.
     13
     14        https://bugs.webkit.org/show_bug.cgi?id=34359
     15
     16        * inspector/front-end/NativeTextViewer.js:
     17        (WebInspector.NativeTextViewer.prototype._createLineDivs):
     18        (WebInspector.NativeTextViewer.prototype._lineHeight):
     19        (WebInspector.NativeTextViewer.prototype.initFontMetrics):
     20        * inspector/front-end/SourceFrame.js:
     21        (WebInspector.SourceFrame.prototype._createEditorIfNeeded):
     22        * inspector/front-end/SourceHTMLTokenizer.js:
     23        (WebInspector.SourceHTMLTokenizer):
     24        (WebInspector.SourceHTMLTokenizer.prototype.nextToken):
     25        * inspector/front-end/SourceHTMLTokenizer.re2js:
     26        * inspector/front-end/TextEditor.js:
     27        (WebInspector.TextEditor.prototype.initFontMetrics):
     28        (WebInspector.TextEditor.prototype._registerShortcuts):
     29        * inspector/front-end/inspectorSyntaxHighlight.css:
     30
    1312010-02-01  Ben Murdoch  <benm@google.com>
    232
  • trunk/WebCore/inspector/front-end/NativeTextViewer.js

    r54133 r54139  
    5959            this._sheet.appendChild(lineDiv);
    6060            this._textModel.setAttribute(i, "line-div", lineDiv);
     61            this._textModel.removeAttribute(i, "div-highlighted");
    6162        }
    6263        this._container.appendChild(this._sheet);
     
    144145            var nextElement = this._textModel.getAttribute(lineNumber + 1, "line-div");
    145146            return nextElement.offsetTop - element.offsetTop;
    146         } else
    147             return element.parentElement.offsetHeight - element.offsetTop;
     147        }
     148        return element.parentElement.offsetHeight - element.offsetTop;
    148149    },
    149150
     
    214215    },
    215216
    216     _initFontMetrics: function()
    217     {
    218         WebInspector.TextEditor.prototype._initFontMetrics.call(this);
     217    initFontMetrics: function()
     218    {
     219        WebInspector.TextEditor.prototype.initFontMetrics.call(this);
    219220        for (var i = 0; i < this._textModel.linesCount; ++i) {
    220221            var lineDiv = this._textModel.getAttribute(i, "line-div");
  • trunk/WebCore/inspector/front-end/SourceFrame.js

    r54133 r54139  
    145145        this._element.addEventListener("keydown", this._keyDown.bind(this), true);
    146146        this._parentElement.appendChild(this._element);
    147         this._editor._initFontMetrics();
     147        this._editor.initFontMetrics();
    148148
    149149        this._editor.mimeType = this._mimeType;
  • trunk/WebCore/inspector/front-end/SourceHTMLTokenizer.js

    r54053 r54139  
    1 /* Generated by re2c 0.13.5 on Thu Jan 28 20:49:22 2010 */
     1/* Generated by re2c 0.13.5 on Mon Feb  1 19:13:12 2010 */
    22/*
    33 * Copyright (C) 2009 Google Inc. All rights reserved.
     
    4646    WebInspector.SourceTokenizer.call(this);
    4747
     48    // The order is determined by the generated code.
    4849    this._lexConditions = {
    4950        INITIAL: 0,
    5051        COMMENT: 1,
    51         DSTRING: 2,
    52         SSTRING: 3
     52        TAG: 2,
     53        DSTRING: 4,
     54        SSTRING: 5
    5355    };
     56    this.case_INITIAL = 1000;
     57    this.case_COMMENT = 1001;
     58    this.case_TAG = 1002;
     59    this.case_DSTRING = 1004;
     60    this.case_SSTRING = 1005;
    5461
    5562    this._parseConditions = {
    5663        INITIAL: 0,
    57         TAG: 1,
    58         ATTRIBUTE: 2,
    59         ATTRIBUTE_VALUE: 3,
    60         SCRIPT: 4,
    61         SCRIPT_ATTRIBUTE: 5,
    62         SCRIPT_ATTRIBUTE_VALUE: 6,
    63         DOCTYPE: 7
     64        ATTRIBUTE: 1,
     65        ATTRIBUTE_VALUE: 2,
     66        SCRIPT: 3,
     67        SCRIPT_ATTRIBUTE: 4,
     68        SCRIPT_ATTRIBUTE_VALUE: 5,
     69        DOCTYPE: 6
    6470    };
    65 
    66     this.case_INITIAL = 1000;
    67     this.case_COMMENT = 1001;
    68     this.case_DSTRING = 1002;
    69     this.case_SSTRING = 1003;
    7071
    7172    this.initialCondition = { lexCondition: this._lexConditions.INITIAL, parseCondition: this._parseConditions.INITIAL };
     
    131132            } else {
    132133                if (this.getLexCondition() < 3) {
    133                     { gotoCase = this.case_DSTRING; continue; };
    134                 } else {
    135                     { gotoCase = this.case_SSTRING; continue; };
     134                    { gotoCase = this.case_TAG; continue; };
     135                } else {
     136                    if (this.getLexCondition() < 4) {
     137                        { gotoCase = this.case_DSTRING; continue; };
     138                    } else {
     139                        { gotoCase = this.case_SSTRING; continue; };
     140                    }
    136141                }
    137142            }
     
    215220            ++cursor;
    216221case 21:
    217             this.setLexCondition(this._lexConditions.INITIAL);
     222            this.setLexCondition(this._lexConditions.TAG);
    218223            { return this._stringToken(cursor, true); }
    219224case 22:
     
    235240case this.case_INITIAL:
    236241            yych = this._charAt(cursor);
    237             if (yych <= '=') {
    238                 if (yych <= '\'') {
    239                     if (yych == '"') { gotoCase = 29; continue; };
    240                     if (yych >= '\'') { gotoCase = 30; continue; };
    241                 } else {
    242                     if (yych <= '9') {
    243                         if (yych >= '0') { gotoCase = 31; continue; };
    244                     } else {
    245                         if (yych <= ';') { gotoCase = 27; continue; };
    246                         if (yych <= '<') { gotoCase = 33; continue; };
    247                         { gotoCase = 35; continue; };
    248                     }
    249                 }
    250             } else {
    251                 if (yych <= '^') {
    252                     if (yych <= '>') { gotoCase = 37; continue; };
    253                     if (yych <= '@') { gotoCase = 27; continue; };
    254                     if (yych <= 'Z') { gotoCase = 31; continue; };
    255                 } else {
    256                     if (yych <= '`') {
    257                         if (yych <= '_') { gotoCase = 31; continue; };
    258                     } else {
    259                         if (yych <= 'z') { gotoCase = 31; continue; };
    260                         if (yych >= 0x80) { gotoCase = 31; continue; };
    261                     }
    262                 }
    263             }
    264 case 27:
    265             ++cursor;
    266 case 28:
     242            if (yych == '<') { gotoCase = 29; continue; };
     243            ++cursor;
    267244            { this.tokenType = null; return cursor; }
    268245case 29:
    269246            yyaccept = 0;
    270247            yych = this._charAt(YYMARKER = ++cursor);
    271             { gotoCase = 82; continue; };
     248            if (yych <= '/') {
     249                if (yych == '!') { gotoCase = 34; continue; };
     250                if (yych >= '/') { gotoCase = 31; continue; };
     251            } else {
     252                if (yych <= 'S') {
     253                    if (yych >= 'S') { gotoCase = 32; continue; };
     254                } else {
     255                    if (yych == 's') { gotoCase = 32; continue; };
     256                }
     257            }
    272258case 30:
    273             yyaccept = 0;
    274             yych = this._charAt(YYMARKER = ++cursor);
    275             { gotoCase = 76; continue; };
    276 case 31:
    277             ++cursor;
    278             yych = this._charAt(cursor);
    279             { gotoCase = 74; continue; };
    280 case 32:
    281259            {
    282260                    if (this._parseCondition === this._parseConditions.SCRIPT) {
     
    285263                    }
    286264
    287                     if (this._parseCondition === this._parseConditions.TAG) {
     265                    this.setLexCondition(this._lexConditions.TAG);
     266
     267                    this.tokenType = "html-tag";
     268                    this._parseCondition = this._parseConditions.INITIAL;
     269                    return cursor;
     270                }
     271case 31:
     272            yyaccept = 0;
     273            yych = this._charAt(YYMARKER = ++cursor);
     274            if (yych == 'S') { gotoCase = 58; continue; };
     275            if (yych == 's') { gotoCase = 58; continue; };
     276            { gotoCase = 30; continue; };
     277case 32:
     278            yych = this._charAt(++cursor);
     279            if (yych == 'C') { gotoCase = 52; continue; };
     280            if (yych == 'c') { gotoCase = 52; continue; };
     281case 33:
     282            cursor = YYMARKER;
     283            { gotoCase = 30; continue; };
     284case 34:
     285            yych = this._charAt(++cursor);
     286            if (yych <= 'C') {
     287                if (yych != '-') { gotoCase = 33; continue; };
     288            } else {
     289                if (yych <= 'D') { gotoCase = 36; continue; };
     290                if (yych == 'd') { gotoCase = 36; continue; };
     291                { gotoCase = 33; continue; };
     292            }
     293            yych = this._charAt(++cursor);
     294            if (yych == '-') { gotoCase = 44; continue; };
     295            { gotoCase = 33; continue; };
     296case 36:
     297            yych = this._charAt(++cursor);
     298            if (yych == 'O') { gotoCase = 37; continue; };
     299            if (yych != 'o') { gotoCase = 33; continue; };
     300case 37:
     301            yych = this._charAt(++cursor);
     302            if (yych == 'C') { gotoCase = 38; continue; };
     303            if (yych != 'c') { gotoCase = 33; continue; };
     304case 38:
     305            yych = this._charAt(++cursor);
     306            if (yych == 'T') { gotoCase = 39; continue; };
     307            if (yych != 't') { gotoCase = 33; continue; };
     308case 39:
     309            yych = this._charAt(++cursor);
     310            if (yych == 'Y') { gotoCase = 40; continue; };
     311            if (yych != 'y') { gotoCase = 33; continue; };
     312case 40:
     313            yych = this._charAt(++cursor);
     314            if (yych == 'P') { gotoCase = 41; continue; };
     315            if (yych != 'p') { gotoCase = 33; continue; };
     316case 41:
     317            yych = this._charAt(++cursor);
     318            if (yych == 'E') { gotoCase = 42; continue; };
     319            if (yych != 'e') { gotoCase = 33; continue; };
     320case 42:
     321            ++cursor;
     322            this.setLexCondition(this._lexConditions.TAG);
     323            {
     324                    this.tokenType = "html-doctype";
     325                    this._parseCondition = this._parseConditions.DOCTYPE;
     326                    return cursor;
     327                }
     328case 44:
     329            ++cursor;
     330            yych = this._charAt(cursor);
     331            if (yych <= '\f') {
     332                if (yych == '\n') { gotoCase = 47; continue; };
     333                { gotoCase = 44; continue; };
     334            } else {
     335                if (yych <= '\r') { gotoCase = 47; continue; };
     336                if (yych != '-') { gotoCase = 44; continue; };
     337            }
     338            ++cursor;
     339            yych = this._charAt(cursor);
     340            if (yych == '-') { gotoCase = 49; continue; };
     341            { gotoCase = 33; continue; };
     342case 47:
     343            ++cursor;
     344            this.setLexCondition(this._lexConditions.COMMENT);
     345            { this.tokenType = "html-comment"; return cursor; }
     346case 49:
     347            ++cursor;
     348            yych = this._charAt(cursor);
     349            if (yych != '>') { gotoCase = 44; continue; };
     350            ++cursor;
     351            { this.tokenType = "html-comment"; return cursor; }
     352case 52:
     353            yych = this._charAt(++cursor);
     354            if (yych == 'R') { gotoCase = 53; continue; };
     355            if (yych != 'r') { gotoCase = 33; continue; };
     356case 53:
     357            yych = this._charAt(++cursor);
     358            if (yych == 'I') { gotoCase = 54; continue; };
     359            if (yych != 'i') { gotoCase = 33; continue; };
     360case 54:
     361            yych = this._charAt(++cursor);
     362            if (yych == 'P') { gotoCase = 55; continue; };
     363            if (yych != 'p') { gotoCase = 33; continue; };
     364case 55:
     365            yych = this._charAt(++cursor);
     366            if (yych == 'T') { gotoCase = 56; continue; };
     367            if (yych != 't') { gotoCase = 33; continue; };
     368case 56:
     369            ++cursor;
     370            this.setLexCondition(this._lexConditions.TAG);
     371            {
     372                    this.tokenType = "html-tag";
     373                    this._parseCondition = this._parseConditions.SCRIPT_ATTRIBUTE;
     374                    return cursor;
     375                }
     376case 58:
     377            yych = this._charAt(++cursor);
     378            if (yych == 'C') { gotoCase = 59; continue; };
     379            if (yych != 'c') { gotoCase = 33; continue; };
     380case 59:
     381            yych = this._charAt(++cursor);
     382            if (yych == 'R') { gotoCase = 60; continue; };
     383            if (yych != 'r') { gotoCase = 33; continue; };
     384case 60:
     385            yych = this._charAt(++cursor);
     386            if (yych == 'I') { gotoCase = 61; continue; };
     387            if (yych != 'i') { gotoCase = 33; continue; };
     388case 61:
     389            yych = this._charAt(++cursor);
     390            if (yych == 'P') { gotoCase = 62; continue; };
     391            if (yych != 'p') { gotoCase = 33; continue; };
     392case 62:
     393            yych = this._charAt(++cursor);
     394            if (yych == 'T') { gotoCase = 63; continue; };
     395            if (yych != 't') { gotoCase = 33; continue; };
     396case 63:
     397            ++cursor;
     398            this.setLexCondition(this._lexConditions.TAG);
     399            {
     400                    this.tokenType = "html-tag";
     401                    this._parseCondition = this._parseConditions.INITIAL;
     402                    return cursor;
     403                }
     404/* *********************************** */
     405case this.case_SSTRING:
     406            yych = this._charAt(cursor);
     407            if (yych <= '\f') {
     408                if (yych == '\n') { gotoCase = 69; continue; };
     409                { gotoCase = 68; continue; };
     410            } else {
     411                if (yych <= '\r') { gotoCase = 69; continue; };
     412                if (yych == '\'') { gotoCase = 71; continue; };
     413                { gotoCase = 68; continue; };
     414            }
     415case 67:
     416            { return this._stringToken(cursor); }
     417case 68:
     418            yych = this._charAt(++cursor);
     419            { gotoCase = 75; continue; };
     420case 69:
     421            ++cursor;
     422            { this.tokenType = null; return cursor; }
     423case 71:
     424            ++cursor;
     425case 72:
     426            this.setLexCondition(this._lexConditions.TAG);
     427            { return this._stringToken(cursor, true); }
     428case 73:
     429            yych = this._charAt(++cursor);
     430            { gotoCase = 72; continue; };
     431case 74:
     432            ++cursor;
     433            yych = this._charAt(cursor);
     434case 75:
     435            if (yych <= '\f') {
     436                if (yych == '\n') { gotoCase = 67; continue; };
     437                { gotoCase = 74; continue; };
     438            } else {
     439                if (yych <= '\r') { gotoCase = 67; continue; };
     440                if (yych == '\'') { gotoCase = 73; continue; };
     441                { gotoCase = 74; continue; };
     442            }
     443/* *********************************** */
     444case this.case_TAG:
     445            yych = this._charAt(cursor);
     446            if (yych <= '=') {
     447                if (yych <= '\'') {
     448                    if (yych == '"') { gotoCase = 80; continue; };
     449                    if (yych >= '\'') { gotoCase = 81; continue; };
     450                } else {
     451                    if (yych <= '/') { gotoCase = 78; continue; };
     452                    if (yych <= '9') { gotoCase = 82; continue; };
     453                    if (yych >= '=') { gotoCase = 84; continue; };
     454                }
     455            } else {
     456                if (yych <= '^') {
     457                    if (yych <= '>') { gotoCase = 86; continue; };
     458                    if (yych <= '@') { gotoCase = 78; continue; };
     459                    if (yych <= 'Z') { gotoCase = 82; continue; };
     460                } else {
     461                    if (yych <= '`') {
     462                        if (yych <= '_') { gotoCase = 82; continue; };
     463                    } else {
     464                        if (yych <= 'z') { gotoCase = 82; continue; };
     465                        if (yych >= 0x80) { gotoCase = 82; continue; };
     466                    }
     467                }
     468            }
     469case 78:
     470            ++cursor;
     471            { this.tokenType = null; return cursor; }
     472case 80:
     473            yyaccept = 0;
     474            yych = this._charAt(YYMARKER = ++cursor);
     475            { gotoCase = 97; continue; };
     476case 81:
     477            yyaccept = 0;
     478            yych = this._charAt(YYMARKER = ++cursor);
     479            { gotoCase = 91; continue; };
     480case 82:
     481            ++cursor;
     482            yych = this._charAt(cursor);
     483            { gotoCase = 89; continue; };
     484case 83:
     485            {
     486                    if (this._parseCondition === this._parseConditions.SCRIPT) {
     487                        this.tokenType = null;
     488                        return cursor;
     489                    }
     490
     491                    if (this._parseCondition === this._parseConditions.INITIAL) {
    288492                        this.tokenType = "html-tag";
    289493                        this._parseCondition = this._parseConditions.ATTRIBUTE;
     
    298502                    return cursor;
    299503                }
    300 case 33:
    301             yyaccept = 1;
    302             yych = this._charAt(YYMARKER = ++cursor);
    303             if (yych <= '/') {
    304                 if (yych == '!') { gotoCase = 42; continue; };
    305                 if (yych >= '/') { gotoCase = 39; continue; };
    306             } else {
    307                 if (yych <= 'S') {
    308                     if (yych >= 'S') { gotoCase = 40; continue; };
    309                 } else {
    310                     if (yych == 's') { gotoCase = 40; continue; };
    311                 }
    312             }
    313 case 34:
    314             {
    315                     if (this._parseCondition === this._parseConditions.SCRIPT) {
    316                         this.tokenType = null;
    317                         return cursor;
    318                     }
    319 
    320                     this.tokenType = "html-tag";
    321                     this._parseCondition = this._parseConditions.TAG;
    322                     return cursor;
    323                 }
    324 case 35:
     504case 84:
    325505            ++cursor;
    326506            {
     
    334514                    return cursor;
    335515                }
    336 case 37:
    337             ++cursor;
     516case 86:
     517            ++cursor;
     518            this.setLexCondition(this._lexConditions.INITIAL);
    338519            {
    339520                    if (this._parseCondition === this._parseConditions.SCRIPT) {
     
    353534                    return cursor;
    354535                }
    355 case 39:
    356             yyaccept = 1;
    357             yych = this._charAt(YYMARKER = ++cursor);
    358             if (yych == 'S') { gotoCase = 66; continue; };
    359             if (yych == 's') { gotoCase = 66; continue; };
    360             { gotoCase = 34; continue; };
    361 case 40:
    362             yych = this._charAt(++cursor);
    363             if (yych == 'C') { gotoCase = 60; continue; };
    364             if (yych == 'c') { gotoCase = 60; continue; };
    365 case 41:
    366             cursor = YYMARKER;
    367             if (yyaccept <= 0) {
    368                 { gotoCase = 28; continue; };
    369             } else {
    370                 { gotoCase = 34; continue; };
    371             }
    372 case 42:
    373             yych = this._charAt(++cursor);
    374             if (yych <= 'C') {
    375                 if (yych != '-') { gotoCase = 41; continue; };
    376             } else {
    377                 if (yych <= 'D') { gotoCase = 44; continue; };
    378                 if (yych == 'd') { gotoCase = 44; continue; };
    379                 { gotoCase = 41; continue; };
    380             }
    381             yych = this._charAt(++cursor);
    382             if (yych == '-') { gotoCase = 52; continue; };
    383             { gotoCase = 41; continue; };
    384 case 44:
    385             yych = this._charAt(++cursor);
    386             if (yych == 'O') { gotoCase = 45; continue; };
    387             if (yych != 'o') { gotoCase = 41; continue; };
    388 case 45:
    389             yych = this._charAt(++cursor);
    390             if (yych == 'C') { gotoCase = 46; continue; };
    391             if (yych != 'c') { gotoCase = 41; continue; };
    392 case 46:
    393             yych = this._charAt(++cursor);
    394             if (yych == 'T') { gotoCase = 47; continue; };
    395             if (yych != 't') { gotoCase = 41; continue; };
    396 case 47:
    397             yych = this._charAt(++cursor);
    398             if (yych == 'Y') { gotoCase = 48; continue; };
    399             if (yych != 'y') { gotoCase = 41; continue; };
    400 case 48:
    401             yych = this._charAt(++cursor);
    402             if (yych == 'P') { gotoCase = 49; continue; };
    403             if (yych != 'p') { gotoCase = 41; continue; };
    404 case 49:
    405             yych = this._charAt(++cursor);
    406             if (yych == 'E') { gotoCase = 50; continue; };
    407             if (yych != 'e') { gotoCase = 41; continue; };
    408 case 50:
    409             ++cursor;
    410             {
    411                     this.tokenType = "html-doctype";
    412                     this._parseCondition = this._parseConditions.DOCTYPE;
    413                     return cursor;
    414                 }
    415 case 52:
    416             ++cursor;
    417             yych = this._charAt(cursor);
    418             if (yych <= '\f') {
    419                 if (yych == '\n') { gotoCase = 55; continue; };
    420                 { gotoCase = 52; continue; };
    421             } else {
    422                 if (yych <= '\r') { gotoCase = 55; continue; };
    423                 if (yych != '-') { gotoCase = 52; continue; };
    424             }
    425             ++cursor;
    426             yych = this._charAt(cursor);
    427             if (yych == '-') { gotoCase = 57; continue; };
    428             { gotoCase = 41; continue; };
    429 case 55:
    430             ++cursor;
    431             this.setLexCondition(this._lexConditions.COMMENT);
    432             { this.tokenType = "html-comment"; return cursor; }
    433 case 57:
    434             ++cursor;
    435             yych = this._charAt(cursor);
    436             if (yych != '>') { gotoCase = 52; continue; };
    437             ++cursor;
    438             { this.tokenType = "html-comment"; return cursor; }
    439 case 60:
    440             yych = this._charAt(++cursor);
    441             if (yych == 'R') { gotoCase = 61; continue; };
    442             if (yych != 'r') { gotoCase = 41; continue; };
    443 case 61:
    444             yych = this._charAt(++cursor);
    445             if (yych == 'I') { gotoCase = 62; continue; };
    446             if (yych != 'i') { gotoCase = 41; continue; };
    447 case 62:
    448             yych = this._charAt(++cursor);
    449             if (yych == 'P') { gotoCase = 63; continue; };
    450             if (yych != 'p') { gotoCase = 41; continue; };
    451 case 63:
    452             yych = this._charAt(++cursor);
    453             if (yych == 'T') { gotoCase = 64; continue; };
    454             if (yych != 't') { gotoCase = 41; continue; };
    455 case 64:
    456             ++cursor;
    457             {
    458                     this.tokenType = "html-tag";
    459                     this._parseCondition = this._parseConditions.SCRIPT_ATTRIBUTE;
    460                     return cursor;
    461                 }
    462 case 66:
    463             yych = this._charAt(++cursor);
    464             if (yych == 'C') { gotoCase = 67; continue; };
    465             if (yych != 'c') { gotoCase = 41; continue; };
    466 case 67:
    467             yych = this._charAt(++cursor);
    468             if (yych == 'R') { gotoCase = 68; continue; };
    469             if (yych != 'r') { gotoCase = 41; continue; };
    470 case 68:
    471             yych = this._charAt(++cursor);
    472             if (yych == 'I') { gotoCase = 69; continue; };
    473             if (yych != 'i') { gotoCase = 41; continue; };
    474 case 69:
    475             yych = this._charAt(++cursor);
    476             if (yych == 'P') { gotoCase = 70; continue; };
    477             if (yych != 'p') { gotoCase = 41; continue; };
    478 case 70:
    479             yych = this._charAt(++cursor);
    480             if (yych == 'T') { gotoCase = 71; continue; };
    481             if (yych != 't') { gotoCase = 41; continue; };
    482 case 71:
    483             ++cursor;
    484             {
    485                     this.tokenType = "html-tag";
    486                     this._parseCondition = this._parseConditions.INITIAL;
    487                     return cursor;
    488                 }
    489 case 73:
    490             ++cursor;
    491             yych = this._charAt(cursor);
    492 case 74:
     536case 88:
     537            ++cursor;
     538            yych = this._charAt(cursor);
     539case 89:
    493540            if (yych <= '^') {
    494541                if (yych <= '9') {
    495                     if (yych <= '/') { gotoCase = 32; continue; };
    496                     { gotoCase = 73; continue; };
    497                 } else {
    498                     if (yych <= '@') { gotoCase = 32; continue; };
    499                     if (yych <= 'Z') { gotoCase = 73; continue; };
    500                     { gotoCase = 32; continue; };
     542                    if (yych <= '/') { gotoCase = 83; continue; };
     543                    { gotoCase = 88; continue; };
     544                } else {
     545                    if (yych <= '@') { gotoCase = 83; continue; };
     546                    if (yych <= 'Z') { gotoCase = 88; continue; };
     547                    { gotoCase = 83; continue; };
    501548                }
    502549            } else {
    503550                if (yych <= '`') {
    504                     if (yych <= '_') { gotoCase = 73; continue; };
    505                     { gotoCase = 32; continue; };
    506                 } else {
    507                     if (yych <= 'z') { gotoCase = 73; continue; };
    508                     if (yych <= 0x7F) { gotoCase = 32; continue; };
    509                     { gotoCase = 73; continue; };
    510                 }
    511             }
    512 case 75:
    513             ++cursor;
    514             yych = this._charAt(cursor);
    515 case 76:
    516             if (yych <= '\f') {
    517                 if (yych != '\n') { gotoCase = 75; continue; };
    518             } else {
    519                 if (yych <= '\r') { gotoCase = 77; continue; };
    520                 if (yych == '\'') { gotoCase = 79; continue; };
    521                 { gotoCase = 75; continue; };
    522             }
    523 case 77:
     551                    if (yych <= '_') { gotoCase = 88; continue; };
     552                    { gotoCase = 83; continue; };
     553                } else {
     554                    if (yych <= 'z') { gotoCase = 88; continue; };
     555                    if (yych <= 0x7F) { gotoCase = 83; continue; };
     556                    { gotoCase = 88; continue; };
     557                }
     558            }
     559case 90:
     560            ++cursor;
     561            yych = this._charAt(cursor);
     562case 91:
     563            if (yych <= '\f') {
     564                if (yych != '\n') { gotoCase = 90; continue; };
     565            } else {
     566                if (yych <= '\r') { gotoCase = 92; continue; };
     567                if (yych == '\'') { gotoCase = 94; continue; };
     568                { gotoCase = 90; continue; };
     569            }
     570case 92:
    524571            ++cursor;
    525572            this.setLexCondition(this._lexConditions.SSTRING);
    526573            { return this._stringToken(cursor); }
    527 case 79:
     574case 94:
    528575            ++cursor;
    529576            { return this._stringToken(cursor, true); }
    530 case 81:
    531             ++cursor;
    532             yych = this._charAt(cursor);
    533 case 82:
    534             if (yych <= '\f') {
    535                 if (yych != '\n') { gotoCase = 81; continue; };
    536             } else {
    537                 if (yych <= '\r') { gotoCase = 83; continue; };
    538                 if (yych == '"') { gotoCase = 79; continue; };
    539                 { gotoCase = 81; continue; };
    540             }
    541 case 83:
     577case 96:
     578            ++cursor;
     579            yych = this._charAt(cursor);
     580case 97:
     581            if (yych <= '\f') {
     582                if (yych != '\n') { gotoCase = 96; continue; };
     583            } else {
     584                if (yych <= '\r') { gotoCase = 98; continue; };
     585                if (yych == '"') { gotoCase = 94; continue; };
     586                { gotoCase = 96; continue; };
     587            }
     588case 98:
    542589            ++cursor;
    543590            this.setLexCondition(this._lexConditions.DSTRING);
    544591            { return this._stringToken(cursor); }
    545 /* *********************************** */
    546 case this.case_SSTRING:
    547             yych = this._charAt(cursor);
    548             if (yych <= '\f') {
    549                 if (yych == '\n') { gotoCase = 89; continue; };
    550                 { gotoCase = 88; continue; };
    551             } else {
    552                 if (yych <= '\r') { gotoCase = 89; continue; };
    553                 if (yych == '\'') { gotoCase = 91; continue; };
    554                 { gotoCase = 88; continue; };
    555             }
    556 case 87:
    557             { return this._stringToken(cursor); }
    558 case 88:
    559             yych = this._charAt(++cursor);
    560             { gotoCase = 95; continue; };
    561 case 89:
    562             ++cursor;
    563             { this.tokenType = null; return cursor; }
    564 case 91:
    565             ++cursor;
    566 case 92:
    567             this.setLexCondition(this._lexConditions.INITIAL);
    568             { return this._stringToken(cursor, true); }
    569 case 93:
    570             yych = this._charAt(++cursor);
    571             { gotoCase = 92; continue; };
    572 case 94:
    573             ++cursor;
    574             yych = this._charAt(cursor);
    575 case 95:
    576             if (yych <= '\f') {
    577                 if (yych == '\n') { gotoCase = 87; continue; };
    578                 { gotoCase = 94; continue; };
    579             } else {
    580                 if (yych <= '\r') { gotoCase = 87; continue; };
    581                 if (yych == '\'') { gotoCase = 93; continue; };
    582                 { gotoCase = 94; continue; };
    583             }
    584592        }
    585593
  • trunk/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js

    r54053 r54139  
    4545    WebInspector.SourceTokenizer.call(this);
    4646
     47    // The order is determined by the generated code.
    4748    this._lexConditions = {
    4849        INITIAL: 0,
    4950        COMMENT: 1,
    50         DSTRING: 2,
    51         SSTRING: 3
     51        TAG: 2,
     52        DSTRING: 4,
     53        SSTRING: 5
    5254    };
     55    this.case_INITIAL = 1000;
     56    this.case_COMMENT = 1001;
     57    this.case_TAG = 1002;
     58    this.case_DSTRING = 1004;
     59    this.case_SSTRING = 1005;
    5360
    5461    this._parseConditions = {
    5562        INITIAL: 0,
    56         TAG: 1,
    57         ATTRIBUTE: 2,
    58         ATTRIBUTE_VALUE: 3,
    59         SCRIPT: 4,
    60         SCRIPT_ATTRIBUTE: 5,
    61         SCRIPT_ATTRIBUTE_VALUE: 6,
    62         DOCTYPE: 7
     63        ATTRIBUTE: 1,
     64        ATTRIBUTE_VALUE: 2,
     65        SCRIPT: 3,
     66        SCRIPT_ATTRIBUTE: 4,
     67        SCRIPT_ATTRIBUTE_VALUE: 5,
     68        DOCTYPE: 6
    6369    };
    64 
    65     this.case_INITIAL = 1000;
    66     this.case_COMMENT = 1001;
    67     this.case_DSTRING = 1002;
    68     this.case_SSTRING = 1003;
    6970
    7071    this.initialCondition = { lexCondition: this._lexConditions.INITIAL, parseCondition: this._parseConditions.INITIAL };
     
    158159                <COMMENT> CommentEnd => INITIAL { this.tokenType = "html-comment"; return cursor; }
    159160
    160                 <INITIAL> DocTypeLT => INITIAL
     161                <INITIAL> DocTypeLT => TAG
    161162                {
    162163                    this.tokenType = "html-doctype";
     
    165166                }
    166167
    167                 <INITIAL> ScriptStart => INITIAL
     168                <INITIAL> ScriptStart => TAG
    168169                {
    169170                    this.tokenType = "html-tag";
     
    172173                }
    173174
    174                 <INITIAL> ScriptEnd => INITIAL
     175                <INITIAL> ScriptEnd => TAG
    175176                {
    176177                    this.tokenType = "html-tag";
     
    179180                }
    180181
    181                 <INITIAL> LT => INITIAL
     182                <INITIAL> LT
    182183                {
    183184                    if (this._parseCondition === this._parseConditions.SCRIPT) {
     
    186187                    }
    187188
     189                    // Only make lexer transition if not in script tag.
     190                    this.setLexCondition(this._lexConditions.TAG);
     191
    188192                    this.tokenType = "html-tag";
    189                     this._parseCondition = this._parseConditions.TAG;
    190                     return cursor;
    191                 }
    192 
    193                 <INITIAL> GT => INITIAL
     193                    this._parseCondition = this._parseConditions.INITIAL;
     194                    return cursor;
     195                }
     196
     197                <TAG> GT => INITIAL
    194198                {
    195199                    if (this._parseCondition === this._parseConditions.SCRIPT) {
     
    210214                }
    211215
    212                 <INITIAL> StringLiteral { return this._stringToken(cursor, true); }
    213                 <INITIAL> DoubleStringStart => DSTRING { return this._stringToken(cursor); }
     216                <TAG> StringLiteral { return this._stringToken(cursor, true); }
     217                <TAG> DoubleStringStart => DSTRING { return this._stringToken(cursor); }
    214218                <DSTRING> DoubleStringContent => DSTRING { return this._stringToken(cursor); }
    215                 <DSTRING> DoubleStringEnd => INITIAL { return this._stringToken(cursor, true); }
    216                 <INITIAL> SingleStringStart => SSTRING { return this._stringToken(cursor); }
     219                <DSTRING> DoubleStringEnd => TAG { return this._stringToken(cursor, true); }
     220                <TAG> SingleStringStart => SSTRING { return this._stringToken(cursor); }
    217221                <SSTRING> SingleStringContent => SSTRING { return this._stringToken(cursor); }
    218                 <SSTRING> SingleStringEnd => INITIAL { return this._stringToken(cursor, true); }
    219 
    220                 <INITIAL> EqualSign => INITIAL
     222                <SSTRING> SingleStringEnd => TAG { return this._stringToken(cursor, true); }
     223
     224                <TAG> EqualSign => TAG
    221225                {
    222226                    if (this._isAttribute()) {
     
    230234                }
    231235
    232                 <INITIAL> Identifier
     236                <TAG> Identifier
    233237                {
    234238                    if (this._parseCondition === this._parseConditions.SCRIPT) {
     
    237241                    }
    238242
    239                     if (this._parseCondition === this._parseConditions.TAG) {
     243                    if (this._parseCondition === this._parseConditions.INITIAL) {
    240244                        this.tokenType = "html-tag";
    241245                        this._parseCondition = this._parseConditions.ATTRIBUTE;
  • trunk/WebCore/inspector/front-end/TextEditor.js

    r54133 r54139  
    977977    },
    978978
    979     _initFontMetrics: function()
     979    initFontMetrics: function()
    980980    {
    981981        var computedStyle = window.getComputedStyle(this.element);
     
    999999        this._shortcuts[WebInspector.KeyboardShortcut.makeKey("d", modifiers.Ctrl | modifiers.Alt)] = this._handleToggleDebugMode.bind(this);
    10001000        this._shortcuts[WebInspector.KeyboardShortcut.makeKey("h", modifiers.Ctrl | modifiers.Alt)] = this._handleToggleHighlightMode.bind(this);
    1001         this._shortcuts[WebInspector.KeyboardShortcut.makeKey("m", modifiers.Ctrl | modifiers.Alt)] = this._handleToggleMonospaceMode.bind(this);
    10021001    },
    10031002
  • trunk/WebCore/inspector/front-end/inspectorSyntaxHighlight.css

    r50411 r54139  
    6666    color: rgb(196, 26, 22);
    6767}
     68
     69/* Keep this in sync with view-source.css */
     70.webkit-html-tag {
     71    color: rgb(136, 18, 128);
     72}
     73
     74.webkit-html-attr-name {
     75    color: rgb(153, 69, 0);
     76}
     77
     78.webkit-html-attr-value {
     79    color: rgb(26, 26, 166);
     80}
     81
     82.webkit-html-comment {
     83    color: rgb(35, 110, 37);
     84}
     85
     86.webkit-html-doctype {
     87    color: rgb(192, 192, 192);
     88}
Note: See TracChangeset for help on using the changeset viewer.