Title: [204513] trunk/Source/WebInspectorUI
Revision
204513
Author
[email protected]
Date
2016-08-16 10:26:16 -0700 (Tue, 16 Aug 2016)

Log Message

Web Inspector: Do not request Scope Chain lists if section is collapsed (mainly Global Variables)
https://bugs.webkit.org/show_bug.cgi?id=140567
<rdar://problem/19504745>

Patch by Joseph Pecoraro <[email protected]> on 2016-08-16
Reviewed by Timothy Hatcher.

* UserInterface/Main.html:
New file name.

* UserInterface/Views/DOMNodeDetailsSidebarPanel.js:
(WebInspector.DOMNodeDetailsSidebarPanel.prototype._refreshProperties.fillSection):
(WebInspector.DOMNodeDetailsSidebarPanel.prototype._refreshProperties):
Avoid fetching object properties until the user expands the section.

* UserInterface/Views/ScopeChainDetailsSidebarPanel.js:
(WebInspector.ScopeChainDetailsSidebarPanel.prototype._generateCallFramesSection):
(WebInspector.ScopeChainDetailsSidebarPanel.prototype._generateWatchExpressionsSection):
Avoid fetching scope variable properties until the user expands the section.

* UserInterface/Views/ObjectPropertiesDetailSectionRow.js: Renamed from Source/WebInspectorUI/UserInterface/Views/DetailsSectionPropertiesRow.js.
(WebInspector.ObjectPropertiesDetailSectionRow):
(WebInspector.ObjectPropertiesDetailSectionRow.prototype.get objectTree):
(WebInspector.ObjectPropertiesDetailSectionRow.prototype._detailsSectionCollapsedStateChanged):
Rename and simplify the class since it always has an ObjectTreeView.
By default the section will auto-expand the ObjectTreeView, however
if provided a details section group, it will defer expanion until
the group expands.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (204512 => 204513)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-08-16 17:14:42 UTC (rev 204512)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-08-16 17:26:16 UTC (rev 204513)
@@ -1,3 +1,33 @@
+2016-08-16  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Do not request Scope Chain lists if section is collapsed (mainly Global Variables)
+        https://bugs.webkit.org/show_bug.cgi?id=140567
+        <rdar://problem/19504745>
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Main.html:
+        New file name.
+
+        * UserInterface/Views/DOMNodeDetailsSidebarPanel.js:
+        (WebInspector.DOMNodeDetailsSidebarPanel.prototype._refreshProperties.fillSection):
+        (WebInspector.DOMNodeDetailsSidebarPanel.prototype._refreshProperties):
+        Avoid fetching object properties until the user expands the section.
+
+        * UserInterface/Views/ScopeChainDetailsSidebarPanel.js:
+        (WebInspector.ScopeChainDetailsSidebarPanel.prototype._generateCallFramesSection):
+        (WebInspector.ScopeChainDetailsSidebarPanel.prototype._generateWatchExpressionsSection):
+        Avoid fetching scope variable properties until the user expands the section.
+
+        * UserInterface/Views/ObjectPropertiesDetailSectionRow.js: Renamed from Source/WebInspectorUI/UserInterface/Views/DetailsSectionPropertiesRow.js.
+        (WebInspector.ObjectPropertiesDetailSectionRow):
+        (WebInspector.ObjectPropertiesDetailSectionRow.prototype.get objectTree):
+        (WebInspector.ObjectPropertiesDetailSectionRow.prototype._detailsSectionCollapsedStateChanged):
+        Rename and simplify the class since it always has an ObjectTreeView.
+        By default the section will auto-expand the ObjectTreeView, however
+        if provided a details section group, it will defer expanion until
+        the group expands.
+
 2016-08-16  Devin Rousso  <[email protected]>
 
         Web Inspector: add "Copy Selected" context menu item to Console

Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (204512 => 204513)


--- trunk/Source/WebInspectorUI/UserInterface/Main.html	2016-08-16 17:14:42 UTC (rev 204512)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html	2016-08-16 17:26:16 UTC (rev 204513)
@@ -449,7 +449,6 @@
     <script src=""
     <script src=""
     <script src=""
-    <script src=""
     <script src=""
     <script src=""
 
@@ -570,6 +569,7 @@
     <script src=""
     <script src=""
     <script src=""
+    <script src=""
     <script src=""
     <script src=""
     <script src=""

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js (204512 => 204513)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js	2016-08-16 17:14:42 UTC (rev 204512)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js	2016-08-16 17:26:16 UTC (rev 204513)
@@ -207,7 +207,7 @@
                 objectTree.showOnlyProperties();
 
                 var detailsSection = new WebInspector.DetailsSection(prototype.description.hash + "-prototype-properties", title, null, null, true);
-                detailsSection.groups[0].rows = [new WebInspector.DetailsSectionPropertiesRow(objectTree)];
+                detailsSection.groups[0].rows = [new WebInspector.ObjectPropertiesDetailSectionRow(objectTree, detailsSection)];
 
                 element.appendChild(detailsSection.element);
             }

Deleted: trunk/Source/WebInspectorUI/UserInterface/Views/DetailsSectionPropertiesRow.js (204512 => 204513)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DetailsSectionPropertiesRow.js	2016-08-16 17:14:42 UTC (rev 204512)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DetailsSectionPropertiesRow.js	2016-08-16 17:26:16 UTC (rev 204513)
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2013, 2015 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.DetailsSectionPropertiesRow = class DetailsSectionPropertiesRow extends WebInspector.DetailsSectionRow
-{
-    constructor(propertiesSection, emptyMessage)
-    {
-        super(emptyMessage);
-
-        this.element.classList.add("properties", WebInspector.SyntaxHighlightedStyleClassName);
-
-        this.propertiesSection = propertiesSection;
-    }
-
-    // Public
-
-    get propertiesSection()
-    {
-        return this._propertiesSection;
-    }
-
-    set propertiesSection(propertiesSection)
-    {
-        this._propertiesSection = propertiesSection || null;
-
-        if (propertiesSection) {
-            // Call expand to cause the section to populate.
-            propertiesSection.expand();
-
-            this.hideEmptyMessage();
-            this.element.appendChild(propertiesSection.element);
-        } else
-            this.showEmptyMessage();
-    }
-};

Copied: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPropertiesDetailSectionRow.js (from rev 204512, trunk/Source/WebInspectorUI/UserInterface/Views/DetailsSectionPropertiesRow.js) (0 => 204513)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPropertiesDetailSectionRow.js	                        (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPropertiesDetailSectionRow.js	2016-08-16 17:26:16 UTC (rev 204513)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2013, 2015 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.ObjectPropertiesDetailSectionRow = class ObjectPropertiesDetailSectionRow extends WebInspector.DetailsSectionRow
+{
+    constructor(objectTree, sectionForDeferredExpand)
+    {
+        super();
+
+        console.assert(objectTree instanceof WebInspector.ObjectTreeView);
+        console.assert(!sectionForDeferredExpand || sectionForDeferredExpand instanceof WebInspector.DetailsSection);
+
+        this._objectTree = objectTree;
+
+        this.hideEmptyMessage();
+        this.element.classList.add("properties", WebInspector.SyntaxHighlightedStyleClassName);
+        this.element.appendChild(objectTree.element);
+
+        if (sectionForDeferredExpand && sectionForDeferredExpand.collapsed)
+            sectionForDeferredExpand.addEventListener(WebInspector.DetailsSection.Event.CollapsedStateChanged, this._detailsSectionCollapsedStateChanged, this);
+        else
+            this._objectTree.expand();
+    }
+
+    // Public
+
+    get objectTree() { return this._objectTree; }
+
+    // Private
+
+    _detailsSectionCollapsedStateChanged(event)
+    {
+        console.assert(!event.target.collapsed);
+
+        this._objectTree.expand();
+
+        event.target.removeEventListener(WebInspector.DetailsSection.Event.CollapsedStateChanged, this._detailsSectionCollapsedStateChanged, this);
+    }
+};

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ScopeChainDetailsSidebarPanel.js (204512 => 204513)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ScopeChainDetailsSidebarPanel.js	2016-08-16 17:14:42 UTC (rev 204512)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ScopeChainDetailsSidebarPanel.js	2016-08-16 17:26:16 UTC (rev 204513)
@@ -224,6 +224,7 @@
             }
 
             let detailsSectionIdentifier = scope.type + "-" + sectionCountByType.get(scope.type);
+            let detailsSection = new WebInspector.DetailsSection(detailsSectionIdentifier, title, null, null, collapsedByDefault);
 
             // FIXME: This just puts two ObjectTreeViews next to each other, but that means
             // that properties are not nicely sorted between the two separate lists.
@@ -244,12 +245,9 @@
                 treeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementAdded, this._treeElementAdded.bind(this, detailsSectionIdentifier), this);
                 treeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementDisclosureDidChanged, this._treeElementDisclosureDidChange.bind(this, detailsSectionIdentifier), this);
 
-                // FIXME: <https://webkit.org/b/140567> Web Inspector: Do not request Scope Chain lists if section is collapsed (mainly Global Variables)
-                // This autoexpands the ObjectTreeView and fetches all properties. Should wait to see if we are collapsed or not.
-                rows.push(new WebInspector.DetailsSectionPropertiesRow(objectTree));
+                rows.push(new WebInspector.ObjectPropertiesDetailSectionRow(objectTree, detailsSection));
             }
 
-            let detailsSection = new WebInspector.DetailsSection(detailsSectionIdentifier, title, null, null, collapsedByDefault);
             detailsSection.groups[0].rows = rows;
             detailsSections.push(detailsSection);
         }
@@ -295,7 +293,7 @@
         }
 
         return Promise.all(promises).then(function() {
-            return Promise.resolve(new WebInspector.DetailsSectionPropertiesRow(objectTree));
+            return Promise.resolve(new WebInspector.ObjectPropertiesDetailSectionRow(objectTree));
         });
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to