Title: [92766] trunk
Revision
92766
Author
pfeld...@chromium.org
Date
2011-08-10 07:01:09 -0700 (Wed, 10 Aug 2011)

Log Message

Web Inspector: CSS editing file containing tabs leads to the whole file change in revision history.
https://bugs.webkit.org/show_bug.cgi?id=65959

Reviewed by Yury Semikhatsky.

Source/WebCore:

* inspector/front-end/SourceFrame.js:
(WebInspector.SourceFrame):
* inspector/front-end/TextEditorModel.js:
(WebInspector.TextEditorModel.prototype._innerSetText):

LayoutTests:

* inspector/editor/text-editor-model-replace-tabs-expected.txt: Removed.
* inspector/editor/text-editor-model-replace-tabs.html: Removed.

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (92765 => 92766)


--- trunk/LayoutTests/ChangeLog	2011-08-10 13:41:30 UTC (rev 92765)
+++ trunk/LayoutTests/ChangeLog	2011-08-10 14:01:09 UTC (rev 92766)
@@ -1,3 +1,13 @@
+2011-08-10  Pavel Feldman  <pfeld...@google.com>
+
+        Web Inspector: CSS editing file containing tabs leads to the whole file change in revision history.
+        https://bugs.webkit.org/show_bug.cgi?id=65959
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/editor/text-editor-model-replace-tabs-expected.txt: Removed.
+        * inspector/editor/text-editor-model-replace-tabs.html: Removed.
+
 2011-08-10  Pavel Feldman  <pfeld...@chromium.org>
 
         Web Inspector: there should be a way to tell what properties are non-enumerable when expanding objects.

Deleted: trunk/LayoutTests/inspector/editor/text-editor-model-replace-tabs-expected.txt (92765 => 92766)


--- trunk/LayoutTests/inspector/editor/text-editor-model-replace-tabs-expected.txt	2011-08-10 13:41:30 UTC (rev 92765)
+++ trunk/LayoutTests/inspector/editor/text-editor-model-replace-tabs-expected.txt	2011-08-10 14:01:09 UTC (rev 92766)
@@ -1,48 +0,0 @@
-This test checks the text editor model _replaceTabsIfNeeded method. In test cases tabulations are denoted with "\t" and spaces are rendered as ".";
-
-Test Case #0
-Input:  
-Output: 
-
-Test Case #1
-Input:  \t
-Output: ....
-
-Test Case #2
-Input:  A\t
-Output: A...
-
-Test Case #3
-Input:  AB\t
-Output: AB..
-
-Test Case #4
-Input:  ABC\t
-Output: ABC.
-
-Test Case #5
-Input:  \tA
-Output: ....A
-
-Test Case #6
-Input:  A\tB
-Output: A...B
-
-Test Case #7
-Input:  \t\tA\t
-Output: ........A...
-
-Test Case #8
-Input:  \tA\t\t
-Output: ....A.......
-
-Test Case #9
-Input:  A
-Output: A
-
-Test Case #10
-Input:  \tABCD
-Output: ....ABCD
-
-Very Long test: PASS
-

Deleted: trunk/LayoutTests/inspector/editor/text-editor-model-replace-tabs.html (92765 => 92766)


--- trunk/LayoutTests/inspector/editor/text-editor-model-replace-tabs.html	2011-08-10 13:41:30 UTC (rev 92765)
+++ trunk/LayoutTests/inspector/editor/text-editor-model-replace-tabs.html	2011-08-10 14:01:09 UTC (rev 92766)
@@ -1,46 +0,0 @@
-<html>
-<head>
-<script src=""
-<script>
-
-function test()
-{
-    var textModel = new WebInspector.TextEditorModel();
-    textModel.replaceTabsWithSpaces = true;
-    var testCases = new Array("","\t","A\t","AB\t","ABC\t","\tA","A\tB","\t\tA\t","\tA\t\t","A","\tABCD");
-    for (var i = 0; i < testCases.length; i++) {
-        var input = testCases[i];
-        var output = new Array(input);
-        textModel._replaceTabsIfNeeded(output);
-        output = output[0];
-        InspectorTest.addResult("Test Case #" + i);
-        InspectorTest.addResult("Input:  " + input.replace(/\t/g, "\\t").replace(/ /g, "."));
-        InspectorTest.addResult("Output: " + output.replace(/\t/g, "\\t").replace(/ /g, "."));
-        InspectorTest.addResult("");
-    }
-
-    var input = [];
-    var output = [];
-    for (var i = 0; i < 10000; i++) {
-        input.push("\t\t\t\t\t\t\t\t\t\t"); // 10 tabulations
-        output.push("                                        "); // 40 spaces
-    }
-    input = new Array(input.join(""));
-    output = output.join("");
-    textModel._replaceTabsIfNeeded(input);
-    var correctResult = (input[0] === output);
-    InspectorTest.addResult("Very Long test: " + (correctResult ? "PASS" : "FAIL"));
-
-    InspectorTest.completeTest();
-}
-
-</script>
-</head>
-
-<body _onload_="runTest()">
-<p>
-This test checks the text editor model _replaceTabsIfNeeded method.
-In test cases tabulations are denoted with "\t" and spaces are rendered as ".";
-</p>
-</body>
-</html>

Modified: trunk/Source/WebCore/ChangeLog (92765 => 92766)


--- trunk/Source/WebCore/ChangeLog	2011-08-10 13:41:30 UTC (rev 92765)
+++ trunk/Source/WebCore/ChangeLog	2011-08-10 14:01:09 UTC (rev 92766)
@@ -1,3 +1,15 @@
+2011-08-10  Pavel Feldman  <pfeld...@google.com>
+
+        Web Inspector: CSS editing file containing tabs leads to the whole file change in revision history.
+        https://bugs.webkit.org/show_bug.cgi?id=65959
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/front-end/SourceFrame.js:
+        (WebInspector.SourceFrame):
+        * inspector/front-end/TextEditorModel.js:
+        (WebInspector.TextEditorModel.prototype._innerSetText):
+
 2011-08-10  Pavel Feldman  <pfeld...@chromium.org>
 
         Web Inspector: there should be a way to tell what properties are non-enumerable when expanding objects.

Modified: trunk/Source/WebCore/inspector/front-end/SourceFrame.js (92765 => 92766)


--- trunk/Source/WebCore/inspector/front-end/SourceFrame.js	2011-08-10 13:41:30 UTC (rev 92765)
+++ trunk/Source/WebCore/inspector/front-end/SourceFrame.js	2011-08-10 14:01:09 UTC (rev 92766)
@@ -37,7 +37,6 @@
     this._url = url;
 
     this._textModel = new WebInspector.TextEditorModel();
-    this._textModel.replaceTabsWithSpaces = true;
 
     var textViewerDelegate = new WebInspector.TextViewerDelegateForSourceFrame(this);
     this._textViewer = new WebInspector.TextViewer(this._textModel, WebInspector.platform, this._url, textViewerDelegate);

Modified: trunk/Source/WebCore/inspector/front-end/TextEditorModel.js (92765 => 92766)


--- trunk/Source/WebCore/inspector/front-end/TextEditorModel.js	2011-08-10 13:41:30 UTC (rev 92765)
+++ trunk/Source/WebCore/inspector/front-end/TextEditorModel.js	2011-08-10 14:01:09 UTC (rev 92766)
@@ -106,11 +106,6 @@
         return newRange;
     },
 
-    set replaceTabsWithSpaces(replaceTabsWithSpaces)
-    {
-        this._replaceTabsWithSpaces = replaceTabsWithSpaces;
-    },
-
     _innerSetText: function(range, text)
     {
         this._eraseRange(range);
@@ -118,7 +113,6 @@
             return new WebInspector.TextRange(range.startLine, range.startColumn, range.startLine, range.startColumn);
 
         var newLines = text.split(/\r?\n/);
-        this._replaceTabsIfNeeded(newLines);
 
         var prefix = this._lines[range.startLine].substring(0, range.startColumn);
         var suffix = this._lines[range.startLine].substring(range.startColumn);
@@ -139,34 +133,6 @@
                                           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 caretIndex = 0;
-            var index = line.indexOf("\t", caretIndex);
-            var buffer = [];
-            var offset = 0;
-            while (index !== -1) {
-                if (index > caretIndex) {
-                    offset += index - caretIndex;
-                    buffer.push(line.substring(caretIndex, index));
-                }
-                caretIndex = index + 1;
-                var space = spaces[offset % 4];
-                offset += space.length;
-                buffer.push(space);
-                index = line.indexOf("\t", caretIndex);
-            }
-            if (line.length > caretIndex)
-                buffer.push(line.substring(caretIndex));
-            lines[i] = buffer.join("");
-        }
-    },
-
     _eraseRange: function(range)
     {
         if (range.isEmpty())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to