Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (203252 => 203253)
--- trunk/Source/WebInspectorUI/ChangeLog 2016-07-14 23:33:13 UTC (rev 203252)
+++ trunk/Source/WebInspectorUI/ChangeLog 2016-07-14 23:37:37 UTC (rev 203253)
@@ -1,3 +1,62 @@
+2016-07-14 Matt Baker <[email protected]>
+
+ Web Inspector: SidebarPanel classes should use View.layout instead of "refresh"
+ https://bugs.webkit.org/show_bug.cgi?id=159745
+ <rdar://problem/27335252>
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Views/ApplicationCacheDetailsSidebarPanel.js:
+ (WebInspector.ApplicationCacheDetailsSidebarPanel.prototype.set applicationCacheFrame):
+ Use needsLayout.
+
+ * UserInterface/Views/CSSStyleDetailsSidebarPanel.js:
+ (WebInspector.CSSStyleDetailsSidebarPanel.prototype.layout):
+ Move refresh logic to layout.
+ (WebInspector.CSSStyleDetailsSidebarPanel.prototype.initialLayout):
+ (WebInspector.CSSStyleDetailsSidebarPanel.prototype._styleSheetAddedOrRemoved):
+ Defer layout to coalesce updates.
+ (WebInspector.CSSStyleDetailsSidebarPanel):
+ (WebInspector.CSSStyleDetailsSidebarPanel.prototype.refresh): Deleted.
+
+ * UserInterface/Views/DOMDetailsSidebarPanel.js:
+ (WebInspector.DOMDetailsSidebarPanel.prototype.set domNode):
+ Use needsLayout.
+
+ * UserInterface/Views/DOMNodeDetailsSidebarPanel.js:
+ Move refresh logic to layout.
+
+ * UserInterface/Views/DetailsSidebarPanel.js:
+ (WebInspector.DetailsSidebarPanel.prototype.shown): Deleted.
+ Base class already forces a layout when shown.
+ (WebInspector.DetailsSidebarPanel.prototype.needsRefresh): Deleted.
+ No longer needed.
+ (WebInspector.DetailsSidebarPanel.prototype.refresh): Deleted.
+ Renamed layout.
+ (WebInspector.DetailsSidebarPanel): Deleted.
+
+ * UserInterface/Views/LayerTreeDetailsSidebarPanel.js:
+ (WebInspector.LayerTreeDetailsSidebarPanel.prototype.supportsDOMNode):
+ (WebInspector.LayerTreeDetailsSidebarPanel.prototype._layerTreeDidChange):
+ Use needsLayout.
+ (WebInspector.LayerTreeDetailsSidebarPanel.prototype.shown):
+ Base class already forces a layout when shown.
+
+ * UserInterface/Views/ResourceDetailsSidebarPanel.js:
+ (WebInspector.ResourceDetailsSidebarPanel.prototype.set resource):
+ Use needsLayout.
+
+ * UserInterface/Views/ScopeChainDetailsSidebarPanel.js:
+ (WebInspector.ScopeChainDetailsSidebarPanel):
+ (WebInspector.ScopeChainDetailsSidebarPanel.prototype.set callFrame):
+ (WebInspector.ScopeChainDetailsSidebarPanel.prototype._addWatchExpression):
+ (WebInspector.ScopeChainDetailsSidebarPanel.prototype._removeWatchExpression):
+ (WebInspector.ScopeChainDetailsSidebarPanel.prototype._clearAllWatchExpressions):
+ (WebInspector.ScopeChainDetailsSidebarPanel.prototype._refreshAllWatchExpressionsButtonClicked):
+ (WebInspector.ScopeChainDetailsSidebarPanel.prototype._didEvaluateExpression):
+ (WebInspector.ScopeChainDetailsSidebarPanel.prototype._mainResourceDidChange):
+ Use needsLayout.
+
2016-07-14 Joseph Pecoraro <[email protected]>
Web Inspector: Maintain selected function when switching between different profile representations
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ApplicationCacheDetailsSidebarPanel.js (203252 => 203253)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ApplicationCacheDetailsSidebarPanel.js 2016-07-14 23:33:13 UTC (rev 203252)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ApplicationCacheDetailsSidebarPanel.js 2016-07-14 23:37:37 UTC (rev 203253)
@@ -89,10 +89,12 @@
this._applicationCacheFrame = applicationCacheFrame;
- this.needsRefresh();
+ this.needsLayout();
}
- refresh()
+ // Protected
+
+ layout()
{
if (!this.applicationCacheFrame)
return;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.js (203252 => 203253)
--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.js 2016-07-14 23:33:13 UTC (rev 203252)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.js 2016-07-14 23:37:37 UTC (rev 203253)
@@ -54,25 +54,6 @@
return nodeToInspect.nodeType() === Node.ELEMENT_NODE;
}
- refresh()
- {
- let domNode = this.domNode;
- if (!domNode)
- return;
-
- this.contentView.element.scrollTop = this._initialScrollOffset;
-
- for (let panel of this._panels) {
- panel.element._savedScrollTop = undefined;
- panel.markAsNeedsRefresh(domNode);
- }
-
- this._updatePseudoClassCheckboxes();
-
- if (!this._classListContainer.hidden)
- this._populateClassToggles();
- }
-
visibilityDidChange()
{
super.visibilityDidChange();
@@ -101,6 +82,25 @@
// Protected
+ layout()
+ {
+ let domNode = this.domNode;
+ if (!domNode)
+ return;
+
+ this.contentView.element.scrollTop = this._initialScrollOffset;
+
+ for (let panel of this._panels) {
+ panel.element._savedScrollTop = undefined;
+ panel.markAsNeedsRefresh(domNode);
+ }
+
+ this._updatePseudoClassCheckboxes();
+
+ if (!this._classListContainer.hidden)
+ this._populateClassToggles();
+ }
+
addEventListeners()
{
let effectiveDOMNode = this.domNode.isPseudoElement() ? this.domNode.parentNode : this.domNode;
@@ -199,8 +199,8 @@
this._addClassInput.addEventListener("keypress", this._addClassInputKeyPressed.bind(this));
this._addClassInput.addEventListener("blur", this._addClassInputBlur.bind(this));
- WebInspector.cssStyleManager.addEventListener(WebInspector.CSSStyleManager.Event.StyleSheetAdded, this.refresh, this);
- WebInspector.cssStyleManager.addEventListener(WebInspector.CSSStyleManager.Event.StyleSheetRemoved, this.refresh, this);
+ WebInspector.cssStyleManager.addEventListener(WebInspector.CSSStyleManager.Event.StyleSheetAdded, this._styleSheetAddedOrRemoved, this);
+ WebInspector.cssStyleManager.addEventListener(WebInspector.CSSStyleManager.Event.StyleSheetRemoved, this._styleSheetAddedOrRemoved, this);
}
sizeDidChange()
@@ -459,6 +459,11 @@
this._selectedPanel.filterDidChange(this._filterBar);
}
+
+ _styleSheetAddedOrRemoved()
+ {
+ this.needsLayout();
+ }
};
WebInspector.CSSStyleDetailsSidebarPanel.NoForcedPseudoClassesScrollOffset = 30; // Default height of the forced pseudo classes container. Updated in sizeDidChange.
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMDetailsSidebarPanel.js (203252 => 203253)
--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMDetailsSidebarPanel.js 2016-07-14 23:33:13 UTC (rev 203252)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMDetailsSidebarPanel.js 2016-07-14 23:37:37 UTC (rev 203253)
@@ -78,7 +78,7 @@
if (this._domNode)
this.addEventListeners();
- this.needsRefresh();
+ this.needsLayout();
}
supportsDOMNode(nodeToInspect)
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js (203252 => 203253)
--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js 2016-07-14 23:33:13 UTC (rev 203252)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js 2016-07-14 23:37:37 UTC (rev 203253)
@@ -94,9 +94,9 @@
}
}
- // Public
+ // Protected
- refresh()
+ layout()
{
var domNode = this.domNode;
if (!domNode)
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DetailsSidebarPanel.js (203252 => 203253)
--- trunk/Source/WebInspectorUI/UserInterface/Views/DetailsSidebarPanel.js 2016-07-14 23:33:13 UTC (rev 203252)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DetailsSidebarPanel.js 2016-07-14 23:37:37 UTC (rev 203253)
@@ -47,29 +47,4 @@
// Implemented by subclasses.
return false;
}
-
- shown()
- {
- super.shown();
-
- if (this._needsRefresh) {
- this._needsRefresh = false;
- this.refresh();
- }
- }
-
- needsRefresh()
- {
- if (!this.selected) {
- this._needsRefresh = true;
- return;
- }
-
- this.refresh();
- }
-
- refresh()
- {
- // Implemented by subclasses.
- }
};
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LayerTreeDetailsSidebarPanel.js (203252 => 203253)
--- trunk/Source/WebInspectorUI/UserInterface/Views/LayerTreeDetailsSidebarPanel.js 2016-07-14 23:33:13 UTC (rev 203252)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LayerTreeDetailsSidebarPanel.js 2016-07-14 23:37:37 UTC (rev 203253)
@@ -50,8 +50,6 @@
console.assert(this.parentSidebar);
- this.needsRefresh();
-
super.shown();
}
@@ -62,8 +60,17 @@
super.hidden();
}
- refresh()
+ // DOMDetailsSidebarPanel Overrides
+
+ supportsDOMNode(nodeToInspect)
{
+ return WebInspector.layerTreeManager.supported && nodeToInspect.nodeType() === Node.ELEMENT_NODE;
+ }
+
+ // Protected
+
+ layout()
+ {
if (!this.domNode)
return;
@@ -73,18 +80,11 @@
});
}
- // DOMDetailsSidebarPanel Overrides
-
- supportsDOMNode(nodeToInspect)
- {
- return WebInspector.layerTreeManager.supported && nodeToInspect.nodeType() === Node.ELEMENT_NODE;
- }
-
// Private
_layerTreeDidChange(event)
{
- this.needsRefresh();
+ this.needsLayout();
}
_showShadowDOMSettingChanged(event)
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceDetailsSidebarPanel.js (203252 => 203253)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceDetailsSidebarPanel.js 2016-07-14 23:33:13 UTC (rev 203252)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceDetailsSidebarPanel.js 2016-07-14 23:37:37 UTC (rev 203253)
@@ -174,10 +174,12 @@
this._resource.addEventListener(WebInspector.Resource.Event.InitiatedResourcesDidChange, this._refreshRelatedResourcesSection, this);
}
- this.needsRefresh();
+ this.needsLayout();
}
- refresh()
+ // Protected
+
+ layout()
{
if (!this._resource)
return;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ScopeChainDetailsSidebarPanel.js (203252 => 203253)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ScopeChainDetailsSidebarPanel.js 2016-07-14 23:33:13 UTC (rev 203252)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ScopeChainDetailsSidebarPanel.js 2016-07-14 23:37:37 UTC (rev 203253)
@@ -58,7 +58,7 @@
this._updateWatchExpressionsNavigationBar();
- this.needsRefresh();
+ this.needsLayout();
// Update on console prompt eval as objects in the scope chain may have changed.
WebInspector.runtimeManager.addEventListener(WebInspector.RuntimeManager.Event.DidEvaluate, this._didEvaluateExpression, this);
@@ -102,10 +102,12 @@
this._callFrame = callFrame;
- this.needsRefresh();
+ this.needsLayout();
}
- refresh()
+ // Protected
+
+ layout()
{
let callFrame = this._callFrame;
@@ -303,7 +305,7 @@
watchExpressions.push(_expression_);
this._watchExpressionsSetting.value = watchExpressions;
- this.needsRefresh();
+ this.needsLayout();
}
_removeWatchExpression(_expression_)
@@ -312,7 +314,7 @@
watchExpressions.remove(_expression_, true);
this._watchExpressionsSetting.value = watchExpressions;
- this.needsRefresh();
+ this.needsLayout();
}
_clearAllWatchExpressions()
@@ -319,7 +321,7 @@
{
this._watchExpressionsSetting.value = [];
- this.needsRefresh();
+ this.needsLayout();
}
_addWatchExpressionButtonClicked(event)
@@ -396,7 +398,7 @@
_refreshAllWatchExpressionsButtonClicked(event)
{
- this.needsRefresh();
+ this.needsLayout();
}
_clearAllWatchExpressionsButtonClicked(event)
@@ -409,7 +411,7 @@
if (event.data.objectGroup === WebInspector.ScopeChainDetailsSidebarPanel.WatchExpressionsObjectGroupName)
return;
- this.needsRefresh();
+ this.needsLayout();
}
_mainResourceDidChange(event)
@@ -417,7 +419,7 @@
if (!event.target.isMainFrame())
return;
- this.needsRefresh();
+ this.needsLayout();
}
_objectTreeElementAddContextMenuItems(objectTreeElement, contextMenu)