Title: [271874] trunk/Source/WebInspectorUI
Revision
271874
Author
nvasil...@apple.com
Date
2021-01-25 19:29:03 -0800 (Mon, 25 Jan 2021)

Log Message

Web Inspector: Add experimental setting to show Layout panel in Elements tab
https://bugs.webkit.org/show_bug.cgi?id=220954
<rdar://problem/73590856>

Reviewed by BJ Burg.

Add "Show layout panel" checkbox to the Experimental settings that shows an empty
panel (for now) in Elements tab.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Base/Setting.js:
* UserInterface/Main.html:
* UserInterface/Views/ElementsTabContentView.js:
(WI.ElementsTabContentView):
* UserInterface/Views/LayoutDetailsSidebarPanel.js: Added.
(WI.LayoutDetailsSidebarPanel):
(WI.LayoutDetailsSidebarPanel.prototype.supportsDOMNode):
(WI.LayoutDetailsSidebarPanel.prototype.attached):
(WI.LayoutDetailsSidebarPanel.prototype.detached):
(WI.LayoutDetailsSidebarPanel.prototype.initialLayout):
(WI.LayoutDetailsSidebarPanel.prototype.layout):
(WI.LayoutDetailsSidebarPanel.prototype._mainResourceDidChange):
* UserInterface/Views/SettingsTabContentView.js:
(WI.SettingsTabContentView.prototype._createExperimentalSettingsView):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (271873 => 271874)


--- trunk/Source/WebInspectorUI/ChangeLog	2021-01-26 02:13:11 UTC (rev 271873)
+++ trunk/Source/WebInspectorUI/ChangeLog	2021-01-26 03:29:03 UTC (rev 271874)
@@ -1,3 +1,30 @@
+2021-01-25  Nikita Vasilyev  <nvasil...@apple.com>
+
+        Web Inspector: Add experimental setting to show Layout panel in Elements tab
+        https://bugs.webkit.org/show_bug.cgi?id=220954
+        <rdar://problem/73590856>
+
+        Reviewed by BJ Burg.
+
+        Add "Show layout panel" checkbox to the Experimental settings that shows an empty
+        panel (for now) in Elements tab.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        * UserInterface/Base/Setting.js:
+        * UserInterface/Main.html:
+        * UserInterface/Views/ElementsTabContentView.js:
+        (WI.ElementsTabContentView):
+        * UserInterface/Views/LayoutDetailsSidebarPanel.js: Added.
+        (WI.LayoutDetailsSidebarPanel):
+        (WI.LayoutDetailsSidebarPanel.prototype.supportsDOMNode):
+        (WI.LayoutDetailsSidebarPanel.prototype.attached):
+        (WI.LayoutDetailsSidebarPanel.prototype.detached):
+        (WI.LayoutDetailsSidebarPanel.prototype.initialLayout):
+        (WI.LayoutDetailsSidebarPanel.prototype.layout):
+        (WI.LayoutDetailsSidebarPanel.prototype._mainResourceDidChange):
+        * UserInterface/Views/SettingsTabContentView.js:
+        (WI.SettingsTabContentView.prototype._createExperimentalSettingsView):
+
 2021-01-21  Devin Rousso  <drou...@apple.com>
 
         [Apple Pay] use the first item in `shippingOptions` even when it's not `selected`

Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (271873 => 271874)


--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2021-01-26 02:13:11 UTC (rev 271873)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2021-01-26 03:29:03 UTC (rev 271874)
@@ -822,6 +822,8 @@
 /* Name of Layers Tab */
 localizedStrings["Layers Tab Name"] = "Layers";
 localizedStrings["Layout & Rendering"] = "Layout & Rendering";
+/* Title of the CSS style panel. */
+localizedStrings["Layout @ Styles Sidebar"] = "Layout";
 /* Layout phase timeline records */
 localizedStrings["Layout @ Timeline record"] = "Layout";
 localizedStrings["Layout Invalidated"] = "Layout Invalidated";
@@ -1293,6 +1295,7 @@
 localizedStrings["Show Console"] = "Show Console";
 localizedStrings["Show Console tab"] = "Show Console tab";
 localizedStrings["Show Elements"] = "Show Elements";
+localizedStrings["Show Layout panel"] = "Show Layout panel";
 localizedStrings["Show Path"] = "Show Path";
 localizedStrings["Show Remaining (%d)"] = "Show Remaining (%d)";
 localizedStrings["Show Scope Chain on pause"] = "Show Scope Chain on pause";

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js (271873 => 271874)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js	2021-01-26 02:13:11 UTC (rev 271873)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js	2021-01-26 03:29:03 UTC (rev 271874)
@@ -223,6 +223,7 @@
     experimentalEnablePreviewFeatures: new WI.Setting("experimental-enable-preview-features", true),
     experimentalEnableStylesJumpToEffective: new WI.Setting("experimental-styles-jump-to-effective", false),
     experimentalEnableStylesJumpToVariableDeclaration: new WI.Setting("experimental-styles-jump-to-variable-declaration", false),
+    experimentalEnableLayoutPanel: new WI.Setting("experimental-enable-layout-panel", false),
 
     // Protocol
     protocolLogAsText: new WI.Setting("protocol-log-as-text", false),

Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (271873 => 271874)


--- trunk/Source/WebInspectorUI/UserInterface/Main.html	2021-01-26 02:13:11 UTC (rev 271873)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html	2021-01-26 03:29:03 UTC (rev 271874)
@@ -740,6 +740,7 @@
     <script src=""
     <script src=""
     <script src=""
+    <script src=""
     <script src=""
     <script src=""
     <script src=""

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ElementsTabContentView.js (271873 => 271874)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ElementsTabContentView.js	2021-01-26 02:13:11 UTC (rev 271873)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ElementsTabContentView.js	2021-01-26 03:29:03 UTC (rev 271874)
@@ -30,8 +30,11 @@
         let detailsSidebarPanelConstructors = [
             WI.RulesStyleDetailsSidebarPanel,
             WI.ComputedStyleDetailsSidebarPanel,
+        ];
 
-        ];
+        if (WI.settings.experimentalEnableLayoutPanel.value)
+            detailsSidebarPanelConstructors.push(WI.LayoutDetailsSidebarPanel);
+
         // COMPATIBILITY (iOS 14.0): `CSS.getFontDataForNode` did not exist yet.
         if (InspectorBackend.hasCommand("CSS.getFontDataForNode"))
             detailsSidebarPanelConstructors.push(WI.FontDetailsSidebarPanel);

Added: trunk/Source/WebInspectorUI/UserInterface/Views/LayoutDetailsSidebarPanel.js (0 => 271874)


--- trunk/Source/WebInspectorUI/UserInterface/Views/LayoutDetailsSidebarPanel.js	                        (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LayoutDetailsSidebarPanel.js	2021-01-26 03:29:03 UTC (rev 271874)
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+WI.LayoutDetailsSidebarPanel = class LayoutDetailsSidebarPanel extends WI.DOMDetailsSidebarPanel
+{
+    constructor()
+    {
+        super("layout-details", WI.UIString("Layout", "Layout @ Styles Sidebar", "Title of the CSS style panel."));
+
+        this.element.classList.add("layout-panel");
+    }
+
+    // Public
+
+    supportsDOMNode(nodeToInspect)
+    {
+        return nodeToInspect.nodeType() === Node.ELEMENT_NODE;
+    }
+
+    attached()
+    {
+        super.attached();
+
+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+    }
+
+    detached()
+    {
+        WI.Frame.removeEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+
+        super.detached();
+    }
+
+    // Protected
+
+    initialLayout()
+    {
+        // FIXME: Move the Box Model section here from the Computed panel.
+    }
+
+    layout()
+    {
+        super.layout();
+    }
+
+    // Private
+
+    _mainResourceDidChange(event)
+    {
+        if (!event.target.isMainFrame())
+            return;
+
+        this.needsLayout();
+    }
+};

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js (271873 => 271874)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js	2021-01-26 02:13:11 UTC (rev 271873)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js	2021-01-26 03:29:03 UTC (rev 271874)
@@ -398,6 +398,7 @@
             let stylesGroup = experimentalSettingsView.addGroup(WI.UIString("Styles:"));
             stylesGroup.addSetting(WI.settings.experimentalEnableStylesJumpToEffective, WI.UIString("Show jump to effective property button"));
             stylesGroup.addSetting(WI.settings.experimentalEnableStylesJumpToVariableDeclaration, WI.UIString("Show jump to variable declaration button"));
+            stylesGroup.addSetting(WI.settings.experimentalEnableLayoutPanel, WI.UIString("Show Layout panel"));
 
             experimentalSettingsView.addSeparator();
         }
@@ -421,6 +422,7 @@
         listenForChange(WI.settings.experimentalEnablePreviewFeatures);
 
         if (hasCSSDomain) {
+            listenForChange(WI.settings.experimentalEnableLayoutPanel);
             listenForChange(WI.settings.experimentalEnableStylesJumpToEffective);
             listenForChange(WI.settings.experimentalEnableStylesJumpToVariableDeclaration);
         }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to