haikuwebkit/LayoutTests/inspector/canvas/requestNode.html

90 lines
3.1 KiB
HTML
Raw Permalink Normal View History

Web Inspector: create canvas content view and details sidebar panel https://bugs.webkit.org/show_bug.cgi?id=138941 <rdar://problem/19051672> Reviewed by Joseph Pecoraro. Source/JavaScriptCore: * inspector/protocol/Canvas.json: - Add an optional `nodeId` attribute to the `Canvas` type. - Add `requestNode` command for getting the node id of the backing canvas element. - Add `requestContent` command for getting the current image content of the canvas. Source/WebCore: Tests: inspector/canvas/requestContent.html inspector/canvas/requestNode.html * inspector/InspectorCanvasAgent.h: * inspector/InspectorCanvasAgent.cpp: (WebCore::InspectorCanvasAgent::requestNode): Gets the node id of the backing canvas element. (WebCore::InspectorCanvasAgent::requestContent): Gets the current image content of the canvas. (WebCore::InspectorCanvasAgent::frameNavigated): (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext): Minor fixes from r218376 <https://webkit.org/b/172623>. (WebCore::InspectorCanvasAgent::buildObjectForCanvas): Optionally send the `nodeId` of the backing canvas element if it is available. * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didCommitLoadImpl): Source/WebInspectorUI: * UserInterface/Models/Canvas.js: (WebInspector.Canvas): (WebInspector.Canvas.fromPayload): (WebInspector.Canvas.prototype.get displayName): (WebInspector.Canvas.requestNode): Added. (WebInspector.Canvas.prototype.requestContent): Added. (WebInspector.Canvas.prototype.saveIdentityToCookie): * UserInterface/Controllers/CanvasManager.js: (WebInspector.CanvasManager.prototype.canvasAdded): (WebInspector.CanvasManager.prototype.canvasRemoved): * UserInterface/Models/Collection.js: * UserInterface/Models/Frame.js: (WebInspector.Frame): (WebInspector.Frame.prototype.get canvasCollection): (WebInspector.Frame.prototype.commitProvisionalLoad): Create a Collection for Canvas in each Frame, and modify it when canvas events are fired. * UserInterface/Views/CanvasContentView.css: Added. (.content-view.canvas > .preview): (.content-view.canvas > .preview > img): * UserInterface/Views/CanvasContentView.js: Added. (WebInspector.CanvasContentView): (WebInspector.CanvasContentView.prototype.get navigationItems): (WebInspector.CanvasContentView.prototype.shown): (WebInspector.CanvasContentView.prototype.hidden): (WebInspector.CanvasContentView.prototype._showPreview): (WebInspector.CanvasContentView.prototype._updateImageGrid): (WebInspector.CanvasContentView.prototype._showGridButtonClicked): * UserInterface/Views/CanvasDetailsSidebarPanel.js: Added. (WebInspector.CanvasDetailsSidebarPanel): (WebInspector.CanvasDetailsSidebarPanel.prototype.inspect): (WebInspector.CanvasDetailsSidebarPanel.prototype.get canvas): (WebInspector.CanvasDetailsSidebarPanel.prototype.set canvas): (WebInspector.CanvasDetailsSidebarPanel.prototype.initialLayout): (WebInspector.CanvasDetailsSidebarPanel.prototype.layout): (WebInspector.CanvasDetailsSidebarPanel.prototype._refreshIdentitySection): (WebInspector.CanvasDetailsSidebarPanel.prototype._refreshSourceSection.this._canvas.requestNode.): (WebInspector.CanvasDetailsSidebarPanel.prototype._refreshSourceSection): * UserInterface/Views/CanvasTreeElement.js: Added. (WebInspector.CanvasTreeElement): * UserInterface/Views/FrameTreeElement.js: (WebInspector.FrameTreeElement.prototype.onattach): (WebInspector.FrameTreeElement.prototype.ondetach): (WebInspector.FrameTreeElement.prototype.onpopulate): (WebInspector.FrameTreeElement.prototype._canvasWasAdded): (WebInspector.FrameTreeElement.prototype._canvasWasRemoved): (WebInspector.FrameTreeElement): * UserInterface/Base/Main.js: * UserInterface/Views/ContentView.js: (WebInspector.ContentView.createFromRepresentedObject): (WebInspector.ContentView.isViewable): * UserInterface/Views/ResourceSidebarPanel.js: (WebInspector.ResourceSidebarPanel): (WebInspector.ResourceSidebarPanel.prototype.matchTreeElementAgainstCustomFilters.match): (WebInspector.ResourceSidebarPanel.prototype._treeSelectionDidChange): * UserInterface/Views/ResourcesTabContentView.js: (WebInspector.ResourcesTabContentView): (WebInspector.ResourcesTabContentView.prototype.canShowRepresentedObject): Show Canvas objects and tie them to the correct ContentView and TreeElement subclasses. * Localizations/en.lproj/localizedStrings.js: * UserInterface/Main.html: * UserInterface/Images/Canvas.svg: Added. * UserInterface/Views/ResourceIcons.css: (.canvas .icon): Added new files/rules/strings related to Canvas UI. * UserInterface/Views/SettingsTabContentView.css: (.content-view.settings .navigation-bar): * UserInterface/Base/Setting.js: * UserInterface/Views/SettingsTabContentView.js: (WebInspector.SettingsTabContentView.prototype.initialLayout): (WebInspector.SettingsTabContentView.prototype._createGeneralSettingsView): (WebInspector.SettingsTabContentView.prototype._createDebugSettingsView): Add an experimental settings toggle in the Debug view for showing canvas contexts. * UserInterface/Views/FolderizedTreeElement.js: (WebInspector.FolderizedTreeElement.prototype._compareTreeElementsByMainTitle): Drive-by fix: ensure that sorting also includes numbers, so that 1 < 2 < 10. * UserInterface/Views/ImageResourceContentView.js: (WebInspector.ImageResourceContentView.prototype.shown): (WebInspector.ImageResourceContentView.prototype.hidden): (WebInspector.ImageResourceContentView.prototype._updateImageGrid): (WebInspector.ImageResourceContentView.prototype._showGridButtonClicked): (WebInspector.ImageResourceContentView): Drive-by fix: change the activated state of the Show Grid navigation item if it changes in another view. LayoutTests: * inspector/canvas/requestContent-expected.txt: Added. * inspector/canvas/requestContent.html: Added. * inspector/canvas/requestNode-expected.txt: Added. * inspector/canvas/requestNode.html: Added. Canonical link: https://commits.webkit.org/190478@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-20 06:48:10 +00:00
<!DOCTYPE html>
<html>
<head>
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
<script>
function load() {
window.onscreenCanvas = document.getElementById("onscreen").getContext("2d");
window.offscreenCanvas = document.createElement("canvas").getContext("2d");
window.cssCanvas = document.getCSSCanvasContext("2d", "css", 10, 10);
runTest();
}
function test() {
let suite = InspectorTest.createAsyncSuite("Canvas.requestNode");
suite.addTestCase({
name: "Canvas.requestNode.validCanvasId",
description: "Get the node id for each canvas on the page.",
test(resolve, reject) {
Web Inspector: add instrumentation for showing existing Web Animations https://bugs.webkit.org/show_bug.cgi?id=205434 <rdar://problem/28328087> Reviewed by Brian Burg. Source/JavaScriptCore: * inspector/protocol/Animation.json: Add types/commands/events for instrumenting the lifecycle of `Animation` objects, as well as commands for getting the JavaScript wrapper object and the target DOM node. Source/WebCore: Add types/commands/events for instrumenting the lifecycle of `Animation` objects, as well as commands for getting the JavaScript wrapper object and the target DOM node. Tests: inspector/animation/effectChanged.html inspector/animation/lifecycle-css-animation.html inspector/animation/lifecycle-css-transition.html inspector/animation/lifecycle-web-animation.html inspector/animation/requestEffectTarget.html inspector/animation/resolveAnimation.html inspector/animation/targetChanged.html * animation/WebAnimation.h: * animation/WebAnimation.cpp: (WebCore::WebAnimation::instances): Added. (WebCore::WebAnimation::instancesMutex): Added. (WebCore::WebAnimation::create): (WebCore::WebAnimation::WebAnimation): (WebCore::WebAnimation::~WebAnimation): (WebCore::WebAnimation::effectTimingDidChange): (WebCore::WebAnimation::setEffectInternal): (WebCore::WebAnimation::effectTargetDidChange): * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::create): * animation/CSSTransition.cpp: (WebCore::CSSTransition::create): * animation/KeyframeEffect.h: (WebCore::KeyframeEffect::parsedKeyframes const): Added. (WebCore::KeyframeEffect::blendingKeyframes const): Added. (WebCore::KeyframeEffect::hasBlendingKeyframes const): Deleted. Provide a way to access the list of keyframes. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didSetWebAnimationEffect): Added. (WebCore::InspectorInstrumentation::didChangeWebAnimationEffectTiming): Added. (WebCore::InspectorInstrumentation::didChangeWebAnimationEffectTarget): Added. (WebCore::InspectorInstrumentation::didCreateWebAnimation): Added. (WebCore::InspectorInstrumentation::didChangeWebAnimationEffect): Deleted. * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didCommitLoadImpl): (WebCore::InspectorInstrumentation::didSetWebAnimationEffectImpl): Added. (WebCore::InspectorInstrumentation::didChangeWebAnimationEffectTimingImpl): Added. (WebCore::InspectorInstrumentation::didChangeWebAnimationEffectTargetImpl): Added. (WebCore::InspectorInstrumentation::didCreateWebAnimationImpl): Added. (WebCore::InspectorInstrumentation::willDestroyWebAnimationImpl): (WebCore::InspectorInstrumentation::didChangeWebAnimationEffectImpl): Deleted. * inspector/InstrumentingAgents.h: (WebCore::InstrumentingAgents::enabledInspectorAnimationAgent const): Added. (WebCore::InstrumentingAgents::setEnabledInspectorAnimationAgent): Added. * inspector/InstrumentingAgents.cpp: (WebCore::InstrumentingAgents::reset): * inspector/agents/InspectorAnimationAgent.h: * inspector/agents/InspectorAnimationAgent.cpp: (WebCore::protocolValueForSeconds): Added. (WebCore::protocolValueForPlaybackDirection): Added. (WebCore::protocolValueForFillMode): Added. (WebCore::buildObjectForKeyframes): Added. (WebCore::buildObjectForEffect): Added. (WebCore::InspectorAnimationAgent::InspectorAnimationAgent): (WebCore::InspectorAnimationAgent::willDestroyFrontendAndBackend): (WebCore::InspectorAnimationAgent::enable): Added. (WebCore::InspectorAnimationAgent::disable): Added. (WebCore::InspectorAnimationAgent::requestEffectTarget): Added. (WebCore::InspectorAnimationAgent::resolveAnimation): Added. (WebCore::InspectorAnimationAgent::didSetWebAnimationEffect): Added. (WebCore::InspectorAnimationAgent::didChangeWebAnimationEffectTiming): Added. (WebCore::InspectorAnimationAgent::didChangeWebAnimationEffectTarget): Added. (WebCore::InspectorAnimationAgent::didCreateWebAnimation): Added. (WebCore::InspectorAnimationAgent::willDestroyWebAnimation): (WebCore::InspectorAnimationAgent::frameNavigated): (WebCore::InspectorAnimationAgent::findAnimationId): Added. (WebCore::InspectorAnimationAgent::assertAnimation): Added. (WebCore::InspectorAnimationAgent::bindAnimation): Added. (WebCore::InspectorAnimationAgent::unbindAnimation): Added. (WebCore::InspectorAnimationAgent::animationDestroyedTimerFired): Added. (WebCore::InspectorAnimationAgent::reset): Added. (WebCore::InspectorAnimationAgent::didChangeWebAnimationEffect): Deleted. * inspector/agents/InspectorDOMAgent.h: * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::pushNodeToFrontend): (WebCore::InspectorDOMAgent::querySelector): (WebCore::InspectorDOMAgent::pushNodePathToFrontend): (WebCore::InspectorDOMAgent::setNodeName): (WebCore::InspectorDOMAgent::setOuterHTML): (WebCore::InspectorDOMAgent::moveTo): (WebCore::InspectorDOMAgent::requestNode): (WebCore::InspectorDOMAgent::pushNodeByPathToFrontend): Add an overload for `pushNodePathToFrontend` that exposes an `ErrorString`. Source/WebInspectorUI: * UserInterface/Controllers/AnimationManager.js: Added. (WI.AnimationManager): (WI.AnimationManager.prototype.get domains): (WI.AnimationManager.prototype.activateExtraDomain): (WI.AnimationManager.prototype.initializeTarget): (WI.AnimationManager.prototype.get animationCollection): (WI.AnimationManager.prototype.get supported): (WI.AnimationManager.prototype.enable): (WI.AnimationManager.prototype.disable): (WI.AnimationManager.prototype.animationCreated): (WI.AnimationManager.prototype.effectChanged): (WI.AnimationManager.prototype.targetChanged): (WI.AnimationManager.prototype.animationDestroyed): (WI.AnimationManager.prototype._handleMainResourceDidChange): * UserInterface/Protocol/AnimationObserver.js: (WI.AnimationObserver.prototype.animationCreated): Added. (WI.AnimationObserver.prototype.effectChanged): Added. (WI.AnimationObserver.prototype.targetChanged): Added. (WI.AnimationObserver.prototype.animationDestroyed): Added. * UserInterface/Models/AnimationCollection.js: Added. (WI.AnimationCollection): (WI.AnimationCollection.prototype.get animationType): (WI.AnimationCollection.prototype.get displayName): (WI.AnimationCollection.prototype.objectIsRequiredType): (WI.AnimationCollection.prototype.animationCollectionForType): (WI.AnimationCollection.prototype.itemAdded): (WI.AnimationCollection.prototype.itemRemoved): (WI.AnimationCollection.prototype.itemsCleared): Similar to `WI.ResourceCollection`, create a subclass of `WI.Collection` that maintains it's own sub-`WI.AnimationCollection`s for each type of `WI.Animation.Type`. * UserInterface/Models/Animation.js: Added. (WI.Animation): (WI.Animation.fromPayload): (WI.Animation.displayNameForAnimationType): (WI.Animation.displayNameForPlaybackDirection): (WI.Animation.displayNameForFillMode): (WI.Animation.resetUniqueDisplayNameNumbers): (WI.Animation.prototype.get animationId): (WI.Animation.prototype.get backtrace): (WI.Animation.prototype.get animationType): (WI.Animation.prototype.get startDelay): (WI.Animation.prototype.get endDelay): (WI.Animation.prototype.get iterationCount): (WI.Animation.prototype.get iterationStart): (WI.Animation.prototype.get iterationDuration): (WI.Animation.prototype.get timingFunction): (WI.Animation.prototype.get playbackDirection): (WI.Animation.prototype.get fillMode): (WI.Animation.prototype.get keyframes): (WI.Animation.prototype.get displayName): (WI.Animation.prototype.requestEffectTarget): (WI.Animation.prototype.effectChanged): (WI.Animation.prototype.targetChanged): (WI.Animation.prototype._updateEffect): * UserInterface/Protocol/RemoteObject.js: (WI.RemoteObject.resolveAnimation): Added. * UserInterface/Views/GraphicsTabContentView.js: Renamed from Source/WebInspectorUI/UserInterface/Views/CanvasTabContentView.js. (WI.GraphicsTabContentView): (WI.GraphicsTabContentView.tabInfo): (WI.GraphicsTabContentView.isTabAllowed): (WI.GraphicsTabContentView.prototype.get type): (WI.GraphicsTabContentView.prototype.showRepresentedObject): Added. (WI.GraphicsTabContentView.prototype.canShowRepresentedObject): (WI.GraphicsTabContentView.prototype.closed): (WI.GraphicsTabContentView.prototype.attached): (WI.GraphicsTabContentView.prototype.detached): (WI.GraphicsTabContentView.prototype.initialLayout): Added. (WI.GraphicsTabContentView.prototype._handleOverviewTreeOutlineSelectionDidChange): Added. * UserInterface/Views/GraphicsTabContentView.css: Renamed from Source/WebInspectorUI/UserInterface/Views/CanvasTabContentView.css. Rename the Canvas Tab to Graphics Tab and display four sections: - Canvases - Web Animations - CSS Animations - CSS Transitions * UserInterface/Views/CanvasSidebarPanel.js: (WI.CanvasSidebarPanel.prototype.canShowRepresentedObject): Only appear if a `WI.Canvas` or `WI.Recording` is selected. * UserInterface/Views/GraphicsOverviewContentView.js: Added. (WI.GraphicsOverviewContentView): (WI.GraphicsOverviewContentView.prototype.get supplementalRepresentedObjects): (WI.GraphicsOverviewContentView.prototype.get navigationItems): (WI.GraphicsOverviewContentView.prototype.attached): (WI.GraphicsOverviewContentView.prototype.detached): (WI.GraphicsOverviewContentView.prototype.initialLayout): (WI.GraphicsOverviewContentView.prototype.dropZoneShouldAppearForDragEvent): (WI.GraphicsOverviewContentView.prototype.dropZoneHandleDrop): (WI.GraphicsOverviewContentView.prototype._handleRefreshButtonClicked): (WI.GraphicsOverviewContentView.prototype._handleShowGridButtonClicked): (WI.GraphicsOverviewContentView.prototype._handleShowImageGridSettingChanged): (WI.GraphicsOverviewContentView.prototype._handleImportButtonNavigationItemClicked): (WI.GraphicsOverviewContentView.prototype._handleOverviewViewSelectedItemChanged): (WI.GraphicsOverviewContentView.prototype._handleOverviewViewSupplementalRepresentedObjectsDidChange): (WI.GraphicsOverviewContentView.prototype._handleClick): * UserInterface/Views/GraphicsOverviewContentView.css: Added. (.content-view.graphics-overview): (.content-view.graphics-overview > section): (.content-view.graphics-overview > section:not(:first-child)): (.content-view.graphics-overview > section > .header): (.content-view.graphics-overview > section:not(:first-of-type) > .header): (.content-view.graphics-overview > section > .header > h1): (.content-view.graphics-overview > section > .header > .navigation-bar): (.content-view.graphics-overview > .content-view.canvas-overview): (@media (prefers-color-scheme: light) .content-view.graphics-overview): (@media (prefers-color-scheme: light) .content-view.graphics-overview > section > .header): Add sticky headers for each of the sections described above. * UserInterface/Views/AnimationCollectionContentView.js: Added. (WI.AnimationCollectionContentView): (WI.AnimationCollectionContentView.prototype.handleRefreshButtonClicked): (WI.AnimationCollectionContentView.prototype.contentViewAdded): (WI.AnimationCollectionContentView.prototype.contentViewRemoved): (WI.AnimationCollectionContentView.prototype.detached): (WI.AnimationCollectionContentView.prototype._handleContentViewMouseEnter): (WI.AnimationCollectionContentView.prototype._handleContentViewMouseLeave): * UserInterface/Views/AnimationCollectionContentView.css: Added. (.content-view.animation-collection): * UserInterface/Views/AnimationContentView.js: Added. (WI.AnimationContentView): (WI.AnimationContentView.get previewHeight): (WI.AnimationContentView.prototype.handleRefreshButtonClicked): (WI.AnimationContentView.prototype.initialLayout): (WI.AnimationContentView.prototype.layout): (WI.AnimationContentView.prototype.sizeDidChange): (WI.AnimationContentView.prototype.attached): (WI.AnimationContentView.prototype.detached): (WI.AnimationContentView.prototype._refreshSubtitle): (WI.AnimationContentView.prototype._refreshPreview.addTitle): (WI.AnimationContentView.prototype._refreshPreview): (WI.AnimationContentView.prototype._handleEffectChanged): (WI.AnimationContentView.prototype._handleTargetChanged): (WI.AnimationContentView.prototype._populateAnimationTargetButtonContextMenu): * UserInterface/Views/AnimationContentView.css: Added. (.content-view.animation): (.content-view.animation.selected): (.content-view.animation > header): (.content-view.animation > header > .titles): (.content-view.animation > header > .titles > .title): (.content-view.animation > header > .titles > .subtitle): (.content-view.animation > header > .titles > .subtitle:not(:empty)::before): (.content-view.animation > header > .navigation-bar): (.content-view.animation:hover > header > .navigation-bar): (.content-view.animation > .preview): (.content-view.animation > .preview > svg): (body[dir=rtl] .content-view.animation > .preview > svg): (.content-view.animation > .preview > svg rect): (.content-view.animation > .preview > svg > .delay line): (.content-view.animation > .preview > svg > .active path): (.content-view.animation > .preview > svg > .active circle): (.content-view.animation > .preview > svg > .active line): (.content-view.animation > .preview > span): (@media (prefers-color-scheme: dark) .content-view.animation > header > .titles > .title): (@media (prefers-color-scheme: dark) .content-view.animation > header > .titles > .subtitle): (@media (prefers-color-scheme: dark) .content-view.animation > .preview): Visualize the start/end delay and keyframes of the given animation as a series of bezier curves separated by markers. * UserInterface/Views/AnimationDetailsSidebarPanel.js: Added. (WI.AnimationDetailsSidebarPanel): (WI.AnimationDetailsSidebarPanel.prototype.inspect): (WI.AnimationDetailsSidebarPanel.prototype.get animation): (WI.AnimationDetailsSidebarPanel.prototype.set animation): (WI.AnimationDetailsSidebarPanel.prototype.initialLayout): (WI.AnimationDetailsSidebarPanel.prototype.layout): (WI.AnimationDetailsSidebarPanel.prototype._refreshIdentitySection): (WI.AnimationDetailsSidebarPanel.prototype._refreshEffectSection): (WI.AnimationDetailsSidebarPanel.prototype._refreshBacktraceSection): (WI.AnimationDetailsSidebarPanel.prototype._handleAnimationEffectChanged): (WI.AnimationDetailsSidebarPanel.prototype._handleAnimationTargetChanged): (WI.AnimationDetailsSidebarPanel.prototype._handleDetailsSectionCollapsedStateChanged): * UserInterface/Views/AnimationDetailsSidebarPanel.css: Added. (.sidebar > .panel.details.animation > .content > .details-section.animation-keyframes .header > .subtitle): (.sidebar > .panel.details.animation > .content > .details-section.animation-keyframes .details-section): (.sidebar > .panel.details.animation > .content > .details-section.animation-keyframes .details-section .row.styles): (.sidebar > .panel.details.animation > .content > .details-section.animation-keyframes .details-section .row.styles .CodeMirror): (.sidebar > .panel.details.animation > .content > .details-section.animation-keyframes .details-section): Show collected information about the selected animation, its effect, and its target. * UserInterface/Controllers/CanvasManager.js: (WI.CanvasManager): (WI.CanvasManager.prototype.get canvasCollection): Added. (WI.CanvasManager.prototype.disable): (WI.CanvasManager.prototype.canvasAdded): (WI.CanvasManager.prototype.canvasRemoved): (WI.CanvasManager.prototype._saveRecordings): Added. (WI.CanvasManager.prototype._mainResourceDidChange): (WI.CanvasManager.prototype.get canvases): Deleted. (WI.CanvasManager.prototype._removeCanvas): Deleted. Rather than have the `WI.CanvasTabContentView` mainain the `WI.CanvasCollection` and have to listen for events from the `WI.CanvasManager`, just have the `WI.CanvasManager` hold on to it instead and provide a getter for it. * UserInterface/Views/CanvasOverviewContentView.js: (WI.CanvasOverviewContentView): (WI.CanvasOverviewContentView.prototype.get navigationItems): (WI.CanvasOverviewContentView.prototype.handleRefreshButtonClicked): (WI.CanvasOverviewContentView.prototype.contentViewAdded): (WI.CanvasOverviewContentView.prototype.contentViewRemoved): (WI.CanvasOverviewContentView.prototype.attached): (WI.CanvasOverviewContentView.prototype.detached): (WI.CanvasOverviewContentView.prototype._addSavedRecording): (WI.CanvasOverviewContentView.prototype.hidden): Deleted. (WI.CanvasOverviewContentView.prototype.get _itemMargin): Deleted. (WI.CanvasOverviewContentView.prototype._refreshPreviews): Deleted. (WI.CanvasOverviewContentView.prototype._updateNavigationItems): Deleted. (WI.CanvasOverviewContentView.prototype._showGridButtonClicked): Deleted. (WI.CanvasOverviewContentView.prototype._updateShowImageGrid): Deleted. * UserInterface/Views/CanvasOverviewContentView.css: (.content-view.canvas-overview): (.content-view.canvas-overview > .content-view.canvas): (@media (prefers-color-scheme: dark) .content-view.canvas-overview): Deleted. * UserInterface/Views/CanvasContentView.js: (WI.CanvasContentView): (WI.CanvasContentView.prototype.handleRefreshButtonClicked): Added. (WI.CanvasContentView.prototype.dropZoneShouldAppearForDragEvent): Added. (WI.CanvasContentView.prototype.dropZoneHandleDrop): Added. (WI.CanvasContentView.prototype.initialLayout): (WI.CanvasContentView.prototype.attached): (WI.CanvasContentView.prototype._populateCanvasElementButtonContextMenu): (WI.CanvasContentView.prototype.shown): Deleted. Move the "Log Canvas Context" to be the first item in the canvas element button context menu. Drive-by: add a `WI.DropZoneView` for when recording JSON files are dragged on top. * UserInterface/Views/CanvasContentView.css: Drive-by: drop `:not(.tab)` from all selectors since the Canvas Tab doesn't exist anymore. * UserInterface/Views/CollectionContentView.js: (WI.CollectionContentView): (WI.CollectionContentView.prototype.get selectedItem): Added. (WI.CollectionContentView.prototype.set selectedItem): Added. (WI.CollectionContentView.prototype.addContentViewForItem): (WI.CollectionContentView.prototype.removeContentViewForItem): (WI.CollectionContentView.prototype.showContentPlaceholder): (WI.CollectionContentView.prototype.initialLayout): (WI.CollectionContentView.prototype._selectItem): (WI.CollectionContentView.prototype._handleClick): Added. (WI.CollectionContentView.prototype.setSelectedItem): Deleted. * UserInterface/Views/CollectionContentView.css: (.content-view.collection > .placeholder:not(.message-text-view)): Added. (.content-view.collection .resource.image img): Deleted. (.content-view.collection .resource.image img:hover): Deleted. When selection is enabled, clicking outside of any of the content views should dismiss the current selection. Clients should also be able to get the currently selected item. * UserInterface/Views/DetailsSectionSimpleRow.js: (WI.DetailsSectionSimpleRow.prototype.set value): Ensure that `0` is considered as a valid value. * UserInterface/Base/Main.js: (WI.loaded): (WI.contentLoaded): (WI.tabContentViewClassForRepresentedObject): * UserInterface/Views/ContentView.js: (WI.ContentView.createFromRepresentedObject): (WI.ContentView.isViewable): Allow `WI.Animation` to be viewable. * UserInterface/Views/Main.css: (.navigation-item-help): Added. (.navigation-item-help > .navigation-bar): Added. (.navigation-item-help > .navigation-bar > .item): Added. (.message-text-view .navigation-item-help): Deleted. (.message-text-view .navigation-item-help .navigation-bar): Deleted. (.message-text-view .navigation-item-help .navigation-bar > .item): Deleted. Allow `WI.createNavigationItemHelp` to be used independently of `WI.createMessageTextView`. * UserInterface/Controllers/DOMManager.js: (WI.DOMManager.prototype.nodeForId): * UserInterface/Controllers/TimelineManager.js: (WI.TimelineManager.prototype.animationTrackingUpdated): * UserInterface/Models/AuditTestCaseResult.js: (WI.AuditTestCaseResult.async fromPayload): Add a fallback so callers don't need to. * UserInterface/Views/ResourceCollectionContentView.js: (WI.ResourceCollectionContentView): * UserInterface/Views/ResourceCollectionContentView.css: (.content-view.resource-collection > .resource.image img): Added. (.content-view.resource-collection > .resource.image img:hover): Added. Drive-by: move these styles to the right file and make them more specific. * UserInterface/Models/Canvas.js: (WI.Canvas.displayNameForContextType): * UserInterface/Models/Recording.js: (WI.Recording.displayNameForRecordingType): Added. Drive-by: fix localized strings. * UserInterface/Views/RecordingContentView.css: Drive-by: drop `:not(.tab)` from all selectors since the Recording Tab doesn't exist anymore. * UserInterface/Main.html: * UserInterface/Images/Graphics.svg: Renamed from Source/WebInspectorUI/UserInterface/Images/Canvas.svg. * Localizations/en.lproj/localizedStrings.js: * UserInterface/Test.html: * UserInterface/Test/Test.js: (WI.loaded): * UserInterface/Test/TestHarness.js: (TestHarness.prototype.expectEmpty): Added. (TestHarness.prototype.expectNotEmpty): Added. (TestHarness.prototype._expectationMessageFormat): (TestHarness.prototype._expectedValueFormat): Add utility function for checking whether the given value is empty: - Array `length === 0` - String `length === 0` - Set `size === 0` - Map `size === 0` - Object `isEmptyObject` Any other type will automatically fail, as non-objects can't be "empty" (e.g. `42`). LayoutTests: * inspector/animation/effectChanged.html: Added. * inspector/animation/effectChanged-expected.txt: Added. * inspector/animation/lifecycle-css-animation.html: Added. * inspector/animation/lifecycle-css-animation-expected.txt: Added. * inspector/animation/lifecycle-css-transition.html: Added. * inspector/animation/lifecycle-css-transition-expected.txt: Added. * inspector/animation/lifecycle-web-animation.html: Added. * inspector/animation/lifecycle-web-animation-expected.txt: Added. * inspector/animation/requestEffectTarget.html: Added. * inspector/animation/requestEffectTarget-expected.txt: Added. * inspector/animation/resolveAnimation.html: Added. * inspector/animation/resolveAnimation-expected.txt: Added. * inspector/animation/targetChanged.html: Added. * inspector/animation/targetChanged-expected.txt: Added. * inspector/animation/resources/lifecycle-utilities.js: Added. (createAnimation): (destroyAnimations): (InspectorTest.AnimationLifecycleUtilities.async awaitAnimationCreated): (InspectorTest.AnimationLifecycleUtilities.async awaitAnimationDestroyed): (InspectorTest.AnimationLifecycleUtilities.async createAnimation): (InspectorTest.AnimationLifecycleUtilities.async destroyAnimations): * inspector/canvas/create-context-webgpu.html: * inspector/canvas/resources/create-context-utilities.js: (destroyCanvases): (awaitCanvasAdded): (InspectorTest.CreateContextUtilities.initializeTestSuite): * inspector/canvas/context-attributes.html: * inspector/canvas/extensions.html: * inspector/canvas/memory.html: * inspector/canvas/requestClientNodes.html: * inspector/canvas/requestContent-2d.html: * inspector/canvas/requestContent-bitmaprenderer.html: * inspector/canvas/requestContent-webgl.html: * inspector/canvas/requestContent-webgl2.html: * inspector/canvas/requestNode.html: * inspector/canvas/resolveContext-2d.html: * inspector/canvas/resolveContext-bitmaprenderer.html: * inspector/canvas/resolveContext-webgl.html: * inspector/canvas/resolveContext-webgl2.html: * inspector/canvas/resolveContext-webgpu.html: * inspector/canvas/recording.html: * inspector/canvas/setRecordingAutoCaptureFrameCount.html: * inspector/canvas/resources/recording-utilities.js: (window.getCanvas): * inspector/canvas/shaderProgram-add-remove-webgpu.html: * inspector/canvas/updateShader-webgpu-sharedVertexFragment.html: * inspector/canvas/resources/shaderProgram-utilities-webgpu.js: * inspector/canvas/resources/shaderProgram-utilities-webgl.js: (deleteContext): (whenProgramAdded): (window.initializeTestSuite): (window.addParentCanvasRemovedTestCase): * inspector/unit-tests/test-harness-expect-functions.html: * inspector/unit-tests/test-harness-expect-functions-expected.txt: Canonical link: https://commits.webkit.org/219987@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255396 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-01-29 23:46:15 +00:00
let canvases = Array.from(WI.canvasManager.canvasCollection);
Web Inspector: create canvas content view and details sidebar panel https://bugs.webkit.org/show_bug.cgi?id=138941 <rdar://problem/19051672> Reviewed by Joseph Pecoraro. Source/JavaScriptCore: * inspector/protocol/Canvas.json: - Add an optional `nodeId` attribute to the `Canvas` type. - Add `requestNode` command for getting the node id of the backing canvas element. - Add `requestContent` command for getting the current image content of the canvas. Source/WebCore: Tests: inspector/canvas/requestContent.html inspector/canvas/requestNode.html * inspector/InspectorCanvasAgent.h: * inspector/InspectorCanvasAgent.cpp: (WebCore::InspectorCanvasAgent::requestNode): Gets the node id of the backing canvas element. (WebCore::InspectorCanvasAgent::requestContent): Gets the current image content of the canvas. (WebCore::InspectorCanvasAgent::frameNavigated): (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext): Minor fixes from r218376 <https://webkit.org/b/172623>. (WebCore::InspectorCanvasAgent::buildObjectForCanvas): Optionally send the `nodeId` of the backing canvas element if it is available. * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didCommitLoadImpl): Source/WebInspectorUI: * UserInterface/Models/Canvas.js: (WebInspector.Canvas): (WebInspector.Canvas.fromPayload): (WebInspector.Canvas.prototype.get displayName): (WebInspector.Canvas.requestNode): Added. (WebInspector.Canvas.prototype.requestContent): Added. (WebInspector.Canvas.prototype.saveIdentityToCookie): * UserInterface/Controllers/CanvasManager.js: (WebInspector.CanvasManager.prototype.canvasAdded): (WebInspector.CanvasManager.prototype.canvasRemoved): * UserInterface/Models/Collection.js: * UserInterface/Models/Frame.js: (WebInspector.Frame): (WebInspector.Frame.prototype.get canvasCollection): (WebInspector.Frame.prototype.commitProvisionalLoad): Create a Collection for Canvas in each Frame, and modify it when canvas events are fired. * UserInterface/Views/CanvasContentView.css: Added. (.content-view.canvas > .preview): (.content-view.canvas > .preview > img): * UserInterface/Views/CanvasContentView.js: Added. (WebInspector.CanvasContentView): (WebInspector.CanvasContentView.prototype.get navigationItems): (WebInspector.CanvasContentView.prototype.shown): (WebInspector.CanvasContentView.prototype.hidden): (WebInspector.CanvasContentView.prototype._showPreview): (WebInspector.CanvasContentView.prototype._updateImageGrid): (WebInspector.CanvasContentView.prototype._showGridButtonClicked): * UserInterface/Views/CanvasDetailsSidebarPanel.js: Added. (WebInspector.CanvasDetailsSidebarPanel): (WebInspector.CanvasDetailsSidebarPanel.prototype.inspect): (WebInspector.CanvasDetailsSidebarPanel.prototype.get canvas): (WebInspector.CanvasDetailsSidebarPanel.prototype.set canvas): (WebInspector.CanvasDetailsSidebarPanel.prototype.initialLayout): (WebInspector.CanvasDetailsSidebarPanel.prototype.layout): (WebInspector.CanvasDetailsSidebarPanel.prototype._refreshIdentitySection): (WebInspector.CanvasDetailsSidebarPanel.prototype._refreshSourceSection.this._canvas.requestNode.): (WebInspector.CanvasDetailsSidebarPanel.prototype._refreshSourceSection): * UserInterface/Views/CanvasTreeElement.js: Added. (WebInspector.CanvasTreeElement): * UserInterface/Views/FrameTreeElement.js: (WebInspector.FrameTreeElement.prototype.onattach): (WebInspector.FrameTreeElement.prototype.ondetach): (WebInspector.FrameTreeElement.prototype.onpopulate): (WebInspector.FrameTreeElement.prototype._canvasWasAdded): (WebInspector.FrameTreeElement.prototype._canvasWasRemoved): (WebInspector.FrameTreeElement): * UserInterface/Base/Main.js: * UserInterface/Views/ContentView.js: (WebInspector.ContentView.createFromRepresentedObject): (WebInspector.ContentView.isViewable): * UserInterface/Views/ResourceSidebarPanel.js: (WebInspector.ResourceSidebarPanel): (WebInspector.ResourceSidebarPanel.prototype.matchTreeElementAgainstCustomFilters.match): (WebInspector.ResourceSidebarPanel.prototype._treeSelectionDidChange): * UserInterface/Views/ResourcesTabContentView.js: (WebInspector.ResourcesTabContentView): (WebInspector.ResourcesTabContentView.prototype.canShowRepresentedObject): Show Canvas objects and tie them to the correct ContentView and TreeElement subclasses. * Localizations/en.lproj/localizedStrings.js: * UserInterface/Main.html: * UserInterface/Images/Canvas.svg: Added. * UserInterface/Views/ResourceIcons.css: (.canvas .icon): Added new files/rules/strings related to Canvas UI. * UserInterface/Views/SettingsTabContentView.css: (.content-view.settings .navigation-bar): * UserInterface/Base/Setting.js: * UserInterface/Views/SettingsTabContentView.js: (WebInspector.SettingsTabContentView.prototype.initialLayout): (WebInspector.SettingsTabContentView.prototype._createGeneralSettingsView): (WebInspector.SettingsTabContentView.prototype._createDebugSettingsView): Add an experimental settings toggle in the Debug view for showing canvas contexts. * UserInterface/Views/FolderizedTreeElement.js: (WebInspector.FolderizedTreeElement.prototype._compareTreeElementsByMainTitle): Drive-by fix: ensure that sorting also includes numbers, so that 1 < 2 < 10. * UserInterface/Views/ImageResourceContentView.js: (WebInspector.ImageResourceContentView.prototype.shown): (WebInspector.ImageResourceContentView.prototype.hidden): (WebInspector.ImageResourceContentView.prototype._updateImageGrid): (WebInspector.ImageResourceContentView.prototype._showGridButtonClicked): (WebInspector.ImageResourceContentView): Drive-by fix: change the activated state of the Show Grid navigation item if it changes in another view. LayoutTests: * inspector/canvas/requestContent-expected.txt: Added. * inspector/canvas/requestContent.html: Added. * inspector/canvas/requestNode-expected.txt: Added. * inspector/canvas/requestNode.html: Added. Canonical link: https://commits.webkit.org/190478@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-20 06:48:10 +00:00
let expectedLength = canvases.length;
InspectorTest.assert(expectedLength === 3, "The page has 3 canvases.");
let nodesMap = new Map;
function finish() {
let results = {};
for (let [canvas, node] of nodesMap)
results[canvas.displayName] = node;
let keys = Object.keys(results);
InspectorTest.assert(keys.length === nodesMap.size, "No display name collisions");
// Ensure that the test runs properly even if the canvas
// events are sent in a different order than the above.
keys.sort();
for (let displayName of keys) {
InspectorTest.expectThat(results[displayName], `Canvas "${displayName}" has node with valid id.`);
InspectorTest.expectEqual(results[displayName].nodeName(), "CANVAS", `Canvas "${displayName}" has node with type "CANVAS".`);
}
resolve();
}
canvases.forEach((canvas) => {
Web Inspector: rename frontend managers to be more consistent with backend agents https://bugs.webkit.org/show_bug.cgi?id=190160 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Test.html: * UserInterface/Test/Test.js: * UserInterface/Main.html: * UserInterface/Base/Main.js: * UserInterface/Base/DOMUtilities.js: * UserInterface/Controllers/ApplicationCacheManager.js: * UserInterface/Controllers/CSSManager.js: Renamed from Source/WebInspectorUI/UserInterface/Controllers/CSSStyleManager.js. * UserInterface/Controllers/ConsoleManager.js: Renamed from Source/WebInspectorUI/UserInterface/Controllers/LogManager.js. * UserInterface/Controllers/DOMDebuggerManager.js: * UserInterface/Controllers/DOMManager.js: Renamed from Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js. * UserInterface/Controllers/DOMStorageManager.js: Renamed from Source/WebInspectorUI/UserInterface/Controllers/StorageManager.js. * UserInterface/Controllers/DashboardManager.js: Removed. * UserInterface/Controllers/DatabaseManager.js: Copied from Source/WebInspectorUI/UserInterface/Controllers/DOMStorageManager.js. * UserInterface/Controllers/HARBuilder.js: * UserInterface/Controllers/IndexedDBManager.js: Copied from Source/WebInspectorUI/UserInterface/Controllers/DOMStorageManager.js. * UserInterface/Controllers/IssueManager.js: Removed. * UserInterface/Controllers/JavaScriptLogViewController.js: * UserInterface/Controllers/NetworkManager.js: Renamed from Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js. * UserInterface/Controllers/SourceMapManager.js: * UserInterface/Controllers/TimelineManager.js: * UserInterface/Debug/UncaughtExceptionReporter.js: * UserInterface/Models/CSSProperty.js: * UserInterface/Models/CSSSelector.js: * UserInterface/Models/CallFrame.js: * UserInterface/Models/Canvas.js: * UserInterface/Models/ConsoleMessage.js: * UserInterface/Models/DOMBreakpoint.js: * UserInterface/Models/DOMNode.js: * UserInterface/Models/DOMNodeStyles.js: * UserInterface/Models/DOMTree.js: * UserInterface/Models/DefaultDashboard.js: * UserInterface/Models/Script.js: * UserInterface/Models/ScriptTimelineRecord.js: * UserInterface/Models/SourceMapResource.js: * UserInterface/Models/TimelineRecording.js: * UserInterface/Protocol/CSSObserver.js: * UserInterface/Protocol/ConsoleObserver.js: * UserInterface/Protocol/DOMObserver.js: * UserInterface/Protocol/DOMStorageObserver.js: * UserInterface/Protocol/DatabaseObserver.js: * UserInterface/Protocol/InspectorFrontendAPI.js: * UserInterface/Protocol/InspectorObserver.js: * UserInterface/Protocol/MainTarget.js: * UserInterface/Protocol/NetworkObserver.js: * UserInterface/Protocol/PageObserver.js: * UserInterface/Protocol/RemoteObject.js: * UserInterface/Protocol/RuntimeObserver.js: * UserInterface/Protocol/WorkerTarget.js: * UserInterface/Views/BoxModelDetailsSectionRow.js: * UserInterface/Views/CanvasOverviewContentView.js: * UserInterface/Views/CanvasTreeElement.js: * UserInterface/Views/ContentView.js: * UserInterface/Views/ContextMenuUtilities.js: * UserInterface/Views/CookieStorageContentView.js: * UserInterface/Views/DOMDetailsSidebarPanel.js: * UserInterface/Views/DOMNodeDetailsSidebarPanel.js: * UserInterface/Views/DOMNodeTreeElement.js: * UserInterface/Views/DOMTreeContentView.js: * UserInterface/Views/DOMTreeDataGrid.js: * UserInterface/Views/DOMTreeElement.js: * UserInterface/Views/DOMTreeElementPathComponent.js: * UserInterface/Views/DOMTreeOutline.js: * UserInterface/Views/DOMTreeUpdater.js: * UserInterface/Views/DebuggerSidebarPanel.js: * UserInterface/Views/ElementsTabContentView.js: * UserInterface/Views/EventBreakpointPopover.js: * UserInterface/Views/EventBreakpointTreeElement.js: * UserInterface/Views/EventListenerSectionGroup.js: * UserInterface/Views/FormattedValue.js: * UserInterface/Views/FrameTreeElement.js: * UserInterface/Views/GeneralStyleDetailsSidebarPanel.js: * UserInterface/Views/IndexedDatabaseObjectStoreContentView.js: * UserInterface/Views/LayerDetailsSidebarPanel.js: * UserInterface/Views/LayerTreeDataGridNode.js: * UserInterface/Views/LayerTreeDetailsSidebarPanel.js: * UserInterface/Views/Layers3DContentView.js: * UserInterface/Views/LogContentView.js: * UserInterface/Views/NetworkTableContentView.js: * UserInterface/Views/ObjectTreeBaseTreeElement.js: * UserInterface/Views/ObjectTreeView.js: * UserInterface/Views/OpenResourceDialog.js: * UserInterface/Views/ResourceSidebarPanel.js: * UserInterface/Views/SearchSidebarPanel.js: * UserInterface/Views/SettingsTabContentView.js: * UserInterface/Views/SourceCodeTextEditor.js: * UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js: * UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js: * UserInterface/Views/StorageSidebarPanel.js: * UserInterface/Views/StyleDetailsPanel.js: * WebInspectorUI.vcxproj/WebInspectorUI.vcxproj: * WebInspectorUI.vcxproj/WebInspectorUI.vcxproj.filters: LayoutTests: * http/tests/inspector/dom/cross-domain-inspected-node-access.html: * http/tests/inspector/dom/disconnect-dom-tree-after-main-frame-navigation.html: * http/tests/inspector/dom/shapes-test.js: * http/tests/inspector/network/har/har-page.html: * http/tests/inspector/network/loadResource-insecure-resource.html: * http/tests/inspector/network/resource-response-source-memory-cache-revalidate-expired-only.html: * http/tests/inspector/network/resource-response-source-memory-cache.html: * http/tests/inspector/network/resource-sizes-memory-cache.html: * http/tests/inspector/network/set-resource-caching-disabled-memory-cache.html: * http/tests/websocket/tests/hybi/inspector/before-load.html: * http/tests/websocket/tests/hybi/inspector/resolveWebSocket.html: * inspector/canvas/requestNode.html: * inspector/codemirror/resources/prettyprinting/utilities.js: (TestPage.registerInitializer.loadPrettyPrintingTestAndExpectedResults): (TestPage.registerInitializer.window.addPrettyPrintingTests): (TestPage.registerInitializer): * inspector/console/clearMessages.html: * inspector/console/command-line-api.html: * inspector/console/console-api.html: * inspector/console/console-count.html: * inspector/console/console-table.html: * inspector/console/console-time.html: * inspector/console/message-stack-trace.html: * inspector/console/messageAdded-from-named-evaluations.html: * inspector/console/messageRepeatCountUpdated.html: * inspector/console/messagesCleared.html: * inspector/console/webcore-logging-expected.txt: * inspector/console/webcore-logging.html: * inspector/controller/runtime-controller-import.html: * inspector/controller/runtime-controller.html: * inspector/css/add-rule.html: * inspector/css/createStyleSheet.html: * inspector/css/css-property.html: * inspector/css/getAllStyleSheets.html: * inspector/css/manager-preferredInspectorStyleSheetForFrame.html: * inspector/css/matched-style-properties.html: * inspector/css/modify-css-property.html: * inspector/css/modify-rule-selector.html: * inspector/css/pseudo-element-matches-for-pseudo-element-node.html: * inspector/css/pseudo-element-matches.html: * inspector/css/selector-dynamic-specificity.html: * inspector/css/selector-specificity.html: * inspector/css/shadow-scoped-style.html: * inspector/css/stylesheet-events-basic.html: * inspector/css/stylesheet-events-imports.html: * inspector/css/stylesheet-events-inspector-stylesheet.html: * inspector/css/stylesheet-events-multiple-documents.html: * inspector/css/stylesheet-with-mutations.html: * inspector/debugger/csp-exceptions.html: * inspector/debugger/js-stacktrace.html: * inspector/debugger/resources/log-pause-location.js: (TestPage.registerInitializer.window.findScript): (TestPage.registerInitializer.window.loadMainPageContent): (TestPage.registerInitializer.window.logResolvedBreakpointLinesWithContext): (TestPage.registerInitializer.window.logLinesWithContext): * inspector/debugger/stepping/stepping-through-autoContinue-breakpoint.html: * inspector/dom-debugger/dom-breakpoints.html: * inspector/dom-debugger/xhr-breakpoints.html: * inspector/dom/breakpoint-for-event-listener.html: * inspector/dom/csp-big5-hash.html: * inspector/dom/csp-hash.html: * inspector/dom/customElementState.html: * inspector/dom/domutilities-csspath.html: * inspector/dom/domutilities-path-dump.html: * inspector/dom/domutilities-xpath.html: * inspector/dom/event-listener-add-remove.html: * inspector/dom/getEventListenersForNode.html: * inspector/dom/getOuterHTML.html: * inspector/dom/hideHighlight.html: * inspector/dom/highlightFrame.html: * inspector/dom/highlightNode.html: * inspector/dom/highlightNodeList.html: * inspector/dom/highlightSelector.html: * inspector/dom/insertAdjacentHTML.html: * inspector/dom/inspect.html: * inspector/dom/pseudo-element-dynamic.html: * inspector/dom/pseudo-element-static.html: * inspector/dom/push-node-by-path-to-frontend.html: * inspector/dom/setEventListenerDisabled.html: * inspector/dom/setInspectedNode.html: * inspector/dom/setOuterHTML-no-document-element.html: * inspector/dom/setOuterHTML.html: * inspector/dom/shadow-and-non-shadow-children.html: * inspector/dom/shadowRootType.html: * inspector/dom/template-content.html: * inspector/formatting/resources/utilities.js: (TestPage.registerInitializer.loadFormattingTestAndExpectedResults): (TestPage.registerInitializer.window.addFormattingTests): (TestPage.registerInitializer): * inspector/indexeddb/clearObjectStore.html: * inspector/indexeddb/deleteDatabaseNamesWithSpace.html: * inspector/indexeddb/requestData.html: * inspector/indexeddb/requestDatabase.html: * inspector/indexeddb/requestDatabaseNames.html: * inspector/layers/layer-tree-manager.html: * inspector/model/dom-node.html: * inspector/model/frame-extra-scripts.html: * inspector/model/script-resource-relationship.html: * inspector/model/stack-trace.html: * inspector/page/empty-or-missing-resources.html: * inspector/page/hidpi-snapshot-size.html: * inspector/page/main-frame-resource.html: * inspector/runtime/change-execution-context-identifier.html: * inspector/runtime/saveResult.html: * inspector/storage/domStorage-events.html: * inspector/worker/console-basic.html: * inspector/worker/resources-in-worker.html: Canonical link: https://commits.webkit.org/205172@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236766 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-02 22:14:52 +00:00
WI.domManager.requestDocument((documentNode) => {
Web Inspector: create canvas content view and details sidebar panel https://bugs.webkit.org/show_bug.cgi?id=138941 <rdar://problem/19051672> Reviewed by Joseph Pecoraro. Source/JavaScriptCore: * inspector/protocol/Canvas.json: - Add an optional `nodeId` attribute to the `Canvas` type. - Add `requestNode` command for getting the node id of the backing canvas element. - Add `requestContent` command for getting the current image content of the canvas. Source/WebCore: Tests: inspector/canvas/requestContent.html inspector/canvas/requestNode.html * inspector/InspectorCanvasAgent.h: * inspector/InspectorCanvasAgent.cpp: (WebCore::InspectorCanvasAgent::requestNode): Gets the node id of the backing canvas element. (WebCore::InspectorCanvasAgent::requestContent): Gets the current image content of the canvas. (WebCore::InspectorCanvasAgent::frameNavigated): (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext): Minor fixes from r218376 <https://webkit.org/b/172623>. (WebCore::InspectorCanvasAgent::buildObjectForCanvas): Optionally send the `nodeId` of the backing canvas element if it is available. * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didCommitLoadImpl): Source/WebInspectorUI: * UserInterface/Models/Canvas.js: (WebInspector.Canvas): (WebInspector.Canvas.fromPayload): (WebInspector.Canvas.prototype.get displayName): (WebInspector.Canvas.requestNode): Added. (WebInspector.Canvas.prototype.requestContent): Added. (WebInspector.Canvas.prototype.saveIdentityToCookie): * UserInterface/Controllers/CanvasManager.js: (WebInspector.CanvasManager.prototype.canvasAdded): (WebInspector.CanvasManager.prototype.canvasRemoved): * UserInterface/Models/Collection.js: * UserInterface/Models/Frame.js: (WebInspector.Frame): (WebInspector.Frame.prototype.get canvasCollection): (WebInspector.Frame.prototype.commitProvisionalLoad): Create a Collection for Canvas in each Frame, and modify it when canvas events are fired. * UserInterface/Views/CanvasContentView.css: Added. (.content-view.canvas > .preview): (.content-view.canvas > .preview > img): * UserInterface/Views/CanvasContentView.js: Added. (WebInspector.CanvasContentView): (WebInspector.CanvasContentView.prototype.get navigationItems): (WebInspector.CanvasContentView.prototype.shown): (WebInspector.CanvasContentView.prototype.hidden): (WebInspector.CanvasContentView.prototype._showPreview): (WebInspector.CanvasContentView.prototype._updateImageGrid): (WebInspector.CanvasContentView.prototype._showGridButtonClicked): * UserInterface/Views/CanvasDetailsSidebarPanel.js: Added. (WebInspector.CanvasDetailsSidebarPanel): (WebInspector.CanvasDetailsSidebarPanel.prototype.inspect): (WebInspector.CanvasDetailsSidebarPanel.prototype.get canvas): (WebInspector.CanvasDetailsSidebarPanel.prototype.set canvas): (WebInspector.CanvasDetailsSidebarPanel.prototype.initialLayout): (WebInspector.CanvasDetailsSidebarPanel.prototype.layout): (WebInspector.CanvasDetailsSidebarPanel.prototype._refreshIdentitySection): (WebInspector.CanvasDetailsSidebarPanel.prototype._refreshSourceSection.this._canvas.requestNode.): (WebInspector.CanvasDetailsSidebarPanel.prototype._refreshSourceSection): * UserInterface/Views/CanvasTreeElement.js: Added. (WebInspector.CanvasTreeElement): * UserInterface/Views/FrameTreeElement.js: (WebInspector.FrameTreeElement.prototype.onattach): (WebInspector.FrameTreeElement.prototype.ondetach): (WebInspector.FrameTreeElement.prototype.onpopulate): (WebInspector.FrameTreeElement.prototype._canvasWasAdded): (WebInspector.FrameTreeElement.prototype._canvasWasRemoved): (WebInspector.FrameTreeElement): * UserInterface/Base/Main.js: * UserInterface/Views/ContentView.js: (WebInspector.ContentView.createFromRepresentedObject): (WebInspector.ContentView.isViewable): * UserInterface/Views/ResourceSidebarPanel.js: (WebInspector.ResourceSidebarPanel): (WebInspector.ResourceSidebarPanel.prototype.matchTreeElementAgainstCustomFilters.match): (WebInspector.ResourceSidebarPanel.prototype._treeSelectionDidChange): * UserInterface/Views/ResourcesTabContentView.js: (WebInspector.ResourcesTabContentView): (WebInspector.ResourcesTabContentView.prototype.canShowRepresentedObject): Show Canvas objects and tie them to the correct ContentView and TreeElement subclasses. * Localizations/en.lproj/localizedStrings.js: * UserInterface/Main.html: * UserInterface/Images/Canvas.svg: Added. * UserInterface/Views/ResourceIcons.css: (.canvas .icon): Added new files/rules/strings related to Canvas UI. * UserInterface/Views/SettingsTabContentView.css: (.content-view.settings .navigation-bar): * UserInterface/Base/Setting.js: * UserInterface/Views/SettingsTabContentView.js: (WebInspector.SettingsTabContentView.prototype.initialLayout): (WebInspector.SettingsTabContentView.prototype._createGeneralSettingsView): (WebInspector.SettingsTabContentView.prototype._createDebugSettingsView): Add an experimental settings toggle in the Debug view for showing canvas contexts. * UserInterface/Views/FolderizedTreeElement.js: (WebInspector.FolderizedTreeElement.prototype._compareTreeElementsByMainTitle): Drive-by fix: ensure that sorting also includes numbers, so that 1 < 2 < 10. * UserInterface/Views/ImageResourceContentView.js: (WebInspector.ImageResourceContentView.prototype.shown): (WebInspector.ImageResourceContentView.prototype.hidden): (WebInspector.ImageResourceContentView.prototype._updateImageGrid): (WebInspector.ImageResourceContentView.prototype._showGridButtonClicked): (WebInspector.ImageResourceContentView): Drive-by fix: change the activated state of the Show Grid navigation item if it changes in another view. LayoutTests: * inspector/canvas/requestContent-expected.txt: Added. * inspector/canvas/requestContent.html: Added. * inspector/canvas/requestNode-expected.txt: Added. * inspector/canvas/requestNode.html: Added. Canonical link: https://commits.webkit.org/190478@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-20 06:48:10 +00:00
CanvasAgent.requestNode(canvas.identifier, (error, nodeId) => {
if (error) {
reject(error);
return;
}
Web Inspector: rename frontend managers to be more consistent with backend agents https://bugs.webkit.org/show_bug.cgi?id=190160 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Test.html: * UserInterface/Test/Test.js: * UserInterface/Main.html: * UserInterface/Base/Main.js: * UserInterface/Base/DOMUtilities.js: * UserInterface/Controllers/ApplicationCacheManager.js: * UserInterface/Controllers/CSSManager.js: Renamed from Source/WebInspectorUI/UserInterface/Controllers/CSSStyleManager.js. * UserInterface/Controllers/ConsoleManager.js: Renamed from Source/WebInspectorUI/UserInterface/Controllers/LogManager.js. * UserInterface/Controllers/DOMDebuggerManager.js: * UserInterface/Controllers/DOMManager.js: Renamed from Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js. * UserInterface/Controllers/DOMStorageManager.js: Renamed from Source/WebInspectorUI/UserInterface/Controllers/StorageManager.js. * UserInterface/Controllers/DashboardManager.js: Removed. * UserInterface/Controllers/DatabaseManager.js: Copied from Source/WebInspectorUI/UserInterface/Controllers/DOMStorageManager.js. * UserInterface/Controllers/HARBuilder.js: * UserInterface/Controllers/IndexedDBManager.js: Copied from Source/WebInspectorUI/UserInterface/Controllers/DOMStorageManager.js. * UserInterface/Controllers/IssueManager.js: Removed. * UserInterface/Controllers/JavaScriptLogViewController.js: * UserInterface/Controllers/NetworkManager.js: Renamed from Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js. * UserInterface/Controllers/SourceMapManager.js: * UserInterface/Controllers/TimelineManager.js: * UserInterface/Debug/UncaughtExceptionReporter.js: * UserInterface/Models/CSSProperty.js: * UserInterface/Models/CSSSelector.js: * UserInterface/Models/CallFrame.js: * UserInterface/Models/Canvas.js: * UserInterface/Models/ConsoleMessage.js: * UserInterface/Models/DOMBreakpoint.js: * UserInterface/Models/DOMNode.js: * UserInterface/Models/DOMNodeStyles.js: * UserInterface/Models/DOMTree.js: * UserInterface/Models/DefaultDashboard.js: * UserInterface/Models/Script.js: * UserInterface/Models/ScriptTimelineRecord.js: * UserInterface/Models/SourceMapResource.js: * UserInterface/Models/TimelineRecording.js: * UserInterface/Protocol/CSSObserver.js: * UserInterface/Protocol/ConsoleObserver.js: * UserInterface/Protocol/DOMObserver.js: * UserInterface/Protocol/DOMStorageObserver.js: * UserInterface/Protocol/DatabaseObserver.js: * UserInterface/Protocol/InspectorFrontendAPI.js: * UserInterface/Protocol/InspectorObserver.js: * UserInterface/Protocol/MainTarget.js: * UserInterface/Protocol/NetworkObserver.js: * UserInterface/Protocol/PageObserver.js: * UserInterface/Protocol/RemoteObject.js: * UserInterface/Protocol/RuntimeObserver.js: * UserInterface/Protocol/WorkerTarget.js: * UserInterface/Views/BoxModelDetailsSectionRow.js: * UserInterface/Views/CanvasOverviewContentView.js: * UserInterface/Views/CanvasTreeElement.js: * UserInterface/Views/ContentView.js: * UserInterface/Views/ContextMenuUtilities.js: * UserInterface/Views/CookieStorageContentView.js: * UserInterface/Views/DOMDetailsSidebarPanel.js: * UserInterface/Views/DOMNodeDetailsSidebarPanel.js: * UserInterface/Views/DOMNodeTreeElement.js: * UserInterface/Views/DOMTreeContentView.js: * UserInterface/Views/DOMTreeDataGrid.js: * UserInterface/Views/DOMTreeElement.js: * UserInterface/Views/DOMTreeElementPathComponent.js: * UserInterface/Views/DOMTreeOutline.js: * UserInterface/Views/DOMTreeUpdater.js: * UserInterface/Views/DebuggerSidebarPanel.js: * UserInterface/Views/ElementsTabContentView.js: * UserInterface/Views/EventBreakpointPopover.js: * UserInterface/Views/EventBreakpointTreeElement.js: * UserInterface/Views/EventListenerSectionGroup.js: * UserInterface/Views/FormattedValue.js: * UserInterface/Views/FrameTreeElement.js: * UserInterface/Views/GeneralStyleDetailsSidebarPanel.js: * UserInterface/Views/IndexedDatabaseObjectStoreContentView.js: * UserInterface/Views/LayerDetailsSidebarPanel.js: * UserInterface/Views/LayerTreeDataGridNode.js: * UserInterface/Views/LayerTreeDetailsSidebarPanel.js: * UserInterface/Views/Layers3DContentView.js: * UserInterface/Views/LogContentView.js: * UserInterface/Views/NetworkTableContentView.js: * UserInterface/Views/ObjectTreeBaseTreeElement.js: * UserInterface/Views/ObjectTreeView.js: * UserInterface/Views/OpenResourceDialog.js: * UserInterface/Views/ResourceSidebarPanel.js: * UserInterface/Views/SearchSidebarPanel.js: * UserInterface/Views/SettingsTabContentView.js: * UserInterface/Views/SourceCodeTextEditor.js: * UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js: * UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js: * UserInterface/Views/StorageSidebarPanel.js: * UserInterface/Views/StyleDetailsPanel.js: * WebInspectorUI.vcxproj/WebInspectorUI.vcxproj: * WebInspectorUI.vcxproj/WebInspectorUI.vcxproj.filters: LayoutTests: * http/tests/inspector/dom/cross-domain-inspected-node-access.html: * http/tests/inspector/dom/disconnect-dom-tree-after-main-frame-navigation.html: * http/tests/inspector/dom/shapes-test.js: * http/tests/inspector/network/har/har-page.html: * http/tests/inspector/network/loadResource-insecure-resource.html: * http/tests/inspector/network/resource-response-source-memory-cache-revalidate-expired-only.html: * http/tests/inspector/network/resource-response-source-memory-cache.html: * http/tests/inspector/network/resource-sizes-memory-cache.html: * http/tests/inspector/network/set-resource-caching-disabled-memory-cache.html: * http/tests/websocket/tests/hybi/inspector/before-load.html: * http/tests/websocket/tests/hybi/inspector/resolveWebSocket.html: * inspector/canvas/requestNode.html: * inspector/codemirror/resources/prettyprinting/utilities.js: (TestPage.registerInitializer.loadPrettyPrintingTestAndExpectedResults): (TestPage.registerInitializer.window.addPrettyPrintingTests): (TestPage.registerInitializer): * inspector/console/clearMessages.html: * inspector/console/command-line-api.html: * inspector/console/console-api.html: * inspector/console/console-count.html: * inspector/console/console-table.html: * inspector/console/console-time.html: * inspector/console/message-stack-trace.html: * inspector/console/messageAdded-from-named-evaluations.html: * inspector/console/messageRepeatCountUpdated.html: * inspector/console/messagesCleared.html: * inspector/console/webcore-logging-expected.txt: * inspector/console/webcore-logging.html: * inspector/controller/runtime-controller-import.html: * inspector/controller/runtime-controller.html: * inspector/css/add-rule.html: * inspector/css/createStyleSheet.html: * inspector/css/css-property.html: * inspector/css/getAllStyleSheets.html: * inspector/css/manager-preferredInspectorStyleSheetForFrame.html: * inspector/css/matched-style-properties.html: * inspector/css/modify-css-property.html: * inspector/css/modify-rule-selector.html: * inspector/css/pseudo-element-matches-for-pseudo-element-node.html: * inspector/css/pseudo-element-matches.html: * inspector/css/selector-dynamic-specificity.html: * inspector/css/selector-specificity.html: * inspector/css/shadow-scoped-style.html: * inspector/css/stylesheet-events-basic.html: * inspector/css/stylesheet-events-imports.html: * inspector/css/stylesheet-events-inspector-stylesheet.html: * inspector/css/stylesheet-events-multiple-documents.html: * inspector/css/stylesheet-with-mutations.html: * inspector/debugger/csp-exceptions.html: * inspector/debugger/js-stacktrace.html: * inspector/debugger/resources/log-pause-location.js: (TestPage.registerInitializer.window.findScript): (TestPage.registerInitializer.window.loadMainPageContent): (TestPage.registerInitializer.window.logResolvedBreakpointLinesWithContext): (TestPage.registerInitializer.window.logLinesWithContext): * inspector/debugger/stepping/stepping-through-autoContinue-breakpoint.html: * inspector/dom-debugger/dom-breakpoints.html: * inspector/dom-debugger/xhr-breakpoints.html: * inspector/dom/breakpoint-for-event-listener.html: * inspector/dom/csp-big5-hash.html: * inspector/dom/csp-hash.html: * inspector/dom/customElementState.html: * inspector/dom/domutilities-csspath.html: * inspector/dom/domutilities-path-dump.html: * inspector/dom/domutilities-xpath.html: * inspector/dom/event-listener-add-remove.html: * inspector/dom/getEventListenersForNode.html: * inspector/dom/getOuterHTML.html: * inspector/dom/hideHighlight.html: * inspector/dom/highlightFrame.html: * inspector/dom/highlightNode.html: * inspector/dom/highlightNodeList.html: * inspector/dom/highlightSelector.html: * inspector/dom/insertAdjacentHTML.html: * inspector/dom/inspect.html: * inspector/dom/pseudo-element-dynamic.html: * inspector/dom/pseudo-element-static.html: * inspector/dom/push-node-by-path-to-frontend.html: * inspector/dom/setEventListenerDisabled.html: * inspector/dom/setInspectedNode.html: * inspector/dom/setOuterHTML-no-document-element.html: * inspector/dom/setOuterHTML.html: * inspector/dom/shadow-and-non-shadow-children.html: * inspector/dom/shadowRootType.html: * inspector/dom/template-content.html: * inspector/formatting/resources/utilities.js: (TestPage.registerInitializer.loadFormattingTestAndExpectedResults): (TestPage.registerInitializer.window.addFormattingTests): (TestPage.registerInitializer): * inspector/indexeddb/clearObjectStore.html: * inspector/indexeddb/deleteDatabaseNamesWithSpace.html: * inspector/indexeddb/requestData.html: * inspector/indexeddb/requestDatabase.html: * inspector/indexeddb/requestDatabaseNames.html: * inspector/layers/layer-tree-manager.html: * inspector/model/dom-node.html: * inspector/model/frame-extra-scripts.html: * inspector/model/script-resource-relationship.html: * inspector/model/stack-trace.html: * inspector/page/empty-or-missing-resources.html: * inspector/page/hidpi-snapshot-size.html: * inspector/page/main-frame-resource.html: * inspector/runtime/change-execution-context-identifier.html: * inspector/runtime/saveResult.html: * inspector/storage/domStorage-events.html: * inspector/worker/console-basic.html: * inspector/worker/resources-in-worker.html: Canonical link: https://commits.webkit.org/205172@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236766 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-02 22:14:52 +00:00
nodesMap.set(canvas, WI.domManager.nodeForId(nodeId));
Web Inspector: create canvas content view and details sidebar panel https://bugs.webkit.org/show_bug.cgi?id=138941 <rdar://problem/19051672> Reviewed by Joseph Pecoraro. Source/JavaScriptCore: * inspector/protocol/Canvas.json: - Add an optional `nodeId` attribute to the `Canvas` type. - Add `requestNode` command for getting the node id of the backing canvas element. - Add `requestContent` command for getting the current image content of the canvas. Source/WebCore: Tests: inspector/canvas/requestContent.html inspector/canvas/requestNode.html * inspector/InspectorCanvasAgent.h: * inspector/InspectorCanvasAgent.cpp: (WebCore::InspectorCanvasAgent::requestNode): Gets the node id of the backing canvas element. (WebCore::InspectorCanvasAgent::requestContent): Gets the current image content of the canvas. (WebCore::InspectorCanvasAgent::frameNavigated): (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext): Minor fixes from r218376 <https://webkit.org/b/172623>. (WebCore::InspectorCanvasAgent::buildObjectForCanvas): Optionally send the `nodeId` of the backing canvas element if it is available. * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didCommitLoadImpl): Source/WebInspectorUI: * UserInterface/Models/Canvas.js: (WebInspector.Canvas): (WebInspector.Canvas.fromPayload): (WebInspector.Canvas.prototype.get displayName): (WebInspector.Canvas.requestNode): Added. (WebInspector.Canvas.prototype.requestContent): Added. (WebInspector.Canvas.prototype.saveIdentityToCookie): * UserInterface/Controllers/CanvasManager.js: (WebInspector.CanvasManager.prototype.canvasAdded): (WebInspector.CanvasManager.prototype.canvasRemoved): * UserInterface/Models/Collection.js: * UserInterface/Models/Frame.js: (WebInspector.Frame): (WebInspector.Frame.prototype.get canvasCollection): (WebInspector.Frame.prototype.commitProvisionalLoad): Create a Collection for Canvas in each Frame, and modify it when canvas events are fired. * UserInterface/Views/CanvasContentView.css: Added. (.content-view.canvas > .preview): (.content-view.canvas > .preview > img): * UserInterface/Views/CanvasContentView.js: Added. (WebInspector.CanvasContentView): (WebInspector.CanvasContentView.prototype.get navigationItems): (WebInspector.CanvasContentView.prototype.shown): (WebInspector.CanvasContentView.prototype.hidden): (WebInspector.CanvasContentView.prototype._showPreview): (WebInspector.CanvasContentView.prototype._updateImageGrid): (WebInspector.CanvasContentView.prototype._showGridButtonClicked): * UserInterface/Views/CanvasDetailsSidebarPanel.js: Added. (WebInspector.CanvasDetailsSidebarPanel): (WebInspector.CanvasDetailsSidebarPanel.prototype.inspect): (WebInspector.CanvasDetailsSidebarPanel.prototype.get canvas): (WebInspector.CanvasDetailsSidebarPanel.prototype.set canvas): (WebInspector.CanvasDetailsSidebarPanel.prototype.initialLayout): (WebInspector.CanvasDetailsSidebarPanel.prototype.layout): (WebInspector.CanvasDetailsSidebarPanel.prototype._refreshIdentitySection): (WebInspector.CanvasDetailsSidebarPanel.prototype._refreshSourceSection.this._canvas.requestNode.): (WebInspector.CanvasDetailsSidebarPanel.prototype._refreshSourceSection): * UserInterface/Views/CanvasTreeElement.js: Added. (WebInspector.CanvasTreeElement): * UserInterface/Views/FrameTreeElement.js: (WebInspector.FrameTreeElement.prototype.onattach): (WebInspector.FrameTreeElement.prototype.ondetach): (WebInspector.FrameTreeElement.prototype.onpopulate): (WebInspector.FrameTreeElement.prototype._canvasWasAdded): (WebInspector.FrameTreeElement.prototype._canvasWasRemoved): (WebInspector.FrameTreeElement): * UserInterface/Base/Main.js: * UserInterface/Views/ContentView.js: (WebInspector.ContentView.createFromRepresentedObject): (WebInspector.ContentView.isViewable): * UserInterface/Views/ResourceSidebarPanel.js: (WebInspector.ResourceSidebarPanel): (WebInspector.ResourceSidebarPanel.prototype.matchTreeElementAgainstCustomFilters.match): (WebInspector.ResourceSidebarPanel.prototype._treeSelectionDidChange): * UserInterface/Views/ResourcesTabContentView.js: (WebInspector.ResourcesTabContentView): (WebInspector.ResourcesTabContentView.prototype.canShowRepresentedObject): Show Canvas objects and tie them to the correct ContentView and TreeElement subclasses. * Localizations/en.lproj/localizedStrings.js: * UserInterface/Main.html: * UserInterface/Images/Canvas.svg: Added. * UserInterface/Views/ResourceIcons.css: (.canvas .icon): Added new files/rules/strings related to Canvas UI. * UserInterface/Views/SettingsTabContentView.css: (.content-view.settings .navigation-bar): * UserInterface/Base/Setting.js: * UserInterface/Views/SettingsTabContentView.js: (WebInspector.SettingsTabContentView.prototype.initialLayout): (WebInspector.SettingsTabContentView.prototype._createGeneralSettingsView): (WebInspector.SettingsTabContentView.prototype._createDebugSettingsView): Add an experimental settings toggle in the Debug view for showing canvas contexts. * UserInterface/Views/FolderizedTreeElement.js: (WebInspector.FolderizedTreeElement.prototype._compareTreeElementsByMainTitle): Drive-by fix: ensure that sorting also includes numbers, so that 1 < 2 < 10. * UserInterface/Views/ImageResourceContentView.js: (WebInspector.ImageResourceContentView.prototype.shown): (WebInspector.ImageResourceContentView.prototype.hidden): (WebInspector.ImageResourceContentView.prototype._updateImageGrid): (WebInspector.ImageResourceContentView.prototype._showGridButtonClicked): (WebInspector.ImageResourceContentView): Drive-by fix: change the activated state of the Show Grid navigation item if it changes in another view. LayoutTests: * inspector/canvas/requestContent-expected.txt: Added. * inspector/canvas/requestContent.html: Added. * inspector/canvas/requestNode-expected.txt: Added. * inspector/canvas/requestNode.html: Added. Canonical link: https://commits.webkit.org/190478@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-20 06:48:10 +00:00
if (nodesMap.size === expectedLength)
finish();
});
});
});
}
});
// ------
suite.addTestCase({
name: "Canvas.requestNode.invalidCanvasId",
description: "Invalid canvas identifiers should cause an error.",
test(resolve, reject) {
const canvasId = "DOES_NOT_EXIST";
CanvasAgent.requestNode(canvasId, (error) => {
InspectorTest.expectThat(error, "Should produce an error.");
InspectorTest.log("Error: " + error);
resolve();
});
}
});
suite.runTestCasesAndFinish();
}
</script>
<style>
.css { background-image: -webkit-canvas(css); }
</style>
</head>
<body onload="load()">
<p>Test that CanvasAgent.requestNode can properly resolve the owner canvas node.</p>
<canvas id="onscreen"></canvas>
</body>
</html>