[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

pfeldman at chromium.org pfeldman at chromium.org
Thu Apr 8 01:59:21 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 81cf3486899dcba13978f81012712ef6092ae73b
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Feb 25 18:46:18 2010 +0000

    2010-02-25  Pavel Feldman  <pfeldman at chromium.org>
    
            Reviewed by Timothy Hatcher.
    
            Web Inspector: evaluate-on-hover does not work on HTML files.
    
            https://bugs.webkit.org/show_bug.cgi?id=35378
    
            * inspector/front-end/SourceCSSTokenizer.re2js:
            * inspector/front-end/SourceHTMLTokenizer.js:
            (WebInspector.SourceHTMLTokenizer):
            (WebInspector.SourceHTMLTokenizer.prototype.set line):
            (WebInspector.SourceHTMLTokenizer.prototype._isExpectingAttribute):
            (WebInspector.SourceHTMLTokenizer.prototype._isExpectingAttributeValue):
            (WebInspector.SourceHTMLTokenizer.prototype._setExpectingAttribute):
            (WebInspector.SourceHTMLTokenizer.prototype._setExpectingAttributeValue):
            (WebInspector.SourceHTMLTokenizer.prototype._attrValueTokenType):
            (WebInspector.SourceHTMLTokenizer.prototype.nextToken):
            * inspector/front-end/SourceHTMLTokenizer.re2js:
            * inspector/front-end/SourceJavaScriptTokenizer.js:
            (WebInspector.SourceJavaScriptTokenizer):
            * inspector/front-end/SourceJavaScriptTokenizer.re2js:
            * inspector/front-end/SourceTokenizer.js:
            (WebInspector.SourceTokenizer.prototype.set condition):
            (WebInspector.SourceTokenizer.prototype.get condition):
            (WebInspector.SourceTokenizer.prototype.get subTokenizer):
            (WebInspector.SourceTokenizer.prototype.getLexCondition):
            (WebInspector.SourceTokenizer.prototype.setLexCondition):
            * inspector/front-end/TextEditorHighlighter.js:
            (WebInspector.TextEditorHighlighter):
            (WebInspector.TextEditorHighlighter.prototype.set mimeType):
            (WebInspector.TextEditorHighlighter.prototype.highlight):
            (WebInspector.TextEditorHighlighter.prototype._highlightInChunks):
            (WebInspector.TextEditorHighlighter.prototype._highlightLines):
            (WebInspector.TextEditorHighlighter.prototype._highlightLine):
            * inspector/front-end/TextViewer.js:
            (WebInspector.TextViewer.prototype._paintLine):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55248 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 360da4e..518c953 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,11 @@
+2010-02-25  Pavel Feldman  <pfeldman at chromium.org>
+
+        Web Inspector: evaluate-on-hover does not work on HTML files.
+
+        https://bugs.webkit.org/show_bug.cgi?id=35378
+
+        * inspector/syntax-highlight-html-expected.txt:
+
 2010-02-25  Ben Murdoch  <benm at google.com>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/LayoutTests/inspector/syntax-highlight-html-expected.txt b/LayoutTests/inspector/syntax-highlight-html-expected.txt
index 5817c30..a7ef223 100644
--- a/LayoutTests/inspector/syntax-highlight-html-expected.txt
+++ b/LayoutTests/inspector/syntax-highlight-html-expected.txt
@@ -6,6 +6,6 @@ Tests that SourceHTMLTokenizer detects the tokens.
 <table cellspacing="0" cellpadding='0'>: webkit-html-tag,webkit-html-tag,*,webkit-html-attribute-name,*,webkit-html-attribute-value,*,webkit-html-attribute-name,*,webkit-html-attribute-value,webkit-html-tag
 <!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
 <!--div><div foobar-->: webkit-html-comment
-<script></script><!--div-->: webkit-html-tag,*,webkit-html-tag,webkit-html-tag,webkit-html-comment
-<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-tag
+<script></script><!--div-->: webkit-html-tag,webkit-html-tag,webkit-html-tag,webkit-html-tag,webkit-html-comment
+<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
 
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 7d984b6..b163038 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,41 @@
+2010-02-25  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector: evaluate-on-hover does not work on HTML files.
+
+        https://bugs.webkit.org/show_bug.cgi?id=35378
+
+        * inspector/front-end/SourceCSSTokenizer.re2js:
+        * inspector/front-end/SourceHTMLTokenizer.js:
+        (WebInspector.SourceHTMLTokenizer):
+        (WebInspector.SourceHTMLTokenizer.prototype.set line):
+        (WebInspector.SourceHTMLTokenizer.prototype._isExpectingAttribute):
+        (WebInspector.SourceHTMLTokenizer.prototype._isExpectingAttributeValue):
+        (WebInspector.SourceHTMLTokenizer.prototype._setExpectingAttribute):
+        (WebInspector.SourceHTMLTokenizer.prototype._setExpectingAttributeValue):
+        (WebInspector.SourceHTMLTokenizer.prototype._attrValueTokenType):
+        (WebInspector.SourceHTMLTokenizer.prototype.nextToken):
+        * inspector/front-end/SourceHTMLTokenizer.re2js:
+        * inspector/front-end/SourceJavaScriptTokenizer.js:
+        (WebInspector.SourceJavaScriptTokenizer):
+        * inspector/front-end/SourceJavaScriptTokenizer.re2js:
+        * inspector/front-end/SourceTokenizer.js:
+        (WebInspector.SourceTokenizer.prototype.set condition):
+        (WebInspector.SourceTokenizer.prototype.get condition):
+        (WebInspector.SourceTokenizer.prototype.get subTokenizer):
+        (WebInspector.SourceTokenizer.prototype.getLexCondition):
+        (WebInspector.SourceTokenizer.prototype.setLexCondition):
+        * inspector/front-end/TextEditorHighlighter.js:
+        (WebInspector.TextEditorHighlighter):
+        (WebInspector.TextEditorHighlighter.prototype.set mimeType):
+        (WebInspector.TextEditorHighlighter.prototype.highlight):
+        (WebInspector.TextEditorHighlighter.prototype._highlightInChunks):
+        (WebInspector.TextEditorHighlighter.prototype._highlightLines):
+        (WebInspector.TextEditorHighlighter.prototype._highlightLine):
+        * inspector/front-end/TextViewer.js:
+        (WebInspector.TextViewer.prototype._paintLine):
+
 2010-02-25  Xan Lopez  <xlopez at igalia.com>
 
         Reviewed by Gustavo Noronha.
diff --git a/WebCore/inspector/front-end/SourceCSSTokenizer.js b/WebCore/inspector/front-end/SourceCSSTokenizer.js
index 599cfb3..f7d7d51 100644
--- a/WebCore/inspector/front-end/SourceCSSTokenizer.js
+++ b/WebCore/inspector/front-end/SourceCSSTokenizer.js
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Thu Jan 28 20:49:22 2010 */
+/* Generated by re2c 0.13.5 on Thu Feb 25 21:44:55 2010 */
 /*
  * Copyright (C) 2009 Google Inc. All rights reserved.
  *
@@ -99,35 +99,35 @@ WebInspector.SourceCSSTokenizer = function()
     
     this._valueKeywords = [
         "above", "absolute", "activeborder", "activecaption", "afar", "after-white-space", "ahead", "alias", "all", "all-scroll",
-        "alternate", "always","amharic", "amharic-abegede", "antialiased", "appworkspace", "aqua", "armenian", "auto", "avoid",
-        "background", "backwards", "baseline", "below", "bidi-override", "black", "blink", "block", "block-axis", "blue", "bold",
-        "bolder", "border", "border-box", "both", "bottom", "break-all", "break-word", "button", "button-bevel", "buttonface",
-        "buttonhighlight", "buttonshadow", "buttontext", "capitalize", "caps-lock-indicator", "caption", "captiontext", "caret", "cell",
-        "center", "checkbox", "circle", "cjk-earthly-branch", "cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote",
-        "col-resize", "collapse", "compact", "condensed", "contain", "content", "content-box", "context-menu", "continuous", "copy",
-        "cover", "crop", "cross", "crosshair", "currentcolor", "cursive", "dashed", "decimal", "decimal-leading-zero", "default",
-        "default-button", "destination-atop", "destination-in", "destination-out", "destination-over", "disc", "discard", "document",
+        "alternate", "always","amharic", "amharic-abegede", "antialiased", "appworkspace", "aqua", "arabic-indic", "armenian",
+        "auto", "avoid", "background", "backwards", "baseline", "below", "bidi-override", "binary", "bengali", "black", "blink",
+        "block", "block-axis", "blue", "bold", "bolder", "border", "border-box", "both", "bottom", "break-all", "break-word", "button",
+        "button-bevel", "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "cambodian", "capitalize", "caps-lock-indicator",
+        "caption", "captiontext", "caret", "cell", "center", "checkbox", "circle", "cjk-earthly-branch", "cjk-heavenly-stem", "cjk-ideographic",
+        "clear", "clip", "close-quote", "col-resize", "collapse", "compact", "condensed", "contain", "content", "content-box", "context-menu",
+        "continuous", "copy", "cover", "crop", "cross", "crosshair", "currentcolor", "cursive", "dashed", "decimal", "decimal-leading-zero", "default",
+        "default-button", "destination-atop", "destination-in", "destination-out", "destination-over", "devanagari", "disc", "discard", "document",
         "dot-dash", "dot-dot-dash", "dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out", "element",
         "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede", "ethiopic-abegede-am-et", "ethiopic-abegede-gez",
         "ethiopic-abegede-ti-er", "ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er", "ethiopic-halehame-aa-et",
         "ethiopic-halehame-am-et", "ethiopic-halehame-gez", "ethiopic-halehame-om-et", "ethiopic-halehame-sid-et",
         "ethiopic-halehame-so-et", "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig", "ew-resize", "expanded",
         "extra-condensed", "extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "forwards", "from", "fuchsia", "geometricPrecision",
-        "georgian", "gray", "graytext", "green", "grey", "groove", "hand", "hangul", "hangul-consonant", "hebrew", "help", "hidden", "hide",
-        "higher", "highlight", "highlighttext", "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "icon", "ignore",
+        "georgian", "gray", "graytext", "green", "grey", "groove", "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hebrew", "help",
+        "hidden", "hide", "higher", "highlight", "highlighttext", "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "icon", "ignore",
         "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite", "infobackground", "infotext", "inherit", "initial", "inline",
-        "inline-axis", "inline-block", "inline-table", "inset", "inside", "intrinsic", "invert", "italic", "justify", "katakana",
-        "katakana-iroha", "landscape", "large", "larger", "left", "level", "lighter", "lime", "line-through", "linear", "lines",
-        "list-button", "list-item", "listbox", "listitem", "local", "logical", "loud", "lower", "lower-alpha", "lower-greek", "lower-latin",
-        "lower-norwegian", "lower-roman", "lowercase", "ltr", "maroon", "match", "media-controls-background", "media-current-time-display",
+        "inline-axis", "inline-block", "inline-table", "inset", "inside", "intrinsic", "invert", "italic", "justify", "kannada", "katakana",
+        "katakana-iroha", "khmer", "landscape", "lao", "large", "larger", "left", "level", "lighter", "lime", "line-through", "linear", "lines",
+        "list-button", "list-item", "listbox", "listitem", "local", "logical", "loud", "lower", "lower-alpha", "lower-greek", "lower-hexadecimal", "lower-latin",
+        "lower-norwegian", "lower-roman", "lowercase", "ltr", "malayalam", "maroon", "match", "media-controls-background", "media-current-time-display",
         "media-fullscreen-button", "media-mute-button", "media-play-button", "media-return-to-realtime-button", "media-rewind-button",
         "media-seek-back-button", "media-seek-forward-button", "media-slider", "media-sliderthumb", "media-time-remaining-display",
         "media-volume-slider", "media-volume-slider-container", "media-volume-sliderthumb", "medium", "menu", "menulist", "menulist-button",
-        "menulist-text", "menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic", "mix", "monospace", "move", "multiple",
-        "n-resize", "narrower", "navy", "ne-resize", "nesw-resize", "no-close-quote", "no-drop", "no-open-quote", "no-repeat", "none",
-        "normal", "not-allowed", "nowrap", "ns-resize", "nw-resize", "nwse-resize", "oblique", "olive", "open-quote", "optimizeLegibility",
-        "optimizeSpeed", "orange", "oromo", "outset", "outside", "overlay", "overline", "padding", "padding-box", "painted", "paused",
-        "plus-darker", "plus-lighter", "pointer", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", "progress", "purple",
+        "menulist-text", "menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic", "mix", "mongolian", "monospace", "move", "multiple",
+        "myanmar", "n-resize", "narrower", "navy", "ne-resize", "nesw-resize", "no-close-quote", "no-drop", "no-open-quote", "no-repeat", "none",
+        "normal", "not-allowed", "nowrap", "ns-resize", "nw-resize", "nwse-resize", "oblique", "octal", "olive", "open-quote", "optimizeLegibility",
+        "optimizeSpeed", "orange", "oriya", "oromo", "outset", "outside", "overlay", "overline", "padding", "padding-box", "painted", "paused",
+        "persian", "plus-darker", "plus-lighter", "pointer", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", "progress", "purple",
         "push-button", "radio", "read-only", "read-write", "read-write-plaintext-only", "red", "relative", "repeat", "repeat-x",
         "repeat-y", "reset", "reverse", "rgb", "rgba", "ridge", "right", "round", "row-resize", "rtl", "run-in", "running", "s-resize", "sans-serif",
         "scroll", "scrollbar", "se-resize", "searchfield", "searchfield-cancel-button", "searchfield-decoration", "searchfield-results-button",
@@ -136,15 +136,15 @@ WebInspector.SourceCSSTokenizer = function()
         "small", "small-caps", "small-caption", "smaller", "solid", "somali", "source-atop", "source-in", "source-out", "source-over",
         "space", "square", "square-button", "start", "static", "status-bar", "stretch", "stroke", "sub", "subpixel-antialiased", "super",
         "sw-resize", "table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group",
-        "table-row", "table-row-group", "teal", "text", "text-bottom", "text-top", "textarea", "textfield", "thick", "thin", "threeddarkshadow",
-        "threedface", "threedhighlight", "threedlightshadow", "threedshadow", "tigre", "tigrinya-er", "tigrinya-er-abegede", "tigrinya-et",
-        "tigrinya-et-abegede", "to", "top", "transparent", "ultra-condensed", "ultra-expanded", "underline", "up", "upper-alpha", "upper-greek",
-        "upper-latin", "upper-norwegian", "upper-roman", "uppercase", "url", "vertical", "vertical-text", "visible", "visibleFill", "visiblePainted",
-        "visibleStroke", "visual", "w-resize", "wait", "wave", "white", "wider", "window", "windowframe", "windowtext", "x-large", "x-small",
-        "xor", "xx-large", "xx-small", "yellow", "-wap-marquee", "-webkit-activelink", "-webkit-auto", "-webkit-baseline-middle", "-webkit-body",
-        "-webkit-box", "-webkit-center", "-webkit-control", "-webkit-focus-ring-color", "-webkit-grab", "-webkit-grabbing", "-webkit-gradient", "-webkit-inline-box",
-        "-webkit-left", "-webkit-link", "-webkit-marquee", "-webkit-mini-control", "-webkit-nowrap", "-webkit-right", "-webkit-small-control",
-        "-webkit-text", "-webkit-xxx-large", "-webkit-zoom-in", "-webkit-zoom-out",
+        "table-row", "table-row-group", "teal", "telugu", "text", "text-bottom", "text-top", "textarea", "textfield", "thai", "thick", "thin",
+        "threeddarkshadow", "threedface", "threedhighlight", "threedlightshadow", "threedshadow", "tibetan", "tigre", "tigrinya-er", "tigrinya-er-abegede",
+        "tigrinya-et", "tigrinya-et-abegede", "to", "top", "transparent", "ultra-condensed", "ultra-expanded", "underline", "up", "upper-alpha", "upper-greek",
+        "upper-hexadecimal", "upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url", "vertical", "vertical-text", "visible",
+        "visibleFill", "visiblePainted", "visibleStroke", "visual", "w-resize", "wait", "wave", "white", "wider", "window", "windowframe", "windowtext",
+        "x-large", "x-small", "xor", "xx-large", "xx-small", "yellow", "-wap-marquee", "-webkit-activelink", "-webkit-auto", "-webkit-baseline-middle",
+        "-webkit-body", "-webkit-box", "-webkit-center", "-webkit-control", "-webkit-focus-ring-color", "-webkit-grab", "-webkit-grabbing",
+        "-webkit-gradient", "-webkit-inline-box", "-webkit-left", "-webkit-link", "-webkit-marquee", "-webkit-mini-control", "-webkit-nowrap", "-webkit-right",
+        "-webkit-small-control", "-webkit-text", "-webkit-xxx-large", "-webkit-zoom-in", "-webkit-zoom-out",
     ].keySet();
 
     this._mediaTypes = ["all", "aural", "braille", "embossed", "handheld", "import", "print", "projection", "screen", "tty", "tv"].keySet();
@@ -183,7 +183,7 @@ WebInspector.SourceCSSTokenizer.prototype = {
 
     _isPropertyValue: function()
     {
-        return this._parseCondition === this._parseConditions.PROPERTY_VALUE || this._parseCondition === this._parseConditions.AT_RULE;
+        return this._condition.parseCondition === this._parseConditions.PROPERTY_VALUE || this._condition.parseCondition === this._parseConditions.AT_RULE;
     },
 
     nextToken: function(cursor)
@@ -423,18 +423,18 @@ case 31:
 case 32:
             {
                     var token = this._line.substring(cursorOnEnter, cursor);
-                    if (this._parseCondition === this._parseConditions.INITIAL) {
+                    if (this._condition.parseCondition === this._parseConditions.INITIAL) {
                         if (token === "@import" || token === "@media") {
                             this.tokenType = "css-at-rule";
-                            this._parseCondition = this._parseConditions.AT_RULE;
+                            this._condition.parseCondition = this._parseConditions.AT_RULE;
                         } else if (token.indexOf("@") === 0)
                             this.tokenType = "css-at-rule";
                         else
                             this.tokenType = "css-selector";
                     }
-                    else if (this._parseCondition === this._parseConditions.AT_RULE && token in this._mediaTypes)
+                    else if (this._condition.parseCondition === this._parseConditions.AT_RULE && token in this._mediaTypes)
                         this.tokenType = "css-keyword";
-                    else if (this._parseCondition === this._parseConditions.PROPERTY && token in this._propertyKeywords)
+                    else if (this._condition.parseCondition === this._parseConditions.PROPERTY && token in this._propertyKeywords)
                         this.tokenType = "css-property";
                     else if (this._isPropertyValue() && token in this._valueKeywords)
                         this.tokenType = "css-keyword";
@@ -647,35 +647,35 @@ case 40:
             ++cursor;
             {
                     this.tokenType = null;
-                    if (this._parseCondition === this._parseConditions.PROPERTY)
-                        this._parseCondition = this._parseConditions.PROPERTY_VALUE;
+                    if (this._condition.parseCondition === this._parseConditions.PROPERTY)
+                        this._condition.parseCondition = this._parseConditions.PROPERTY_VALUE;
                     return cursor;
                 }
 case 42:
             ++cursor;
             {
                     this.tokenType = null;
-                    if (this._parseCondition === this._parseConditions.AT_RULE)
-                        this._parseCondition = this._parseConditions.INITIAL;
+                    if (this._condition.parseCondition === this._parseConditions.AT_RULE)
+                        this._condition.parseCondition = this._parseConditions.INITIAL;
                     else
-                        this._parseCondition = this._parseConditions.PROPERTY;
+                        this._condition.parseCondition = this._parseConditions.PROPERTY;
                     return cursor;
                 }
 case 44:
             ++cursor;
             {
                     this.tokenType = null;
-                    if (this._parseCondition === this._parseConditions.AT_RULE)
-                        this._parseCondition = this._parseConditions.INITIAL;
+                    if (this._condition.parseCondition === this._parseConditions.AT_RULE)
+                        this._condition.parseCondition = this._parseConditions.INITIAL;
                     else
-                        this._parseCondition = this._parseConditions.PROPERTY;
+                        this._condition.parseCondition = this._parseConditions.PROPERTY;
                     return cursor;
                 }
 case 46:
             ++cursor;
             {
                     this.tokenType = null;
-                    this._parseCondition = this._parseConditions.INITIAL;
+                    this._condition.parseCondition = this._parseConditions.INITIAL;
                     return cursor;
                 }
 case 48:
diff --git a/WebCore/inspector/front-end/SourceCSSTokenizer.re2js b/WebCore/inspector/front-end/SourceCSSTokenizer.re2js
index ac22bd4..6ba9f60 100644
--- a/WebCore/inspector/front-end/SourceCSSTokenizer.re2js
+++ b/WebCore/inspector/front-end/SourceCSSTokenizer.re2js
@@ -182,7 +182,7 @@ WebInspector.SourceCSSTokenizer.prototype = {
 
     _isPropertyValue: function()
     {
-        return this._parseCondition === this._parseConditions.PROPERTY_VALUE || this._parseCondition === this._parseConditions.AT_RULE;
+        return this._condition.parseCondition === this._parseConditions.PROPERTY_VALUE || this._condition.parseCondition === this._parseConditions.AT_RULE;
     },
 
     nextToken: function(cursor)
@@ -244,35 +244,35 @@ WebInspector.SourceCSSTokenizer.prototype = {
                 <INITIAL> OpenCurlyBracket
                 {
                     this.tokenType = null;
-                    if (this._parseCondition === this._parseConditions.AT_RULE)
-                        this._parseCondition = this._parseConditions.INITIAL;
+                    if (this._condition.parseCondition === this._parseConditions.AT_RULE)
+                        this._condition.parseCondition = this._parseConditions.INITIAL;
                     else
-                        this._parseCondition = this._parseConditions.PROPERTY;
+                        this._condition.parseCondition = this._parseConditions.PROPERTY;
                     return cursor;
                 }
 
                 <INITIAL> CloseCurlyBracket
                 {
                     this.tokenType = null;
-                    this._parseCondition = this._parseConditions.INITIAL;
+                    this._condition.parseCondition = this._parseConditions.INITIAL;
                     return cursor;
                 }
 
                 <INITIAL> Colon
                 {
                     this.tokenType = null;
-                    if (this._parseCondition === this._parseConditions.PROPERTY)
-                        this._parseCondition = this._parseConditions.PROPERTY_VALUE;
+                    if (this._condition.parseCondition === this._parseConditions.PROPERTY)
+                        this._condition.parseCondition = this._parseConditions.PROPERTY_VALUE;
                     return cursor;
                 }
 
                 <INITIAL> Semicolon
                 {
                     this.tokenType = null;
-                    if (this._parseCondition === this._parseConditions.AT_RULE)
-                        this._parseCondition = this._parseConditions.INITIAL;
+                    if (this._condition.parseCondition === this._parseConditions.AT_RULE)
+                        this._condition.parseCondition = this._parseConditions.INITIAL;
                     else
-                        this._parseCondition = this._parseConditions.PROPERTY;
+                        this._condition.parseCondition = this._parseConditions.PROPERTY;
                     return cursor;
                 }
 
@@ -288,18 +288,18 @@ WebInspector.SourceCSSTokenizer.prototype = {
                 <INITIAL> Identifier
                 {
                     var token = this._line.substring(cursorOnEnter, cursor);
-                    if (this._parseCondition === this._parseConditions.INITIAL) {
+                    if (this._condition.parseCondition === this._parseConditions.INITIAL) {
                         if (token === "@import" || token === "@media") {
                             this.tokenType = "css-at-rule";
-                            this._parseCondition = this._parseConditions.AT_RULE;
+                            this._condition.parseCondition = this._parseConditions.AT_RULE;
                         } else if (token.indexOf("@") === 0)
                             this.tokenType = "css-at-rule";
                         else
                             this.tokenType = "css-selector";
                     }
-                    else if (this._parseCondition === this._parseConditions.AT_RULE && token in this._mediaTypes)
+                    else if (this._condition.parseCondition === this._parseConditions.AT_RULE && token in this._mediaTypes)
                         this.tokenType = "css-keyword";
-                    else if (this._parseCondition === this._parseConditions.PROPERTY && token in this._propertyKeywords)
+                    else if (this._condition.parseCondition === this._parseConditions.PROPERTY && token in this._propertyKeywords)
                         this.tokenType = "css-property";
                     else if (this._isPropertyValue() && token in this._valueKeywords)
                         this.tokenType = "css-keyword";
diff --git a/WebCore/inspector/front-end/SourceHTMLTokenizer.js b/WebCore/inspector/front-end/SourceHTMLTokenizer.js
index 3c9bd8c..cfbc44f 100644
--- a/WebCore/inspector/front-end/SourceHTMLTokenizer.js
+++ b/WebCore/inspector/front-end/SourceHTMLTokenizer.js
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Mon Feb 15 19:30:21 2010 */
+/* Generated by re2c 0.13.5 on Thu Feb 25 21:44:55 2010 */
 /*
  * Copyright (C) 2009 Google Inc. All rights reserved.
  *
@@ -71,31 +71,43 @@ WebInspector.SourceHTMLTokenizer = function()
     };
 
     this.initialCondition = { lexCondition: this._lexConditions.INITIAL, parseCondition: this._parseConditions.INITIAL };
+    this.condition = this.initialCondition;
 }
 
 WebInspector.SourceHTMLTokenizer.prototype = {
+    set line(line) {
+        if (this._internalJavaScriptTokenizer) {
+            var match = /<\/script/i.exec(line);
+            if (match) {
+                this._internalJavaScriptTokenizer.line = line.substring(0, match.index);
+            } else
+                this._internalJavaScriptTokenizer.line = line;
+        }
+        this._line = line;
+    },
+
     _isExpectingAttribute: function()
     {
-        return this._parseCondition & this._parseConditions.ATTRIBUTE;
+        return this._condition.parseCondition & this._parseConditions.ATTRIBUTE;
     },
 
     _isExpectingAttributeValue: function()
     {
-        return this._parseCondition & this._parseConditions.ATTRIBUTE_VALUE;
+        return this._condition.parseCondition & this._parseConditions.ATTRIBUTE_VALUE;
     },
 
     _setExpectingAttribute: function()
     {
         if (this._isExpectingAttributeValue())
-            this._parseCondition ^= this._parseConditions.ATTRIBUTE_VALUE;
-        this._parseCondition |= this._parseConditions.ATTRIBUTE;
+            this._condition.parseCondition ^= this._parseConditions.ATTRIBUTE_VALUE;
+        this._condition.parseCondition |= this._parseConditions.ATTRIBUTE;
     },
 
     _setExpectingAttributeValue: function()
     {
         if (this._isExpectingAttribute())
-            this._parseCondition ^= this._parseConditions.ATTRIBUTE;
-        this._parseCondition |= this._parseConditions.ATTRIBUTE_VALUE;
+            this._condition.parseCondition ^= this._parseConditions.ATTRIBUTE;
+        this._condition.parseCondition |= this._parseConditions.ATTRIBUTE_VALUE;
     },
 
     _stringToken: function(cursor, stringEnds)
@@ -112,8 +124,8 @@ WebInspector.SourceHTMLTokenizer.prototype = {
 
     _attrValueTokenType: function()
     {
-        if (this._parseCondition & this._parseConditions.LINKIFY) {
-            if (this._parseCondition & this._parseConditions.A_NODE)
+        if (this._condition.parseCondition & this._parseConditions.LINKIFY) {
+            if (this._condition.parseCondition & this._parseConditions.A_NODE)
                 return "html-external-link";
             return "html-resource-link";
         }
@@ -122,6 +134,20 @@ WebInspector.SourceHTMLTokenizer.prototype = {
 
     nextToken: function(cursor)
     {
+        if (this._internalJavaScriptTokenizer) {
+            // Re-set line to force </script> detection first.
+            this.line = this._line;
+            if (cursor !== this._internalJavaScriptTokenizer._line.length) {
+                // Tokenizer is stateless, so restore its condition before tokenizing and save it after.
+                this._internalJavaScriptTokenizer.condition = this._condition.internalJavaScriptTokenizerCondition;
+                var result = this._internalJavaScriptTokenizer.nextToken(cursor);
+                this.tokenType = this._internalJavaScriptTokenizer.tokenType;
+                this._condition.internalJavaScriptTokenizerCondition = this._internalJavaScriptTokenizer.condition;
+                return result;
+            } else if (cursor !== this._line.length)
+                delete this._internalJavaScriptTokenizer;
+        }
+
         var cursorOnEnter = cursor;
         var gotoCase = 1;
         while (1) {
@@ -305,14 +331,14 @@ case 39:
 case 40:
             this.setLexCondition(this._lexConditions.TAG);
             {
-                    if (this._parseCondition & this._parseConditions.SCRIPT) {
+                    if (this._condition.parseCondition & this._parseConditions.SCRIPT) {
                         // Do not tokenize script tag contents, keep lexer state although processing "<".
                         this.setLexCondition(this._lexConditions.INITIAL);
                         this.tokenType = null;
                         return cursor;
                     }
 
-                    this._parseCondition = this._parseConditions.INITIAL;
+                    this._condition.parseCondition = this._parseConditions.INITIAL;
                     this.tokenType = "html-tag";
                     return cursor;
                 }
@@ -413,14 +439,14 @@ case 66:
             ++cursor;
             this.setLexCondition(this._lexConditions.TAG);
             {
-                    if (this._parseCondition & this._parseConditions.SCRIPT) {
+                    if (this._condition.parseCondition & this._parseConditions.SCRIPT) {
                         // Do not tokenize script tag contents, keep lexer state although processing "<".
                         this.setLexCondition(this._lexConditions.INITIAL);
                         this.tokenType = null;
                         return cursor;
                     }
                     this.tokenType = "html-tag";
-                    this._parseCondition = this._parseConditions.SCRIPT;
+                    this._condition.parseCondition = this._parseConditions.SCRIPT;
                     this._setExpectingAttribute();
                     return cursor;
                 }
@@ -449,7 +475,7 @@ case 73:
             this.setLexCondition(this._lexConditions.TAG);
             {
                     this.tokenType = "html-tag";
-                    this._parseCondition = this._parseConditions.INITIAL;
+                    this._condition.parseCondition = this._parseConditions.INITIAL;
                     return cursor;
                 }
 /* *********************************** */
@@ -527,26 +553,26 @@ case this.case_TAG:
             { gotoCase = 109; continue; };
 case 89:
             {
-                    if (this._parseCondition === this._parseConditions.SCRIPT) {
+                    if (this._condition.parseCondition === this._parseConditions.SCRIPT) {
                         // Fall through if expecting attributes.
                         this.tokenType = null;
                         return cursor;
                     }
 
-                    if (this._parseCondition === this._parseConditions.INITIAL) {
+                    if (this._condition.parseCondition === this._parseConditions.INITIAL) {
                         this.tokenType = "html-tag";
                         this._setExpectingAttribute();
                         var token = this._line.substring(cursorOnEnter, cursor);
                         if (token === "a")
-                            this._parseCondition |= this._parseConditions.A_NODE;
-                        else if (this._parseCondition & this._parseConditions.A_NODE)
-                            this._parseCondition ^= this._parseConditions.A_NODE;
+                            this._condition.parseCondition |= this._parseConditions.A_NODE;
+                        else if (this._condition.parseCondition & this._parseConditions.A_NODE)
+                            this._condition.parseCondition ^= this._parseConditions.A_NODE;
                     } else if (this._isExpectingAttribute()) {
                         var token = this._line.substring(cursorOnEnter, cursor);
                         if (token === "href" || token === "src")
-                            this._parseCondition |= this._parseConditions.LINKIFY;
-                        else if (this._parseCondition |= this._parseConditions.LINKIFY)
-                            this._parseCondition ^= this._parseConditions.LINKIFY;
+                            this._condition.parseCondition |= this._parseConditions.LINKIFY;
+                        else if (this._condition.parseCondition |= this._parseConditions.LINKIFY)
+                            this._condition.parseCondition ^= this._parseConditions.LINKIFY;
                         this.tokenType = "html-attribute-name";
                     } else if (this._isExpectingAttributeValue())
                         this.tokenType = this._attrValueTokenType();
@@ -577,14 +603,17 @@ case 96:
             ++cursor;
             this.setLexCondition(this._lexConditions.INITIAL);
             {
-                    if (this._parseCondition & this._parseConditions.SCRIPT) {
+                    this.tokenType = "html-tag";
+                    if (this._condition.parseCondition & this._parseConditions.SCRIPT) {
+                        if (!this._internalJavaScriptTokenizer) {
+                            this._internalJavaScriptTokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer("text/javascript");
+                            this._condition.internalJavaScriptTokenizerCondition = this._internalJavaScriptTokenizer.initialCondition;
+                        }
                         // Do not tokenize script tag contents.
-                        this.tokenType = null;
                         return cursor;
                     }
 
-                    this._parseCondition = this._parseConditions.INITIAL;
-                    this.tokenType = "html-tag";
+                    this._condition.parseCondition = this._parseConditions.INITIAL;
                     return cursor;
                 }
 case 98:
diff --git a/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js b/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js
index cfa8834..44c62b3 100644
--- a/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js
+++ b/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js
@@ -70,31 +70,43 @@ WebInspector.SourceHTMLTokenizer = function()
     };
 
     this.initialCondition = { lexCondition: this._lexConditions.INITIAL, parseCondition: this._parseConditions.INITIAL };
+    this.condition = this.initialCondition;
 }
 
 WebInspector.SourceHTMLTokenizer.prototype = {
+    set line(line) {
+        if (this._internalJavaScriptTokenizer) {
+            var match = /<\/script/i.exec(line);
+            if (match) {
+                this._internalJavaScriptTokenizer.line = line.substring(0, match.index);
+            } else
+                this._internalJavaScriptTokenizer.line = line;
+        }
+        this._line = line;
+    },
+
     _isExpectingAttribute: function()
     {
-        return this._parseCondition & this._parseConditions.ATTRIBUTE;
+        return this._condition.parseCondition & this._parseConditions.ATTRIBUTE;
     },
 
     _isExpectingAttributeValue: function()
     {
-        return this._parseCondition & this._parseConditions.ATTRIBUTE_VALUE;
+        return this._condition.parseCondition & this._parseConditions.ATTRIBUTE_VALUE;
     },
 
     _setExpectingAttribute: function()
     {
         if (this._isExpectingAttributeValue())
-            this._parseCondition ^= this._parseConditions.ATTRIBUTE_VALUE;
-        this._parseCondition |= this._parseConditions.ATTRIBUTE;
+            this._condition.parseCondition ^= this._parseConditions.ATTRIBUTE_VALUE;
+        this._condition.parseCondition |= this._parseConditions.ATTRIBUTE;
     },
 
     _setExpectingAttributeValue: function()
     {
         if (this._isExpectingAttribute())
-            this._parseCondition ^= this._parseConditions.ATTRIBUTE;
-        this._parseCondition |= this._parseConditions.ATTRIBUTE_VALUE;
+            this._condition.parseCondition ^= this._parseConditions.ATTRIBUTE;
+        this._condition.parseCondition |= this._parseConditions.ATTRIBUTE_VALUE;
     },
 
     _stringToken: function(cursor, stringEnds)
@@ -111,8 +123,8 @@ WebInspector.SourceHTMLTokenizer.prototype = {
 
     _attrValueTokenType: function()
     {
-        if (this._parseCondition & this._parseConditions.LINKIFY) {
-            if (this._parseCondition & this._parseConditions.A_NODE)
+        if (this._condition.parseCondition & this._parseConditions.LINKIFY) {
+            if (this._condition.parseCondition & this._parseConditions.A_NODE)
                 return "html-external-link";
             return "html-resource-link";
         }
@@ -121,6 +133,20 @@ WebInspector.SourceHTMLTokenizer.prototype = {
 
     nextToken: function(cursor)
     {
+        if (this._internalJavaScriptTokenizer) {
+            // Re-set line to force </script> detection first.
+            this.line = this._line;
+            if (cursor !== this._internalJavaScriptTokenizer._line.length) {
+                // Tokenizer is stateless, so restore its condition before tokenizing and save it after.
+                this._internalJavaScriptTokenizer.condition = this._condition.internalJavaScriptTokenizerCondition;
+                var result = this._internalJavaScriptTokenizer.nextToken(cursor);
+                this.tokenType = this._internalJavaScriptTokenizer.tokenType;
+                this._condition.internalJavaScriptTokenizerCondition = this._internalJavaScriptTokenizer.condition;
+                return result;
+            } else if (cursor !== this._line.length)
+                delete this._internalJavaScriptTokenizer;
+        }
+
         var cursorOnEnter = cursor;
         var gotoCase = 1;
         while (1) {
@@ -174,14 +200,14 @@ WebInspector.SourceHTMLTokenizer.prototype = {
 
                 <INITIAL> ScriptStart => TAG
                 {
-                    if (this._parseCondition & this._parseConditions.SCRIPT) {
+                    if (this._condition.parseCondition & this._parseConditions.SCRIPT) {
                         // Do not tokenize script tag contents, keep lexer state although processing "<".
                         this.setLexCondition(this._lexConditions.INITIAL);
                         this.tokenType = null;
                         return cursor;
                     }
                     this.tokenType = "html-tag";
-                    this._parseCondition = this._parseConditions.SCRIPT;
+                    this._condition.parseCondition = this._parseConditions.SCRIPT;
                     this._setExpectingAttribute();
                     return cursor;
                 }
@@ -189,34 +215,37 @@ WebInspector.SourceHTMLTokenizer.prototype = {
                 <INITIAL> ScriptEnd => TAG
                 {
                     this.tokenType = "html-tag";
-                    this._parseCondition = this._parseConditions.INITIAL;
+                    this._condition.parseCondition = this._parseConditions.INITIAL;
                     return cursor;
                 }
 
                 <INITIAL> LT => TAG
                 {
-                    if (this._parseCondition & this._parseConditions.SCRIPT) {
+                    if (this._condition.parseCondition & this._parseConditions.SCRIPT) {
                         // Do not tokenize script tag contents, keep lexer state although processing "<".
                         this.setLexCondition(this._lexConditions.INITIAL);
                         this.tokenType = null;
                         return cursor;
                     }
 
-                    this._parseCondition = this._parseConditions.INITIAL;
+                    this._condition.parseCondition = this._parseConditions.INITIAL;
                     this.tokenType = "html-tag";
                     return cursor;
                 }
-
+  
                 <TAG> GT => INITIAL
                 {
-                    if (this._parseCondition & this._parseConditions.SCRIPT) {
+                    this.tokenType = "html-tag";
+                    if (this._condition.parseCondition & this._parseConditions.SCRIPT) {
+                        if (!this._internalJavaScriptTokenizer) {
+                            this._internalJavaScriptTokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer("text/javascript");
+                            this._condition.internalJavaScriptTokenizerCondition = this._internalJavaScriptTokenizer.initialCondition;
+                        }
                         // Do not tokenize script tag contents.
-                        this.tokenType = null;
                         return cursor;
                     }
 
-                    this._parseCondition = this._parseConditions.INITIAL;
-                    this.tokenType = "html-tag";
+                    this._condition.parseCondition = this._parseConditions.INITIAL;
                     return cursor;
                 }
 
@@ -238,26 +267,26 @@ WebInspector.SourceHTMLTokenizer.prototype = {
 
                 <TAG> Identifier
                 {
-                    if (this._parseCondition === this._parseConditions.SCRIPT) {
+                    if (this._condition.parseCondition === this._parseConditions.SCRIPT) {
                         // Fall through if expecting attributes.
                         this.tokenType = null;
                         return cursor;
                     }
 
-                    if (this._parseCondition === this._parseConditions.INITIAL) {
+                    if (this._condition.parseCondition === this._parseConditions.INITIAL) {
                         this.tokenType = "html-tag";
                         this._setExpectingAttribute();
                         var token = this._line.substring(cursorOnEnter, cursor);
                         if (token === "a")
-                            this._parseCondition |= this._parseConditions.A_NODE;
-                        else if (this._parseCondition & this._parseConditions.A_NODE)
-                            this._parseCondition ^= this._parseConditions.A_NODE;
+                            this._condition.parseCondition |= this._parseConditions.A_NODE;
+                        else if (this._condition.parseCondition & this._parseConditions.A_NODE)
+                            this._condition.parseCondition ^= this._parseConditions.A_NODE;
                     } else if (this._isExpectingAttribute()) {
                         var token = this._line.substring(cursorOnEnter, cursor);
                         if (token === "href" || token === "src")
-                            this._parseCondition |= this._parseConditions.LINKIFY;
-                        else if (this._parseCondition |= this._parseConditions.LINKIFY)
-                            this._parseCondition ^= this._parseConditions.LINKIFY;
+                            this._condition.parseCondition |= this._parseConditions.LINKIFY;
+                        else if (this._condition.parseCondition |= this._parseConditions.LINKIFY)
+                            this._condition.parseCondition ^= this._parseConditions.LINKIFY;
                         this.tokenType = "html-attribute-name";
                     } else if (this._isExpectingAttributeValue())
                         this.tokenType = this._attrValueTokenType();
diff --git a/WebCore/inspector/front-end/SourceJavaScriptTokenizer.js b/WebCore/inspector/front-end/SourceJavaScriptTokenizer.js
index 75abeee..fbd44d7 100644
--- a/WebCore/inspector/front-end/SourceJavaScriptTokenizer.js
+++ b/WebCore/inspector/front-end/SourceJavaScriptTokenizer.js
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Thu Jan 28 20:49:23 2010 */
+/* Generated by re2c 0.13.5 on Thu Feb 25 21:44:55 2010 */
 /*
  * Copyright (C) 2009 Google Inc. All rights reserved.
  *
@@ -69,6 +69,7 @@ WebInspector.SourceJavaScriptTokenizer = function()
     this.case_REGEX = 1005;
 
     this.initialCondition = { lexCondition: this._lexConditions.NODIV }
+    this.condition = this.initialCondition;
 }
 
 WebInspector.SourceJavaScriptTokenizer.prototype = {
diff --git a/WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js b/WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js
index 053c82f..ae71efe 100644
--- a/WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js
+++ b/WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js
@@ -68,6 +68,7 @@ WebInspector.SourceJavaScriptTokenizer = function()
     this.case_REGEX = 1005;
 
     this.initialCondition = { lexCondition: this._lexConditions.NODIV }
+    this.condition = this.initialCondition;
 }
 
 WebInspector.SourceJavaScriptTokenizer.prototype = {
diff --git a/WebCore/inspector/front-end/SourceTokenizer.js b/WebCore/inspector/front-end/SourceTokenizer.js
index d498028..1832d42 100644
--- a/WebCore/inspector/front-end/SourceTokenizer.js
+++ b/WebCore/inspector/front-end/SourceTokenizer.js
@@ -40,28 +40,27 @@ WebInspector.SourceTokenizer.prototype = {
 
     set condition(condition)
     {
-        this._lexCondition = condition.lexCondition;
-        this._parseCondition = condition.parseCondition;
+        this._condition = condition;
     },
 
     get condition()
     {
-        return { lexCondition: this._lexCondition, parseCondition: this._parseCondition };
+        return this._condition;
     },
 
-    hasCondition: function(condition)
+    get subTokenizer()
     {
-        return this._lexCondition === condition.lexCondition && this._parseCondition === condition.parseCondition;
+        return this._condition.subTokenizer;
     },
 
     getLexCondition: function()
     {
-        return this._lexCondition;
+        return this.condition.lexCondition;
     },
 
     setLexCondition: function(lexCondition)
     {
-        this._lexCondition = lexCondition;
+        this.condition.lexCondition = lexCondition;
     },
 
     _charAt: function(cursor)
diff --git a/WebCore/inspector/front-end/TextEditorHighlighter.js b/WebCore/inspector/front-end/TextEditorHighlighter.js
index cf0b590..0f9ec2f 100644
--- a/WebCore/inspector/front-end/TextEditorHighlighter.js
+++ b/WebCore/inspector/front-end/TextEditorHighlighter.js
@@ -34,24 +34,24 @@ WebInspector.TextEditorHighlighter = function(textModel, damageCallback)
     this._textModel = textModel;
     this._tokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer("text/html");
     this._damageCallback = damageCallback;
+    this._lastHighlightedLine = 0;
 }
 
 WebInspector.TextEditorHighlighter.prototype = {
     set mimeType(mimeType)
     {
         var tokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer(mimeType);
-        if (tokenizer)
+        if (tokenizer) {
             this._tokenizer = tokenizer;
+            this._tokenizerCondition = this._tokenizer.initialCondition;
+        }
     },
 
     highlight: function(endLine)
     {
         // First check if we have work to do.
-        var state = this._textModel.getAttribute(endLine - 1, "highlighter-state")
-        if (state && !state.outOfDate) {
-            // Last line is highlighted, just exit.
+        if (endLine <= this._lastHighlightedLine)
             return;
-        }
 
         this._requestedEndLine = endLine;
 
@@ -60,18 +60,9 @@ WebInspector.TextEditorHighlighter.prototype = {
             return;
         }
 
-        // We will be highlighting. First rewind to the last highlighted line to gain proper highlighter context.
-        var startLine = endLine;
-        while (startLine > 0) {
-            var state = this._textModel.getAttribute(startLine - 1, "highlighter-state");
-            if (state && !state.outOfDate)
-                break;
-            startLine--;
-        }
-
         // Do small highlight synchronously. This will provide instant highlight on PageUp / PageDown, gentle scrolling.
-        var toLine = Math.min(startLine + 200, endLine);
-        this._highlightInChunks(startLine, toLine);
+        var toLine = Math.min(this._lastHighlightedLine + 200, endLine);
+        this._highlightInChunks(this._lastHighlightedLine, toLine);
 
         // Schedule tail highlight if necessary.
         if (endLine > toLine)
@@ -83,8 +74,7 @@ WebInspector.TextEditorHighlighter.prototype = {
         delete this._highlightTimer;
 
         // First we always check if we have work to do. Could be that user scrolled back and we can quit.
-        var state = this._textModel.getAttribute(this._requestedEndLine - 1, "highlighter-state");
-        if (state && !state.outOfDate)
+        if (this._requestedEndLine <= this._lastHighlightedLine)
             return;
 
         if (this._requestedEndLine !== endLine) {
@@ -102,68 +92,30 @@ WebInspector.TextEditorHighlighter.prototype = {
             this._highlightTimer = setTimeout(this._highlightInChunks.bind(this, toLine, this._requestedEndLine), 10);
     },
 
-    updateHighlight: function(startLine, endLine)
-    {
-        // Start line was edited, we should highlight everything until endLine synchronously.
-        if (startLine) {
-            var state = this._textModel.getAttribute(startLine - 1, "highlighter-state");
-            if (!state || state.outOfDate) {
-                // Highlighter did not reach this point yet, nothing to update. It will reach it on subsequent timer tick and do the job.
-                return;
-            }
-        }
-
-        var restored = this._highlightLines(startLine, endLine);
-
-        // Set invalidated flag to the subsequent lines.
-        for (var i = endLine; i < this._textModel.linesCount; ++i) {
-            var highlighterState = this._textModel.getAttribute(i, "highlighter-state");
-            if (highlighterState)
-                highlighterState.outOfDate = !restored;
-            else
-                return;
-        }
-    },
-
     _highlightLines: function(startLine, endLine)
     {
-        // Restore highlighter context taken from previous line.
-        var state = this._textModel.getAttribute(startLine - 1, "highlighter-state");
-        if (state)
-            this._tokenizer.condition = state.postCondition;
-        else
-            this._tokenizer.condition = this._tokenizer.initialCondition;
-
-        for (var i = startLine; i < endLine; ++i) {
-            state = {};
-            state.preCondition = this._tokenizer.condition;
-            state.attributes = {};
+        // Tokenizer is stateless and reused accross viewers, restore its condition before highlight and save it after.
+        this._tokenizer.condition = this._tokenizerCondition;
+        for (var i = startLine; i < endLine; ++i)
+            this._highlightLine(i);
+        this._lastHighlightedLine = endLine;
+        this._tokenizerCondition = this._tokenizer.condition;
 
-            this._lex(this._textModel.line(i), i, state.attributes);
-
-            state.postCondition = this._tokenizer.condition;
-            this._textModel.setAttribute(i, "highlighter-state", state);
-
-            var nextLineState = this._textModel.getAttribute(i + 1, "highlighter-state");
-            if (nextLineState && this._tokenizer.hasCondition(nextLineState.preCondition)) {
-                // Following lines are up to date, no need re-highlight.
-                this._damageCallback(startLine, i + 1);
-                return true;
-            }
-        }
         this._damageCallback(startLine, endLine);
-        return false;
     },
 
-    _lex: function(line, lineNumber, attributes) {
-         this._tokenizer.line = line;
-         var column = 0;
-         do {
-             var newColumn = this._tokenizer.nextToken(column);
-             var tokenType = this._tokenizer.tokenType;
-             if (tokenType)
-                 attributes[column] = { length: newColumn - column, tokenType: tokenType };
-             column = newColumn;
-         } while (column < line.length)
+    _highlightLine: function(lineNumber) {
+        var line = this._textModel.line(lineNumber);
+        var attributes = {};
+        this._tokenizer.line = line;
+        var column = 0;
+        do {
+            var newColumn = this._tokenizer.nextToken(column);
+            var tokenType = this._tokenizer.tokenType;
+            if (tokenType)
+                attributes[column] = { length: newColumn - column, tokenType: tokenType, subTokenizer: this._tokenizer.subTokenizer };
+            column = newColumn;
+        } while (column < line.length)
+        this._textModel.setAttribute(lineNumber, "highlight", attributes);
     }
 }
diff --git a/WebCore/inspector/front-end/TextViewer.js b/WebCore/inspector/front-end/TextViewer.js
index 9be6a00..50ce3d3 100644
--- a/WebCore/inspector/front-end/TextViewer.js
+++ b/WebCore/inspector/front-end/TextViewer.js
@@ -330,16 +330,15 @@ WebInspector.TextViewer.prototype = {
     _paintLine: function(lineRow, lineNumber)
     {
         var element = lineRow.lastChild;
-        var highlighterState = this._textModel.getAttribute(lineNumber, "highlighter-state");
-        var line = this._textModel.line(lineNumber);
-
-        if (!highlighterState) {
+        var highlight = this._textModel.getAttribute(lineNumber, "highlight");
+        if (!highlight) {
             if (this._rangeToMark && this._rangeToMark.startLine === lineNumber)
                 this._markedRangeElement = highlightSearchResult(element, this._rangeToMark.startColumn, this._rangeToMark.endColumn - this._rangeToMark.startColumn);
             return;
         }
 
         element.removeChildren();
+        var line = this._textModel.line(lineNumber);
 
         var plainTextStart = -1;
         for (var j = 0; j < line.length;) {
@@ -348,7 +347,7 @@ WebInspector.TextViewer.prototype = {
                 plainTextStart = j;
                 break;
             }
-            var attribute = highlighterState && highlighterState.attributes[j];
+            var attribute = highlight[j];
             if (!attribute || !attribute.tokenType) {
                 if (plainTextStart === -1)
                     plainTextStart = j;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list