Title: [252378] trunk/Source/WebInspectorUI
- Revision
- 252378
- Author
- [email protected]
- Date
- 2019-11-12 16:23:23 -0800 (Tue, 12 Nov 2019)
Log Message
Web Inspector: Sources: create/update local override drop zone shown in image collection view
https://bugs.webkit.org/show_bug.cgi?id=204097
Reviewed by Joseph Pecoraro.
* UserInterface/Views/CollectionContentView.js:
(WI.CollectionContentView):
(WI.CollectionContentView.prototype.get contentViewConstructorOptions): Added.
(WI.CollectionContentView.prototype.addContentViewForItem):
* UserInterface/Views/ResourceCollectionContentView.js:
(WI.ResourceCollectionContentView.prototype.get contentViewConstructorOptions): Added.
Provide a way to pass options when instantiating the content view from the constructor.
* UserInterface/Views/ImageResourceContentView.js:
(WI.ImageResourceContentView.prototype.contentAvailable):
Support an optional object parameter that can be used to disable the `WI.DropZone`.
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (252377 => 252378)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-11-13 00:07:00 UTC (rev 252377)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-11-13 00:23:23 UTC (rev 252378)
@@ -1,3 +1,22 @@
+2019-11-12 Devin Rousso <[email protected]>
+
+ Web Inspector: Sources: create/update local override drop zone shown in image collection view
+ https://bugs.webkit.org/show_bug.cgi?id=204097
+
+ Reviewed by Joseph Pecoraro.
+
+ * UserInterface/Views/CollectionContentView.js:
+ (WI.CollectionContentView):
+ (WI.CollectionContentView.prototype.get contentViewConstructorOptions): Added.
+ (WI.CollectionContentView.prototype.addContentViewForItem):
+ * UserInterface/Views/ResourceCollectionContentView.js:
+ (WI.ResourceCollectionContentView.prototype.get contentViewConstructorOptions): Added.
+ Provide a way to pass options when instantiating the content view from the constructor.
+
+ * UserInterface/Views/ImageResourceContentView.js:
+ (WI.ImageResourceContentView.prototype.contentAvailable):
+ Support an optional object parameter that can be used to disable the `WI.DropZone`.
+
2019-11-07 Devin Rousso <[email protected]>
Web Inspector: REGRESSION(r251958): console prompt is automatically focused when page is reloaded
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CollectionContentView.js (252377 => 252378)
--- trunk/Source/WebInspectorUI/UserInterface/Views/CollectionContentView.js 2019-11-13 00:07:00 UTC (rev 252377)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CollectionContentView.js 2019-11-13 00:23:23 UTC (rev 252378)
@@ -28,6 +28,7 @@
constructor(collection, contentViewConstructor, contentPlaceholder)
{
console.assert(collection instanceof WI.Collection);
+ console.assert(contentViewConstructor instanceof WI.ContentView);
super(collection);
@@ -99,6 +100,12 @@
// Protected
+ get contentViewConstructorOptions()
+ {
+ // Implemented by subclasses.
+ return {};
+ }
+
addContentViewForItem(item)
{
if (!this._contentViewConstructor)
@@ -111,7 +118,7 @@
this.hideContentPlaceholder();
- let contentView = new this._contentViewConstructor(item);
+ let contentView = new this._contentViewConstructor(item, this.contentViewConstructorOptions);
console.assert(contentView instanceof WI.ContentView);
let handleClick = (event) => {
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ImageResourceContentView.js (252377 => 252378)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ImageResourceContentView.js 2019-11-13 00:07:00 UTC (rev 252377)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ImageResourceContentView.js 2019-11-13 00:23:23 UTC (rev 252378)
@@ -25,7 +25,7 @@
WI.ImageResourceContentView = class ImageResourceContentView extends WI.ResourceContentView
{
- constructor(resource)
+ constructor(resource, {disableDropZone} = {})
{
console.assert(resource instanceof WI.Resource);
@@ -33,6 +33,7 @@
this._imageElement = null;
this._draggingInternalImageElement = false;
+ this._disableDropZone = disableDropZone || false;
const toolTip = WI.UIString("Show transparency grid");
const activatedToolTip = WI.UIString("Hide transparency grid");
@@ -86,7 +87,7 @@
this._draggingInternalImageElement = false;
});
- if (WI.NetworkManager.supportsLocalResourceOverrides()) {
+ if (WI.NetworkManager.supportsLocalResourceOverrides() && !this._disableDropZone) {
let dropZoneView = new WI.DropZoneView(this);
dropZoneView.targetElement = imageContainer;
this.addSubview(dropZoneView);
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceCollectionContentView.js (252377 => 252378)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceCollectionContentView.js 2019-11-13 00:07:00 UTC (rev 252377)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceCollectionContentView.js 2019-11-13 00:23:23 UTC (rev 252378)
@@ -98,6 +98,14 @@
super.detached();
}
+ get contentViewConstructorOptions()
+ {
+ let contentViewConstructorOptions = super.contentViewConstructorOptions;
+ if (this.representedObject.resourceType === WI.Resource.Type.Image)
+ contentViewConstructorOptions.disableDropZone = true;
+ return contentViewConstructorOptions;
+ }
+
contentViewAdded(contentView)
{
console.assert(contentView instanceof WI.ResourceContentView);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes