[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 02:03:13 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit bd3e8b8c4dda7fbe2bd501b579a9db241e9e8131
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Feb 27 10:48:18 2010 +0000

    2010-02-27  Pavel Feldman  <pfeldman at chromium.org>
    
            Reviewed by Timothy Hatcher.
    
            Web Inspector: REGRESSION: hangs when scrolling in Resource pane.
    
            https://bugs.webkit.org/show_bug.cgi?id=35216
    
            * inspector/front-end/TextEditorHighlighter.js:
            (WebInspector.TextEditorHighlighter):
            (WebInspector.TextEditorHighlighter.prototype.highlight):
            (WebInspector.TextEditorHighlighter.prototype._highlightInChunks):
            (WebInspector.TextEditorHighlighter.prototype._highlightLines):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55352 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 70bfc73..c166820 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2010-02-27  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector: REGRESSION: hangs when scrolling in Resource pane.
+
+        https://bugs.webkit.org/show_bug.cgi?id=35216
+
+        * inspector/front-end/TextEditorHighlighter.js:
+        (WebInspector.TextEditorHighlighter):
+        (WebInspector.TextEditorHighlighter.prototype.highlight):
+        (WebInspector.TextEditorHighlighter.prototype._highlightInChunks):
+        (WebInspector.TextEditorHighlighter.prototype._highlightLines):
+
 2010-02-27  Xan Lopez  <xlopez at igalia.com>
 
         Reviewed by Gustavo Noronha.
diff --git a/WebCore/inspector/front-end/TextEditorHighlighter.js b/WebCore/inspector/front-end/TextEditorHighlighter.js
index 0f9ec2f..3fea7a5 100644
--- a/WebCore/inspector/front-end/TextEditorHighlighter.js
+++ b/WebCore/inspector/front-end/TextEditorHighlighter.js
@@ -35,6 +35,7 @@ WebInspector.TextEditorHighlighter = function(textModel, damageCallback)
     this._tokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer("text/html");
     this._damageCallback = damageCallback;
     this._lastHighlightedLine = 0;
+    this._lastHighlightedColumn = 0;
 }
 
 WebInspector.TextEditorHighlighter.prototype = {
@@ -61,15 +62,14 @@ WebInspector.TextEditorHighlighter.prototype = {
         }
 
         // Do small highlight synchronously. This will provide instant highlight on PageUp / PageDown, gentle scrolling.
-        var toLine = Math.min(this._lastHighlightedLine + 200, endLine);
-        this._highlightInChunks(this._lastHighlightedLine, toLine);
+        this._highlightInChunks(endLine);
 
         // Schedule tail highlight if necessary.
-        if (endLine > toLine)
-            this._highlightTimer = setTimeout(this._highlightInChunks.bind(this, toLine, endLine), 100);
+        if (this._lastHighlightedLine < endLine)
+            this._highlightTimer = setTimeout(this._highlightInChunks.bind(this, endLine), 100);
     },
 
-    _highlightInChunks: function(startLine, endLine)
+    _highlightInChunks: function(endLine)
     {
         delete this._highlightTimer;
 
@@ -79,43 +79,48 @@ WebInspector.TextEditorHighlighter.prototype = {
 
         if (this._requestedEndLine !== endLine) {
             // User keeps updating the job in between of our timer ticks. Just reschedule self, don't eat CPU (they must be scrolling).
-            this._highlightTimer = setTimeout(this._highlightInChunks.bind(this, startLine, this._requestedEndLine), 100);
+            this._highlightTimer = setTimeout(this._highlightInChunks.bind(this, this._requestedEndLine), 100);
             return;
         }
 
-        // Highlight 500 lines chunk.
-        var toLine = Math.min(startLine + 500, this._requestedEndLine);
-        this._highlightLines(startLine, toLine);
+        this._highlightLines(this._requestedEndLine);
 
         // Schedule tail highlight if necessary.
-        if (toLine < this._requestedEndLine)
-            this._highlightTimer = setTimeout(this._highlightInChunks.bind(this, toLine, this._requestedEndLine), 10);
+        if (this._lastHighlightedLine < this._requestedEndLine)
+            this._highlightTimer = setTimeout(this._highlightInChunks.bind(this, this._requestedEndLine), 10);
     },
 
-    _highlightLines: function(startLine, endLine)
+    _highlightLines: function(endLine)
     {
         // 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;
+        var tokensCount = 0;
+        for (var lineNumber = this._lastHighlightedLine; lineNumber < endLine; ++lineNumber) {
+            var line = this._textModel.line(lineNumber);
+            this._tokenizer.line = line;
+            var attributes = this._textModel.getAttribute(lineNumber, "highlight") || {};
 
-        this._damageCallback(startLine, endLine);
-    },
+            // Highlight line.
+            do {
+                var newColumn = this._tokenizer.nextToken(this._lastHighlightedColumn);
+                var tokenType = this._tokenizer.tokenType;
+                if (tokenType)
+                    attributes[this._lastHighlightedColumn] = { length: newColumn - this._lastHighlightedColumn, tokenType: tokenType, subTokenizer: this._tokenizer.subTokenizer };
+                this._lastHighlightedColumn = newColumn;
+                if (++tokensCount > 1000)
+                    break;
+            } while (this._lastHighlightedColumn < 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);
+            this._textModel.setAttribute(lineNumber, "highlight", attributes);
+            if (this._lastHighlightedColumn < line.length) {
+                // Too much work for single chunk - exit.
+                break;
+            } else
+                this._lastHighlightedColumn = 0;
+        }
+
+        this._damageCallback(this._lastHighlightedLine, lineNumber);
+        this._tokenizerCondition = this._tokenizer.condition;
+        this._lastHighlightedLine = lineNumber;
     }
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list