[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.20-204-g221d8e8

eric at webkit.org eric at webkit.org
Wed Feb 10 22:16:17 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 7a9077f51c261e821e5c8769a2047ca6fde4dcbb
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Feb 5 10:50:42 2010 +0000

    2010-02-05  Pavel Feldman  <pfeldman at chromium.org>
    
            Reviewed by Timothy Hatcher.
    
            Web Inspector: Tab width for javascript source is 8, should be 4
    
            https://bugs.webkit.org/show_bug.cgi?id=31248
    
            * inspector/front-end/SourceFrame.js:
            (WebInspector.SourceFrame):
            * inspector/front-end/TextEditorModel.js:
            (WebInspector.TextEditorModel.prototype.set replaceTabsWithSpaces):
            (WebInspector.TextEditorModel.prototype._innerSetText):
            (WebInspector.TextEditorModel.prototype._replaceTabsIfNeeded):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54415 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 56c3ddd..fbe8796 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-02-05  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector: Tab width for javascript source is 8, should be 4
+
+        https://bugs.webkit.org/show_bug.cgi?id=31248
+
+        * inspector/front-end/SourceFrame.js:
+        (WebInspector.SourceFrame):
+        * inspector/front-end/TextEditorModel.js:
+        (WebInspector.TextEditorModel.prototype.set replaceTabsWithSpaces):
+        (WebInspector.TextEditorModel.prototype._innerSetText):
+        (WebInspector.TextEditorModel.prototype._replaceTabsIfNeeded):
+
 2010-02-05  Tony Chang  <tony at chromium.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebCore/inspector/front-end/SourceFrame.js b/WebCore/inspector/front-end/SourceFrame.js
index e30dbdb..bc9122b 100644
--- a/WebCore/inspector/front-end/SourceFrame.js
+++ b/WebCore/inspector/front-end/SourceFrame.js
@@ -33,6 +33,7 @@ WebInspector.SourceFrame = function(parentElement, addBreakpointDelegate)
     this._parentElement = parentElement;
 
     this._textModel = new WebInspector.TextEditorModel();
+    this._textModel.replaceTabsWithSpaces = true;
 
     this._messages = [];
     this._rowMessages = {};
diff --git a/WebCore/inspector/front-end/TextEditorModel.js b/WebCore/inspector/front-end/TextEditorModel.js
index fc56026..e56c269 100644
--- a/WebCore/inspector/front-end/TextEditorModel.js
+++ b/WebCore/inspector/front-end/TextEditorModel.js
@@ -97,6 +97,11 @@ WebInspector.TextEditorModel.prototype = {
         return newRange;
     },
 
+    set replaceTabsWithSpaces(replaceTabsWithSpaces)
+    {
+        this._replaceTabsWithSpaces = replaceTabsWithSpaces;
+    },
+
     _innerSetText: function(range, text)
     {
         this._eraseRange(range);
@@ -104,6 +109,8 @@ WebInspector.TextEditorModel.prototype = {
             return new WebInspector.TextRange(range.startLine, range.startColumn, range.startLine, range.startColumn);
 
         var newLines = text.split("\n");
+        this._replaceTabsIfNeeded(newLines);
+
         var prefix = this._lines[range.startLine].substring(0, range.startColumn);
         var prefixArguments = this._arguments
         var suffix = this._lines[range.startLine].substring(range.startColumn);
@@ -124,6 +131,22 @@ WebInspector.TextEditorModel.prototype = {
                                           range.startLine + newLines.length - 1, postCaret);
     },
 
+    _replaceTabsIfNeeded: function(lines)
+    {
+        if (!this._replaceTabsWithSpaces)
+            return;
+        var spaces = [ "    ", "   ", "  ", " "];
+        for (var i = 0; i < lines.length; ++i) {
+            var line = lines[i];
+            var index = line.indexOf("\t");
+            while (index !== -1) {
+                line = line.substring(0, index) + spaces[index % 4] + line.substring(index + 1);
+                index = line.indexOf("\t", index + 1);
+            }
+            lines[i] = line;
+        }
+    },
+
     _eraseRange: function(range)
     {
         if (range.isEmpty())

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list