Web Inspector: Preview Canvas path when viewing a recording
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Aug 2017 23:55:36 +0000 (23:55 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Aug 2017 23:55:36 +0000 (23:55 +0000)
commit8be3f32e1793c9e3f556c3e3a2a9e5bf5db048cc
tree1974c7b6405ea3fa0ecfa531031bfd0e5519fb47
parent4c4b49ee2e6c24ef43a1c2e31c61e9774e479c2c
Web Inspector: Preview Canvas path when viewing a recording
https://bugs.webkit.org/show_bug.cgi?id=174967

Reviewed by Brian Burg.

Source/WebCore:

Tests: fast/canvas/2d.currentPoint.html
       fast/canvas/2d.getPath.modification.html
       fast/canvas/2d.getPath.newobject.html
       fast/canvas/2d.setPath.html

* html/canvas/CanvasPath.idl:
* html/canvas/CanvasPath.h:
* html/canvas/CanvasPath.cpp:
(WebCore::CanvasPath::currentX const):
(WebCore::CanvasPath::currentY const):

* html/canvas/CanvasRenderingContext2D.idl:
* html/canvas/CanvasRenderingContext2D.h:
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::setPath):
(WebCore::CanvasRenderingContext2D::getPath const):

* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setInspectorAdditionsEnabled):
(WebCore::RuntimeEnabledFeatures::inspectorAdditionsEnabled const):
Add runtime flag for added IDL items above so that they are only usable within the inspector
process. The runtime flag is not enabled from anywhere else as of now.

* inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::buildInitialState):
Send current path as part of the InitialState.
Drive-by: deduplicate more string values.
Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Base/Setting.js:

* UserInterface/Views/RecordingContentView.js:
(WI.RecordingContentView):
(WI.RecordingContentView.supportsCanvasPathDebugging):
(WI.RecordingContentView.prototype.get navigationItems):
(WI.RecordingContentView.prototype.shown):
(WI.RecordingContentView.prototype._generateContentCanvas2D):
(WI.RecordingContentView.prototype._actionModifiesPath):
(WI.RecordingContentView.prototype._updateCanvasPath):
(WI.RecordingContentView.prototype._showPathButtonClicked):
Show each segment of the current path as an overlay when the setting is enabled.
Drive-by: fix forgotten function rename.
* UserInterface/Views/RecordingContentView.css:
(.content-view:not(.tab).recording canvas.path):

* UserInterface/Views/RecordingStateDetailsSidebarPanel.js:
(WI.RecordingStateDetailsSidebarPanel.prototype._generateDetailsCanvas2D):
Show the currentX/currentY in the current state.

* UserInterface/Models/RecordingAction.js:
(WI.RecordingAction.isFunctionForType):
(WI.RecordingAction.prototype.swizzle):
Use Sets for better performance.

Source/WebKit:

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetInspectorAdditionsEnabled):
(WKPreferencesGetInspectorAdditionsEnabled):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):
Add plumbing for new InspectorAdditions runtime flag.

* WebProcess/WebPage/WebInspectorUI.cpp:
(WebKit::WebInspectorUI::WebInspectorUI):
Enable InspectorAdditions by default in the WebInspector page.

Source/WebKitLegacy/mac:

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences inspectorAdditionsEnabled]):
(-[WebPreferences setInspectorAdditionsEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
Add plumbing for new InspectorAdditions runtime flag.

Tools:

* DumpRenderTree/TestOptions.h:
* DumpRenderTree/TestOptions.mm:
(TestOptions::TestOptions):
* DumpRenderTree/mac/DumpRenderTree.mm:
(setWebPreferencesForTestOptions):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetPreferencesToConsistentValues):
(WTR::updateTestOptionsFromTestHeader):
* WebKitTestRunner/TestOptions.h:
(WTR::TestOptions::hasSameInitializationOptions const):
Add plumbing for new InspectorAdditions runtime flag.

LayoutTests:

* fast/canvas/2d.currentPoint-expected.txt: Added.
* fast/canvas/2d.currentPoint.html: Added.
* fast/canvas/2d.getPath.modification-expected.txt: Added.
* fast/canvas/2d.getPath.modification.html: Added.
* fast/canvas/2d.getPath.newobject-expected.txt: Added.
* fast/canvas/2d.getPath.newobject.html: Added.
* fast/canvas/2d.setPath-expected.txt: Added.
* fast/canvas/2d.setPath.html: Added.

* inspector/canvas/recording-2d-expected.txt:
* inspector/canvas/recording-2d.html:
Updated for additional deduplication in InitialState.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220370 268f45cc-cd09-0410-ab3c-d52691b4dbfc
44 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/canvas/2d.currentPoint-expected.txt [new file with mode: 0644]
LayoutTests/fast/canvas/2d.currentPoint.html [new file with mode: 0644]
LayoutTests/fast/canvas/2d.getPath.modification-expected.txt [new file with mode: 0644]
LayoutTests/fast/canvas/2d.getPath.modification.html [new file with mode: 0644]
LayoutTests/fast/canvas/2d.getPath.newobject-expected.txt [new file with mode: 0644]
LayoutTests/fast/canvas/2d.getPath.newobject.html [new file with mode: 0644]
LayoutTests/fast/canvas/2d.setPath-expected.txt [new file with mode: 0644]
LayoutTests/fast/canvas/2d.setPath.html [new file with mode: 0644]
LayoutTests/inspector/canvas/recording-2d-expected.txt
LayoutTests/inspector/canvas/recording-2d.html
Source/WebCore/ChangeLog
Source/WebCore/html/canvas/CanvasPath.cpp
Source/WebCore/html/canvas/CanvasPath.h
Source/WebCore/html/canvas/CanvasPath.idl
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
Source/WebCore/html/canvas/CanvasRenderingContext2D.h
Source/WebCore/html/canvas/CanvasRenderingContext2D.idl
Source/WebCore/inspector/InspectorCanvas.cpp
Source/WebCore/page/RuntimeEnabledFeatures.h
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/UserInterface/Base/Setting.js
Source/WebInspectorUI/UserInterface/Models/RecordingAction.js
Source/WebInspectorUI/UserInterface/Views/RecordingContentView.css
Source/WebInspectorUI/UserInterface/Views/RecordingContentView.js
Source/WebInspectorUI/UserInterface/Views/RecordingStateDetailsSidebarPanel.js
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPreferencesDefinitions.h
Source/WebKit/UIProcess/API/C/WKPreferences.cpp
Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h
Source/WebKit/WebProcess/WebPage/WebInspectorUI.cpp
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h
Source/WebKitLegacy/mac/WebView/WebPreferences.mm
Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h
Source/WebKitLegacy/mac/WebView/WebView.mm
Tools/ChangeLog
Tools/DumpRenderTree/TestOptions.h
Tools/DumpRenderTree/TestOptions.mm
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestOptions.h