Title: [192086] trunk/Source/WebInspectorUI
Revision
192086
Author
[email protected]
Date
2015-11-05 16:03:59 -0800 (Thu, 05 Nov 2015)

Log Message

Web Inspector: Convert remaining ContentViews to View base class
https://bugs.webkit.org/show_bug.cgi?id=150729

Reviewed by Brian Burg.

Refactor content views to reuse View features: remove updateLayout and
element getters, and use View.prototype.addSubview and removeSubview
where appropriate.

* UserInterface/Views/ApplicationCacheFrameContentView.js:
(WebInspector.ApplicationCacheFrameContentView.prototype._createDataGrid):
* UserInterface/Views/ClusterContentView.js:
(WebInspector.ClusterContentView):
(WebInspector.ClusterContentView.prototype.updateLayout): Deleted.
* UserInterface/Views/CookieStorageContentView.js:
(WebInspector.CookieStorageContentView.prototype._rebuildTable):
(WebInspector.CookieStorageContentView.prototype.updateLayout): Deleted.
* UserInterface/Views/DOMStorageContentView.js:
(WebInspector.DOMStorageContentView):
(WebInspector.DOMStorageContentView.prototype.updateLayout): Deleted.
* UserInterface/Views/DOMTreeContentView.js:
(WebInspector.DOMTreeContentView.prototype.layout):
(WebInspector.DOMTreeContentView.prototype.updateLayout): Deleted.
* UserInterface/Views/DatabaseTableContentView.js:
(WebInspector.DatabaseTableContentView):
(WebInspector.DatabaseTableContentView.prototype._queryFinished):
(WebInspector.DatabaseTableContentView.prototype._queryError):
* UserInterface/Views/FontResourceContentView.js:
(WebInspector.FontResourceContentView.prototype.layout):
(WebInspector.FontResourceContentView):
(WebInspector.FontResourceContentView.prototype.updateLayout): Deleted.
* UserInterface/Views/IndexedDatabaseObjectStoreContentView.js:
(WebInspector.IndexedDatabaseObjectStoreContentView):
(WebInspector.IndexedDatabaseObjectStoreContentView.prototype.updateLayout): Deleted.
* UserInterface/Views/LogContentView.js:
(WebInspector.LogContentView.prototype.layout):
(WebInspector.LogContentView.prototype.updateLayout): Deleted.
* UserInterface/Views/NetworkGridContentView.js:
(WebInspector.NetworkGridContentView):
(WebInspector.NetworkGridContentView.prototype.needsLayout):
(WebInspector.NetworkGridContentView.prototype.layout):
(WebInspector.NetworkGridContentView.prototype.updateLayout): Deleted.
* UserInterface/Views/OverviewTimelineView.js:
(WebInspector.OverviewTimelineView):
(WebInspector.OverviewTimelineView.prototype.layout): Deleted.
* UserInterface/Views/ScriptContentView.js:
(WebInspector.ScriptContentView.prototype._contentWillPopulate):
(WebInspector.ScriptContentView.prototype.updateLayout): Deleted.
* UserInterface/Views/TextContentView.js:
(WebInspector.TextContentView):
(WebInspector.TextContentView.prototype.updateLayout): Deleted.
* UserInterface/Views/TextEditor.js:
(WebInspector.TextEditor):
(WebInspector.TextEditor.prototype.layout):
(WebInspector.TextEditor.prototype.get element): Deleted.
(WebInspector.TextEditor.prototype.updateLayout): Deleted.
* UserInterface/Views/TimelineRecordingContentView.js:
(WebInspector.TimelineRecordingContentView):
(WebInspector.TimelineRecordingContentView.prototype.layout):
(WebInspector.TimelineRecordingContentView.prototype._currentContentViewDidChange):
(WebInspector.TimelineRecordingContentView.prototype.updateLayout): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (192085 => 192086)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-11-05 23:20:37 UTC (rev 192085)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-11-06 00:03:59 UTC (rev 192086)
@@ -1,3 +1,67 @@
+2015-11-05  Matt Baker  <[email protected]>
+
+        Web Inspector: Convert remaining ContentViews to View base class
+        https://bugs.webkit.org/show_bug.cgi?id=150729
+
+        Reviewed by Brian Burg.
+
+        Refactor content views to reuse View features: remove updateLayout and
+        element getters, and use View.prototype.addSubview and removeSubview
+        where appropriate.
+
+        * UserInterface/Views/ApplicationCacheFrameContentView.js:
+        (WebInspector.ApplicationCacheFrameContentView.prototype._createDataGrid):
+        * UserInterface/Views/ClusterContentView.js:
+        (WebInspector.ClusterContentView):
+        (WebInspector.ClusterContentView.prototype.updateLayout): Deleted.
+        * UserInterface/Views/CookieStorageContentView.js:
+        (WebInspector.CookieStorageContentView.prototype._rebuildTable):
+        (WebInspector.CookieStorageContentView.prototype.updateLayout): Deleted.
+        * UserInterface/Views/DOMStorageContentView.js:
+        (WebInspector.DOMStorageContentView):
+        (WebInspector.DOMStorageContentView.prototype.updateLayout): Deleted.
+        * UserInterface/Views/DOMTreeContentView.js:
+        (WebInspector.DOMTreeContentView.prototype.layout):
+        (WebInspector.DOMTreeContentView.prototype.updateLayout): Deleted.
+        * UserInterface/Views/DatabaseTableContentView.js:
+        (WebInspector.DatabaseTableContentView):
+        (WebInspector.DatabaseTableContentView.prototype._queryFinished):
+        (WebInspector.DatabaseTableContentView.prototype._queryError):
+        * UserInterface/Views/FontResourceContentView.js:
+        (WebInspector.FontResourceContentView.prototype.layout):
+        (WebInspector.FontResourceContentView):
+        (WebInspector.FontResourceContentView.prototype.updateLayout): Deleted.
+        * UserInterface/Views/IndexedDatabaseObjectStoreContentView.js:
+        (WebInspector.IndexedDatabaseObjectStoreContentView):
+        (WebInspector.IndexedDatabaseObjectStoreContentView.prototype.updateLayout): Deleted.
+        * UserInterface/Views/LogContentView.js:
+        (WebInspector.LogContentView.prototype.layout):
+        (WebInspector.LogContentView.prototype.updateLayout): Deleted.
+        * UserInterface/Views/NetworkGridContentView.js:
+        (WebInspector.NetworkGridContentView):
+        (WebInspector.NetworkGridContentView.prototype.needsLayout):
+        (WebInspector.NetworkGridContentView.prototype.layout):
+        (WebInspector.NetworkGridContentView.prototype.updateLayout): Deleted.
+        * UserInterface/Views/OverviewTimelineView.js:
+        (WebInspector.OverviewTimelineView):
+        (WebInspector.OverviewTimelineView.prototype.layout): Deleted.
+        * UserInterface/Views/ScriptContentView.js:
+        (WebInspector.ScriptContentView.prototype._contentWillPopulate):
+        (WebInspector.ScriptContentView.prototype.updateLayout): Deleted.
+        * UserInterface/Views/TextContentView.js:
+        (WebInspector.TextContentView):
+        (WebInspector.TextContentView.prototype.updateLayout): Deleted.
+        * UserInterface/Views/TextEditor.js:
+        (WebInspector.TextEditor):
+        (WebInspector.TextEditor.prototype.layout):
+        (WebInspector.TextEditor.prototype.get element): Deleted.
+        (WebInspector.TextEditor.prototype.updateLayout): Deleted.
+        * UserInterface/Views/TimelineRecordingContentView.js:
+        (WebInspector.TimelineRecordingContentView):
+        (WebInspector.TimelineRecordingContentView.prototype.layout):
+        (WebInspector.TimelineRecordingContentView.prototype._currentContentViewDidChange):
+        (WebInspector.TimelineRecordingContentView.prototype.updateLayout): Deleted.
+
 2015-11-05  Nikita Vasilyev  <[email protected]>
 
         Web Inspector: Pretty print falsely triggers on some JS that wasn't minified

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ApplicationCacheFrameContentView.js (192085 => 192086)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ApplicationCacheFrameContentView.js	2015-11-05 23:20:37 UTC (rev 192085)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ApplicationCacheFrameContentView.js	2015-11-06 00:03:59 UTC (rev 192086)
@@ -171,7 +171,7 @@
         this._dataGrid.sortColumnIdentifier = "url";
         this._dataGrid.sortOrder = WebInspector.DataGrid.SortOrder.Ascending;
 
-        this.element.appendChild(this._dataGrid.element);
+        this.addSubview(this._dataGrid);
         this._dataGrid.updateLayout();
     }
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ClusterContentView.js (192085 => 192086)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ClusterContentView.js	2015-11-05 23:20:37 UTC (rev 192085)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ClusterContentView.js	2015-11-06 00:03:59 UTC (rev 192086)
@@ -33,7 +33,7 @@
 
         this._contentViewContainer = new WebInspector.ContentViewContainer;
         this._contentViewContainer.addEventListener(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange, this._currentContentViewDidChange, this);
-        this.element.appendChild(this._contentViewContainer.element);
+        this.addSubview(this._contentViewContainer);
 
         WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.SelectionPathComponentsDidChange, this._contentViewSelectionPathComponentDidChange, this);
         WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.SupplementalRepresentedObjectsDidChange, this._contentViewSupplementalRepresentedObjectsDidChange, this);
@@ -60,11 +60,6 @@
         return true;
     }
 
-    updateLayout()
-    {
-        this._contentViewContainer.updateLayout();
-    }
-
     shown()
     {
         this._contentViewContainer.shown();

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CookieStorageContentView.js (192085 => 192086)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CookieStorageContentView.js	2015-11-05 23:20:37 UTC (rev 192085)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CookieStorageContentView.js	2015-11-06 00:03:59 UTC (rev 192086)
@@ -78,12 +78,6 @@
         PageAgent.getCookies(callback.bind(this));
     }
 
-    updateLayout()
-    {
-        if (this._dataGrid)
-            this._dataGrid.updateLayout();
-    }
-
     saveToCookie(cookie)
     {
         cookie.type = WebInspector.ContentViewCookieType.CookieStorage;
@@ -144,7 +138,7 @@
             this._dataGrid = new WebInspector.DataGrid(columns, null, this._deleteCallback.bind(this));
             this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged, this._sortDataGrid, this);
 
-            this.element.appendChild(this._dataGrid.element);
+            this.addSubview(this._dataGrid);
             this._dataGrid.updateLayout();
         }
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMStorageContentView.js (192085 => 192086)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMStorageContentView.js	2015-11-05 23:20:37 UTC (rev 192085)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMStorageContentView.js	2015-11-06 00:03:59 UTC (rev 192086)
@@ -46,7 +46,7 @@
         this._dataGrid.sortColumnIdentifier = "key";
         this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged, this._sortDataGrid, this);
 
-        this.element.appendChild(this._dataGrid.element);
+        this.addSubview(this._dataGrid);
 
         this._populate();
     }
@@ -112,12 +112,6 @@
         this._sortDataGrid();
     }
 
-    updateLayout()
-    {
-        if (this._dataGrid)
-            this._dataGrid.updateLayout();
-    }
-
     get scrollableElements()
     {
         if (!this._dataGrid)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js (192085 => 192086)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js	2015-11-05 23:20:37 UTC (rev 192085)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js	2015-11-06 00:03:59 UTC (rev 192086)
@@ -81,11 +81,6 @@
         return [this.element];
     }
 
-    updateLayout()
-    {
-        this._domTreeOutline.updateSelection();
-    }
-
     shown()
     {
         this._domTreeOutline.setVisible(true, WebInspector.isConsoleFocused());
@@ -284,6 +279,13 @@
         this._revealSearchResult(this._currentSearchResultIndex, changeFocus);
     }
 
+    // Protected
+
+    layout()
+    {
+        this._domTreeOutline.updateSelection();
+    }
+
     // Private
 
     _revealSearchResult(index, changeFocus)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DatabaseTableContentView.js (192085 => 192086)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DatabaseTableContentView.js	2015-11-05 23:20:37 UTC (rev 192085)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DatabaseTableContentView.js	2015-11-06 00:03:59 UTC (rev 192086)
@@ -33,6 +33,7 @@
 
         this._refreshButtonNavigationItem = new WebInspector.ButtonNavigationItem("database-table-refresh", WebInspector.UIString("Refresh"), "Images/ReloadFull.svg", 13, 13);
         this._refreshButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._refreshButtonClicked, this);
+        this._messageTextViewElement = null;
 
         this.update();
     }
@@ -82,27 +83,40 @@
         // It would be nice to do better than creating a new data grid each time the table is updated, but the table updating
         // doesn't happen very frequently. Additionally, using DataGrid's createSortableDataGrid makes our code much cleaner and it knows
         // how to sort arbitrary columns.
-        this.element.removeChildren();
+        if (this._dataGrid) {
+            this.removeSubview(this._dataGrid);
+            this._dataGrid = null;
+        }
 
-        this._dataGrid = WebInspector.DataGrid.createSortableDataGrid(columnNames, values);
-        if (!this._dataGrid || !this._dataGrid.element) {
-            this._dataGrid = undefined;
+        if (this._messageTextViewElement)
+            this._messageTextViewElement.remove();
 
-            // If the DataGrid is empty, then we were returned a table with no columns. This can happen when a table has
-            // no data, the SELECT query only returns column names when there is data.
-            this.element.removeChildren();
-            this.element.appendChild(WebInspector.createMessageTextView(WebInspector.UIString("The “%s”\ntable is empty.").format(this.representedObject.name), false));
+        if (columnNames.length) {
+            this._dataGrid = WebInspector.DataGrid.createSortableDataGrid(columnNames, values);
+
+            this.addSubview(this._dataGrid);
+            this.updateLayout();
             return;
         }
 
-        this.element.appendChild(this._dataGrid.element);
-        this._dataGrid.updateLayout();
+        // We were returned a table with no columns. This can happen when a table has
+        // no data, the SELECT query only returns column names when there is data.
+        this._messageTextViewElement = WebInspector.createMessageTextView(WebInspector.UIString("The “%s”\ntable is empty.").format(this.representedObject.name), false);
+        this.element.appendChild(this._messageTextViewElement);
     }
 
     _queryError(error)
     {
-        this.element.removeChildren();
-        this.element.appendChild(WebInspector.createMessageTextView(WebInspector.UIString("An error occured trying to\nread the “%s” table.").format(this.representedObject.name), true));
+        if (this._dataGrid) {
+            this.removeSubview(this._dataGrid);
+            this._dataGrid = null;
+        }
+
+        if (this._messageTextViewElement)
+            this._messageTextViewElement.remove();
+
+        this._messageTextViewElement = WebInspector.createMessageTextView(WebInspector.UIString("An error occured trying to\nread the “%s” table.").format(this.representedObject.name), true);
+        this.element.appendChild(this._messageTextViewElement);
     }
 
     _refreshButtonClicked()

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/FontResourceContentView.js (192085 => 192086)


--- trunk/Source/WebInspectorUI/UserInterface/Views/FontResourceContentView.js	2015-11-05 23:20:37 UTC (rev 192085)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/FontResourceContentView.js	2015-11-06 00:03:59 UTC (rev 192086)
@@ -112,11 +112,6 @@
         this.sizeToFit();
     }
 
-    updateLayout()
-    {
-        this.sizeToFit();
-    }
-
     shown()
     {
         // Add the style element since it is removed when hidden.
@@ -140,6 +135,13 @@
         if (this._fontObjectURL)
             URL.revokeObjectURL(this._fontObjectURL);
     }
+
+    // Protected
+
+    layout()
+    {
+        this.sizeToFit();
+    }
 }
 
 WebInspector.FontResourceContentView._uniqueFontIdentifier = 0;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseObjectStoreContentView.js (192085 => 192086)


--- trunk/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseObjectStoreContentView.js	2015-11-05 23:20:37 UTC (rev 192085)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseObjectStoreContentView.js	2015-11-06 00:03:59 UTC (rev 192086)
@@ -69,7 +69,7 @@
 
         this._dataGrid = new WebInspector.DataGrid(columnInfo);
         this._dataGrid.scrollContainer.addEventListener("scroll", this._dataGridScrolled.bind(this));
-        this.element.appendChild(this._dataGrid.element);
+        this.addSubview(this._dataGrid);
 
         this._entries = [];
 
@@ -100,11 +100,6 @@
         cookie.objectStoreIndexName = this._objectStoreIndex && this._objectStoreIndex.name;
     }
 
-    updateLayout()
-    {
-        this._dataGrid.updateLayout();
-    }
-
     // Private
 
     _reset()

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js (192085 => 192086)


--- trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js	2015-11-05 23:20:37 UTC (rev 192085)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js	2015-11-06 00:03:59 UTC (rev 192086)
@@ -107,13 +107,6 @@
         return this._logViewController;
     }
 
-    updateLayout()
-    {
-        super.updateLayout();
-
-        this._scrollElementHeight = this.messagesElement.getBoundingClientRect().height;
-    }
-
     get scrollableElements()
     {
         return [this.element];
@@ -253,6 +246,13 @@
             this.prompt.focus();
     }
 
+    // Protected
+
+    layout()
+    {
+        this._scrollElementHeight = this.messagesElement.getBoundingClientRect().height;
+    }
+
     // Private
 
     _formatMessagesAsData(onlySelected)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NetworkGridContentView.js (192085 => 192086)


--- trunk/Source/WebInspectorUI/UserInterface/Views/NetworkGridContentView.js	2015-11-05 23:20:37 UTC (rev 192085)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NetworkGridContentView.js	2015-11-06 00:03:59 UTC (rev 192086)
@@ -86,7 +86,7 @@
         this._dataGrid.sortOrder = WebInspector.DataGrid.SortOrder.Ascending;
 
         this.element.classList.add("network-grid");
-        this.element.appendChild(this._dataGrid.element);
+        this.addSubview(this._dataGrid);
 
         var networkTimeline = WebInspector.timelineManager.persistentNetworkTimeline;
         networkTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this._networkTimelineRecordAdded, this);
@@ -136,27 +136,12 @@
         this._dataGrid.closed();
     }
 
-    updateLayout()
-    {
-        if (this._scheduledLayoutUpdateIdentifier) {
-            cancelAnimationFrame(this._scheduledLayoutUpdateIdentifier);
-            delete this._scheduledLayoutUpdateIdentifier;
-        }
-
-        this._dataGrid.updateLayout();
-
-        this._processPendingRecords();
-    }
-
     needsLayout()
     {
         if (!this._networkSidebarPanel.visible)
             return;
 
-        if (this._scheduledLayoutUpdateIdentifier)
-            return;
-
-        this._scheduledLayoutUpdateIdentifier = requestAnimationFrame(this.updateLayout.bind(this));
+        super.needsLayout();
     }
 
     reset()
@@ -165,6 +150,13 @@
         this._dataGrid.reset();
     }
 
+    // Protected
+
+    layout()
+    {
+        this._processPendingRecords();
+    }
+
     // Private
 
     _processPendingRecords()

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/OverviewTimelineView.js (192085 => 192086)


--- trunk/Source/WebInspectorUI/UserInterface/Views/OverviewTimelineView.js	2015-11-05 23:20:37 UTC (rev 192085)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/OverviewTimelineView.js	2015-11-06 00:03:59 UTC (rev 192086)
@@ -41,8 +41,7 @@
 
         this._timelineRuler = new WebInspector.TimelineRuler;
         this._timelineRuler.allowsClippedLabels = true;
-        // FIXME: change to `this.addSubview(this._timelineRuler)` once <https://webkit.org/b/150703> is fixed.
-        this.element.appendChild(this._timelineRuler.element);
+        this.addSubview(this._timelineRuler);
 
         this._currentTimeMarker = new WebInspector.TimelineMarker(0, WebInspector.TimelineMarker.Type.CurrentTime);
         this._timelineRuler.addMarker(this._currentTimeMarker);
@@ -182,9 +181,6 @@
             }
         }
 
-        // FIXME: remove once <https://webkit.org/b/150703> is fixed.
-        this._timelineRuler.updateLayout();
-
         this._processPendingRepresentedObjects();
     }
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ScriptContentView.js (192085 => 192086)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ScriptContentView.js	2015-11-05 23:20:37 UTC (rev 192085)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ScriptContentView.js	2015-11-06 00:03:59 UTC (rev 192086)
@@ -184,11 +184,6 @@
         this._textEditor.revealNextSearchResult(changeFocus);
     }
 
-    updateLayout()
-    {
-        this._textEditor.updateLayout();
-    }
-
     // Private
 
     _contentWillPopulate(event)
@@ -201,7 +196,7 @@
             this._textEditor.readOnly = false;
 
         this.element.removeChildren();
-        this.element.appendChild(this._textEditor.element);
+        this.addSubview(this._textEditor);
     }
 
     _contentDidPopulate(event)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TextContentView.js (192085 => 192086)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TextContentView.js	2015-11-05 23:20:37 UTC (rev 192085)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TextContentView.js	2015-11-06 00:03:59 UTC (rev 192086)
@@ -35,7 +35,7 @@
         this._textEditor.addEventListener(WebInspector.TextEditor.Event.NumberOfSearchResultsDidChange, this._numberOfSearchResultsDidChange, this);
         this._textEditor.addEventListener(WebInspector.TextEditor.Event.FormattingDidChange, this._textEditorFormattingDidChange, this);
 
-        this.element.appendChild(this._textEditor.element);
+        this.addSubview(this._textEditor);
 
         this._textEditor.readOnly = true;
         this._textEditor.mimeType = mimeType;
@@ -147,11 +147,6 @@
         this._textEditor.revealNextSearchResult(changeFocus);
     }
 
-    updateLayout()
-    {
-        this._textEditor.updateLayout();
-    }
-
     // Private
 
     _togglePrettyPrint(event)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js (192085 => 192086)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js	2015-11-05 23:20:37 UTC (rev 192085)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js	2015-11-06 00:03:59 UTC (rev 192086)
@@ -23,14 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TextEditor = class TextEditor extends WebInspector.Object
+WebInspector.TextEditor = class TextEditor extends WebInspector.View
 {
     constructor(element, mimeType, delegate)
     {
-        super();
+        super(element);
 
-        this._element = element || document.createElement("div");
-        this._element.classList.add("text-editor", WebInspector.SyntaxHighlightedStyleClassName);
+        this.element.classList.add("text-editor", WebInspector.SyntaxHighlightedStyleClassName);
 
         // FIXME: <https://webkit.org/b/149120> Web Inspector: Preferences for Text Editor behavior
         this._codeMirror = CodeMirror(this.element, {
@@ -72,11 +71,6 @@
 
     // Public
 
-    get element()
-    {
-        return this._element;
-    }
-
     get visible()
     {
         return this._visible;
@@ -505,15 +499,6 @@
         this._codeMirror.operation(revealAndHighlightLine.bind(this));
     }
 
-    updateLayout(force)
-    {
-        // FIXME: <https://webkit.org/b/146256> Web Inspector: Nested ContentBrowsers / ContentViewContainers cause too many ContentView updates
-        // Ideally we would not get an updateLayout call if we are not visible. We should restructure ContentView
-        // show/hide restoration to reduce duplicated work and solve this in the process.
-        if (this._visible)
-            this._codeMirror.refresh();
-    }
-
     shown()
     {
         this._visible = true;
@@ -724,6 +709,17 @@
 
     // Protected
 
+    layout()
+    {
+        // FIXME: <https://webkit.org/b/146256> Web Inspector: Nested ContentBrowsers / ContentViewContainers cause too many ContentView updates
+        // Ideally we would not get an updateLayout call if we are not visible. We should restructure ContentView
+        // show/hide restoration to reduce duplicated work and solve this in the process.
+
+        // FIXME: visible check can be removed once <https://webkit.org/b/150741> is fixed.
+        if (this._visible)
+            this._codeMirror.refresh();
+    }
+
     prettyPrint(pretty)
     {
         function prettyPrintAndUpdateEditor()
@@ -937,7 +933,7 @@
         var coordinates = this._codeMirror.cursorCoords(true, "page");
 
         // Adjust the coordinates to be based in the text editor's space.
-        var textEditorRect = this._element.getBoundingClientRect();
+        let textEditorRect = this.element.getBoundingClientRect();
         coordinates.top -= textEditorRect.top;
         coordinates.left -= textEditorRect.left;
 
@@ -945,7 +941,7 @@
         this._bouncyHighlightElement.textContent = textContent;
         this._bouncyHighlightElement.style.top = coordinates.top + "px";
         this._bouncyHighlightElement.style.left = coordinates.left + "px";
-        this._element.appendChild(this._bouncyHighlightElement);
+        this.element.appendChild(this._bouncyHighlightElement);
 
         function animationEnded()
         {

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js (192085 => 192086)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js	2015-11-05 23:20:37 UTC (rev 192085)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js	2015-11-06 00:03:59 UTC (rev 192086)
@@ -46,11 +46,13 @@
         this._renderingFrameTimelineOverview.addEventListener(WebInspector.TimelineOverview.Event.RecordSelected, this._recordSelected, this);
 
         this._currentTimelineOverview = this._linearTimelineOverview;
+
+        // FIXME: use View.prototype.addSubview once <https://webkit.org/b/149190> is fixed.
         this.element.appendChild(this._currentTimelineOverview.element);
 
         this._contentViewContainer = new WebInspector.ContentViewContainer;
         this._contentViewContainer.addEventListener(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange, this._currentContentViewDidChange, this);
-        this.element.appendChild(this._contentViewContainer.element);
+        this.addSubview(this._contentViewContainer);
 
         this._clearTimelineNavigationItem = new WebInspector.ButtonNavigationItem("clear-timeline", WebInspector.UIString("Clear Timeline"), "Images/NavigationItemTrash.svg", 15, 15);
         this._clearTimelineNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._clearTimeline, this);
@@ -210,12 +212,6 @@
         this._contentViewContainer.goForward();
     }
 
-    updateLayout()
-    {
-        this._currentTimelineOverview.updateLayoutForResize();
-        this._contentViewContainer.updateLayout();
-    }
-
     saveToCookie(cookie)
     {
         cookie.type = WebInspector.ContentViewCookieType.Timelines;
@@ -324,6 +320,13 @@
         return true;
     }
 
+    // Protected
+
+    layout()
+    {
+        this._currentTimelineOverview.updateLayoutForResize();
+    }
+
     // Private
 
     _currentContentViewDidChange(event)
@@ -338,6 +341,7 @@
         if (newTimelineOverview !== this._currentTimelineOverview) {
             this._currentTimelineOverview.hidden();
 
+            // FIXME: use View.prototype.replaceSubview once <https://webkit.org/b/149190> is fixed.
             this.element.insertBefore(newTimelineOverview.element, this._currentTimelineOverview.element);
             this.element.removeChild(this._currentTimelineOverview.element);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to