WebKit Bugzilla
Attachment 373615 Details for
Bug 199544
: Layers visualization should show layer contents
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Non-working patch
bug-199544-20190707213651.patch (text/plain), 9.18 KB, created by
Simon Fraser (smfr)
on 2019-07-07 21:36:52 PDT
(
hide
)
Description:
Non-working patch
Filename:
MIME Type:
Creator:
Simon Fraser (smfr)
Created:
2019-07-07 21:36:52 PDT
Size:
9.18 KB
patch
obsolete
>Subversion Revision: 247200 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index a51dd09d542c61c9ef2724394d58629923df3dc3..cf6218c6b1706b2e9df67b082e8592d1e5d146a6 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,12 @@ >+2019-07-07 Simon Fraser <simon.fraser@apple.com> >+ >+ Layers visualization should show layer contents >+ https://bugs.webkit.org/show_bug.cgi?id=199544 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * inspector/protocol/LayerTree.json: >+ > 2019-07-07 Simon Fraser <simon.fraser@apple.com> > > Layer visualization needs to show more data about the layers >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 02dbee2b9392483c67f82267565d4a136161ff73..dfdeedf2788d429d251ff4e22ee41cab08155017 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,16 @@ >+2019-07-07 Simon Fraser <simon.fraser@apple.com> >+ >+ Layers visualization should show layer contents >+ https://bugs.webkit.org/show_bug.cgi?id=199544 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ No new tests (OOPS!). >+ >+ * inspector/agents/InspectorLayerTreeAgent.cpp: >+ (WebCore::InspectorLayerTreeAgent::imageForLayerContents): >+ * inspector/agents/InspectorLayerTreeAgent.h: >+ > 2019-07-07 Simon Fraser <simon.fraser@apple.com> > > Layer visualization needs to show more data about the layers >diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog >index 1f4d068ef2930ccd6003c51a25997a97458a3a78..2664f577f2d45ac19aebf30b1d49d8c9a8627f0e 100644 >--- a/Source/WebInspectorUI/ChangeLog >+++ b/Source/WebInspectorUI/ChangeLog >@@ -1,3 +1,16 @@ >+2019-07-07 Simon Fraser <simon.fraser@apple.com> >+ >+ Layers visualization should show layer contents >+ https://bugs.webkit.org/show_bug.cgi?id=199544 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * UserInterface/Controllers/LayerTreeManager.js: >+ (WI.LayerTreeManager.prototype.imageForLayerContents): >+ * UserInterface/Views/Layers3DContentView.js: >+ (WI.Layers3DContentView.prototype._updateLayers): >+ (WI.Layers3DContentView.prototype._createLayerMesh): >+ > 2019-07-07 Simon Fraser <simon.fraser@apple.com> > > Layer visualization needs to show more data about the layers >diff --git a/Source/JavaScriptCore/inspector/protocol/LayerTree.json b/Source/JavaScriptCore/inspector/protocol/LayerTree.json >index e9cfbf4c03b63563b7fa44971249fedff43186b7..aa6df1ebcb162e0a59a1bf600f314b0fecd5f07f 100644 >--- a/Source/JavaScriptCore/inspector/protocol/LayerTree.json >+++ b/Source/JavaScriptCore/inspector/protocol/LayerTree.json >@@ -118,6 +118,16 @@ > "returns": [ > { "name": "compositingReasons", "$ref": "CompositingReasons", "description": "An object containing the reasons why the layer was composited as properties." } > ] >+ }, >+ { >+ "name": "imageForLayerContents", >+ "description": "Provides an image which is a snapshot of the layer contents.", >+ "parameters": [ >+ { "name": "layerId", "$ref": "LayerId", "description": "The id of the layer for which we want to get an image." } >+ ], >+ "returns": [ >+ { "name": "image", "type": "string", "description": "Base64-encoded data of the layer contents." } >+ ] > } > ], > "events": [ >diff --git a/Source/WebCore/inspector/agents/InspectorLayerTreeAgent.cpp b/Source/WebCore/inspector/agents/InspectorLayerTreeAgent.cpp >index 964e3bc72bd80cff5b2b591833e678021d08e2bb..9ae352a9051ca4627f14b5e51249b47940570248 100644 >--- a/Source/WebCore/inspector/agents/InspectorLayerTreeAgent.cpp >+++ b/Source/WebCore/inspector/agents/InspectorLayerTreeAgent.cpp >@@ -31,6 +31,8 @@ > #include "config.h" > #include "InspectorLayerTreeAgent.h" > >+#include "FrameSnapshotting.h" >+#include "ImageBuffer.h" > #include "InspectorDOMAgent.h" > #include "InstrumentingAgents.h" > #include "IntRect.h" >@@ -350,6 +352,31 @@ void InspectorLayerTreeAgent::reasonsForCompositingLayer(ErrorString& errorStrin > compositingReasonsResult = WTFMove(compositingReasons); > } > >+void InspectorLayerTreeAgent::imageForLayerContents(ErrorString& errorString, const String& layerId, String* outDataURL) >+{ >+ const RenderLayer* renderLayer = m_idToLayer.get(layerId); >+ >+ if (!renderLayer) { >+ errorString = "Could not find a bound layer for the provided id"_s; >+ return; >+ } >+ >+ RenderObject* renderer = &renderLayer->renderer(); >+ Node* node = renderer->node(); >+ if (!node) { >+ errorString = "Could not get the layers's node"_s; >+ return; >+ } >+ >+ auto snapshot = WebCore::snapshotNode(renderer->frame(), *node); >+ if (!snapshot) { >+ errorString = "Could not capture snapshot"_s; >+ return; >+ } >+ >+ *outDataURL = snapshot->toDataURL("image/png"_s, WTF::nullopt, PreserveResolution::Yes); >+} >+ > String InspectorLayerTreeAgent::bind(const RenderLayer* layer) > { > if (!layer) >diff --git a/Source/WebCore/inspector/agents/InspectorLayerTreeAgent.h b/Source/WebCore/inspector/agents/InspectorLayerTreeAgent.h >index cdfa14e74106e11e659fa813977a5fa779c1716b..337bd1f71bb3ac2759eda651bb0a2fe7d4c3937f 100644 >--- a/Source/WebCore/inspector/agents/InspectorLayerTreeAgent.h >+++ b/Source/WebCore/inspector/agents/InspectorLayerTreeAgent.h >@@ -65,6 +65,7 @@ public: > void disable(ErrorString&) override; > void layersForNode(ErrorString&, int nodeId, RefPtr<JSON::ArrayOf<Inspector::Protocol::LayerTree::Layer>>&) override; > void reasonsForCompositingLayer(ErrorString&, const String& layerId, RefPtr<Inspector::Protocol::LayerTree::CompositingReasons>&) override; >+ void imageForLayerContents(ErrorString&, const String& layerId, String*) override; > > private: > // RenderLayer-related methods. >diff --git a/Source/WebInspectorUI/UserInterface/Controllers/LayerTreeManager.js b/Source/WebInspectorUI/UserInterface/Controllers/LayerTreeManager.js >index 17e1ad59a7a102f6490dbbb5f37522b3e5c46463..22c38b4895398d4cbbb3a5e0e6c0fbc8f473db05 100644 >--- a/Source/WebInspectorUI/UserInterface/Controllers/LayerTreeManager.js >+++ b/Source/WebInspectorUI/UserInterface/Controllers/LayerTreeManager.js >@@ -90,6 +90,15 @@ WI.LayerTreeManager = class LayerTreeManager extends WI.Object > }); > } > >+ imageForLayerContents(layer, callback) >+ { >+ console.assert(this.supported); >+ >+ LayerTreeAgent.imageForLayerContents(layer.layerId, function(error, image) { >+ callback(error ? 0 : image); >+ }); >+ } >+ > layerTreeDidChange() > { > this.dispatchEventToListeners(WI.LayerTreeManager.Event.LayerTreeDidChange); >diff --git a/Source/WebInspectorUI/UserInterface/Views/Layers3DContentView.js b/Source/WebInspectorUI/UserInterface/Views/Layers3DContentView.js >index c923d02cefe88366eeb4e3cd608c494cc4de2235..0a5e2c665b0c38cb3e4311720b73a8a1d456d702 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/Layers3DContentView.js >+++ b/Source/WebInspectorUI/UserInterface/Views/Layers3DContentView.js >@@ -267,6 +267,22 @@ WI.Layers3DContentView = class Layers3DContentView extends WI.ContentView > layerGroup.position.set(layer.bounds.x, -layer.bounds.y, index * zInterval); > }); > >+ newLayers.forEach((layer) => { >+ WI.layerTreeManager.imageForLayerContents(layer, (dataURI) => { >+ >+ let layerGroup = this._layerGroupsById.get(layer.layerId); >+ let [plane, outline] = layerGroup.children; >+ >+ let textureImage = new Image(); >+ textureImage.onload = () => { >+ plane.material.map.image = textureImage; >+ plane.material.needsUpdate = true; >+ }; >+ textureImage.src = dataURI; >+ }); >+ >+ }); >+ > this._boundingBox.setFromObject(this._scene); > this._controls.maxDistance = this._boundingBox.max.z + WI.Layers3DContentView._zPadding; > >@@ -291,7 +307,7 @@ WI.Layers3DContentView = class Layers3DContentView extends WI.ContentView > new THREE.Vector3(width, -height, 0), > new THREE.Vector3(width, 0, 0), > ); >- >+ > let layerColors = this._colorsForLayer(layer); > if (isOutline) { > let material = new THREE.LineBasicMaterial({ >@@ -304,13 +320,27 @@ WI.Layers3DContentView = class Layers3DContentView extends WI.ContentView > > geometry.faces.push(new THREE.Face3(0, 1, 3), new THREE.Face3(1, 2, 3)); > >+ let texture = new THREE.Texture(); > let material = new THREE.MeshBasicMaterial({ > color: layerColors.fill, > opacity: layerColors.fillOpacity, >+ map: texture, > transparent: true, > side: THREE.DoubleSide, > depthWrite: false, > }); >+ >+ geometry.faceVertexUvs[0].push([ >+ new THREE.Vector2(0, 0.0), >+ new THREE.Vector2(0, 0.1), >+ new THREE.Vector2(1, 1), >+ ]); >+ >+ geometry.faceVertexUvs[0].push([ >+ new THREE.Vector2(0, 0), >+ new THREE.Vector2(1, 1), >+ new THREE.Vector2(1, 0), >+ ]); > > return new THREE.Mesh(geometry, material); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199544
:
373615
|
373818
|
431555