Web Inspector: Reduce synchronous view layouts
authormattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Nov 2015 05:44:32 +0000 (05:44 +0000)
committermattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Nov 2015 05:44:32 +0000 (05:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=151058

Reviewed by Timothy Hatcher.

Replace calls to View.updateLayout with needsLayout, when a synchronous layout
isn't absolutely necessary.

* UserInterface/Models/BackForwardEntry.js:
(WebInspector.BackForwardEntry.prototype.prepareToShow):

* UserInterface/Views/ApplicationCacheFrameContentView.js:
(WebInspector.ApplicationCacheFrameContentView.prototype.updateLayout): Deleted.
View subclasses shouldn't override updateLayout.

* UserInterface/Views/ButtonNavigationItem.js:
(WebInspector.ButtonNavigationItem.prototype.set label):

* UserInterface/Views/ContentBrowser.js:
(WebInspector.ContentBrowser.prototype._contentViewSelectionPathComponentDidChange):
(WebInspector.ContentBrowser.prototype._currentContentViewDidChange):
(WebInspector.ContentBrowser.prototype._contentViewNavigationItemsDidChange):

* UserInterface/Views/DatabaseTableContentView.js:
(WebInspector.DatabaseTableContentView.prototype._queryFinished):
Just update DataGrid's layout, not the whole view. The grid is the only subview
so the result is identical, but the intent is cleared this way.
(WebInspector.DatabaseTableContentView.prototype.updateLayout): Deleted.
View subclasses shouldn't override updateLayout.

* UserInterface/Views/LogContentView.js:
(WebInspector.LogContentView.prototype.didAppendConsoleMessageView):
(WebInspector.LogContentView.prototype.promptDidChangeHeight): Deleted.
Unused code.

* UserInterface/Views/Sidebar.js:
(WebInspector.Sidebar.prototype.set width):
(WebInspector.Sidebar.prototype.set collapsed):

* UserInterface/Views/TextResourceContentView.js:
(WebInspector.TextResourceContentView.prototype._contentWillPopulate):
Add TextEditor as a subview.
(WebInspector.TextResourceContentView.prototype.updateLayout): Deleted.
View subclasses shouldn't override updateLayout.

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

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Models/BackForwardEntry.js
Source/WebInspectorUI/UserInterface/Views/ApplicationCacheFrameContentView.js
Source/WebInspectorUI/UserInterface/Views/ButtonNavigationItem.js
Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js
Source/WebInspectorUI/UserInterface/Views/DatabaseTableContentView.js
Source/WebInspectorUI/UserInterface/Views/LogContentView.js
Source/WebInspectorUI/UserInterface/Views/Sidebar.js
Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js

index c0e1a4c..72009f0 100644 (file)
@@ -1,5 +1,53 @@
 2015-11-18  Matt Baker  <mattbaker@apple.com>
 
+        Web Inspector: Reduce synchronous view layouts
+        https://bugs.webkit.org/show_bug.cgi?id=151058
+
+        Reviewed by Timothy Hatcher.
+
+        Replace calls to View.updateLayout with needsLayout, when a synchronous layout
+        isn't absolutely necessary.
+
+        * UserInterface/Models/BackForwardEntry.js:
+        (WebInspector.BackForwardEntry.prototype.prepareToShow):
+
+        * UserInterface/Views/ApplicationCacheFrameContentView.js:
+        (WebInspector.ApplicationCacheFrameContentView.prototype.updateLayout): Deleted.
+        View subclasses shouldn't override updateLayout.
+
+        * UserInterface/Views/ButtonNavigationItem.js:
+        (WebInspector.ButtonNavigationItem.prototype.set label):
+
+        * UserInterface/Views/ContentBrowser.js:
+        (WebInspector.ContentBrowser.prototype._contentViewSelectionPathComponentDidChange):
+        (WebInspector.ContentBrowser.prototype._currentContentViewDidChange):
+        (WebInspector.ContentBrowser.prototype._contentViewNavigationItemsDidChange):
+
+        * UserInterface/Views/DatabaseTableContentView.js:
+        (WebInspector.DatabaseTableContentView.prototype._queryFinished):
+        Just update DataGrid's layout, not the whole view. The grid is the only subview
+        so the result is identical, but the intent is cleared this way.
+        (WebInspector.DatabaseTableContentView.prototype.updateLayout): Deleted.
+        View subclasses shouldn't override updateLayout.
+
+        * UserInterface/Views/LogContentView.js:
+        (WebInspector.LogContentView.prototype.didAppendConsoleMessageView):
+        (WebInspector.LogContentView.prototype.promptDidChangeHeight): Deleted.
+        Unused code.
+
+        * UserInterface/Views/Sidebar.js:
+        (WebInspector.Sidebar.prototype.set width):
+        (WebInspector.Sidebar.prototype.set collapsed):
+
+        * UserInterface/Views/TextResourceContentView.js:
+        (WebInspector.TextResourceContentView.prototype._contentWillPopulate):
+        Add TextEditor as a subview.
+        (WebInspector.TextResourceContentView.prototype.updateLayout): Deleted.
+        View subclasses shouldn't override updateLayout.
+
+
+2015-11-18  Matt Baker  <mattbaker@apple.com>
+
         Web Inspector: Probes sidebar panel sections should use NavigationBar
         https://bugs.webkit.org/show_bug.cgi?id=151373
 
index 51f0317..c83a123 100644 (file)
@@ -59,7 +59,7 @@ WebInspector.BackForwardEntry = class BackForwardEntry extends WebInspector.Obje
         this.contentView.visible = true;
         if (shouldCallShown)
             this.contentView.shown();
-        this.contentView.updateLayout();
+        this.contentView.needsLayout();
     }
 
     prepareToHide()
index 5a82d5f..a6ee42b 100644 (file)
@@ -57,12 +57,6 @@ WebInspector.ApplicationCacheFrameContentView = class ApplicationCacheFrameConte
         WebInspector.applicationCacheManager.removeEventListener(null, null, this);
     }
 
-    updateLayout()
-    {
-        if (this.dataGrid)
-            this.dataGrid.updateLayout();
-    }
-
     saveToCookie(cookie)
     {
         cookie.type = WebInspector.ContentViewCookieType.ApplicationCache;
index 7525367..fdd0636 100644 (file)
@@ -76,7 +76,7 @@ WebInspector.ButtonNavigationItem = class ButtonNavigationItem extends WebInspec
         this._element.classList.add(WebInspector.ButtonNavigationItem.TextOnlyClassName);
         this._element.textContent = newLabel || "";
         if (this.parentNavigationBar)
-            this.parentNavigationBar.updateLayout();
+            this.parentNavigationBar.needsLayout();
     }
 
     get image()
index 71134ab..0125b44 100644 (file)
@@ -435,7 +435,7 @@ WebInspector.ContentBrowser = class ContentBrowser extends WebInspector.View
 
         this._updateContentViewNavigationItems();
 
-        this._navigationBar.updateLayout();
+        this._navigationBar.needsLayout();
 
         this._dispatchCurrentRepresentedObjectsDidChangeEventSoon();
     }
@@ -459,7 +459,7 @@ WebInspector.ContentBrowser = class ContentBrowser extends WebInspector.View
         this._updateContentViewNavigationItems();
         this._updateFindBanner(currentContentView);
 
-        this._navigationBar.updateLayout();
+        this._navigationBar.needsLayout();
 
         this.dispatchEventToListeners(WebInspector.ContentBrowser.Event.CurrentContentViewDidChange);
 
@@ -472,7 +472,7 @@ WebInspector.ContentBrowser = class ContentBrowser extends WebInspector.View
             return;
 
         this._updateContentViewNavigationItems();
-        this._navigationBar.updateLayout();
+        this._navigationBar.needsLayout();
     }
 
     _hierarchicalPathComponentWasSelected(event)
index 9626292..52d7deb 100644 (file)
@@ -50,12 +50,6 @@ WebInspector.DatabaseTableContentView = class DatabaseTableContentView extends W
         this.representedObject.database.executeSQL("SELECT * FROM \"" + this._escapeTableName(this.representedObject.name) + "\"", this._queryFinished.bind(this), this._queryError.bind(this));
     }
 
-    updateLayout()
-    {
-        if (this._dataGrid)
-            this._dataGrid.updateLayout();
-    }
-
     saveToCookie(cookie)
     {
         cookie.type = WebInspector.ContentViewCookieType.DatabaseTable;
@@ -95,7 +89,7 @@ WebInspector.DatabaseTableContentView = class DatabaseTableContentView extends W
             this._dataGrid = WebInspector.DataGrid.createSortableDataGrid(columnNames, values);
 
             this.addSubview(this._dataGrid);
-            this.updateLayout();
+            this._dataGrid.updateLayout();
             return;
         }
 
index 351056e..d61874a 100644 (file)
@@ -126,7 +126,7 @@ WebInspector.LogContentView = class LogContentView extends WebInspector.ContentV
     {
         console.assert(messageView instanceof WebInspector.ConsoleMessageView || messageView instanceof WebInspector.ConsoleCommandView);
 
-        WebInspector.quickConsole.updateLayout();
+        WebInspector.quickConsole.needsLayout();
 
         // Nest the message.
         var type = messageView instanceof WebInspector.ConsoleCommandView ? null : messageView.message.type;
@@ -166,11 +166,6 @@ WebInspector.LogContentView = class LogContentView extends WebInspector.ContentV
         this._logViewController.scrollToBottom();
     }
 
-    promptDidChangeHeight()
-    {
-        WebInspector.quickConsole.updateLayout();
-    }
-
     get supportsSearch()
     {
         return true;
index 0a59c2f..3670bd6 100644 (file)
@@ -182,7 +182,7 @@ WebInspector.Sidebar = class Sidebar extends WebInspector.View
         this.element.style.width = newWidth + "px";
 
         if (!this.collapsed && this._navigationBar)
-            this._navigationBar.updateLayout();
+            this._navigationBar.needsLayout();
 
         if (!this.collapsed && this._selectedSidebarPanel)
             this._selectedSidebarPanel.widthDidChange();
@@ -203,10 +203,8 @@ WebInspector.Sidebar = class Sidebar extends WebInspector.View
         this._collapsed = flag || false;
         this.element.classList.toggle(WebInspector.Sidebar.CollapsedStyleClassName);
 
-        if (!this._collapsed) {
-            if (this._navigationBar)
-                this._navigationBar.updateLayout();
-        }
+        if (!this._collapsed && this._navigationBar)
+            this._navigationBar.needsLayout();
 
         if (this._selectedSidebarPanel) {
             if (this._selectedSidebarPanel.visible)
index 2d88314..f4c198c 100644 (file)
@@ -174,16 +174,11 @@ WebInspector.TextResourceContentView = class TextResourceContentView extends Web
         this._textEditor.revealNextSearchResult(changeFocus);
     }
 
-    updateLayout()
-    {
-        this._textEditor.updateLayout();
-    }
-
     // Private
 
     _contentWillPopulate(event)
     {
-        if (this._textEditor.element.parentNode === this.element)
+        if (this._textEditor.parentView === this)
             return;
 
         // Check the MIME-type for CSS since Resource.Type.Stylesheet also includes XSL, which we can't edit yet.
@@ -195,7 +190,7 @@ WebInspector.TextResourceContentView = class TextResourceContentView extends Web
             this._textEditor.readOnly = false;
 
         this.element.removeChildren();
-        this.element.appendChild(this._textEditor.element);
+        this.addSubview(this._textEditor);
     }
 
     _contentDidPopulate(event)