Title: [219888] trunk/Source/WebInspectorUI
Revision
219888
Author
nvasil...@apple.com
Date
2017-07-25 14:43:14 -0700 (Tue, 25 Jul 2017)

Log Message

Web Inspector: Styles: Add a switch for Spreadsheet model style editor to experimental settings
https://bugs.webkit.org/show_bug.cgi?id=174741
<rdar://problem/33467954>

Reviewed by Brian Burg.

Show a blank panel when Spreadsheet Style Editor is enabled.

* UserInterface/Base/Setting.js:
* UserInterface/Main.html:
* UserInterface/Views/CSSStyleDetailsSidebarPanel.js:
(WebInspector.CSSStyleDetailsSidebarPanel):
(WebInspector.CSSStyleDetailsSidebarPanel.prototype.computedStyleDetailsPanelShowProperty):
* UserInterface/Views/RulesStyleSpreadsheetDetailsPanel.js: Added.
(WebInspector.RulesStyleSpreadsheetDetailsPanel):
(WebInspector.RulesStyleSpreadsheetDetailsPanel.prototype.filterDidChange):
(WebInspector.RulesStyleSpreadsheetDetailsPanel.prototype.scrollToSectionAndHighlightProperty):

* UserInterface/Views/SettingsTabContentView.css:
(.content-view.settings > .settings-view > .container.hidden):
(.content-view.settings > .settings-view > .container-centered):
(.content-view.settings > .settings-view > .container button):
* UserInterface/Views/SettingsTabContentView.js:
(WebInspector.SettingsTabContentView.prototype._createDebugSettingsView):
* UserInterface/Views/SettingsView.js:
(WebInspector.SettingsView.prototype.addCenteredContainer):
(WebInspector.SettingsView):
Show "Reload Web Inspector" button when Spreadsheet Style Editor setting is modified.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (219887 => 219888)


--- trunk/Source/WebInspectorUI/ChangeLog	2017-07-25 21:22:29 UTC (rev 219887)
+++ trunk/Source/WebInspectorUI/ChangeLog	2017-07-25 21:43:14 UTC (rev 219888)
@@ -1,3 +1,34 @@
+2017-07-25  Nikita Vasilyev  <nvasil...@apple.com>
+
+        Web Inspector: Styles: Add a switch for Spreadsheet model style editor to experimental settings
+        https://bugs.webkit.org/show_bug.cgi?id=174741
+        <rdar://problem/33467954>
+
+        Reviewed by Brian Burg.
+
+        Show a blank panel when Spreadsheet Style Editor is enabled.
+
+        * UserInterface/Base/Setting.js:
+        * UserInterface/Main.html:
+        * UserInterface/Views/CSSStyleDetailsSidebarPanel.js:
+        (WebInspector.CSSStyleDetailsSidebarPanel):
+        (WebInspector.CSSStyleDetailsSidebarPanel.prototype.computedStyleDetailsPanelShowProperty):
+        * UserInterface/Views/RulesStyleSpreadsheetDetailsPanel.js: Added.
+        (WebInspector.RulesStyleSpreadsheetDetailsPanel):
+        (WebInspector.RulesStyleSpreadsheetDetailsPanel.prototype.filterDidChange):
+        (WebInspector.RulesStyleSpreadsheetDetailsPanel.prototype.scrollToSectionAndHighlightProperty):
+
+        * UserInterface/Views/SettingsTabContentView.css:
+        (.content-view.settings > .settings-view > .container.hidden):
+        (.content-view.settings > .settings-view > .container-centered):
+        (.content-view.settings > .settings-view > .container button):
+        * UserInterface/Views/SettingsTabContentView.js:
+        (WebInspector.SettingsTabContentView.prototype._createDebugSettingsView):
+        * UserInterface/Views/SettingsView.js:
+        (WebInspector.SettingsView.prototype.addCenteredContainer):
+        (WebInspector.SettingsView):
+        Show "Reload Web Inspector" button when Spreadsheet Style Editor setting is modified.
+
 2017-07-25  Devin Rousso  <drou...@apple.com>
 
         Web Inspector: add context menu item for taking a screenshot of a node

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js (219887 => 219888)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js	2017-07-25 21:22:29 UTC (rev 219887)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js	2017-07-25 21:43:14 UTC (rev 219888)
@@ -124,4 +124,5 @@
 
     // Experimental
     experimentalShowCanvasContextsInResources: new WebInspector.Setting("experimental-show-canvas-contexts-in-resources", false),
+    experimentalSpreadsheetStyleEditor: new WebInspector.Setting("experimental-spreadsheet-style-editor", false),
 };

Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (219887 => 219888)


--- trunk/Source/WebInspectorUI/UserInterface/Main.html	2017-07-25 21:22:29 UTC (rev 219887)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html	2017-07-25 21:43:14 UTC (rev 219888)
@@ -649,6 +649,7 @@
     <script src=""
     <script src=""
     <script src=""
+    <script src=""
     <script src=""
     <script src=""
     <script src=""

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.js (219887 => 219888)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.js	2017-07-25 21:22:29 UTC (rev 219887)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.js	2017-07-25 21:43:14 UTC (rev 219888)
@@ -35,13 +35,18 @@
         this._rulesStyleDetailsPanel = new WebInspector.RulesStyleDetailsPanel(this);
         this._visualStyleDetailsPanel = new WebInspector.VisualStyleDetailsPanel(this);
 
-        this._panels = [this._computedStyleDetailsPanel, this._rulesStyleDetailsPanel, this._visualStyleDetailsPanel];
-        this._panelNavigationInfo = [this._computedStyleDetailsPanel.navigationInfo, this._rulesStyleDetailsPanel.navigationInfo, this._visualStyleDetailsPanel.navigationInfo];
+        if (WebInspector.settings.experimentalSpreadsheetStyleEditor.value)
+            this._activeRulesStyleDetailsPanel = new WebInspector.RulesStyleSpreadsheetDetailsPanel(this);
+        else
+            this._activeRulesStyleDetailsPanel = this._rulesStyleDetailsPanel;
 
-        this._lastSelectedPanelSetting = new WebInspector.Setting("last-selected-style-details-panel", this._rulesStyleDetailsPanel.navigationInfo.identifier);
+        this._panels = [this._computedStyleDetailsPanel, this._activeRulesStyleDetailsPanel, this._visualStyleDetailsPanel];
+        this._panelNavigationInfo = [this._computedStyleDetailsPanel.navigationInfo, this._activeRulesStyleDetailsPanel.navigationInfo, this._visualStyleDetailsPanel.navigationInfo];
+
+        this._lastSelectedPanelSetting = new WebInspector.Setting("last-selected-style-details-panel", this._activeRulesStyleDetailsPanel.navigationInfo.identifier);
         this._classListContainerToggledSetting = new WebInspector.Setting("class-list-container-toggled", false);
 
-        this._initiallySelectedPanel = this._panelMatchingIdentifier(this._lastSelectedPanelSetting.value) || this._rulesStyleDetailsPanel;
+        this._initiallySelectedPanel = this._panelMatchingIdentifier(this._lastSelectedPanelSetting.value) || this._activeRulesStyleDetailsPanel;
 
         this._navigationItem = new WebInspector.ScopeRadioButtonNavigationItem(this.identifier, this.displayName, this._panelNavigationInfo, this._initiallySelectedPanel.navigationInfo);
         this._navigationItem.addEventListener(WebInspector.ScopeRadioButtonNavigationItem.Event.SelectedItemChanged, this._handleSelectedItemChanged, this);
@@ -76,8 +81,8 @@
 
     computedStyleDetailsPanelShowProperty(property)
     {
-        this._rulesStyleDetailsPanel.scrollToSectionAndHighlightProperty(property);
-        this._switchPanels(this._rulesStyleDetailsPanel);
+        this._activeRulesStyleDetailsPanel.scrollToSectionAndHighlightProperty(property);
+        this._switchPanels(this._activeRulesStyleDetailsPanel);
 
         this._navigationItem.selectedItemIdentifier = this._lastSelectedPanelSetting.value;
     }

Copied: trunk/Source/WebInspectorUI/UserInterface/Views/RulesStyleSpreadsheetDetailsPanel.js (from rev 219887, trunk/Source/WebInspectorUI/UserInterface/Views/SettingsView.js) (0 => 219888)


--- trunk/Source/WebInspectorUI/UserInterface/Views/RulesStyleSpreadsheetDetailsPanel.js	                        (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/RulesStyleSpreadsheetDetailsPanel.js	2017-07-25 21:43:14 UTC (rev 219888)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.RulesStyleSpreadsheetDetailsPanel = class RulesStyleSpreadsheetDetailsPanel extends WebInspector.StyleDetailsPanel
+{
+    constructor(delegate)
+    {
+        super(delegate, "rules", "rules", WebInspector.UIString("Styles \u2014 Rules"));
+    }
+
+    // Public
+
+    filterDidChange()
+    {
+        // Called by WebInspector.CSSStyleDetailsSidebarPanel.prototype._filterDidChange.
+        // Unimplemented.
+    }
+
+    scrollToSectionAndHighlightProperty(property)
+    {
+        // Unimplemented.
+    }
+};

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.css (219887 => 219888)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.css	2017-07-25 21:22:29 UTC (rev 219887)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.css	2017-07-25 21:43:14 UTC (rev 219888)
@@ -59,6 +59,19 @@
     font-size: 13px;
 }
 
+.content-view.settings > .settings-view > .container.hidden {
+    display: none;
+}
+
+.content-view.settings > .settings-view > .container-centered {
+    display: block;
+    text-align: center;
+}
+
+.content-view.settings > .settings-view > .container button {
+    font-size: inherit;
+}
+
 .content-view.settings > .settings-view > .container > .title {
     margin-top: 2px;
     width: 50%;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js (219887 => 219888)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js	2017-07-25 21:22:29 UTC (rev 219887)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js	2017-07-25 21:43:14 UTC (rev 219888)
@@ -266,6 +266,23 @@
             this._debugSettingsView.addSetting(WebInspector.UIString("Canvas:"), WebInspector.settings.experimentalShowCanvasContextsInResources, WebInspector.UIString("Show Contexts in Resources Tab"));
         }
 
+        this._debugSettingsView.addSeparator();
+        this._debugSettingsView.addSetting(WebInspector.unlocalizedString("Styles Panel:"), WebInspector.settings.experimentalSpreadsheetStyleEditor, WebInspector.unlocalizedString("Spreadsheet Style Editor"));
+
+        this._debugSettingsView.addSeparator();
+
+        let reloadInspectorButton = document.createElement("button");
+        reloadInspectorButton.textContent = WebInspector.unlocalizedString("Reload Web Inspector");
+        reloadInspectorButton.addEventListener("click", () => { window.location.reload(); });
+
+        let reloadInspectorContainerElement = this._debugSettingsView.addCenteredContainer(reloadInspectorButton, WebInspector.unlocalizedString("for changes to take effect"));
+        reloadInspectorContainerElement.classList.add("hidden");
+
+        let experimentalSpreadsheetStyleEditorInitialValue = WebInspector.settings.experimentalSpreadsheetStyleEditor.value;
+        WebInspector.settings.experimentalSpreadsheetStyleEditor.addEventListener(WebInspector.Setting.Event.Changed, () => {
+            reloadInspectorContainerElement.classList.toggle("hidden", experimentalSpreadsheetStyleEditorInitialValue === WebInspector.settings.experimentalSpreadsheetStyleEditor.value);
+        });
+
         this.addSettingsView(this._debugSettingsView);
     }
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SettingsView.js (219887 => 219888)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SettingsView.js	2017-07-25 21:22:29 UTC (rev 219887)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SettingsView.js	2017-07-25 21:43:14 UTC (rev 219888)
@@ -68,6 +68,16 @@
         let separatorElement = this.element.appendChild(document.createElement("div"));
         separatorElement.classList.add("separator");
     }
+
+    addCenteredContainer(...nodes)
+    {
+        let containerElement = document.createElement("div");
+        containerElement.append(...nodes);
+        containerElement.classList.add("container", "container-centered");
+        this.element.append(containerElement);
+
+        return containerElement;
+    }
 };
 
 WebInspector.SettingsView.EditorType = {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to