Web Inspector: replace TypeVerifier with subclasses of WI.Collection
authorwebkit@devinrousso.com <webkit@devinrousso.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Oct 2017 23:49:05 +0000 (23:49 +0000)
committerwebkit@devinrousso.com <webkit@devinrousso.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Oct 2017 23:49:05 +0000 (23:49 +0000)
commitcee71d622e7084d5e3f35c777a5d3b66bdc2c660
tree2a1745b83a6b40d728040522941382832ba68b59
parent165a1987b47a744b9cef20eecd10266b7563ac7b
Web Inspector: replace TypeVerifier with subclasses of WI.Collection
https://bugs.webkit.org/show_bug.cgi?id=178045
<rdar://problem/35174307>

Reviewed by Brian Burg.

Source/WebInspectorUI:

* UserInterface/Models/Collection.js:
(WI.Collection):
(WI.Collection.prototype.get displayName):
(WI.Collection.prototype.objectIsRequiredType):
(WI.Collection.prototype.add):
(WI.Collection.prototype.get typeVerifier): Deleted.
Instead of exposing the typeVerifier, we create a public predicate that returns whether the
given object matches the expected type of the Collection. Subclasses can override it to
limit the scope of the collection to a particular type.

* UserInterface/Models/CollectionTypes.js:
(WI.FrameCollection.prototype.get displayName):
(WI.FrameCollection.prototype.objectIsRequiredType):
(WI.FrameCollection): Deleted.
(WI.ScriptCollection.prototype.get displayName):
(WI.ScriptCollection.prototype.objectIsRequiredType):
(WI.ScriptCollection): Deleted.
(WI.CSSStyleSheetCollection.prototype.get displayName):
(WI.CSSStyleSheetCollection.prototype.objectIsRequiredType):
(WI.CSSStyleSheetCollection): Deleted.
(WI.CanvasCollection.prototype.get displayName):
(WI.CanvasCollection.prototype.objectIsRequiredType):
(WI.CanvasCollection): Deleted.
(WI.ShaderProgramCollection.prototype.get displayName):
(WI.ShaderProgramCollection.prototype.objectIsRequiredType):
(WI.ShaderProgramCollection): Deleted.
(WI.RecordingCollection.prototype.get displayName):
(WI.RecordingCollection.prototype.objectIsRequiredType):
(WI.RecordingCollection): Deleted.
* UserInterface/Models/ResourceCollection.js:
(WI.ResourceCollection):
(WI.ResourceCollection.prototype.get displayName):
(WI.ResourceCollection.prototype.objectIsRequiredType):
(WI.ResourceCollection.verifierForType): Deleted.
* UserInterface/Views/TreeOutlineGroup.js:
(WI.TreeOutlineGroup.prototype.objectIsRequiredType):
(WI.TreeOutlineGroup): Deleted.
Introduce additional subclasses of Collection for other model types. Modify existing
subclasses to remove `typeVerifier` and instead extend `objectIsRequiredType`.

* UserInterface/Models/Canvas.js:
(WI.Canvas):
* UserInterface/Models/Frame.js:
(WI.Frame):
* UserInterface/Protocol/Target.js:
(WI.Target):
* UserInterface/Views/ResourceSidebarPanel.js:
(WI.ResourceSidebarPanel.prototype.treeElementForRepresentedObject):
(WI.ResourceSidebarPanel.prototype._addScript):

* UserInterface/Views/CollectionContentView.js:
(WI.CollectionContentView):
(WI.CollectionContentView.titleForCollection): Delete.
* UserInterface/Views/ResourceCollectionContentView.js:
(WI.ResourceCollectionContentView):
Require that subclasses of Collection override `get displayName` if the CollectionContentView
is not provided with a `contentPlaceholderText`.

(WI.CollectionContentView.prototype.initialLayout):
We don't need to create and add ContentView for each item of the Collection, as this is
already done by attached().

(WI.CollectionContentView.prototype._showContentPlaceholder):
Remove the 250ms delay before showing the placeholder TitleView.

* UserInterface/Views/FolderizedTreeElement.js:
(WI.FolderizedTreeElement.prototype._settingsForRepresentedObject):

LayoutTests:

* inspector/unit-tests/collection-expected.txt:
* inspector/unit-tests/collection.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223997 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/unit-tests/collection-expected.txt
LayoutTests/inspector/unit-tests/collection.html
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/UserInterface/Models/Canvas.js
Source/WebInspectorUI/UserInterface/Models/Collection.js
Source/WebInspectorUI/UserInterface/Models/CollectionTypes.js
Source/WebInspectorUI/UserInterface/Models/Frame.js
Source/WebInspectorUI/UserInterface/Models/ResourceCollection.js
Source/WebInspectorUI/UserInterface/Protocol/Target.js
Source/WebInspectorUI/UserInterface/Views/CollectionContentView.js
Source/WebInspectorUI/UserInterface/Views/FolderizedTreeElement.js
Source/WebInspectorUI/UserInterface/Views/ResourceCollectionContentView.js
Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/TreeOutlineGroup.js