Web Inspector: Styles Redesign: turn on CSS spreadsheet editor by default
authornvasilyev@apple.com <nvasilyev@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Nov 2017 20:46:10 +0000 (20:46 +0000)
committernvasilyev@apple.com <nvasilyev@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Nov 2017 20:46:10 +0000 (20:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=179100
<rdar://problem/35285990>

Reviewed by Brian Burg.

Add a "Legacy Style Editor" checkbox and remove the experimental "Spreadsheet Style Editor" checkbox.

Remove settings of the legacy styles editor:
- Show inline warnings
- Automatically insert newline
- Select text on first click

These settings are not applicable for the spreadsheet styles editor and
now are always enabled for the legacy styles editor.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Base/Setting.js:
* UserInterface/Views/CSSStyleDeclarationTextEditor.js:
(WI.CSSStyleDeclarationTextEditor):
(WI.CSSStyleDeclarationTextEditor.prototype._handleMouseUp):
(WI.CSSStyleDeclarationTextEditor.):
* UserInterface/Views/CSSStyleDetailsSidebarPanel.js:
(WI.CSSStyleDetailsSidebarPanel):
* UserInterface/Views/SettingsTabContentView.js:
(WI.SettingsTabContentView.prototype._createGeneralSettingsView):
(WI.SettingsTabContentView.prototype._createExperimentalSettingsView):

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

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/UserInterface/Base/Setting.js
Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js
Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js

index c2a1e84..9d04041 100644 (file)
@@ -1,3 +1,33 @@
+2017-11-02  Nikita Vasilyev  <nvasilyev@apple.com>
+
+        Web Inspector: Styles Redesign: turn on CSS spreadsheet editor by default
+        https://bugs.webkit.org/show_bug.cgi?id=179100
+        <rdar://problem/35285990>
+
+        Reviewed by Brian Burg.
+
+        Add a "Legacy Style Editor" checkbox and remove the experimental "Spreadsheet Style Editor" checkbox.
+
+        Remove settings of the legacy styles editor:
+        - Show inline warnings
+        - Automatically insert newline
+        - Select text on first click
+
+        These settings are not applicable for the spreadsheet styles editor and
+        now are always enabled for the legacy styles editor.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        * UserInterface/Base/Setting.js:
+        * UserInterface/Views/CSSStyleDeclarationTextEditor.js:
+        (WI.CSSStyleDeclarationTextEditor):
+        (WI.CSSStyleDeclarationTextEditor.prototype._handleMouseUp):
+        (WI.CSSStyleDeclarationTextEditor.):
+        * UserInterface/Views/CSSStyleDetailsSidebarPanel.js:
+        (WI.CSSStyleDetailsSidebarPanel):
+        * UserInterface/Views/SettingsTabContentView.js:
+        (WI.SettingsTabContentView.prototype._createGeneralSettingsView):
+        (WI.SettingsTabContentView.prototype._createExperimentalSettingsView):
+
 2017-11-01  Devin Rousso  <webkit@devinrousso.com>
 
         Web Inspector: consolidate DOMTreeElement contextmenu items into submenus
index 2b6f5aa..c5e744e 100644 (file)
@@ -120,7 +120,6 @@ localizedStrings["Attributes"] = "Attributes";
 localizedStrings["Author Stylesheet"] = "Author Stylesheet";
 localizedStrings["Auto Increment"] = "Auto Increment";
 localizedStrings["Automatically continue after evaluating"] = "Automatically continue after evaluating";
-localizedStrings["Automatically insert newline"] = "Automatically insert newline";
 localizedStrings["Available Style Sheets"] = "Available Style Sheets";
 localizedStrings["Average Time"] = "Average Time";
 localizedStrings["Back (%s)"] = "Back (%s)";
@@ -528,6 +527,7 @@ localizedStrings["Layout"] = "Layout";
 localizedStrings["Layout & Rendering"] = "Layout & Rendering";
 localizedStrings["Layout Invalidated"] = "Layout Invalidated";
 localizedStrings["Left"] = "Left";
+localizedStrings["Legacy Style Editor"] = "Legacy Style Editor";
 localizedStrings["Letter"] = "Letter";
 localizedStrings["Ligatures"] = "Ligatures";
 localizedStrings["Line %d"] = "Line %d";
@@ -801,7 +801,6 @@ localizedStrings["Security Origin"] = "Security Origin";
 localizedStrings["Select %s Rule"] = "Select %s Rule";
 localizedStrings["Select baseline snapshot"] = "Select baseline snapshot";
 localizedStrings["Select comparison snapshot"] = "Select comparison snapshot";
-localizedStrings["Select text on first click"] = "Select text on first click";
 localizedStrings["Selected"] = "Selected";
 localizedStrings["Selected Canvas Context"] = "Selected Canvas Context";
 localizedStrings["Selected Element"] = "Selected Element";
@@ -843,7 +842,6 @@ localizedStrings["Show all actions"] = "Show all actions";
 localizedStrings["Show all resources"] = "Show all resources";
 localizedStrings["Show compositing borders"] = "Show compositing borders";
 localizedStrings["Show errors logged to the Console"] = "Show errors logged to the Console";
-localizedStrings["Show inline warnings"] = "Show inline warnings";
 localizedStrings["Show messages logged to the Console"] = "Show messages logged to the Console";
 localizedStrings["Show network information"] = "Show network information";
 localizedStrings["Show page load timing"] = "Show page load timing";
@@ -877,7 +875,6 @@ localizedStrings["Specificity: (%d, %d, %d)"] = "Specificity: (%d, %d, %d)";
 localizedStrings["Specificity: No value for selected element"] = "Specificity: No value for selected element";
 localizedStrings["Spelling"] = "Spelling";
 localizedStrings["Spread"] = "Spread";
-localizedStrings["Spreadsheet Style Editor"] = "Spreadsheet Style Editor";
 localizedStrings["Spring"] = "Spring";
 localizedStrings["Stalled"] = "Stalled";
 localizedStrings["Start Time"] = "Start Time";
@@ -903,7 +900,6 @@ localizedStrings["Style Attribute"] = "Style Attribute";
 localizedStrings["Style Rules"] = "Style Rules";
 localizedStrings["Style rule"] = "Style rule";
 localizedStrings["Styles"] = "Styles";
-localizedStrings["Styles Editing:"] = "Styles Editing:";
 localizedStrings["Styles Invalidated"] = "Styles Invalidated";
 localizedStrings["Styles Panel:"] = "Styles Panel:";
 localizedStrings["Styles Recalculated"] = "Styles Recalculated";
index 2394fc3..4e9deaa 100644 (file)
@@ -117,15 +117,12 @@ WI.settings = {
     clearNetworkOnNavigate: new WI.Setting("clear-network-on-navigate", true),
     zoomFactor: new WI.Setting("zoom-factor", 1),
     layoutDirection: new WI.Setting("layout-direction-override", "system"),
-    stylesShowInlineWarnings: new WI.Setting("styles-show-inline-warning", true),
-    stylesInsertNewline: new WI.Setting("styles-insert-newline", true),
-    stylesSelectOnFirstClick: new WI.Setting("styles-select-on-first-click", true),
     showScopeChainOnPause: new WI.Setting("show-scope-chain-sidebar", true),
     showImageGrid: new WI.Setting("show-image-grid", false),
     showCanvasPath: new WI.Setting("show-canvas-path", false),
     selectedNetworkDetailContentViewIdentifier: new WI.Setting("network-detail-content-view-identifier", "preview"),
 
     // Experimental
-    experimentalSpreadsheetStyleEditor: new WI.Setting("experimental-spreadsheet-style-editor", false),
+    experimentalLegacyStyleEditor: new WI.Setting("experimental-legacy-style-editor", false),
     experimentalEnableLayersTab: new WI.Setting("experimental-enable-layers-tab", false),
 };
index 763e788..a088e87 100644 (file)
@@ -89,8 +89,6 @@ WI.CSSStyleDeclarationTextEditor = class CSSStyleDeclarationTextEditor extends W
 
         this.style = style;
         this._shownProperties = [];
-
-        WI.settings.stylesShowInlineWarnings.addEventListener(WI.Setting.Event.Changed, this.refresh, this);
     }
 
     // Public
@@ -479,17 +477,17 @@ WI.CSSStyleDeclarationTextEditor = class CSSStyleDeclarationTextEditor extends W
             let line = this._codeMirror.getLine(cursor.line);
             if (cursor.ch === line.trimRight().length) {
                 let nextLine = this._codeMirror.getLine(cursor.line + 1);
-                if (WI.settings.stylesInsertNewline.value && cursor.line < this._codeMirror.lineCount() - 1 && (!nextLine || !nextLine.trim().length)) {
+                if (cursor.line < this._codeMirror.lineCount() - 1 && (!nextLine || !nextLine.trim().length)) {
                     this._codeMirror.setCursor({line: cursor.line + 1, ch: 0});
                 } else {
                     let line = this._codeMirror.getLine(cursor.line);
-                    let replacement = WI.settings.stylesInsertNewline.value ? "\n" : "";
+                    let replacement = "\n";
                     if (!line.trimRight().endsWith(";") && !this._textAtCursorIsComment(this._codeMirror, cursor))
                         replacement = ";" + replacement;
 
                     this._codeMirror.replaceRange(replacement, cursor);
                 }
-            } else if (WI.settings.stylesSelectOnFirstClick.value && this._mouseDownCursorPosition.previousRange) {
+            } else if (this._mouseDownCursorPosition.previousRange) {
                 let range = this._rangeForNextNameOrValue(this._codeMirror, cursor, line);
 
                 let clickedDifferentLine = this._mouseDownCursorPosition.previousRange.from.line !== cursor.line || this._mouseDownCursorPosition.previousRange.to.line !== cursor.line;
@@ -953,17 +951,15 @@ WI.CSSStyleDeclarationTextEditor = class CSSStyleDeclarationTextEditor extends W
                     let to = {line: marker.range.endLine, ch: marker.range.endColumn};
                     this._codeMirror.markText(from, to, {className: "invalid"});
 
-                    if (WI.settings.stylesShowInlineWarnings.value) {
-                        let invalidMarker = document.createElement("button");
-                        invalidMarker.classList.add("invalid-warning-marker", "clickable");
-                        invalidMarker.title = WI.UIString("The variable ā€œ%sā€ does not exist.\nClick to delete and open autocomplete.").format(variableString);
-                        invalidMarker.addEventListener("click", (event) => {
-                            this._codeMirror.replaceRange("", from, to);
-                            this._codeMirror.setCursor(from);
-                            this._completionController.completeAtCurrentPositionIfNeeded(true);
-                        });
-                        this._codeMirror.setBookmark(from, invalidMarker);
-                    }
+                    let invalidMarker = document.createElement("button");
+                    invalidMarker.classList.add("invalid-warning-marker", "clickable");
+                    invalidMarker.title = WI.UIString("The variable ā€œ%sā€ does not exist.\nClick to delete and open autocomplete.").format(variableString);
+                    invalidMarker.addEventListener("click", (event) => {
+                        this._codeMirror.replaceRange("", from, to);
+                        this._codeMirror.setCursor(from);
+                        this._completionController.completeAtCurrentPositionIfNeeded(true);
+                    });
+                    this._codeMirror.setBookmark(from, invalidMarker);
                     return;
                 }
 
@@ -1094,7 +1090,7 @@ WI.CSSStyleDeclarationTextEditor = class CSSStyleDeclarationTextEditor extends W
             }
         }
 
-        if (this._codeMirror.getOption("readOnly") || property.hasOtherVendorNameOrKeyword() || property.text.trim().endsWith(":") || !WI.settings.stylesShowInlineWarnings.value)
+        if (this._codeMirror.getOption("readOnly") || property.hasOtherVendorNameOrKeyword() || property.text.trim().endsWith(":"))
             return;
 
         var propertyHasUnnecessaryPrefix = property.name.startsWith("-webkit-") && WI.CSSCompletions.cssNameCompletions.isValidPropertyName(property.canonicalName);
index 9bb8170..35fa1b7 100644 (file)
@@ -35,10 +35,10 @@ WI.CSSStyleDetailsSidebarPanel = class CSSStyleDetailsSidebarPanel extends WI.DO
         this._rulesStyleDetailsPanel = new WI.RulesStyleDetailsPanel(this);
         this._visualStyleDetailsPanel = new WI.VisualStyleDetailsPanel(this);
 
-        if (WI.settings.experimentalSpreadsheetStyleEditor.value)
-            this._activeRulesStyleDetailsPanel = new WI.SpreadsheetRulesStyleDetailsPanel(this);
-        else
+        if (WI.settings.experimentalLegacyStyleEditor.value)
             this._activeRulesStyleDetailsPanel = this._rulesStyleDetailsPanel;
+        else
+            this._activeRulesStyleDetailsPanel = new WI.SpreadsheetRulesStyleDetailsPanel(this);
 
         this._panels = [this._computedStyleDetailsPanel, this._activeRulesStyleDetailsPanel, this._visualStyleDetailsPanel];
         this._panelNavigationInfo = [this._computedStyleDetailsPanel.navigationInfo, this._activeRulesStyleDetailsPanel.navigationInfo, this._visualStyleDetailsPanel.navigationInfo];
index 4f45f4a..1f7c515 100644 (file)
@@ -202,13 +202,6 @@ WI.SettingsTabContentView = class SettingsTabContentView extends WI.TabContentVi
 
         generalSettingsView.addSeparator();
 
-        let stylesEditingGroup = generalSettingsView.addGroup(WI.UIString("Styles Editing:"));
-        stylesEditingGroup.addSetting(WI.settings.stylesShowInlineWarnings, WI.UIString("Show inline warnings"));
-        stylesEditingGroup.addSetting(WI.settings.stylesInsertNewline, WI.UIString("Automatically insert newline"));
-        stylesEditingGroup.addSetting(WI.settings.stylesSelectOnFirstClick, WI.UIString("Select text on first click"));
-
-        generalSettingsView.addSeparator();
-
         generalSettingsView.addSetting(WI.UIString("Network:"), WI.settings.clearNetworkOnNavigate, WI.UIString("Clear when page loads"));
 
         generalSettingsView.addSeparator();
@@ -262,7 +255,7 @@ WI.SettingsTabContentView = class SettingsTabContentView extends WI.TabContentVi
         let experimentalSettingsView = new WI.SettingsView("experimental", WI.UIString("Experimental"));
 
         if (window.CSSAgent) {
-            experimentalSettingsView.addSetting(WI.UIString("Styles Panel:"), WI.settings.experimentalSpreadsheetStyleEditor, WI.UIString("Spreadsheet Style Editor"));
+            experimentalSettingsView.addSetting(WI.UIString("Styles Panel:"), WI.settings.experimentalLegacyStyleEditor, WI.UIString("Legacy Style Editor"));
             experimentalSettingsView.addSeparator();
         }
 
@@ -285,7 +278,7 @@ WI.SettingsTabContentView = class SettingsTabContentView extends WI.TabContentVi
             });
         }
 
-        listenForChange(WI.settings.experimentalSpreadsheetStyleEditor);
+        listenForChange(WI.settings.experimentalLegacyStyleEditor);
         listenForChange(WI.settings.experimentalEnableLayersTab);
 
         this.addSettingsView(experimentalSettingsView);