Changeset 55248 in webkit
- Timestamp:
- Feb 25, 2010 10:46:18 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r55230 r55248 1 2010-02-25 Pavel Feldman <pfeldman@chromium.org> 2 3 Web Inspector: evaluate-on-hover does not work on HTML files. 4 5 https://bugs.webkit.org/show_bug.cgi?id=35378 6 7 * inspector/syntax-highlight-html-expected.txt: 8 1 9 2010-02-25 Ben Murdoch <benm@google.com> 2 10 -
trunk/LayoutTests/inspector/syntax-highlight-html-expected.txt
r54780 r55248 7 7 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">: webkit-html-doctype,webkit-html-doctype,webkit-html-doctype 8 8 <!--div><div foobar-->: webkit-html-comment 9 <script></script><!--div-->: webkit-html-tag, *,webkit-html-tag,webkit-html-tag,webkit-html-comment10 <script type="text/javascript">document.write('<script type="text/javascript"></' + 'script>');</script>: webkit-html-tag,*,webkit-html-attribute-name,*,webkit-html-attribute-value, *,webkit-html-tag,webkit-html-tag9 <script></script><!--div-->: webkit-html-tag,webkit-html-tag,webkit-html-tag,webkit-html-tag,webkit-html-comment 10 <script type="text/javascript">document.write('<script type="text/javascript"></' + 'script>');</script>: webkit-html-tag,*,webkit-html-attribute-name,*,webkit-html-attribute-value,webkit-html-tag,webkit-javascript-ident,*,webkit-javascript-ident,*,webkit-javascript-string,*,webkit-javascript-string,*,webkit-html-tag,webkit-html-tag 11 11 -
trunk/WebCore/ChangeLog
r55244 r55248 1 2010-02-25 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Timothy Hatcher. 4 5 Web Inspector: evaluate-on-hover does not work on HTML files. 6 7 https://bugs.webkit.org/show_bug.cgi?id=35378 8 9 * inspector/front-end/SourceCSSTokenizer.re2js: 10 * inspector/front-end/SourceHTMLTokenizer.js: 11 (WebInspector.SourceHTMLTokenizer): 12 (WebInspector.SourceHTMLTokenizer.prototype.set line): 13 (WebInspector.SourceHTMLTokenizer.prototype._isExpectingAttribute): 14 (WebInspector.SourceHTMLTokenizer.prototype._isExpectingAttributeValue): 15 (WebInspector.SourceHTMLTokenizer.prototype._setExpectingAttribute): 16 (WebInspector.SourceHTMLTokenizer.prototype._setExpectingAttributeValue): 17 (WebInspector.SourceHTMLTokenizer.prototype._attrValueTokenType): 18 (WebInspector.SourceHTMLTokenizer.prototype.nextToken): 19 * inspector/front-end/SourceHTMLTokenizer.re2js: 20 * inspector/front-end/SourceJavaScriptTokenizer.js: 21 (WebInspector.SourceJavaScriptTokenizer): 22 * inspector/front-end/SourceJavaScriptTokenizer.re2js: 23 * inspector/front-end/SourceTokenizer.js: 24 (WebInspector.SourceTokenizer.prototype.set condition): 25 (WebInspector.SourceTokenizer.prototype.get condition): 26 (WebInspector.SourceTokenizer.prototype.get subTokenizer): 27 (WebInspector.SourceTokenizer.prototype.getLexCondition): 28 (WebInspector.SourceTokenizer.prototype.setLexCondition): 29 * inspector/front-end/TextEditorHighlighter.js: 30 (WebInspector.TextEditorHighlighter): 31 (WebInspector.TextEditorHighlighter.prototype.set mimeType): 32 (WebInspector.TextEditorHighlighter.prototype.highlight): 33 (WebInspector.TextEditorHighlighter.prototype._highlightInChunks): 34 (WebInspector.TextEditorHighlighter.prototype._highlightLines): 35 (WebInspector.TextEditorHighlighter.prototype._highlightLine): 36 * inspector/front-end/TextViewer.js: 37 (WebInspector.TextViewer.prototype._paintLine): 38 1 39 2010-02-25 Xan Lopez <xlopez@igalia.com> 2 40 -
trunk/WebCore/inspector/front-end/SourceCSSTokenizer.js
r54053 r55248 1 /* Generated by re2c 0.13.5 on Thu Jan 28 20:49:222010 */1 /* Generated by re2c 0.13.5 on Thu Feb 25 21:44:55 2010 */ 2 2 /* 3 3 * Copyright (C) 2009 Google Inc. All rights reserved. … … 100 100 this._valueKeywords = [ 101 101 "above", "absolute", "activeborder", "activecaption", "afar", "after-white-space", "ahead", "alias", "all", "all-scroll", 102 "alternate", "always","amharic", "amharic-abegede", "antialiased", "appworkspace", "aqua", "ar menian", "auto", "avoid",103 " background", "backwards", "baseline", "below", "bidi-override", "black", "blink", "block", "block-axis", "blue", "bold",104 "b older", "border", "border-box", "both", "bottom", "break-all", "break-word", "button", "button-bevel", "buttonface",105 "button highlight", "buttonshadow", "buttontext", "capitalize", "caps-lock-indicator", "caption", "captiontext", "caret", "cell",106 "c enter", "checkbox", "circle", "cjk-earthly-branch", "cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote",107 "c ol-resize", "collapse", "compact", "condensed", "contain", "content", "content-box", "context-menu", "continuous", "copy",108 "co ver", "crop", "cross", "crosshair", "currentcolor", "cursive", "dashed", "decimal", "decimal-leading-zero", "default",109 "default-button", "destination-atop", "destination-in", "destination-out", "destination-over", "d isc", "discard", "document",102 "alternate", "always","amharic", "amharic-abegede", "antialiased", "appworkspace", "aqua", "arabic-indic", "armenian", 103 "auto", "avoid", "background", "backwards", "baseline", "below", "bidi-override", "binary", "bengali", "black", "blink", 104 "block", "block-axis", "blue", "bold", "bolder", "border", "border-box", "both", "bottom", "break-all", "break-word", "button", 105 "button-bevel", "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "cambodian", "capitalize", "caps-lock-indicator", 106 "caption", "captiontext", "caret", "cell", "center", "checkbox", "circle", "cjk-earthly-branch", "cjk-heavenly-stem", "cjk-ideographic", 107 "clear", "clip", "close-quote", "col-resize", "collapse", "compact", "condensed", "contain", "content", "content-box", "context-menu", 108 "continuous", "copy", "cover", "crop", "cross", "crosshair", "currentcolor", "cursive", "dashed", "decimal", "decimal-leading-zero", "default", 109 "default-button", "destination-atop", "destination-in", "destination-out", "destination-over", "devanagari", "disc", "discard", "document", 110 110 "dot-dash", "dot-dot-dash", "dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out", "element", 111 111 "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede", "ethiopic-abegede-am-et", "ethiopic-abegede-gez", … … 114 114 "ethiopic-halehame-so-et", "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig", "ew-resize", "expanded", 115 115 "extra-condensed", "extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "forwards", "from", "fuchsia", "geometricPrecision", 116 "georgian", "gray", "graytext", "green", "grey", "groove", " hand", "hangul", "hangul-consonant", "hebrew", "help", "hidden", "hide",117 "hi gher", "highlight", "highlighttext", "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "icon", "ignore",116 "georgian", "gray", "graytext", "green", "grey", "groove", "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hebrew", "help", 117 "hidden", "hide", "higher", "highlight", "highlighttext", "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "icon", "ignore", 118 118 "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite", "infobackground", "infotext", "inherit", "initial", "inline", 119 "inline-axis", "inline-block", "inline-table", "inset", "inside", "intrinsic", "invert", "italic", "justify", "ka takana",120 "katakana-iroha", " landscape", "large", "larger", "left", "level", "lighter", "lime", "line-through", "linear", "lines",121 "list-button", "list-item", "listbox", "listitem", "local", "logical", "loud", "lower", "lower-alpha", "lower-greek", "lower- latin",122 "lower-norwegian", "lower-roman", "lowercase", "ltr", "ma roon", "match", "media-controls-background", "media-current-time-display",119 "inline-axis", "inline-block", "inline-table", "inset", "inside", "intrinsic", "invert", "italic", "justify", "kannada", "katakana", 120 "katakana-iroha", "khmer", "landscape", "lao", "large", "larger", "left", "level", "lighter", "lime", "line-through", "linear", "lines", 121 "list-button", "list-item", "listbox", "listitem", "local", "logical", "loud", "lower", "lower-alpha", "lower-greek", "lower-hexadecimal", "lower-latin", 122 "lower-norwegian", "lower-roman", "lowercase", "ltr", "malayalam", "maroon", "match", "media-controls-background", "media-current-time-display", 123 123 "media-fullscreen-button", "media-mute-button", "media-play-button", "media-return-to-realtime-button", "media-rewind-button", 124 124 "media-seek-back-button", "media-seek-forward-button", "media-slider", "media-sliderthumb", "media-time-remaining-display", 125 125 "media-volume-slider", "media-volume-slider-container", "media-volume-sliderthumb", "medium", "menu", "menulist", "menulist-button", 126 "menulist-text", "menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic", "mix", "mon ospace", "move", "multiple",127 " n-resize", "narrower", "navy", "ne-resize", "nesw-resize", "no-close-quote", "no-drop", "no-open-quote", "no-repeat", "none",128 "normal", "not-allowed", "nowrap", "ns-resize", "nw-resize", "nwse-resize", "oblique", "o live", "open-quote", "optimizeLegibility",129 "optimizeSpeed", "orange", "or omo", "outset", "outside", "overlay", "overline", "padding", "padding-box", "painted", "paused",130 "p lus-darker", "plus-lighter", "pointer", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", "progress", "purple",126 "menulist-text", "menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic", "mix", "mongolian", "monospace", "move", "multiple", 127 "myanmar", "n-resize", "narrower", "navy", "ne-resize", "nesw-resize", "no-close-quote", "no-drop", "no-open-quote", "no-repeat", "none", 128 "normal", "not-allowed", "nowrap", "ns-resize", "nw-resize", "nwse-resize", "oblique", "octal", "olive", "open-quote", "optimizeLegibility", 129 "optimizeSpeed", "orange", "oriya", "oromo", "outset", "outside", "overlay", "overline", "padding", "padding-box", "painted", "paused", 130 "persian", "plus-darker", "plus-lighter", "pointer", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", "progress", "purple", 131 131 "push-button", "radio", "read-only", "read-write", "read-write-plaintext-only", "red", "relative", "repeat", "repeat-x", 132 132 "repeat-y", "reset", "reverse", "rgb", "rgba", "ridge", "right", "round", "row-resize", "rtl", "run-in", "running", "s-resize", "sans-serif", … … 137 137 "space", "square", "square-button", "start", "static", "status-bar", "stretch", "stroke", "sub", "subpixel-antialiased", "super", 138 138 "sw-resize", "table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group", 139 "table-row", "table-row-group", "teal", "te xt", "text-bottom", "text-top", "textarea", "textfield", "thick", "thin", "threeddarkshadow",140 "threed face", "threedhighlight", "threedlightshadow", "threedshadow", "tigre", "tigrinya-er", "tigrinya-er-abegede", "tigrinya-et",141 "tigrinya-et -abegede", "to", "top", "transparent", "ultra-condensed", "ultra-expanded", "underline", "up", "upper-alpha", "upper-greek",142 "upper- latin", "upper-norwegian", "upper-roman", "uppercase", "url", "vertical", "vertical-text", "visible", "visibleFill", "visiblePainted",143 "visible Stroke", "visual", "w-resize", "wait", "wave", "white", "wider", "window", "windowframe", "windowtext", "x-large", "x-small",144 "x or", "xx-large", "xx-small", "yellow", "-wap-marquee", "-webkit-activelink", "-webkit-auto", "-webkit-baseline-middle", "-webkit-body",145 "-webkit-bo x", "-webkit-center", "-webkit-control", "-webkit-focus-ring-color", "-webkit-grab", "-webkit-grabbing", "-webkit-gradient", "-webkit-inline-box",146 "-webkit- left", "-webkit-link", "-webkit-marquee", "-webkit-mini-control", "-webkit-nowrap", "-webkit-right", "-webkit-small-control",147 "-webkit- text", "-webkit-xxx-large", "-webkit-zoom-in", "-webkit-zoom-out",139 "table-row", "table-row-group", "teal", "telugu", "text", "text-bottom", "text-top", "textarea", "textfield", "thai", "thick", "thin", 140 "threeddarkshadow", "threedface", "threedhighlight", "threedlightshadow", "threedshadow", "tibetan", "tigre", "tigrinya-er", "tigrinya-er-abegede", 141 "tigrinya-et", "tigrinya-et-abegede", "to", "top", "transparent", "ultra-condensed", "ultra-expanded", "underline", "up", "upper-alpha", "upper-greek", 142 "upper-hexadecimal", "upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url", "vertical", "vertical-text", "visible", 143 "visibleFill", "visiblePainted", "visibleStroke", "visual", "w-resize", "wait", "wave", "white", "wider", "window", "windowframe", "windowtext", 144 "x-large", "x-small", "xor", "xx-large", "xx-small", "yellow", "-wap-marquee", "-webkit-activelink", "-webkit-auto", "-webkit-baseline-middle", 145 "-webkit-body", "-webkit-box", "-webkit-center", "-webkit-control", "-webkit-focus-ring-color", "-webkit-grab", "-webkit-grabbing", 146 "-webkit-gradient", "-webkit-inline-box", "-webkit-left", "-webkit-link", "-webkit-marquee", "-webkit-mini-control", "-webkit-nowrap", "-webkit-right", 147 "-webkit-small-control", "-webkit-text", "-webkit-xxx-large", "-webkit-zoom-in", "-webkit-zoom-out", 148 148 ].keySet(); 149 149 … … 184 184 _isPropertyValue: function() 185 185 { 186 return this._ parseCondition === this._parseConditions.PROPERTY_VALUE || this._parseCondition === this._parseConditions.AT_RULE;186 return this._condition.parseCondition === this._parseConditions.PROPERTY_VALUE || this._condition.parseCondition === this._parseConditions.AT_RULE; 187 187 }, 188 188 … … 424 424 { 425 425 var token = this._line.substring(cursorOnEnter, cursor); 426 if (this._ parseCondition === this._parseConditions.INITIAL) {426 if (this._condition.parseCondition === this._parseConditions.INITIAL) { 427 427 if (token === "@import" || token === "@media") { 428 428 this.tokenType = "css-at-rule"; 429 this._ parseCondition = this._parseConditions.AT_RULE;429 this._condition.parseCondition = this._parseConditions.AT_RULE; 430 430 } else if (token.indexOf("@") === 0) 431 431 this.tokenType = "css-at-rule"; … … 433 433 this.tokenType = "css-selector"; 434 434 } 435 else if (this._ parseCondition === this._parseConditions.AT_RULE && token in this._mediaTypes)435 else if (this._condition.parseCondition === this._parseConditions.AT_RULE && token in this._mediaTypes) 436 436 this.tokenType = "css-keyword"; 437 else if (this._ parseCondition === this._parseConditions.PROPERTY && token in this._propertyKeywords)437 else if (this._condition.parseCondition === this._parseConditions.PROPERTY && token in this._propertyKeywords) 438 438 this.tokenType = "css-property"; 439 439 else if (this._isPropertyValue() && token in this._valueKeywords) … … 648 648 { 649 649 this.tokenType = null; 650 if (this._ parseCondition === this._parseConditions.PROPERTY)651 this._ parseCondition = this._parseConditions.PROPERTY_VALUE;650 if (this._condition.parseCondition === this._parseConditions.PROPERTY) 651 this._condition.parseCondition = this._parseConditions.PROPERTY_VALUE; 652 652 return cursor; 653 653 } … … 656 656 { 657 657 this.tokenType = null; 658 if (this._ parseCondition === this._parseConditions.AT_RULE)659 this._ parseCondition = this._parseConditions.INITIAL;658 if (this._condition.parseCondition === this._parseConditions.AT_RULE) 659 this._condition.parseCondition = this._parseConditions.INITIAL; 660 660 else 661 this._ parseCondition = this._parseConditions.PROPERTY;661 this._condition.parseCondition = this._parseConditions.PROPERTY; 662 662 return cursor; 663 663 } … … 666 666 { 667 667 this.tokenType = null; 668 if (this._ parseCondition === this._parseConditions.AT_RULE)669 this._ parseCondition = this._parseConditions.INITIAL;668 if (this._condition.parseCondition === this._parseConditions.AT_RULE) 669 this._condition.parseCondition = this._parseConditions.INITIAL; 670 670 else 671 this._ parseCondition = this._parseConditions.PROPERTY;671 this._condition.parseCondition = this._parseConditions.PROPERTY; 672 672 return cursor; 673 673 } … … 676 676 { 677 677 this.tokenType = null; 678 this._ parseCondition = this._parseConditions.INITIAL;678 this._condition.parseCondition = this._parseConditions.INITIAL; 679 679 return cursor; 680 680 } -
trunk/WebCore/inspector/front-end/SourceCSSTokenizer.re2js
r54472 r55248 183 183 _isPropertyValue: function() 184 184 { 185 return this._ parseCondition === this._parseConditions.PROPERTY_VALUE || this._parseCondition === this._parseConditions.AT_RULE;185 return this._condition.parseCondition === this._parseConditions.PROPERTY_VALUE || this._condition.parseCondition === this._parseConditions.AT_RULE; 186 186 }, 187 187 … … 245 245 { 246 246 this.tokenType = null; 247 if (this._ parseCondition === this._parseConditions.AT_RULE)248 this._ parseCondition = this._parseConditions.INITIAL;247 if (this._condition.parseCondition === this._parseConditions.AT_RULE) 248 this._condition.parseCondition = this._parseConditions.INITIAL; 249 249 else 250 this._ parseCondition = this._parseConditions.PROPERTY;250 this._condition.parseCondition = this._parseConditions.PROPERTY; 251 251 return cursor; 252 252 } … … 255 255 { 256 256 this.tokenType = null; 257 this._ parseCondition = this._parseConditions.INITIAL;257 this._condition.parseCondition = this._parseConditions.INITIAL; 258 258 return cursor; 259 259 } … … 262 262 { 263 263 this.tokenType = null; 264 if (this._ parseCondition === this._parseConditions.PROPERTY)265 this._ parseCondition = this._parseConditions.PROPERTY_VALUE;264 if (this._condition.parseCondition === this._parseConditions.PROPERTY) 265 this._condition.parseCondition = this._parseConditions.PROPERTY_VALUE; 266 266 return cursor; 267 267 } … … 270 270 { 271 271 this.tokenType = null; 272 if (this._ parseCondition === this._parseConditions.AT_RULE)273 this._ parseCondition = this._parseConditions.INITIAL;272 if (this._condition.parseCondition === this._parseConditions.AT_RULE) 273 this._condition.parseCondition = this._parseConditions.INITIAL; 274 274 else 275 this._ parseCondition = this._parseConditions.PROPERTY;275 this._condition.parseCondition = this._parseConditions.PROPERTY; 276 276 return cursor; 277 277 } … … 289 289 { 290 290 var token = this._line.substring(cursorOnEnter, cursor); 291 if (this._ parseCondition === this._parseConditions.INITIAL) {291 if (this._condition.parseCondition === this._parseConditions.INITIAL) { 292 292 if (token === "@import" || token === "@media") { 293 293 this.tokenType = "css-at-rule"; 294 this._ parseCondition = this._parseConditions.AT_RULE;294 this._condition.parseCondition = this._parseConditions.AT_RULE; 295 295 } else if (token.indexOf("@") === 0) 296 296 this.tokenType = "css-at-rule"; … … 298 298 this.tokenType = "css-selector"; 299 299 } 300 else if (this._ parseCondition === this._parseConditions.AT_RULE && token in this._mediaTypes)300 else if (this._condition.parseCondition === this._parseConditions.AT_RULE && token in this._mediaTypes) 301 301 this.tokenType = "css-keyword"; 302 else if (this._ parseCondition === this._parseConditions.PROPERTY && token in this._propertyKeywords)302 else if (this._condition.parseCondition === this._parseConditions.PROPERTY && token in this._propertyKeywords) 303 303 this.tokenType = "css-property"; 304 304 else if (this._isPropertyValue() && token in this._valueKeywords) -
trunk/WebCore/inspector/front-end/SourceHTMLTokenizer.js
r54780 r55248 1 /* Generated by re2c 0.13.5 on Mon Feb 15 19:30:212010 */1 /* Generated by re2c 0.13.5 on Thu Feb 25 21:44:55 2010 */ 2 2 /* 3 3 * Copyright (C) 2009 Google Inc. All rights reserved. … … 72 72 73 73 this.initialCondition = { lexCondition: this._lexConditions.INITIAL, parseCondition: this._parseConditions.INITIAL }; 74 this.condition = this.initialCondition; 74 75 } 75 76 76 77 WebInspector.SourceHTMLTokenizer.prototype = { 78 set line(line) { 79 if (this._internalJavaScriptTokenizer) { 80 var match = /<\/script/i.exec(line); 81 if (match) { 82 this._internalJavaScriptTokenizer.line = line.substring(0, match.index); 83 } else 84 this._internalJavaScriptTokenizer.line = line; 85 } 86 this._line = line; 87 }, 88 77 89 _isExpectingAttribute: function() 78 90 { 79 return this._ parseCondition & this._parseConditions.ATTRIBUTE;91 return this._condition.parseCondition & this._parseConditions.ATTRIBUTE; 80 92 }, 81 93 82 94 _isExpectingAttributeValue: function() 83 95 { 84 return this._ parseCondition & this._parseConditions.ATTRIBUTE_VALUE;96 return this._condition.parseCondition & this._parseConditions.ATTRIBUTE_VALUE; 85 97 }, 86 98 … … 88 100 { 89 101 if (this._isExpectingAttributeValue()) 90 this._ parseCondition ^= this._parseConditions.ATTRIBUTE_VALUE;91 this._ parseCondition |= this._parseConditions.ATTRIBUTE;102 this._condition.parseCondition ^= this._parseConditions.ATTRIBUTE_VALUE; 103 this._condition.parseCondition |= this._parseConditions.ATTRIBUTE; 92 104 }, 93 105 … … 95 107 { 96 108 if (this._isExpectingAttribute()) 97 this._ parseCondition ^= this._parseConditions.ATTRIBUTE;98 this._ parseCondition |= this._parseConditions.ATTRIBUTE_VALUE;109 this._condition.parseCondition ^= this._parseConditions.ATTRIBUTE; 110 this._condition.parseCondition |= this._parseConditions.ATTRIBUTE_VALUE; 99 111 }, 100 112 … … 113 125 _attrValueTokenType: function() 114 126 { 115 if (this._ parseCondition & this._parseConditions.LINKIFY) {116 if (this._ parseCondition & this._parseConditions.A_NODE)127 if (this._condition.parseCondition & this._parseConditions.LINKIFY) { 128 if (this._condition.parseCondition & this._parseConditions.A_NODE) 117 129 return "html-external-link"; 118 130 return "html-resource-link"; … … 123 135 nextToken: function(cursor) 124 136 { 137 if (this._internalJavaScriptTokenizer) { 138 // Re-set line to force </script> detection first. 139 this.line = this._line; 140 if (cursor !== this._internalJavaScriptTokenizer._line.length) { 141 // Tokenizer is stateless, so restore its condition before tokenizing and save it after. 142 this._internalJavaScriptTokenizer.condition = this._condition.internalJavaScriptTokenizerCondition; 143 var result = this._internalJavaScriptTokenizer.nextToken(cursor); 144 this.tokenType = this._internalJavaScriptTokenizer.tokenType; 145 this._condition.internalJavaScriptTokenizerCondition = this._internalJavaScriptTokenizer.condition; 146 return result; 147 } else if (cursor !== this._line.length) 148 delete this._internalJavaScriptTokenizer; 149 } 150 125 151 var cursorOnEnter = cursor; 126 152 var gotoCase = 1; … … 306 332 this.setLexCondition(this._lexConditions.TAG); 307 333 { 308 if (this._ parseCondition & this._parseConditions.SCRIPT) {334 if (this._condition.parseCondition & this._parseConditions.SCRIPT) { 309 335 // Do not tokenize script tag contents, keep lexer state although processing "<". 310 336 this.setLexCondition(this._lexConditions.INITIAL); … … 313 339 } 314 340 315 this._ parseCondition = this._parseConditions.INITIAL;341 this._condition.parseCondition = this._parseConditions.INITIAL; 316 342 this.tokenType = "html-tag"; 317 343 return cursor; … … 414 440 this.setLexCondition(this._lexConditions.TAG); 415 441 { 416 if (this._ parseCondition & this._parseConditions.SCRIPT) {442 if (this._condition.parseCondition & this._parseConditions.SCRIPT) { 417 443 // Do not tokenize script tag contents, keep lexer state although processing "<". 418 444 this.setLexCondition(this._lexConditions.INITIAL); … … 421 447 } 422 448 this.tokenType = "html-tag"; 423 this._ parseCondition = this._parseConditions.SCRIPT;449 this._condition.parseCondition = this._parseConditions.SCRIPT; 424 450 this._setExpectingAttribute(); 425 451 return cursor; … … 450 476 { 451 477 this.tokenType = "html-tag"; 452 this._ parseCondition = this._parseConditions.INITIAL;478 this._condition.parseCondition = this._parseConditions.INITIAL; 453 479 return cursor; 454 480 } … … 528 554 case 89: 529 555 { 530 if (this._ parseCondition === this._parseConditions.SCRIPT) {556 if (this._condition.parseCondition === this._parseConditions.SCRIPT) { 531 557 // Fall through if expecting attributes. 532 558 this.tokenType = null; … … 534 560 } 535 561 536 if (this._ parseCondition === this._parseConditions.INITIAL) {562 if (this._condition.parseCondition === this._parseConditions.INITIAL) { 537 563 this.tokenType = "html-tag"; 538 564 this._setExpectingAttribute(); 539 565 var token = this._line.substring(cursorOnEnter, cursor); 540 566 if (token === "a") 541 this._ parseCondition |= this._parseConditions.A_NODE;542 else if (this._ parseCondition & this._parseConditions.A_NODE)543 this._ parseCondition ^= this._parseConditions.A_NODE;567 this._condition.parseCondition |= this._parseConditions.A_NODE; 568 else if (this._condition.parseCondition & this._parseConditions.A_NODE) 569 this._condition.parseCondition ^= this._parseConditions.A_NODE; 544 570 } else if (this._isExpectingAttribute()) { 545 571 var token = this._line.substring(cursorOnEnter, cursor); 546 572 if (token === "href" || token === "src") 547 this._ parseCondition |= this._parseConditions.LINKIFY;548 else if (this._ parseCondition |= this._parseConditions.LINKIFY)549 this._ parseCondition ^= this._parseConditions.LINKIFY;573 this._condition.parseCondition |= this._parseConditions.LINKIFY; 574 else if (this._condition.parseCondition |= this._parseConditions.LINKIFY) 575 this._condition.parseCondition ^= this._parseConditions.LINKIFY; 550 576 this.tokenType = "html-attribute-name"; 551 577 } else if (this._isExpectingAttributeValue()) … … 578 604 this.setLexCondition(this._lexConditions.INITIAL); 579 605 { 580 if (this._parseCondition & this._parseConditions.SCRIPT) { 606 this.tokenType = "html-tag"; 607 if (this._condition.parseCondition & this._parseConditions.SCRIPT) { 608 if (!this._internalJavaScriptTokenizer) { 609 this._internalJavaScriptTokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer("text/javascript"); 610 this._condition.internalJavaScriptTokenizerCondition = this._internalJavaScriptTokenizer.initialCondition; 611 } 581 612 // Do not tokenize script tag contents. 582 this.tokenType = null;583 613 return cursor; 584 614 } 585 615 586 this._parseCondition = this._parseConditions.INITIAL; 587 this.tokenType = "html-tag"; 616 this._condition.parseCondition = this._parseConditions.INITIAL; 588 617 return cursor; 589 618 } -
trunk/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js
r54780 r55248 71 71 72 72 this.initialCondition = { lexCondition: this._lexConditions.INITIAL, parseCondition: this._parseConditions.INITIAL }; 73 this.condition = this.initialCondition; 73 74 } 74 75 75 76 WebInspector.SourceHTMLTokenizer.prototype = { 77 set line(line) { 78 if (this._internalJavaScriptTokenizer) { 79 var match = /<\/script/i.exec(line); 80 if (match) { 81 this._internalJavaScriptTokenizer.line = line.substring(0, match.index); 82 } else 83 this._internalJavaScriptTokenizer.line = line; 84 } 85 this._line = line; 86 }, 87 76 88 _isExpectingAttribute: function() 77 89 { 78 return this._ parseCondition & this._parseConditions.ATTRIBUTE;90 return this._condition.parseCondition & this._parseConditions.ATTRIBUTE; 79 91 }, 80 92 81 93 _isExpectingAttributeValue: function() 82 94 { 83 return this._ parseCondition & this._parseConditions.ATTRIBUTE_VALUE;95 return this._condition.parseCondition & this._parseConditions.ATTRIBUTE_VALUE; 84 96 }, 85 97 … … 87 99 { 88 100 if (this._isExpectingAttributeValue()) 89 this._ parseCondition ^= this._parseConditions.ATTRIBUTE_VALUE;90 this._ parseCondition |= this._parseConditions.ATTRIBUTE;101 this._condition.parseCondition ^= this._parseConditions.ATTRIBUTE_VALUE; 102 this._condition.parseCondition |= this._parseConditions.ATTRIBUTE; 91 103 }, 92 104 … … 94 106 { 95 107 if (this._isExpectingAttribute()) 96 this._ parseCondition ^= this._parseConditions.ATTRIBUTE;97 this._ parseCondition |= this._parseConditions.ATTRIBUTE_VALUE;108 this._condition.parseCondition ^= this._parseConditions.ATTRIBUTE; 109 this._condition.parseCondition |= this._parseConditions.ATTRIBUTE_VALUE; 98 110 }, 99 111 … … 112 124 _attrValueTokenType: function() 113 125 { 114 if (this._ parseCondition & this._parseConditions.LINKIFY) {115 if (this._ parseCondition & this._parseConditions.A_NODE)126 if (this._condition.parseCondition & this._parseConditions.LINKIFY) { 127 if (this._condition.parseCondition & this._parseConditions.A_NODE) 116 128 return "html-external-link"; 117 129 return "html-resource-link"; … … 122 134 nextToken: function(cursor) 123 135 { 136 if (this._internalJavaScriptTokenizer) { 137 // Re-set line to force </script> detection first. 138 this.line = this._line; 139 if (cursor !== this._internalJavaScriptTokenizer._line.length) { 140 // Tokenizer is stateless, so restore its condition before tokenizing and save it after. 141 this._internalJavaScriptTokenizer.condition = this._condition.internalJavaScriptTokenizerCondition; 142 var result = this._internalJavaScriptTokenizer.nextToken(cursor); 143 this.tokenType = this._internalJavaScriptTokenizer.tokenType; 144 this._condition.internalJavaScriptTokenizerCondition = this._internalJavaScriptTokenizer.condition; 145 return result; 146 } else if (cursor !== this._line.length) 147 delete this._internalJavaScriptTokenizer; 148 } 149 124 150 var cursorOnEnter = cursor; 125 151 var gotoCase = 1; … … 175 201 <INITIAL> ScriptStart => TAG 176 202 { 177 if (this._ parseCondition & this._parseConditions.SCRIPT) {203 if (this._condition.parseCondition & this._parseConditions.SCRIPT) { 178 204 // Do not tokenize script tag contents, keep lexer state although processing "<". 179 205 this.setLexCondition(this._lexConditions.INITIAL); … … 182 208 } 183 209 this.tokenType = "html-tag"; 184 this._ parseCondition = this._parseConditions.SCRIPT;210 this._condition.parseCondition = this._parseConditions.SCRIPT; 185 211 this._setExpectingAttribute(); 186 212 return cursor; … … 190 216 { 191 217 this.tokenType = "html-tag"; 192 this._ parseCondition = this._parseConditions.INITIAL;218 this._condition.parseCondition = this._parseConditions.INITIAL; 193 219 return cursor; 194 220 } … … 196 222 <INITIAL> LT => TAG 197 223 { 198 if (this._ parseCondition & this._parseConditions.SCRIPT) {224 if (this._condition.parseCondition & this._parseConditions.SCRIPT) { 199 225 // Do not tokenize script tag contents, keep lexer state although processing "<". 200 226 this.setLexCondition(this._lexConditions.INITIAL); … … 203 229 } 204 230 205 this._ parseCondition = this._parseConditions.INITIAL;231 this._condition.parseCondition = this._parseConditions.INITIAL; 206 232 this.tokenType = "html-tag"; 207 233 return cursor; 208 234 } 209 235 210 236 <TAG> GT => INITIAL 211 237 { 212 if (this._parseCondition & this._parseConditions.SCRIPT) { 238 this.tokenType = "html-tag"; 239 if (this._condition.parseCondition & this._parseConditions.SCRIPT) { 240 if (!this._internalJavaScriptTokenizer) { 241 this._internalJavaScriptTokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer("text/javascript"); 242 this._condition.internalJavaScriptTokenizerCondition = this._internalJavaScriptTokenizer.initialCondition; 243 } 213 244 // Do not tokenize script tag contents. 214 this.tokenType = null;215 245 return cursor; 216 246 } 217 247 218 this._parseCondition = this._parseConditions.INITIAL; 219 this.tokenType = "html-tag"; 248 this._condition.parseCondition = this._parseConditions.INITIAL; 220 249 return cursor; 221 250 } … … 239 268 <TAG> Identifier 240 269 { 241 if (this._ parseCondition === this._parseConditions.SCRIPT) {270 if (this._condition.parseCondition === this._parseConditions.SCRIPT) { 242 271 // Fall through if expecting attributes. 243 272 this.tokenType = null; … … 245 274 } 246 275 247 if (this._ parseCondition === this._parseConditions.INITIAL) {276 if (this._condition.parseCondition === this._parseConditions.INITIAL) { 248 277 this.tokenType = "html-tag"; 249 278 this._setExpectingAttribute(); 250 279 var token = this._line.substring(cursorOnEnter, cursor); 251 280 if (token === "a") 252 this._ parseCondition |= this._parseConditions.A_NODE;253 else if (this._ parseCondition & this._parseConditions.A_NODE)254 this._ parseCondition ^= this._parseConditions.A_NODE;281 this._condition.parseCondition |= this._parseConditions.A_NODE; 282 else if (this._condition.parseCondition & this._parseConditions.A_NODE) 283 this._condition.parseCondition ^= this._parseConditions.A_NODE; 255 284 } else if (this._isExpectingAttribute()) { 256 285 var token = this._line.substring(cursorOnEnter, cursor); 257 286 if (token === "href" || token === "src") 258 this._ parseCondition |= this._parseConditions.LINKIFY;259 else if (this._ parseCondition |= this._parseConditions.LINKIFY)260 this._ parseCondition ^= this._parseConditions.LINKIFY;287 this._condition.parseCondition |= this._parseConditions.LINKIFY; 288 else if (this._condition.parseCondition |= this._parseConditions.LINKIFY) 289 this._condition.parseCondition ^= this._parseConditions.LINKIFY; 261 290 this.tokenType = "html-attribute-name"; 262 291 } else if (this._isExpectingAttributeValue()) -
trunk/WebCore/inspector/front-end/SourceJavaScriptTokenizer.js
r54979 r55248 1 /* Generated by re2c 0.13.5 on Thu Jan 28 20:49:232010 */1 /* Generated by re2c 0.13.5 on Thu Feb 25 21:44:55 2010 */ 2 2 /* 3 3 * Copyright (C) 2009 Google Inc. All rights reserved. … … 70 70 71 71 this.initialCondition = { lexCondition: this._lexConditions.NODIV } 72 this.condition = this.initialCondition; 72 73 } 73 74 -
trunk/WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js
r54979 r55248 69 69 70 70 this.initialCondition = { lexCondition: this._lexConditions.NODIV } 71 this.condition = this.initialCondition; 71 72 } 72 73 -
trunk/WebCore/inspector/front-end/SourceTokenizer.js
r54872 r55248 41 41 set condition(condition) 42 42 { 43 this._lexCondition = condition.lexCondition; 44 this._parseCondition = condition.parseCondition; 43 this._condition = condition; 45 44 }, 46 45 47 46 get condition() 48 47 { 49 return { lexCondition: this._lexCondition, parseCondition: this._parseCondition };48 return this._condition; 50 49 }, 51 50 52 hasCondition: function(condition)51 get subTokenizer() 53 52 { 54 return this._ lexCondition === condition.lexCondition && this._parseCondition === condition.parseCondition;53 return this._condition.subTokenizer; 55 54 }, 56 55 57 56 getLexCondition: function() 58 57 { 59 return this. _lexCondition;58 return this.condition.lexCondition; 60 59 }, 61 60 62 61 setLexCondition: function(lexCondition) 63 62 { 64 this. _lexCondition = lexCondition;63 this.condition.lexCondition = lexCondition; 65 64 }, 66 65 -
trunk/WebCore/inspector/front-end/TextEditorHighlighter.js
r54962 r55248 35 35 this._tokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer("text/html"); 36 36 this._damageCallback = damageCallback; 37 this._lastHighlightedLine = 0; 37 38 } 38 39 … … 41 42 { 42 43 var tokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer(mimeType); 43 if (tokenizer) 44 if (tokenizer) { 44 45 this._tokenizer = tokenizer; 46 this._tokenizerCondition = this._tokenizer.initialCondition; 47 } 45 48 }, 46 49 … … 48 51 { 49 52 // First check if we have work to do. 50 var state = this._textModel.getAttribute(endLine - 1, "highlighter-state") 51 if (state && !state.outOfDate) { 52 // Last line is highlighted, just exit. 53 if (endLine <= this._lastHighlightedLine) 53 54 return; 54 }55 55 56 56 this._requestedEndLine = endLine; … … 61 61 } 62 62 63 // We will be highlighting. First rewind to the last highlighted line to gain proper highlighter context.64 var startLine = endLine;65 while (startLine > 0) {66 var state = this._textModel.getAttribute(startLine - 1, "highlighter-state");67 if (state && !state.outOfDate)68 break;69 startLine--;70 }71 72 63 // Do small highlight synchronously. This will provide instant highlight on PageUp / PageDown, gentle scrolling. 73 var toLine = Math.min( startLine + 200, endLine);74 this._highlightInChunks( startLine, toLine);64 var toLine = Math.min(this._lastHighlightedLine + 200, endLine); 65 this._highlightInChunks(this._lastHighlightedLine, toLine); 75 66 76 67 // Schedule tail highlight if necessary. … … 84 75 85 76 // First we always check if we have work to do. Could be that user scrolled back and we can quit. 86 var state = this._textModel.getAttribute(this._requestedEndLine - 1, "highlighter-state"); 87 if (state && !state.outOfDate) 77 if (this._requestedEndLine <= this._lastHighlightedLine) 88 78 return; 89 79 … … 103 93 }, 104 94 105 updateHighlight: function(startLine, endLine)95 _highlightLines: function(startLine, endLine) 106 96 { 107 // Start line was edited, we should highlight everything until endLine synchronously. 108 if (startLine) { 109 var state = this._textModel.getAttribute(startLine - 1, "highlighter-state"); 110 if (!state || state.outOfDate) { 111 // Highlighter did not reach this point yet, nothing to update. It will reach it on subsequent timer tick and do the job. 112 return; 113 } 114 } 97 // Tokenizer is stateless and reused accross viewers, restore its condition before highlight and save it after. 98 this._tokenizer.condition = this._tokenizerCondition; 99 for (var i = startLine; i < endLine; ++i) 100 this._highlightLine(i); 101 this._lastHighlightedLine = endLine; 102 this._tokenizerCondition = this._tokenizer.condition; 115 103 116 var restored = this._highlightLines(startLine, endLine); 117 118 // Set invalidated flag to the subsequent lines. 119 for (var i = endLine; i < this._textModel.linesCount; ++i) { 120 var highlighterState = this._textModel.getAttribute(i, "highlighter-state"); 121 if (highlighterState) 122 highlighterState.outOfDate = !restored; 123 else 124 return; 125 } 104 this._damageCallback(startLine, endLine); 126 105 }, 127 106 128 _highlightLines: function(startLine, endLine) 129 { 130 // Restore highlighter context taken from previous line. 131 var state = this._textModel.getAttribute(startLine - 1, "highlighter-state"); 132 if (state) 133 this._tokenizer.condition = state.postCondition; 134 else 135 this._tokenizer.condition = this._tokenizer.initialCondition; 136 137 for (var i = startLine; i < endLine; ++i) { 138 state = {}; 139 state.preCondition = this._tokenizer.condition; 140 state.attributes = {}; 141 142 this._lex(this._textModel.line(i), i, state.attributes); 143 144 state.postCondition = this._tokenizer.condition; 145 this._textModel.setAttribute(i, "highlighter-state", state); 146 147 var nextLineState = this._textModel.getAttribute(i + 1, "highlighter-state"); 148 if (nextLineState && this._tokenizer.hasCondition(nextLineState.preCondition)) { 149 // Following lines are up to date, no need re-highlight. 150 this._damageCallback(startLine, i + 1); 151 return true; 152 } 153 } 154 this._damageCallback(startLine, endLine); 155 return false; 156 }, 157 158 _lex: function(line, lineNumber, attributes) { 159 this._tokenizer.line = line; 160 var column = 0; 161 do { 162 var newColumn = this._tokenizer.nextToken(column); 163 var tokenType = this._tokenizer.tokenType; 164 if (tokenType) 165 attributes[column] = { length: newColumn - column, tokenType: tokenType }; 166 column = newColumn; 167 } while (column < line.length) 107 _highlightLine: function(lineNumber) { 108 var line = this._textModel.line(lineNumber); 109 var attributes = {}; 110 this._tokenizer.line = line; 111 var column = 0; 112 do { 113 var newColumn = this._tokenizer.nextToken(column); 114 var tokenType = this._tokenizer.tokenType; 115 if (tokenType) 116 attributes[column] = { length: newColumn - column, tokenType: tokenType, subTokenizer: this._tokenizer.subTokenizer }; 117 column = newColumn; 118 } while (column < line.length) 119 this._textModel.setAttribute(lineNumber, "highlight", attributes); 168 120 } 169 121 } -
trunk/WebCore/inspector/front-end/TextViewer.js
r54962 r55248 331 331 { 332 332 var element = lineRow.lastChild; 333 var highlighterState = this._textModel.getAttribute(lineNumber, "highlighter-state"); 334 var line = this._textModel.line(lineNumber); 335 336 if (!highlighterState) { 333 var highlight = this._textModel.getAttribute(lineNumber, "highlight"); 334 if (!highlight) { 337 335 if (this._rangeToMark && this._rangeToMark.startLine === lineNumber) 338 336 this._markedRangeElement = highlightSearchResult(element, this._rangeToMark.startColumn, this._rangeToMark.endColumn - this._rangeToMark.startColumn); … … 341 339 342 340 element.removeChildren(); 341 var line = this._textModel.line(lineNumber); 343 342 344 343 var plainTextStart = -1; … … 349 348 break; 350 349 } 351 var attribute = highlight erState && highlighterState.attributes[j];350 var attribute = highlight[j]; 352 351 if (!attribute || !attribute.tokenType) { 353 352 if (plainTextStart === -1)
Note: See TracChangeset
for help on using the changeset viewer.