Web Inspector: provide a way to edit page settings on a remote target
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 26 Jan 2019 03:57:17 +0000 (03:57 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 26 Jan 2019 03:57:17 +0000 (03:57 +0000)
commit3ab7d2c53b473cc204a5fddc3174e758b6dfd818
treebbd7e2a2f07115521568da7042a219f8e26cb2a8
parent273c91ecaf2ec97a0c37ff748b1febccd208f3bc
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: https://svn.webkit.org/repository/webkit/trunk@240540 268f45cc-cd09-0410-ab3c-d52691b4dbfc
28 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/page/overrideSetting-expected.txt [new file with mode: 0644]
LayoutTests/inspector/page/overrideSetting.html [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/protocol/Page.json
Source/WebCore/ChangeLog
Source/WebCore/Scripts/GenerateSettings.rb
Source/WebCore/Scripts/SettingsTemplates/Settings.cpp.erb
Source/WebCore/Scripts/SettingsTemplates/Settings.h.erb
Source/WebCore/inspector/InspectorFrontendClient.h
Source/WebCore/inspector/InspectorFrontendClientLocal.h
Source/WebCore/inspector/InspectorFrontendHost.cpp
Source/WebCore/inspector/InspectorFrontendHost.h
Source/WebCore/inspector/InspectorFrontendHost.idl
Source/WebCore/inspector/agents/InspectorPageAgent.cpp
Source/WebCore/inspector/agents/InspectorPageAgent.h
Source/WebCore/page/Settings.yaml
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/UserInterface/Base/Main.js
Source/WebInspectorUI/UserInterface/Images/Device.svg [new file with mode: 0644]
Source/WebInspectorUI/UserInterface/Protocol/Target.js
Source/WebInspectorUI/UserInterface/Test/Test.js
Source/WebInspectorUI/UserInterface/Views/Main.css
Source/WebInspectorUI/UserInterface/Views/Popover.js
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.h
Source/WebKit/WebProcess/WebPage/WebInspectorUI.h