Web Inspector: provide a way to edit page settings on a remote target
https://bugs.webkit.org/show_bug.cgi?id=193813
<rdar://problem/47359510>
Reviewed by Joseph Pecoraro.
Source/JavaScriptCore:
* inspector/protocol/Page.json:
Add `overrideSetting` command with supporting `Setting` enum type.
Source/WebCore:
Test: inspector/page/overrideSetting.html
* page/Settings.yaml:
* Scripts/GenerateSettings.rb:
* Scripts/SettingsTemplates/Settings.cpp.erb:
* Scripts/SettingsTemplates/Settings.h.erb:
Add support for an `inspectorOverride` boolean value for each setting that will take
precedence over the actual `Setting`'s value when set.
* inspector/agents/InspectorPageAgent.h:
* inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::disable):
(WebCore::InspectorPageAgent::overrideSetting): Added.
* inspector/InspectorFrontendHost.idl:
* inspector/InspectorFrontendHost.h:
* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::isRemote const): Added.
* inspector/InspectorFrontendClient.h:
(WebCore::InspectorFrontendClient::isRemote const): Added.
* inspector/InspectorFrontendClientLocal.h:
(WebCore::InspectorFrontendClientLocal::isRemote const): Added.
Source/WebInspectorUI:
Add toolbar button that shows a popover with the target's (page's) settings when clicked.
* UserInterface/Base/Main.js:
(WI.loaded):
(WI.contentLoaded):
(WI.initializeTarget): Added.
(WI._handleDeviceSettingsToolbarButtonClicked): Added.
(WI.didDismissPopover): Added.
* UserInterface/Views/Main.css:
(.device-settings-content): Added.
(.device-settings-content .columns): Added.
(.device-settings-content .columns > .column): Added.
(.device-settings-content .columns > .column + .column): Added.
(body[dir=ltr] .device-settings-content label > input): Added.
(body[dir=rtl] .device-settings-content label > input): Added.
* UserInterface/Views/Popover.js:
(WI.Popover.prototype._update.area):
(WI.Popover.prototype._update):
(WI.Popover.prototype._drawBackground):
(WI.Popover.prototype._bestMetricsForEdge):
(WI.Popover.prototype._drawFrame):
If the best area is negative, treat it as the worst area.
Allow areas to be clamped so long as the clamped edge is not the preferred edge.
* UserInterface/Base/Test.js:
(WI.initializeTarget): Added.
* UserInterface/Images/Device.svg: Added.
* Localizations/en.lproj/localizedStrings.js:
Source/WebKit:
* WebProcess/WebPage/WebInspectorUI.h:
(WebKit::WebInspectorUI::isRemote() const): Added.
* WebProcess/WebPage/RemoteWebInspectorUI.h:
(WebKit::RemoteWebInspectorUI::isRemote() const): Added.
LayoutTests:
* inspector/page/overrideSetting.html: Added.
* inspector/page/overrideSetting-expected.txt: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@240540 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/inspector/page/overrideSetting-expected.txt b/LayoutTests/inspector/page/overrideSetting-expected.txt
new file mode 100644
index 0000000..9cb53e5
--- /dev/null
+++ b/LayoutTests/inspector/page/overrideSetting-expected.txt
@@ -0,0 +1,11 @@
+Tests for the Page.overrideSetting command.
+
+
+== Running test suite: Page.overrideSetting
+-- Running test case: Page.overrideSetting.AuthorAndUserStylesEnabled
+Property "color" equals "rgb(255, 0, 0)"
+Overriding AuthorAndUserStylesEnabled to false...
+Property "color" equals "rgb(0, 0, 0)"
+Removing AuthorAndUserStylesEnabled override...
+Property "color" equals "rgb(255, 0, 0)"
+