Web Inspector: move showWhitespace option into experiments
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Feb 2013 10:04:18 +0000 (10:04 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Feb 2013 10:04:18 +0000 (10:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=109552

Patch by Andrey Lushnikov <lushnikov@chromium.org> on 2013-02-12
Reviewed by Vsevolod Vlasov.

Source/WebCore:

Remove "show whitespace" setting and add it to experiments.

No new tests: fixed an existing test to verify changes.

* English.lproj/localizedStrings.js:
* inspector/front-end/DefaultTextEditor.js:
(WebInspector.TextEditorMainPanel):
(WebInspector.TextEditorMainPanel.prototype.wasShown):
(WebInspector.TextEditorMainPanel.prototype.willHide):
* inspector/front-end/Settings.js:
(WebInspector.ExperimentsSettings):
* inspector/front-end/SettingsScreen.js:
(WebInspector.GenericSettingsTab):

LayoutTests:

Fix layout test to switch on experiment instead of toggling one of the
options.

* inspector/editor/text-editor-show-whitespace-expected.txt:
* inspector/editor/text-editor-show-whitespace.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@142597 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/inspector/editor/text-editor-show-whitespace-expected.txt
LayoutTests/inspector/editor/text-editor-show-whitespace.html
Source/WebCore/ChangeLog
Source/WebCore/English.lproj/localizedStrings.js
Source/WebCore/inspector/front-end/DefaultTextEditor.js
Source/WebCore/inspector/front-end/Settings.js
Source/WebCore/inspector/front-end/SettingsScreen.js

index 3eafb88f682c2f8b945025964a5161537aeb1ed5..4f7cca3b82256c92129076a7b1e0c66ff9084b97 100644 (file)
@@ -1,3 +1,16 @@
+2013-02-12  Andrey Lushnikov  <lushnikov@chromium.org>
+
+        Web Inspector: move showWhitespace option into experiments
+        https://bugs.webkit.org/show_bug.cgi?id=109552
+
+        Reviewed by Vsevolod Vlasov.
+
+        Fix layout test to switch on experiment instead of toggling one of the
+        options.
+
+        * inspector/editor/text-editor-show-whitespace-expected.txt:
+        * inspector/editor/text-editor-show-whitespace.html:
+
 2013-02-11  Yury Semikhatsky  <yurys@chromium.org>
 
         Web Inspector: stack trace is cut at native bind if inspector is closed
index 2384905b1e20d25d5e31046acf18ef2e99fd9486..ad713af3905eea8c8c8ea48fdb03450d14d41056 100644 (file)
@@ -1,4 +1,4 @@
-This test checks how text editor splits whitespace sequences to highlight them if the appropriate setting is set up.
+This test checks how text editor splits whitespace sequences to highlight them if the appropriate experiment is switched on.
 
 Actual text:
 function foo(a, b) {
@@ -6,14 +6,6 @@ function foo(a, b) {
     a = "string with spaces";
     a = 2;               a = 3;
 }
-========== Editor HTML showWhitespaceInEditor OFF ==========
-
-<div class="inner-container" tabindex="0">
-<div class="webkit-line-content"><span class="webkit-javascript-keyword">function</span><span class="webkit-whitespace"> </span><span class="webkit-javascript-ident">foo</span>(<span class="webkit-javascript-ident">a</span>,<span class="webkit-whitespace"> </span><span class="webkit-javascript-ident">b</span>)<span class="webkit-whitespace"> </span>{</div>
-<div class="webkit-line-content"><span class="webkit-whitespace">    </span><span class="webkit-javascript-comment">// spaces in comment</span></div>
-<div class="webkit-line-content"><span class="webkit-whitespace">    </span><span class="webkit-javascript-ident">a</span><span class="webkit-whitespace"> </span>=<span class="webkit-whitespace"> </span><span class="webkit-javascript-string">"string with spaces"</span>;</div>
-<div class="webkit-line-content"><span class="webkit-whitespace">    </span><span class="webkit-javascript-ident">a</span><span class="webkit-whitespace"> </span>=<span class="webkit-whitespace"> </span><span class="webkit-javascript-number">2</span>;<span class="webkit-whitespace">               </span><span class="webkit-javascript-ident">a</span><span class="webkit-whitespace"> </span>=<span class="webkit-whitespace"> </span><span class="webkit-javascript-number">3</span>;</div>
-<div class="webkit-line-content">}</div></div>
 ========== Editor HTML after setting showWhitespaceInEditor ON ==========
 
 <div class="inner-container" tabindex="0">
index a75deb65b8b4b39419f8848d64e8dbc875eabb0b..f13c574272d4c989bec31b1e2891f1909ea387e6 100644 (file)
@@ -11,16 +11,13 @@ function foo(a, b) {
     a = 2;               a = 3;
 }
 
-    WebInspector.settings.showWhitespaceInEditor.set(false);
+    WebInspector.experimentsSettings.showWhitespaceInEditor.enableForTest();
     var textEditor = InspectorTest.createTestEditor();
     textEditor.overrideViewportForTest(0, undefined, 3);
     textEditor.mimeType = "text/javascript";
     textEditor.setText(foo.toString());
     InspectorTest.addResult("Actual text:");
     InspectorTest.addResult(textEditor.text());
-    InspectorTest.addResult("========== Editor HTML showWhitespaceInEditor OFF ==========");
-    InspectorTest.dumpEditorHTML(textEditor, true);
-    WebInspector.settings.showWhitespaceInEditor.set(true);
     InspectorTest.addResult("========== Editor HTML after setting showWhitespaceInEditor ON ==========");
     InspectorTest.dumpEditorHTML(textEditor, true);
     InspectorTest.completeTest();
@@ -32,7 +29,7 @@ function foo(a, b) {
 <body onload="runTest();">
 <p>
 This test checks how text editor splits whitespace sequences to highlight them if the appropriate
-setting is set up.
+experiment is switched on.
 </p>
 </body>
 </html>
index 4f9c345a8909af7e98e69eab9287ab762d2ba334..6a869f5b4d63a0a5ed2a832dcad78572ef176336 100644 (file)
@@ -1,3 +1,24 @@
+2013-02-12  Andrey Lushnikov  <lushnikov@chromium.org>
+
+        Web Inspector: move showWhitespace option into experiments
+        https://bugs.webkit.org/show_bug.cgi?id=109552
+
+        Reviewed by Vsevolod Vlasov.
+
+        Remove "show whitespace" setting and add it to experiments.
+
+        No new tests: fixed an existing test to verify changes.
+
+        * English.lproj/localizedStrings.js:
+        * inspector/front-end/DefaultTextEditor.js:
+        (WebInspector.TextEditorMainPanel):
+        (WebInspector.TextEditorMainPanel.prototype.wasShown):
+        (WebInspector.TextEditorMainPanel.prototype.willHide):
+        * inspector/front-end/Settings.js:
+        (WebInspector.ExperimentsSettings):
+        * inspector/front-end/SettingsScreen.js:
+        (WebInspector.GenericSettingsTab):
+
 2013-02-12  Tamas Czene  <tczene@inf.u-szeged.hu>
 
         Add error checking into OpenCL version of SVG filters.
index 7635229db5f83003122a88e8802d4d8d559b4174..0228aa903c14458f73d7fcdb282b6e2bdc5cd63f 100644 (file)
@@ -390,7 +390,6 @@ localizedStrings["Show rulers"] = "Show rulers";
 localizedStrings["Show Shadow DOM"] = "Show Shadow DOM";
 localizedStrings["Show times as percentages."] = "Show times as percentages.";
 localizedStrings["Show total and self times as percentages."] = "Show total and self times as percentages.";
-localizedStrings["Show whitespace"] = "Show whitespace";
 localizedStrings["Size"] = "Size";
 localizedStrings["Snapshot %d"] = "Snapshot %d";
 localizedStrings["End Time"] = "End Time";
index c2b99c44648c286091145d4e6af4b669a7cc0e5f..22ff08d2e64e0eb482039e89ac7fd406f260662c 100644 (file)
@@ -1364,8 +1364,7 @@ WebInspector.TextEditorMainPanel = function(delegate, textModel, url, syncScroll
     this.element.addEventListener("textInput", this._handleTextInput.bind(this), false);
     this.element.addEventListener("cut", this._handleCut.bind(this), false);
 
-    this._showWhitespace = WebInspector.settings.showWhitespaceInEditor.get();
-    this._handleShowWhitespaceInEditorChange = this._handleShowWhitespaceInEditorChange.bind(this);
+    this._showWhitespace = WebInspector.experimentsSettings.showWhitespaceInEditor.isEnabled();
 
     this._container.addEventListener("focus", this._handleFocused.bind(this), false);
 
@@ -1441,21 +1440,6 @@ WebInspector.TextEditorMainPanel.prototype = {
         return true;
     },
 
-    _handleShowWhitespaceInEditorChange: function()
-    {
-        this._showWhitespace = WebInspector.settings.showWhitespaceInEditor.get();
-        var visibleFrom = this.scrollTop();
-        var visibleTo = visibleFrom + this.clientHeight();
-
-        if (!visibleTo)
-            return;
-
-        var result = this.findVisibleChunks(visibleFrom, visibleTo);
-        var startLine = this._textChunks[result.start].startLine;
-        var endLine = this._textChunks[result.end - 1].startLine + this._textChunks[result.end - 1].linesCount;
-        this._paintLines(startLine, endLine + 1);
-    },
-
     /**
      * @param {string} regex
      * @param {string} cssClass
@@ -1531,8 +1515,6 @@ WebInspector.TextEditorMainPanel.prototype = {
 
     wasShown: function()
     {
-        WebInspector.settings.showWhitespaceInEditor.addChangeListener(this._handleShowWhitespaceInEditorChange);
-
         this._boundSelectionChangeListener = this._handleSelectionChange.bind(this);
         document.addEventListener("selectionchange", this._boundSelectionChangeListener, false);
 
@@ -1542,8 +1524,6 @@ WebInspector.TextEditorMainPanel.prototype = {
 
     willHide: function()
     {
-        WebInspector.settings.showWhitespaceInEditor.removeChangeListener(this._handleShowWhitespaceInEditorChange);
-
         document.removeEventListener("selectionchange", this._boundSelectionChangeListener, false);
         delete this._boundSelectionChangeListener;
 
index 9352204a1ecccd7b9cd264aeb53baae0307b2027..27d8c2f9b96fd0e43f21ffe5b1afabfcc41eca24 100644 (file)
@@ -111,7 +111,6 @@ WebInspector.Settings = function()
     this.deviceOrientationOverride = this.createSetting("deviceOrientationOverride", "");
     this.showHeapSnapshotObjectsHiddenProperties = this.createSetting("showHeaSnapshotObjectsHiddenProperties", false);
     this.showNativeSnapshotUninstrumentedSize = this.createSetting("showNativeSnapshotUninstrumentedSize", false);
-    this.showWhitespaceInEditor = this.createSetting("showWhitespaceInEditor", false);
     this.searchInContentScripts = this.createSetting("searchInContentScripts", false);
     this.textEditorIndent = this.createSetting("textEditorIndent", "    ");
     this.lastDockState = this.createSetting("lastDockState", "");
@@ -218,6 +217,7 @@ WebInspector.ExperimentsSettings = function()
     this.showOverridesInDrawer = this._createExperiment("showOverridesInDrawer", "Show Overrides in drawer");
     this.fileSystemProject = this._createExperiment("fileSystemProject", "File system folders in Sources Panel");
     this.horizontalPanelSplit = this._createExperiment("horizontalPanelSplit", "Allow horizontal split in Elements and Sources panels");
+    this.showWhitespaceInEditor = this._createExperiment("showWhitespaceInEditor", "Show whitespace characters in editor");
 
     this._cleanUpSetting();
 }
index 657acce5586a73098fbc864720bfb49654963fd3..6ef2a86df9947f33dd0e9ea048a864d58b9729c5 100644 (file)
@@ -307,7 +307,6 @@ WebInspector.GenericSettingsTab = function()
 
     p = this._appendSection(WebInspector.UIString("Sources"));
     p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Search in content scripts"), WebInspector.settings.searchInContentScripts));
-    p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show whitespace"), WebInspector.settings.showWhitespaceInEditor));
     p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Enable source maps"), WebInspector.settings.sourceMapsEnabled));
     if (WebInspector.experimentsSettings.isEnabled("sass"))
         p.appendChild(this._createCSSAutoReloadControls());