Web Inspector: Use debounce proxies in a couple more places
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Apr 2016 21:58:46 +0000 (21:58 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Apr 2016 21:58:46 +0000 (21:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=156759

Reviewed by Joseph Pecoraro.

* UserInterface/Views/ContentBrowser.js:
(WebInspector.ContentBrowser.prototype._dispatchCurrentRepresentedObjectsDidChangeEvent):
(WebInspector.ContentBrowser.prototype._contentViewSelectionPathComponentDidChange):
(WebInspector.ContentBrowser.prototype._contentViewSupplementalRepresentedObjectsDidChange):
(WebInspector.ContentBrowser.prototype._dispatchCurrentRepresentedObjectsDidChangeEventSoon): Deleted.
* UserInterface/Views/DOMTreeUpdater.js:
(WebInspector.DOMTreeUpdater.prototype._attributesUpdated):
(WebInspector.DOMTreeUpdater.prototype._characterDataModified):
(WebInspector.DOMTreeUpdater.prototype._nodeInserted):
(WebInspector.DOMTreeUpdater.prototype._nodeRemoved):
(WebInspector.DOMTreeUpdater.prototype._updateModifiedNodes):
(WebInspector.DOMTreeUpdater.prototype._updateModifiedNodesSoon): Deleted.
* UserInterface/Views/NavigationSidebarPanel.js:
(WebInspector.NavigationSidebarPanel):
(WebInspector.NavigationSidebarPanel.prototype._updateContentOverflowShadowVisibility):
(WebInspector.NavigationSidebarPanel.prototype._treeElementAddedOrChanged):
(WebInspector.NavigationSidebarPanel.prototype._treeElementDisclosureDidChange):
(WebInspector.NavigationSidebarPanel.prototype._updateContentOverflowShadowVisibilitySoon): Deleted.

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

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js
Source/WebInspectorUI/UserInterface/Views/DOMTreeUpdater.js
Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js

index 71f1609..49cc8d5 100644 (file)
@@ -1,5 +1,32 @@
 2016-04-19  Timothy Hatcher  <timothy@apple.com>
 
+        Web Inspector: Use debounce proxies in a couple more places
+
+        https://bugs.webkit.org/show_bug.cgi?id=156759
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Views/ContentBrowser.js:
+        (WebInspector.ContentBrowser.prototype._dispatchCurrentRepresentedObjectsDidChangeEvent):
+        (WebInspector.ContentBrowser.prototype._contentViewSelectionPathComponentDidChange):
+        (WebInspector.ContentBrowser.prototype._contentViewSupplementalRepresentedObjectsDidChange):
+        (WebInspector.ContentBrowser.prototype._dispatchCurrentRepresentedObjectsDidChangeEventSoon): Deleted.
+        * UserInterface/Views/DOMTreeUpdater.js:
+        (WebInspector.DOMTreeUpdater.prototype._attributesUpdated):
+        (WebInspector.DOMTreeUpdater.prototype._characterDataModified):
+        (WebInspector.DOMTreeUpdater.prototype._nodeInserted):
+        (WebInspector.DOMTreeUpdater.prototype._nodeRemoved):
+        (WebInspector.DOMTreeUpdater.prototype._updateModifiedNodes):
+        (WebInspector.DOMTreeUpdater.prototype._updateModifiedNodesSoon): Deleted.
+        * UserInterface/Views/NavigationSidebarPanel.js:
+        (WebInspector.NavigationSidebarPanel):
+        (WebInspector.NavigationSidebarPanel.prototype._updateContentOverflowShadowVisibility):
+        (WebInspector.NavigationSidebarPanel.prototype._treeElementAddedOrChanged):
+        (WebInspector.NavigationSidebarPanel.prototype._treeElementDisclosureDidChange):
+        (WebInspector.NavigationSidebarPanel.prototype._updateContentOverflowShadowVisibilitySoon): Deleted.
+
+2016-04-19  Timothy Hatcher  <timothy@apple.com>
+
         Web Inspector: Make debounce use an ES6 Proxy
 
         https://bugs.webkit.org/show_bug.cgi?id=156756
index 48b7302..738f651 100644 (file)
@@ -421,19 +421,9 @@ WebInspector.ContentBrowser = class ContentBrowser extends WebInspector.View
         }
     }
 
-    _dispatchCurrentRepresentedObjectsDidChangeEventSoon()
-    {
-        if (this._currentRepresentedObjectsDidChangeTimeout)
-            return;
-        this._currentRepresentedObjectsDidChangeTimeout = setTimeout(this._dispatchCurrentRepresentedObjectsDidChangeEvent.bind(this), 0);
-    }
-
     _dispatchCurrentRepresentedObjectsDidChangeEvent()
     {
-        if (this._currentRepresentedObjectsDidChangeTimeout) {
-            clearTimeout(this._currentRepresentedObjectsDidChangeTimeout);
-            delete this._currentRepresentedObjectsDidChangeTimeout;
-        }
+        this._dispatchCurrentRepresentedObjectsDidChangeEvent.cancelDebounce();
 
         this.dispatchEventToListeners(WebInspector.ContentBrowser.Event.CurrentRepresentedObjectsDidChange);
     }
@@ -450,7 +440,7 @@ WebInspector.ContentBrowser = class ContentBrowser extends WebInspector.View
 
         this._navigationBar.needsLayout();
 
-        this._dispatchCurrentRepresentedObjectsDidChangeEventSoon();
+        this.soon._dispatchCurrentRepresentedObjectsDidChangeEvent();
     }
 
     _contentViewSupplementalRepresentedObjectsDidChange(event)
@@ -458,7 +448,7 @@ WebInspector.ContentBrowser = class ContentBrowser extends WebInspector.View
         if (event.target !== this.currentContentView)
             return;
 
-        this._dispatchCurrentRepresentedObjectsDidChangeEventSoon();
+        this.soon._dispatchCurrentRepresentedObjectsDidChangeEvent();
     }
 
     _currentContentViewDidChange(event)
index ee5d2b7..6b6260e 100644 (file)
@@ -57,28 +57,28 @@ WebInspector.DOMTreeUpdater.prototype = {
     {
         this._recentlyModifiedNodes.push({node: event.data.node, updated: true, attribute: event.data.name});
         if (this._treeOutline._visible)
-            this._updateModifiedNodesSoon();
+            this.soon._updateModifiedNodes();
     },
 
     _characterDataModified: function(event)
     {
         this._recentlyModifiedNodes.push({node: event.data.node, updated: true});
         if (this._treeOutline._visible)
-            this._updateModifiedNodesSoon();
+            this.soon._updateModifiedNodes();
     },
 
     _nodeInserted: function(event)
     {
         this._recentlyModifiedNodes.push({node: event.data.node, parent: event.data.parent, inserted: true});
         if (this._treeOutline._visible)
-            this._updateModifiedNodesSoon();
+            this.soon._updateModifiedNodes();
     },
 
     _nodeRemoved: function(event)
     {
         this._recentlyModifiedNodes.push({node: event.data.node, parent: event.data.parent, removed: true});
         if (this._treeOutline._visible)
-            this._updateModifiedNodesSoon();
+            this.soon._updateModifiedNodes();
     },
 
     _childNodeCountUpdated: function(event)
@@ -88,19 +88,9 @@ WebInspector.DOMTreeUpdater.prototype = {
             treeElement.hasChildren = event.data.hasChildNodes();
     },
 
-    _updateModifiedNodesSoon: function()
-    {
-        if (this._updateModifiedNodesTimeout)
-            return;
-        this._updateModifiedNodesTimeout = setTimeout(this._updateModifiedNodes.bind(this), 0);
-    },
-
     _updateModifiedNodes: function()
     {
-        if (this._updateModifiedNodesTimeout) {
-            clearTimeout(this._updateModifiedNodesTimeout);
-            this._updateModifiedNodesTimeout = null;
-        }
+        this._updateModifiedNodes.cancelDebounce();
 
         let updatedParentTreeElements = [];
         for (let recentlyModifiedNode of this._recentlyModifiedNodes) {
index 84c5347..06d6826 100644 (file)
@@ -33,7 +33,7 @@ WebInspector.NavigationSidebarPanel = class NavigationSidebarPanel extends WebIn
 
         this._visibleContentTreeOutlines = new Set;
 
-        this.contentView.element.addEventListener("scroll", this._updateContentOverflowShadowVisibilitySoon.bind(this));
+        this.contentView.element.addEventListener("scroll", this.soon._updateContentOverflowShadowVisibility);
 
         this._contentTreeOutline = this.createContentTreeOutline(true);
         this._selectedContentTreeOutline = null;
@@ -53,7 +53,7 @@ WebInspector.NavigationSidebarPanel = class NavigationSidebarPanel extends WebIn
             this.element.appendChild(this._topOverflowShadowElement);
         }
 
-        this._boundUpdateContentOverflowShadowVisibility = this._updateContentOverflowShadowVisibilitySoon.bind(this);
+        this._boundUpdateContentOverflowShadowVisibility = this.soon._updateContentOverflowShadowVisibility;
         window.addEventListener("resize", this._boundUpdateContentOverflowShadowVisibility);
 
         this._filtersSetting = new WebInspector.Setting(identifier + "-navigation-sidebar-filters", {});
@@ -486,18 +486,10 @@ WebInspector.NavigationSidebarPanel = class NavigationSidebarPanel extends WebIn
     }
 
     // Private
-    
-    _updateContentOverflowShadowVisibilitySoon()
-    {
-        if (this._updateContentOverflowShadowVisibilityIdentifier)
-            return;
-
-        this._updateContentOverflowShadowVisibilityIdentifier = setTimeout(this._updateContentOverflowShadowVisibility.bind(this), 0);
-    }
 
     _updateContentOverflowShadowVisibility()
     {
-        this._updateContentOverflowShadowVisibilityIdentifier = undefined;
+        this._updateContentOverflowShadowVisibility.cancelDebounce();
 
         let scrollHeight = this.contentView.element.scrollHeight;
         let offsetHeight = this.contentView.element.offsetHeight;
@@ -636,7 +628,7 @@ WebInspector.NavigationSidebarPanel = class NavigationSidebarPanel extends WebIn
         }
 
         this._checkForEmptyFilterResults();
-        this._updateContentOverflowShadowVisibilitySoon();
+        this.soon._updateContentOverflowShadowVisibility();
 
         if (this.selected)
             this._checkElementsForPendingViewStateCookie([treeElement]);
@@ -646,7 +638,7 @@ WebInspector.NavigationSidebarPanel = class NavigationSidebarPanel extends WebIn
 
     _treeElementDisclosureDidChange(event)
     {
-        this._updateContentOverflowShadowVisibilitySoon();
+        this.soon._updateContentOverflowShadowVisibility();
     }
 
     _treeSelectionDidChange(event)