Changeset 208441 in webkit


Ignore:
Timestamp:
Nov 9, 2016 10:25:30 AM (8 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: Allow FolderTreeElement to display content when selected
https://bugs.webkit.org/show_bug.cgi?id=164407

Patch by Devin Rousso <Devin Rousso> on 2016-11-09
Reviewed by Timothy Hatcher.

  • UserInterface/Main.html:

Add CollectionContentView and TitleView.

  • UserInterface/Base/Main.js:
  • UserInterface/Views/ContentView.js:

(WebInspector.ContentView.createFromRepresentedObject):
(WebInspector.ContentView.isViewable):
Add support for Collection as the representedObject of a content view.

  • UserInterface/Views/CollectionContentView.css: Added.

(.content-view.collection):
(.content-view.collection > .content-view):

  • UserInterface/Views/CollectionContentView.js: Added.

(WebInspector.CollectionContentView):
(WebInspector.CollectionContentView.prototype.initialLayout):
(WebInspector.CollectionContentView.prototype._addContentViewForItem):
(WebInspector.CollectionContentView.prototype._removeContentViewForItem):
(WebInspector.CollectionContentView.prototype._handleItemAdded):
(WebInspector.CollectionContentView.prototype._handleItemRemoved):
(WebInspector.CollectionContentView.prototype._handleContentError):
Takes in a Collection when constructed, and attempts to display a sub-ContentView for each
item in the collection if the type of the collection is viewable en masse. Currently, this
is only supported for WebInspector.Resource.Type.Image collections.

  • UserInterface/Views/ResourceContentView.js:

(WebInspector.ResourceContentView.prototype._contentError):
Dispatch an event whenever the content fails to load.

  • UserInterface/Views/ResourceSidebarPanel.js:

(WebInspector.ResourceSidebarPanel.prototype._treeSelectionDidChange):

  • UserInterface/Views/ResourcesTabContentView.js:

(WebInspector.ResourcesTabContentView.prototype.canShowRepresentedObject):
Allow FolderTreeElements to be selected.

  • UserInterface/Views/TitleView.css: Added.

(.title-view):

  • UserInterface/Views/TitleView.js: Added.

(WebInspector.TitleView):
Basic view that displays the given text in the center of the viewable area.

Location:
trunk/Source/WebInspectorUI
Files:
4 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r208348 r208441  
     12016-11-09  Devin Rousso  <dcrousso+webkit@gmail.com>
     2
     3        Web Inspector: Allow FolderTreeElement to display content when selected
     4        https://bugs.webkit.org/show_bug.cgi?id=164407
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        * UserInterface/Main.html:
     9        Add CollectionContentView and TitleView.
     10
     11        * UserInterface/Base/Main.js:
     12        * UserInterface/Views/ContentView.js:
     13        (WebInspector.ContentView.createFromRepresentedObject):
     14        (WebInspector.ContentView.isViewable):
     15        Add support for Collection as the representedObject of a content view.
     16
     17        * UserInterface/Views/CollectionContentView.css: Added.
     18        (.content-view.collection):
     19        (.content-view.collection > .content-view):
     20        * UserInterface/Views/CollectionContentView.js: Added.
     21        (WebInspector.CollectionContentView):
     22        (WebInspector.CollectionContentView.prototype.initialLayout):
     23        (WebInspector.CollectionContentView.prototype._addContentViewForItem):
     24        (WebInspector.CollectionContentView.prototype._removeContentViewForItem):
     25        (WebInspector.CollectionContentView.prototype._handleItemAdded):
     26        (WebInspector.CollectionContentView.prototype._handleItemRemoved):
     27        (WebInspector.CollectionContentView.prototype._handleContentError):
     28        Takes in a Collection when constructed, and attempts to display a sub-ContentView for each
     29        item in the collection if the type of the collection is viewable en masse.  Currently, this
     30        is only supported for WebInspector.Resource.Type.Image collections.
     31
     32        * UserInterface/Views/ResourceContentView.js:
     33        (WebInspector.ResourceContentView.prototype._contentError):
     34        Dispatch an event whenever the content fails to load.
     35
     36        * UserInterface/Views/ResourceSidebarPanel.js:
     37        (WebInspector.ResourceSidebarPanel.prototype._treeSelectionDidChange):
     38        * UserInterface/Views/ResourcesTabContentView.js:
     39        (WebInspector.ResourcesTabContentView.prototype.canShowRepresentedObject):
     40        Allow FolderTreeElements to be selected.
     41
     42        * UserInterface/Views/TitleView.css: Added.
     43        (.title-view):
     44        * UserInterface/Views/TitleView.js: Added.
     45        (WebInspector.TitleView):
     46        Basic view that displays the given text in the center of the viewable area.
     47
    1482016-11-03  Nikita Vasilyev  <nvasilyev@apple.com>
    249
  • trunk/Source/WebInspectorUI/UserInterface/Base/Main.js

    r208304 r208441  
    11111111        return WebInspector.ResourcesTabContentView;
    11121112
     1113    if (representedObject instanceof WebInspector.Collection)
     1114        return WebInspector.CollectionContentView;
     1115
    11131116    return null;
    11141117};
  • trunk/Source/WebInspectorUI/UserInterface/Main.html

    r208304 r208441  
    5050    <link rel="stylesheet" href="Views/ClusterContentView.css">
    5151    <link rel="stylesheet" href="Views/CodeMirrorOverrides.css">
     52    <link rel="stylesheet" href="Views/CollectionContentView.css">
    5253    <link rel="stylesheet" href="Views/ColorPicker.css">
    5354    <link rel="stylesheet" href="Views/ColorWheel.css">
     
    176177    <link rel="stylesheet" href="Views/TimelineTabContentView.css">
    177178    <link rel="stylesheet" href="Views/TimelineView.css">
     179    <link rel="stylesheet" href="Views/TitleView.css">
    178180    <link rel="stylesheet" href="Views/Toolbar.css">
    179181    <link rel="stylesheet" href="Views/TreeElementStatusButton.css">
     
    490492    <script src="Views/CodeMirrorFormatters.js"></script>
    491493    <script src="Views/CodeMirrorTextMarkers.js"></script>
     494    <script src="Views/CollectionContentView.js"></script>
    492495    <script src="Views/ColorPicker.js"></script>
    493496    <script src="Views/ColorWheel.js"></script>
     
    653656    <script src="Views/TimelineRecordingProgressView.js"></script>
    654657    <script src="Views/TimelineRuler.js"></script>
     658    <script src="Views/TitleView.js"></script>
    655659    <script src="Views/ToggleButtonNavigationItem.js"></script>
    656660    <script src="Views/TextToggleButtonNavigationItem.js"></script>
  • trunk/Source/WebInspectorUI/UserInterface/Views/ContentView.js

    r200064 r208441  
    142142            return new WebInspector.HeapSnapshotClusterContentView(representedObject, extraArguments);
    143143
     144        if (representedObject instanceof WebInspector.Collection)
     145            return new WebInspector.CollectionContentView(representedObject, extraArguments);
     146
    144147        if (typeof representedObject === "string" || representedObject instanceof String)
    145148            return new WebInspector.TextContentView(representedObject, extraArguments);
     
    244247            return true;
    245248        if (representedObject instanceof WebInspector.HeapSnapshotProxy || representedObject instanceof WebInspector.HeapSnapshotDiffProxy)
     249            return true;
     250        if (representedObject instanceof WebInspector.Collection)
    246251            return true;
    247252        if (typeof representedObject === "string" || representedObject instanceof String)
  • trunk/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js

    r208091 r208441  
    105105        this.element.removeChildren();
    106106        this.element.appendChild(WebInspector.createMessageTextView(error, true));
     107
     108        this.dispatchEventToListeners(WebInspector.ResourceContentView.Event.ContentError);
    107109    }
    108110
     
    133135    }
    134136};
     137
     138WebInspector.ResourceContentView.Event = {
     139    ContentError: "resource-content-view-content-error",
     140};
  • trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js

    r208337 r208441  
    114114        // A custom implementation is needed for this since the frames are populated lazily.
    115115
    116         if (!this._mainFrameTreeElement && (representedObject instanceof WebInspector.Resource || representedObject instanceof WebInspector.Frame)) {
     116        if (!this._mainFrameTreeElement && (representedObject instanceof WebInspector.Resource || representedObject instanceof WebInspector.Frame || representedObject instanceof WebInspector.Collection)) {
    117117            // All resources are under the main frame, so we need to return early if we don't have the main frame yet.
    118118            return null;
     
    441441    {
    442442        let treeElement = event.data.selectedElement;
    443         if (!treeElement || treeElement instanceof WebInspector.FolderTreeElement)
    444             return;
    445 
    446         if (treeElement instanceof WebInspector.ResourceTreeElement
     443        if (!treeElement)
     444            return;
     445
     446        if (treeElement instanceof WebInspector.FolderTreeElement
     447            || treeElement instanceof WebInspector.ResourceTreeElement
    447448            || treeElement instanceof WebInspector.ScriptTreeElement
    448449            || treeElement instanceof WebInspector.ContentFlowTreeElement) {
  • trunk/Source/WebInspectorUI/UserInterface/Views/ResourcesTabContentView.js

    r208091 r208441  
    6060            || representedObject instanceof WebInspector.Resource
    6161            || representedObject instanceof WebInspector.Script
    62             || representedObject instanceof WebInspector.ContentFlow;
     62            || representedObject instanceof WebInspector.ContentFlow
     63            || representedObject instanceof WebInspector.Collection;
    6364    }
    6465};
Note: See TracChangeset for help on using the changeset viewer.