Changeset 218544 in webkit
- Timestamp:
- Jun 19, 2017 11:48:10 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 9 added
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r218535 r218544 1 2017-06-19 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: create canvas content view and details sidebar panel 4 https://bugs.webkit.org/show_bug.cgi?id=138941 5 <rdar://problem/19051672> 6 7 Reviewed by Joseph Pecoraro. 8 9 * inspector/canvas/requestContent-expected.txt: Added. 10 * inspector/canvas/requestContent.html: Added. 11 * inspector/canvas/requestNode-expected.txt: Added. 12 * inspector/canvas/requestNode.html: Added. 13 1 14 2017-06-19 Frederic Wang <fwang@igalia.com> 2 15 -
trunk/Source/JavaScriptCore/ChangeLog
r218527 r218544 1 2017-06-19 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: create canvas content view and details sidebar panel 4 https://bugs.webkit.org/show_bug.cgi?id=138941 5 <rdar://problem/19051672> 6 7 Reviewed by Joseph Pecoraro. 8 9 * inspector/protocol/Canvas.json: 10 - Add an optional `nodeId` attribute to the `Canvas` type. 11 - Add `requestNode` command for getting the node id of the backing canvas element. 12 - Add `requestContent` command for getting the current image content of the canvas. 13 1 14 2017-06-19 Yusuke Suzuki <utatane.tea@gmail.com> 2 15 -
trunk/Source/JavaScriptCore/inspector/protocol/Canvas.json
r218440 r218544 23 23 { "name": "contextType", "$ref": "ContextType", "description": "The type of rendering context backing the canvas." }, 24 24 { "name": "frameId", "$ref": "Network.FrameId", "description": "Parent frame identifier." }, 25 { "name": "nodeId", "$ref": "DOM.NodeId", "optional": true, "description": "The corresponding DOM node id." }, 25 26 { "name": "cssCanvasName", "type": "string", "optional": true, "description": "The CSS canvas identifier, for canvases created with <code>document.getCSSCanvasContext</code>." } 26 27 ] … … 35 36 "name": "disable", 36 37 "description": "Disables Canvas domain events." 38 }, 39 { 40 "name": "requestNode", 41 "description": "Gets the NodeId for the canvas node with the given CanvasId.", 42 "parameters": [ 43 { "name": "canvasId", "$ref": "CanvasId", "description": "Canvas identifier." } 44 ], 45 "returns": [ 46 { "name": "nodeId", "$ref": "DOM.NodeId", "description": "Node identifier for given canvas." } 47 ] 48 }, 49 { 50 "name": "requestContent", 51 "description": "Gets the data for the canvas node with the given CanvasId.", 52 "parameters": [ 53 { "name": "canvasId", "$ref": "CanvasId", "description": "Canvas identifier." } 54 ], 55 "returns": [ 56 { "name": "content", "type": "string", "description": "Base64-encoded data of the canvas' contents." } 57 ] 37 58 } 38 59 ], -
trunk/Source/WebCore/ChangeLog
r218535 r218544 1 2017-06-19 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: create canvas content view and details sidebar panel 4 https://bugs.webkit.org/show_bug.cgi?id=138941 5 <rdar://problem/19051672> 6 7 Reviewed by Joseph Pecoraro. 8 9 Tests: inspector/canvas/requestContent.html 10 inspector/canvas/requestNode.html 11 12 * inspector/InspectorCanvasAgent.h: 13 * inspector/InspectorCanvasAgent.cpp: 14 (WebCore::InspectorCanvasAgent::requestNode): 15 Gets the node id of the backing canvas element. 16 17 (WebCore::InspectorCanvasAgent::requestContent): 18 Gets the current image content of the canvas. 19 20 (WebCore::InspectorCanvasAgent::frameNavigated): 21 (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext): 22 Minor fixes from r218376 <https://webkit.org/b/172623>. 23 24 (WebCore::InspectorCanvasAgent::buildObjectForCanvas): 25 Optionally send the `nodeId` of the backing canvas element if it is available. 26 27 * inspector/InspectorInstrumentation.cpp: 28 (WebCore::InspectorInstrumentation::didCommitLoadImpl): 29 1 30 2017-06-19 Frederic Wang <fwang@igalia.com> 2 31 -
trunk/Source/WebCore/inspector/InspectorCanvasAgent.cpp
r218440 r218544 28 28 29 29 #include "CanvasRenderingContext.h" 30 #include "CanvasRenderingContext2D.h" 30 31 #include "Document.h" 31 #include "DocumentLoader.h"32 32 #include "Frame.h" 33 33 #include "InspectorDOMAgent.h" … … 93 93 } 94 94 95 void InspectorCanvasAgent::requestNode(ErrorString& errorString, const String& canvasId, int* nodeId) 96 { 97 const CanvasEntry* canvasEntry = getCanvasEntry(canvasId); 98 if (!canvasEntry) { 99 errorString = ASCIILiteral("Invalid canvas identifier"); 100 return; 101 } 102 103 int documentNodeId = m_instrumentingAgents.inspectorDOMAgent()->boundNodeId(&canvasEntry->element->document()); 104 if (!documentNodeId) { 105 errorString = ASCIILiteral("Document has not been requested"); 106 return; 107 } 108 109 *nodeId = m_instrumentingAgents.inspectorDOMAgent()->pushNodeToFrontend(errorString, documentNodeId, canvasEntry->element); 110 } 111 112 void InspectorCanvasAgent::requestContent(ErrorString& errorString, const String& canvasId, String* content) 113 { 114 const CanvasEntry* canvasEntry = getCanvasEntry(canvasId); 115 if (!canvasEntry) { 116 errorString = ASCIILiteral("Invalid canvas identifier"); 117 return; 118 } 119 120 CanvasRenderingContext* context = canvasEntry->element->renderingContext(); 121 if (is<CanvasRenderingContext2D>(context)) { 122 ExceptionOr<String> result = canvasEntry->element->toDataURL(ASCIILiteral("image/png")); 123 if (result.hasException()) { 124 errorString = result.releaseException().releaseMessage(); 125 return; 126 } 127 *content = result.releaseReturnValue(); 128 } else { 129 // FIXME: <https://webkit.org/b/173569> Web Inspector: Support getting the content of WebGL/WebGL2/WebGPU contexts 130 errorString = ASCIILiteral("Unsupported canvas context type"); 131 } 132 } 133 95 134 void InspectorCanvasAgent::frameNavigated(Frame& frame) 96 135 { … … 106 145 } 107 146 108 if (!m_enabled) {109 m_canvasEntries.clear();110 return;111 }112 113 147 for (auto* canvasElement : canvasesForFrame) { 114 148 auto canvasEntry = m_canvasEntries.take(canvasElement); 115 m_frontendDispatcher->canvasRemoved(canvasEntry.identifier); 149 if (m_enabled) 150 m_frontendDispatcher->canvasRemoved(canvasEntry.identifier); 116 151 } 117 152 } … … 133 168 134 169 CanvasEntry newCanvasEntry("canvas:" + IdentifiersFactory::createIdentifier(), &canvasElement); 135 if (m_canvasToCSSCanvasId.contains(&canvasElement)) 136 newCanvasEntry.cssCanvasName = m_canvasToCSSCanvasId.take(&canvasElement); 170 newCanvasEntry.cssCanvasName = m_canvasToCSSCanvasId.take(&canvasElement); 137 171 138 172 m_canvasEntries.set(&canvasElement, newCanvasEntry); … … 230 264 if (!canvasEntry.cssCanvasName.isEmpty()) 231 265 canvas->setCssCanvasName(canvasEntry.cssCanvasName); 266 else { 267 InspectorDOMAgent* domAgent = m_instrumentingAgents.inspectorDOMAgent(); 268 int nodeId = domAgent->boundNodeId(&canvasElement); 269 if (!nodeId) { 270 if (int documentNodeId = domAgent->boundNodeId(&canvasElement.document())) { 271 ErrorString ignored; 272 nodeId = domAgent->pushNodeToFrontend(ignored, documentNodeId, &canvasElement); 273 } 274 } 275 276 if (nodeId) 277 canvas->setNodeId(nodeId); 278 } 232 279 233 280 return canvas; -
trunk/Source/WebCore/inspector/InspectorCanvasAgent.h
r218440 r218544 39 39 namespace WebCore { 40 40 41 class DocumentLoader;42 41 class InspectorPageAgent; 43 42 class WebGLRenderingContextBase; … … 59 58 void enable(ErrorString&) override; 60 59 void disable(ErrorString&) override; 60 void requestNode(ErrorString&, const String& canvasId, int* nodeId) override; 61 void requestContent(ErrorString&, const String& canvasId, String* content) override; 61 62 62 63 // InspectorInstrumentation -
trunk/Source/WebInspectorUI/ChangeLog
r218521 r218544 1 2017-06-19 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: create canvas content view and details sidebar panel 4 https://bugs.webkit.org/show_bug.cgi?id=138941 5 <rdar://problem/19051672> 6 7 Reviewed by Joseph Pecoraro. 8 9 * UserInterface/Models/Canvas.js: 10 (WebInspector.Canvas): 11 (WebInspector.Canvas.fromPayload): 12 (WebInspector.Canvas.prototype.get displayName): 13 (WebInspector.Canvas.requestNode): Added. 14 (WebInspector.Canvas.prototype.requestContent): Added. 15 (WebInspector.Canvas.prototype.saveIdentityToCookie): 16 17 * UserInterface/Controllers/CanvasManager.js: 18 (WebInspector.CanvasManager.prototype.canvasAdded): 19 (WebInspector.CanvasManager.prototype.canvasRemoved): 20 * UserInterface/Models/Collection.js: 21 * UserInterface/Models/Frame.js: 22 (WebInspector.Frame): 23 (WebInspector.Frame.prototype.get canvasCollection): 24 (WebInspector.Frame.prototype.commitProvisionalLoad): 25 Create a Collection for Canvas in each Frame, and modify it when canvas events are fired. 26 27 * UserInterface/Views/CanvasContentView.css: Added. 28 (.content-view.canvas > .preview): 29 (.content-view.canvas > .preview > img): 30 * UserInterface/Views/CanvasContentView.js: Added. 31 (WebInspector.CanvasContentView): 32 (WebInspector.CanvasContentView.prototype.get navigationItems): 33 (WebInspector.CanvasContentView.prototype.shown): 34 (WebInspector.CanvasContentView.prototype.hidden): 35 (WebInspector.CanvasContentView.prototype._showPreview): 36 (WebInspector.CanvasContentView.prototype._updateImageGrid): 37 (WebInspector.CanvasContentView.prototype._showGridButtonClicked): 38 * UserInterface/Views/CanvasDetailsSidebarPanel.js: Added. 39 (WebInspector.CanvasDetailsSidebarPanel): 40 (WebInspector.CanvasDetailsSidebarPanel.prototype.inspect): 41 (WebInspector.CanvasDetailsSidebarPanel.prototype.get canvas): 42 (WebInspector.CanvasDetailsSidebarPanel.prototype.set canvas): 43 (WebInspector.CanvasDetailsSidebarPanel.prototype.initialLayout): 44 (WebInspector.CanvasDetailsSidebarPanel.prototype.layout): 45 (WebInspector.CanvasDetailsSidebarPanel.prototype._refreshIdentitySection): 46 (WebInspector.CanvasDetailsSidebarPanel.prototype._refreshSourceSection.this._canvas.requestNode.): 47 (WebInspector.CanvasDetailsSidebarPanel.prototype._refreshSourceSection): 48 * UserInterface/Views/CanvasTreeElement.js: Added. 49 (WebInspector.CanvasTreeElement): 50 51 * UserInterface/Views/FrameTreeElement.js: 52 (WebInspector.FrameTreeElement.prototype.onattach): 53 (WebInspector.FrameTreeElement.prototype.ondetach): 54 (WebInspector.FrameTreeElement.prototype.onpopulate): 55 (WebInspector.FrameTreeElement.prototype._canvasWasAdded): 56 (WebInspector.FrameTreeElement.prototype._canvasWasRemoved): 57 (WebInspector.FrameTreeElement): 58 * UserInterface/Base/Main.js: 59 * UserInterface/Views/ContentView.js: 60 (WebInspector.ContentView.createFromRepresentedObject): 61 (WebInspector.ContentView.isViewable): 62 * UserInterface/Views/ResourceSidebarPanel.js: 63 (WebInspector.ResourceSidebarPanel): 64 (WebInspector.ResourceSidebarPanel.prototype.matchTreeElementAgainstCustomFilters.match): 65 (WebInspector.ResourceSidebarPanel.prototype._treeSelectionDidChange): 66 * UserInterface/Views/ResourcesTabContentView.js: 67 (WebInspector.ResourcesTabContentView): 68 (WebInspector.ResourcesTabContentView.prototype.canShowRepresentedObject): 69 Show Canvas objects and tie them to the correct ContentView and TreeElement subclasses. 70 71 * Localizations/en.lproj/localizedStrings.js: 72 * UserInterface/Main.html: 73 * UserInterface/Images/Canvas.svg: Added. 74 * UserInterface/Views/ResourceIcons.css: 75 (.canvas .icon): 76 Added new files/rules/strings related to Canvas UI. 77 78 * UserInterface/Views/SettingsTabContentView.css: 79 (.content-view.settings .navigation-bar): 80 81 * UserInterface/Base/Setting.js: 82 * UserInterface/Views/SettingsTabContentView.js: 83 (WebInspector.SettingsTabContentView.prototype.initialLayout): 84 (WebInspector.SettingsTabContentView.prototype._createGeneralSettingsView): 85 (WebInspector.SettingsTabContentView.prototype._createDebugSettingsView): 86 Add an experimental settings toggle in the Debug view for showing canvas contexts. 87 88 * UserInterface/Views/FolderizedTreeElement.js: 89 (WebInspector.FolderizedTreeElement.prototype._compareTreeElementsByMainTitle): 90 Drive-by fix: ensure that sorting also includes numbers, so that 1 < 2 < 10. 91 92 * UserInterface/Views/ImageResourceContentView.js: 93 (WebInspector.ImageResourceContentView.prototype.shown): 94 (WebInspector.ImageResourceContentView.prototype.hidden): 95 (WebInspector.ImageResourceContentView.prototype._updateImageGrid): 96 (WebInspector.ImageResourceContentView.prototype._showGridButtonClicked): 97 (WebInspector.ImageResourceContentView): 98 Drive-by fix: change the activated state of the Show Grid navigation item if it changes 99 in another view. 100 1 101 2017-06-19 Devin Rousso <drousso@apple.com> 2 102 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r218521 r218544 56 56 localizedStrings[", "] = ", "; 57 57 localizedStrings["1 match"] = "1 match"; 58 localizedStrings["2D"] = "2D"; 58 59 localizedStrings["Accessibility"] = "Accessibility"; 59 60 localizedStrings["Action"] = "Action"; … … 137 138 localizedStrings["Busy"] = "Busy"; 138 139 localizedStrings["CSP Hash"] = "CSP Hash"; 140 localizedStrings["CSS Canvas"] = "CSS Canvas"; 141 localizedStrings["CSS canvas “%s”"] = "CSS canvas “%s”"; 139 142 localizedStrings["Cached"] = "Cached"; 140 143 localizedStrings["Call Frames Truncated"] = "Call Frames Truncated"; … … 144 147 localizedStrings["Cancel Automatic Continue"] = "Cancel Automatic Continue"; 145 148 localizedStrings["Cancel comparison"] = "Cancel comparison"; 149 localizedStrings["Canvas"] = "Canvas"; 150 localizedStrings["Canvas %d"] = "Canvas %d"; 151 localizedStrings["Canvas %s"] = "Canvas %s"; 152 localizedStrings["Canvas:"] = "Canvas:"; 153 localizedStrings["Canvases"] = "Canvases"; 146 154 localizedStrings["Cap"] = "Cap"; 147 155 localizedStrings["Caps"] = "Caps"; … … 263 271 localizedStrings["Delete Node"] = "Delete Node"; 264 272 localizedStrings["Detach into separate window"] = "Detach into separate window"; 273 localizedStrings["Detached"] = "Detached"; 265 274 localizedStrings["Details"] = "Details"; 266 275 localizedStrings["Did you mean “%s”?\nClick to replace."] = "Did you mean “%s”?\nClick to replace."; … … 562 571 localizedStrings["No Layer Available"] = "No Layer Available"; 563 572 localizedStrings["No Parameters"] = "No Parameters"; 573 localizedStrings["No Preview Available"] = "No Preview Available"; 564 574 localizedStrings["No Properties"] = "No Properties"; 565 575 localizedStrings["No Properties \u2014 Click to Edit"] = "No Properties \u2014 Click to Edit"; … … 752 762 localizedStrings["Show All Nodes (%d More)"] = "Show All Nodes (%d More)"; 753 763 localizedStrings["Show Console tab"] = "Show Console tab"; 764 localizedStrings["Show Contexts in Resources Tab"] = "Show Contexts in Resources Tab"; 754 765 localizedStrings["Show Grid"] = "Show Grid"; 755 766 localizedStrings["Show Remaining (%d)"] = "Show Remaining (%d)"; -
trunk/Source/WebInspectorUI/UserInterface/Base/Main.js
r218440 r218544 1132 1132 || representedObject instanceof WebInspector.Resource 1133 1133 || representedObject instanceof WebInspector.Script 1134 || representedObject instanceof WebInspector.CSSStyleSheet) 1134 || representedObject instanceof WebInspector.CSSStyleSheet 1135 || representedObject instanceof WebInspector.Canvas) 1135 1136 return WebInspector.ResourcesTabContentView; 1136 1137 -
trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js
r218159 r218544 122 122 showScopeChainOnPause: new WebInspector.Setting("show-scope-chain-sidebar", true), 123 123 showImageGrid: new WebInspector.Setting("show-image-grid", false), 124 125 // Experimental 126 experimentalShowCanvasContextsInResources: new WebInspector.Setting("experimental-show-canvas-contexts-in-resources", false), 124 127 }; -
trunk/Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js
r218440 r218544 54 54 this._canvasIdentifierMap.set(canvas.identifier, canvas); 55 55 56 canvas.frame.canvasCollection.add(canvas); 57 56 58 this.dispatchEventToListeners(WebInspector.CanvasManager.Event.CanvasWasAdded, {canvas}); 57 59 } … … 65 67 if (!canvas) 66 68 return; 69 70 canvas.frame.canvasCollection.remove(canvas); 67 71 68 72 this.dispatchEventToListeners(WebInspector.CanvasManager.Event.CanvasWasRemoved, {canvas}); -
trunk/Source/WebInspectorUI/UserInterface/Main.html
r218440 r218544 46 46 <link rel="stylesheet" href="Views/CallFrameTreeElement.css"> 47 47 <link rel="stylesheet" href="Views/CallFrameView.css"> 48 <link rel="stylesheet" href="Views/CanvasContentView.css"> 48 49 <link rel="stylesheet" href="Views/ChartDetailsSectionRow.css"> 49 50 <link rel="stylesheet" href="Views/CircleChart.css"> … … 509 510 <script src="Views/CallFrameTreeElement.js"></script> 510 511 <script src="Views/CallFrameView.js"></script> 512 <script src="Views/CanvasContentView.js"></script> 513 <script src="Views/CanvasDetailsSidebarPanel.js"></script> 514 <script src="Views/CanvasTreeElement.js"></script> 511 515 <script src="Views/ChartDetailsSectionRow.js"></script> 512 516 <script src="Views/CircleChart.js"></script> -
trunk/Source/WebInspectorUI/UserInterface/Models/Canvas.js
r218440 r218544 26 26 WebInspector.Canvas = class Canvas extends WebInspector.Object 27 27 { 28 constructor(identifier, contextType, frame, cssCanvasName)28 constructor(identifier, contextType, frame, {domNode, cssCanvasName} = {}) 29 29 { 30 30 super(); … … 37 37 this._contextType = contextType; 38 38 this._frame = frame; 39 this._domNode = domNode || null; 39 40 this._cssCanvasName = cssCanvasName || ""; 40 41 } … … 57 58 58 59 let frame = WebInspector.frameResourceManager.frameForIdentifier(payload.frameId); 59 return new WebInspector.Canvas(payload.canvasId, contextType, frame, payload.cssCanvasName); 60 return new WebInspector.Canvas(payload.canvasId, contextType, frame, { 61 domNode: payload.nodeId ? WebInspector.domTreeManager.nodeForId(payload.nodeId) : null, 62 cssCanvasName: payload.cssCanvasName, 63 }); 60 64 } 61 65 … … 66 70 return WebInspector.UIString("2D"); 67 71 case WebInspector.Canvas.ContextType.WebGL: 68 return WebInspector. UIString("WebGL");72 return WebInspector.unlocalizedString("WebGL"); 69 73 default: 70 74 console.error("Invalid canvas context type", contextType); … … 86 90 get displayName() 87 91 { 88 if (this.cssCanvasName) { 89 console.assert(!this._node, "Unexpected DOM node for CSS canvas."); 92 if (this._cssCanvasName) 90 93 return WebInspector.UIString("CSS canvas “%s”").format(this._cssCanvasName); 94 95 if (this._domNode) { 96 let idSelector = this._domNode.escapedIdSelector; 97 if (idSelector) 98 return WebInspector.UIString("Canvas %s").format(idSelector); 91 99 } 92 93 // TODO:if the DOM node for the canvas is known and an id attribute value94 // exists, return the following: WebInspector.UIString("Canvas #%s").format(id);95 100 96 101 if (!this._uniqueDisplayNameNumber) … … 99 104 } 100 105 106 requestNode(callback) 107 { 108 if (this._domNode) { 109 callback(this._domNode); 110 return; 111 } 112 113 WebInspector.domTreeManager.requestDocument((document) => { 114 CanvasAgent.requestNode(this._identifier, (error, nodeId) => { 115 if (error) { 116 callback(null); 117 return; 118 } 119 120 this._domNode = WebInspector.domTreeManager.nodeForId(nodeId); 121 callback(this._domNode); 122 }); 123 }); 124 } 125 126 requestContent(callback) 127 { 128 CanvasAgent.requestContent(this._identifier, (error, content) => { 129 if (error) { 130 callback(null); 131 return; 132 } 133 134 callback(content); 135 }); 136 } 137 101 138 saveIdentityToCookie(cookie) 102 139 { 103 140 cookie[WebInspector.Canvas.FrameURLCookieKey] = this._frame.url.hash; 141 104 142 if (this._cssCanvasName) 105 143 cookie[WebInspector.Canvas.CSSCanvasNameCookieKey] = this._cssCanvasName; 144 else if (this._domNode) 145 cookie[WebInspector.Canvas.NodePathCookieKey] = this._domNode.path; 106 146 107 // TODO: if the canvas has an associated DOM node, and the node path to the cookie.108 147 } 109 148 }; … … 115 154 116 155 WebInspector.Canvas.ContextType = { 117 Canvas2D: Symbol("canvas-2d"),118 WebGL: Symbol("webgl"),156 Canvas2D: "canvas-2d", 157 WebGL: "webgl", 119 158 }; 159 160 WebInspector.Canvas.ResourceSidebarType = "resource-type-canvas"; -
trunk/Source/WebInspectorUI/UserInterface/Models/Collection.js
r217258 r218544 118 118 Script: (object) => object instanceof WebInspector.Script, 119 119 CSSStyleSheet: (object) => object instanceof WebInspector.CSSStyleSheet, 120 Canvas: (object) => object instanceof WebInspector.Canvas, 120 121 }; -
trunk/Source/WebInspectorUI/UserInterface/Models/Frame.js
r208246 r218544 40 40 this._provisionalResourceCollection = new WebInspector.ResourceCollection; 41 41 this._extraScriptCollection = new WebInspector.Collection(WebInspector.Collection.TypeVerifier.Script); 42 this._canvasCollection = new WebInspector.Collection(WebInspector.Collection.TypeVerifier.Canvas); 42 43 43 44 this._childFrameCollection = new WebInspector.Collection(WebInspector.Collection.TypeVerifier.Frame); … … 59 60 get resourceCollection() { return this._resourceCollection; } 60 61 get extraScriptCollection() { return this._extraScriptCollection; } 62 get canvasCollection() { return this._canvasCollection; } 61 63 get childFrameCollection() { return this._childFrameCollection; } 62 64 … … 134 136 this._provisionalResourceCollection = new WebInspector.ResourceCollection; 135 137 this._extraScriptCollection.clear(); 138 this._canvasCollection.clear(); 136 139 137 140 this.clearExecutionContexts(true); -
trunk/Source/WebInspectorUI/UserInterface/Views/ContentView.js
r217258 r218544 58 58 return new WebInspector.TextResourceContentView(representedObject, extraArguments); 59 59 60 if (representedObject instanceof WebInspector.Canvas) 61 return new WebInspector.CanvasContentView(representedObject, extraArguments); 62 60 63 if (representedObject instanceof WebInspector.TimelineRecording) 61 64 return new WebInspector.TimelineRecordingContentView(representedObject, extraArguments); … … 240 243 if (representedObject instanceof WebInspector.CSSStyleSheet) 241 244 return true; 245 if (representedObject instanceof WebInspector.Canvas) 246 return true; 242 247 if (representedObject instanceof WebInspector.TimelineRecording) 243 248 return true; -
trunk/Source/WebInspectorUI/UserInterface/Views/FolderizedTreeElement.js
r208520 r218544 238 238 239 239 // Then sort by title. 240 return a.mainTitle.localeCompare(b.mainTitle );240 return a.mainTitle.localeCompare(b.mainTitle, undefined, {numeric: true}); 241 241 } 242 242 -
trunk/Source/WebInspectorUI/UserInterface/Views/FrameTreeElement.js
r217258 r218544 54 54 this.registerFolderizeSettings("extra-scripts", WebInspector.UIString("Extra Scripts"), this._frame.extraScriptCollection, WebInspector.ScriptTreeElement); 55 55 56 if (window.CanvasAgent && WebInspector.settings.experimentalShowCanvasContextsInResources.value) 57 this.registerFolderizeSettings("canvases", WebInspector.UIString("Canvases"), this._frame.canvasCollection, WebInspector.CanvasTreeElement); 58 56 59 function forwardingConstructor(representedObject, ...extraArguments) { 57 60 if (representedObject instanceof WebInspector.CSSStyleSheet) … … 122 125 123 126 WebInspector.cssStyleManager.addEventListener(WebInspector.CSSStyleManager.Event.StyleSheetAdded, this._styleSheetAdded, this); 127 128 if (window.CanvasAgent && WebInspector.settings.experimentalShowCanvasContextsInResources.value) { 129 this._frame.canvasCollection.addEventListener(WebInspector.Collection.Event.ItemAdded, this._canvasWasAdded, this); 130 this._frame.canvasCollection.addEventListener(WebInspector.Collection.Event.ItemRemoved, this._canvasWasRemoved, this); 131 } 124 132 } 125 133 … … 127 135 { 128 136 WebInspector.cssStyleManager.removeEventListener(WebInspector.CSSStyleManager.Event.StyleSheetAdded, this._styleSheetAdded, this); 137 138 if (window.CanvasAgent && WebInspector.settings.experimentalShowCanvasContextsInResources.value) { 139 this._frame.canvasCollection.removeEventListener(WebInspector.Collection.Event.ItemAdded, this._canvasWasAdded, this); 140 this._frame.canvasCollection.removeEventListener(WebInspector.Collection.Event.ItemRemoved, this._canvasWasRemoved, this); 141 } 129 142 130 143 super.ondetach(); … … 187 200 } 188 201 202 if (window.CanvasAgent && WebInspector.settings.experimentalShowCanvasContextsInResources.value) { 203 for (let canvas of this._frame.canvasCollection.items) 204 this.addChildForRepresentedObject(canvas); 205 } 206 189 207 const doNotCreateIfMissing = true; 190 208 WebInspector.cssStyleManager.preferredInspectorStyleSheetForFrame(this._frame, this.addRepresentedObjectToNewChildQueue.bind(this), doNotCreateIfMissing); … … 280 298 this.addRepresentedObjectToNewChildQueue(event.data.styleSheet); 281 299 } 300 301 _canvasWasAdded(event) 302 { 303 this.addRepresentedObjectToNewChildQueue(event.data.item); 304 } 305 306 _canvasWasRemoved(event) 307 { 308 this.removeChildForRepresentedObject(event.data.item); 309 } 282 310 }; -
trunk/Source/WebInspectorUI/UserInterface/Views/ImageResourceContentView.js
r218159 r218544 60 60 this._imageElement.src = objectURL; 61 61 this._imageElement.setAttribute("filename", this.resource.urlComponents.lastPathComponent || ""); 62 this._ toggleImageGrid();62 this._updateImageGrid(); 63 63 64 64 this.element.appendChild(this._imageElement); … … 71 71 super.shown(); 72 72 73 this._toggleImageGrid(); 73 this._updateImageGrid(); 74 75 WebInspector.settings.showImageGrid.addEventListener(WebInspector.Setting.Event.Changed, this._updateImageGrid, this); 76 } 77 78 hidden() 79 { 80 WebInspector.settings.showImageGrid.removeEventListener(WebInspector.Setting.Event.Changed, this._updateImageGrid, this); 81 82 super.hidden(); 74 83 } 75 84 76 85 // Private 77 86 78 _ toggleImageGrid()87 _updateImageGrid() 79 88 { 80 89 if (!this._imageElement) 81 90 return; 82 91 83 let activated = this._showGridButtonNavigationItem.activated;84 92 let activated = WebInspector.settings.showImageGrid.value; 93 this._showGridButtonNavigationItem.activated = activated; 85 94 this._imageElement.classList.toggle("show-grid", activated); 86 95 } … … 88 97 _showGridButtonClicked(event) 89 98 { 90 WebInspector.settings.showImageGrid.value = this._showGridButtonNavigationItem.activated =!this._showGridButtonNavigationItem.activated;99 WebInspector.settings.showImageGrid.value = !this._showGridButtonNavigationItem.activated; 91 100 92 this._ toggleImageGrid();101 this._updateImageGrid(); 93 102 } 94 103 }; -
trunk/Source/WebInspectorUI/UserInterface/Views/ResourceIcons.css
r218042 r218544 72 72 } 73 73 74 .canvas .icon { 75 content: url(../Images/Canvas.svg); 76 } 77 74 78 .large .resource-icon .icon { 75 79 content: image-set(url(../Images/DocumentGenericLarge.png) 1x, url(../Images/DocumentGenericLarge@2x.png) 2x); -
trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js
r217750 r218544 51 51 } 52 52 53 let canvasesScopeBarItem = new WebInspector.ScopeBarItem(scopeItemPrefix + WebInspector.Canvas.ResourceSidebarType, WebInspector.UIString("Canvases")); 54 canvasesScopeBarItem[WebInspector.ResourceSidebarPanel.ResourceTypeSymbol] = WebInspector.Canvas.ResourceSidebarType; 55 scopeBarItems.insertAtIndex(canvasesScopeBarItem, scopeBarItems.length - 1); 56 53 57 this._scopeBar = new WebInspector.ScopeBar("resource-sidebar-scope-bar", scopeBarItems, scopeBarItems[0], true); 54 58 this._scopeBar.addEventListener(WebInspector.ScopeBar.Event.SelectionChanged, this._scopeBarSelectionDidChange, this); … … 225 229 if (treeElement instanceof WebInspector.ScriptTreeElement) 226 230 return selectedScopeBarItem[WebInspector.ResourceSidebarPanel.ResourceTypeSymbol] === WebInspector.Resource.Type.Script; 231 232 if (treeElement instanceof WebInspector.CanvasTreeElement) 233 return selectedScopeBarItem[WebInspector.ResourceSidebarPanel.ResourceTypeSymbol] === WebInspector.Canvas.ResourceSidebarType; 227 234 228 235 console.assert(treeElement instanceof WebInspector.ResourceTreeElement, "Unknown treeElement", treeElement); … … 446 453 || treeElement instanceof WebInspector.ScriptTreeElement 447 454 || treeElement instanceof WebInspector.CSSStyleSheetTreeElement 448 || treeElement instanceof WebInspector.ContentFlowTreeElement) { 455 || treeElement instanceof WebInspector.ContentFlowTreeElement 456 || treeElement instanceof WebInspector.CanvasTreeElement) { 449 457 const cookie = null; 450 458 const options = { -
trunk/Source/WebInspectorUI/UserInterface/Views/ResourcesTabContentView.js
r217460 r218544 31 31 let tabBarItem = new WebInspector.GeneralTabBarItem(image, title); 32 32 let detailsSidebarPanelConstructors = [WebInspector.ResourceDetailsSidebarPanel, WebInspector.ProbeDetailsSidebarPanel]; 33 34 if (window.CanvasAgent && WebInspector.settings.experimentalShowCanvasContextsInResources.value) 35 detailsSidebarPanelConstructors.push(WebInspector.CanvasDetailsSidebarPanel); 33 36 34 37 // FIXME: Until ContentFlows are moved to the Elements tab, these details sidebar panels need to be included. … … 67 70 || representedObject instanceof WebInspector.CSSStyleSheet 68 71 || representedObject instanceof WebInspector.ContentFlow 72 || representedObject instanceof WebInspector.Canvas 69 73 || representedObject instanceof WebInspector.Collection; 70 74 } -
trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.css
r216451 r218544 28 28 padding-bottom: 6vh; 29 29 overflow-y: auto; 30 } 31 32 .content-view.settings .navigation-bar { 33 position: -webkit-sticky; 34 top: 0; 35 background-color: white; 30 36 } 31 37 -
trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js
r217625 r218544 165 165 WebInspector.notifications.addEventListener(WebInspector.Notification.DebugUIEnabledDidChange, this._updateDebugSettingsViewVisibility, this); 166 166 this._updateDebugSettingsViewVisibility(); 167 168 this.selectedSettingsView = this._settingsViews[0]; 167 169 } 168 170 … … 223 225 224 226 this.addSettingsView(generalSettingsView); 225 this.selectedSettingsView = generalSettingsView;226 227 } 227 228 … … 259 260 layoutDirectionEditor.value = WebInspector.settings.layoutDirection.value; 260 261 layoutDirectionEditor.addEventListener(WebInspector.SettingEditor.Event.ValueDidChange, () => { WebInspector.setLayoutDirection(layoutDirectionEditor.value); }); 262 263 if (window.CanvasAgent) { 264 this._debugSettingsView.addSeparator(); 265 266 this._debugSettingsView.addSetting(WebInspector.UIString("Canvas:"), WebInspector.settings.experimentalShowCanvasContextsInResources, WebInspector.UIString("Show Contexts in Resources Tab")); 267 } 261 268 262 269 this.addSettingsView(this._debugSettingsView);
Note: See TracChangeset
for help on using the changeset viewer.