WebKit Bugzilla
Attachment 360208 Details for
Bug 193813
: Web Inspector: provide a way to edit page settings on a remote target
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193813-20190125184336.patch (text/plain), 50.37 KB, created by
Devin Rousso
on 2019-01-25 18:43:37 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Devin Rousso
Created:
2019-01-25 18:43:37 PST
Size:
50.37 KB
patch
obsolete
>diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index fee924841fd1e866945470d51083438bc6c4e5c7..c7a16318a31a2aa63dbba4621f892ff8f7d940af 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,14 @@ >+2019-01-25 Devin Rousso <drousso@apple.com> >+ >+ 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. >+ >+ * inspector/protocol/Page.json: >+ Add `overrideSetting` command with supporting `Setting` enum type. >+ > 2019-01-25 Jon Davis <jond@apple.com> > > Update JavaScriptCore feature status entries. >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 354ef06152994edd80b746eac4ec0a2d923278ed..4670828ddb2a27dc6b3d74b821a02485223e1019 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,34 @@ >+2019-01-25 Devin Rousso <drousso@apple.com> >+ >+ 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. >+ >+ 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. >+ > 2019-01-25 Brent Fulgham <bfulgham@apple.com> > > Activate the WebResourceLoadStatisticsStore in the NetworkProcess and deactivate it in the UIProcess. >diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog >index 559aaf6354101597cfebe48f984169581bcb8c18..27868e82fc741050f266f8dcf2526e79315edb93 100644 >--- a/Source/WebInspectorUI/ChangeLog >+++ b/Source/WebInspectorUI/ChangeLog >@@ -1,3 +1,42 @@ >+2019-01-25 Devin Rousso <drousso@apple.com> >+ >+ 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. >+ >+ 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: >+ > 2019-01-25 Devin Rousso <drousso@apple.com> > > Web Inspector: Timelines: DOMContentLoaded and load event lines need to be more obvious >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 17e4a7e4805388346f1d683c790c7a495a0f3422..4426d7c5cca69395f6d521a34222dea72eeadae5 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,16 @@ >+2019-01-25 Devin Rousso <drousso@apple.com> >+ >+ 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. >+ >+ * WebProcess/WebPage/WebInspectorUI.h: >+ (WebKit::WebInspectorUI::isRemote() const): Added. >+ * WebProcess/WebPage/RemoteWebInspectorUI.h: >+ (WebKit::RemoteWebInspectorUI::isRemote() const): Added. >+ > 2019-01-25 Per Arne Vollan <pvollan@apple.com> > > [iOS] Deny mach lookups to services not used. >diff --git a/Source/JavaScriptCore/inspector/protocol/Page.json b/Source/JavaScriptCore/inspector/protocol/Page.json >index b94a5f9ffe3caf3440a49b11e601fc3d9b8f8eac..7dba156ad5505135a34a4812ed6d6d29673be771 100644 >--- a/Source/JavaScriptCore/inspector/protocol/Page.json >+++ b/Source/JavaScriptCore/inspector/protocol/Page.json >@@ -3,6 +3,18 @@ > "description": "Actions and events related to the inspected page belong to the page domain.", > "availability": ["web"], > "types": [ >+ { >+ "id": "Setting", >+ "type": "string", >+ "description": "List of settings able to be overridden by WebInspector. Keep this in sync with FOR_EACH_INSPECTOR_OVERRIDE_SETTING.", >+ "enum": [ >+ "AuthorAndUserStylesEnabled", >+ "ImagesEnabled", >+ "NeedsSiteSpecificQuirks", >+ "ScriptEnabled", >+ "WebSecurityEnabled" >+ ] >+ }, > { > "id": "ResourceType", > "type": "string", >@@ -117,6 +129,14 @@ > { "name": "url", "type": "string", "description": "URL to navigate the page to." } > ] > }, >+ { >+ "name": "overrideSetting", >+ "description": "Allows the frontend to override the inspected page's settings.", >+ "parameters": [ >+ { "name": "setting", "$ref": "Setting" }, >+ { "name": "value", "type": "boolean", "optional": true, "description": "Value to override the setting with. If this value is not provided, the override is removed. Overrides are removed when Web Inspector closes/disconnects." } >+ ] >+ }, > { > "name": "getCookies", > "description": "Returns all browser cookies. Depending on the backend support, will return detailed cookie information in the <code>cookies</code> field.", >diff --git a/Source/WebCore/Scripts/GenerateSettings.rb b/Source/WebCore/Scripts/GenerateSettings.rb >index cf5f1af0f16c01d6f47c593f1fc37d0f80fd8137..8aca9456bfe74edc3f9b7d81ff7f01b686dc12e3 100755 >--- a/Source/WebCore/Scripts/GenerateSettings.rb >+++ b/Source/WebCore/Scripts/GenerateSettings.rb >@@ -68,6 +68,7 @@ class Setting > attr_accessor :conditional > attr_accessor :onChange > attr_accessor :getter >+ attr_accessor :inspectorOverride > > def initialize(name, opts) > @name = name >@@ -76,6 +77,7 @@ class Setting > @conditional = opts["conditional"] > @onChange = opts["onChange"] > @getter = opts["getter"] >+ @inspectorOverride = opts["inspectorOverride"] > end > > def valueType? >@@ -113,6 +115,10 @@ class Setting > @onChange != nil > end > >+ def hasComplexGetter? >+ hasInspectorOverride? >+ end >+ > def setterFunctionName > if @name.start_with?("css", "xss", "ftp", "dom", "dns") > "set" + @name[0..2].upcase + @name[3..@name.length] >@@ -124,6 +130,10 @@ class Setting > def getterFunctionName > @getter || @name > end >+ >+ def hasInspectorOverride? >+ @inspectorOverride == true >+ end > end > > class Conditional >@@ -131,6 +141,7 @@ class Conditional > attr_accessor :settings > attr_accessor :boolSettings > attr_accessor :nonBoolSettings >+ attr_accessor :settingsWithComplexGetters > attr_accessor :settingsWithComplexSetters > > def initialize(condition, settings) >@@ -139,6 +150,7 @@ class Conditional > > @boolSettings = @settings.select { |setting| setting.type == "bool" } > @nonBoolSettings = @settings.reject { |setting| setting.type == "bool" } >+ @settingsWithComplexGetters = @settings.select { |setting| setting.hasComplexGetter? } > @settingsWithComplexSetters = @settings.select { |setting| setting.hasComplexSetter? } > end > end >@@ -148,6 +160,7 @@ class Settings > attr_accessor :unconditionalSetting > attr_accessor :unconditionalBoolSetting > attr_accessor :unconditionalNonBoolSetting >+ attr_accessor :unconditionalSettingWithComplexGetters > attr_accessor :unconditionalSettingWithComplexSetters > attr_accessor :conditionals > >@@ -161,7 +174,9 @@ class Settings > @unconditionalSetting = @settings.reject { |setting| setting.conditional } > @unconditionalBoolSetting = @unconditionalSetting.select { |setting| setting.type == "bool" } > @unconditionalNonBoolSetting = @unconditionalSetting.reject { |setting| setting.type == "bool" } >+ @unconditionalSettingWithComplexGetters = @unconditionalSetting.select { |setting| setting.hasComplexGetter? } > @unconditionalSettingWithComplexSetters = @unconditionalSetting.select { |setting| setting.hasComplexSetter? } >+ @inspectorOverrideSettings = @settings.select { |setting| setting.hasInspectorOverride? } > > @conditionals = [] > conditionalsMap = {} >diff --git a/Source/WebCore/Scripts/SettingsTemplates/Settings.cpp.erb b/Source/WebCore/Scripts/SettingsTemplates/Settings.cpp.erb >index 1ff7e9347f77b6d2faa1e70f474643eea2f03d88..c56e7ae7d4f0faa39adcd1982a5ec2efc52af461 100644 >--- a/Source/WebCore/Scripts/SettingsTemplates/Settings.cpp.erb >+++ b/Source/WebCore/Scripts/SettingsTemplates/Settings.cpp.erb >@@ -71,6 +71,17 @@ Settings::~Settings() > { > } > >+<%- for @setting in @unconditionalSettingWithComplexGetters do -%> >+<%= @setting.parameterType %> Settings::<%= @setting.getterFunctionName %>() const >+{ >+<%- if @setting.hasInspectorOverride? -%> >+ if (m_<%= @setting.name %>InspectorOverride) >+ return m_<%= @setting.name %>InspectorOverride.value(); >+<%- end -%> >+ return m_<%= @setting.name %>; >+} >+ >+<%- end -%> > <%- for @setting in @unconditionalSettingWithComplexSetters do -%> > void Settings::<%= @setting.setterFunctionName %>(<%= @setting.parameterType %> <%= @setting.name %>) > { >@@ -82,8 +93,18 @@ void Settings::<%= @setting.setterFunctionName %>(<%= @setting.parameterType %> > > <%- end -%> > <%- for @conditional in @conditionals do -%> >-<%- if @conditional.settingsWithComplexSetters.length != 0 -%> >+<%- if @conditional.settingsWithComplexGetters.length != 0 or @conditional.settingsWithComplexSetters.length != 0-%> > #if ENABLE(<%= @conditional.condition %>) >+<%- for @setting in @conditional.settingsWithComplexGetters do -%> >+<%= @setting.parameterType %> Settings::<%= @setting.getterFunctionName %>() const >+{ >+<%- if @setting.hasInspectorOverride? -%> >+ if (m_<%= @setting.name %>InspectorOverride) >+ return m_<%= @setting.name %>InspectorOverride.value(); >+<%- end -%> >+ return m_<%= @setting.name %>; >+} >+<%- end -%> > <%- for @setting in @conditional.settingsWithComplexSetters -%> > void Settings::<%= @setting.setterFunctionName %>(<%= @setting.parameterType %> <%= @setting.name %>) > { >@@ -95,6 +116,18 @@ void Settings::<%= @setting.setterFunctionName %>(<%= @setting.parameterType %> > <%- end -%> > #endif > >+<%- end -%> >+<%- end -%> >+<%- for @setting in @inspectorOverrideSettings do -%> >+<%- if @setting.hasComplexSetter? -%> >+void Settings::<%= @setting.setterFunctionName %>InspectorOverride(Optional<<%= @setting.parameterType %>> <%= @setting.name %>InspectorOverride) >+{ >+ if (m_<%= @setting.name %>InspectorOverride == <%= @setting.name %>InspectorOverride) >+ return; >+ m_<%= @setting.name %>InspectorOverride = <%= @setting.name %>InspectorOverride; >+ <%= @setting.onChange %>(); >+} >+ > <%- end -%> > <%- end -%> > } >diff --git a/Source/WebCore/Scripts/SettingsTemplates/Settings.h.erb b/Source/WebCore/Scripts/SettingsTemplates/Settings.h.erb >index c98c845e76547b06a81f2478632b0f16131dbcb3..2d528cd64933a64144621ac7e41669ab15c4ed70 100644 >--- a/Source/WebCore/Scripts/SettingsTemplates/Settings.h.erb >+++ b/Source/WebCore/Scripts/SettingsTemplates/Settings.h.erb >@@ -41,7 +41,11 @@ public: > ~Settings(); > > <%- for @setting in @unconditionalSetting do -%> >+ <%- if @setting.hasComplexGetter? -%> >+ WEBCORE_EXPORT <%= @setting.parameterType %> <%= @setting.getterFunctionName %>() const; >+ <%- else -%> > <%= @setting.parameterType %> <%= @setting.getterFunctionName %>() const { return m_<%= @setting.name %>; } >+ <%- end -%> > <%- if @setting.hasComplexSetter? -%> > WEBCORE_EXPORT void <%= @setting.setterFunctionName %>(<%= @setting.parameterType %>); > <%- else -%> >@@ -52,7 +56,11 @@ public: > <%- for @conditional in @conditionals do -%> > #if ENABLE(<%= @conditional.condition %>) > <%- for @setting in @conditional.settings do -%> >+ <%- if @setting.hasComplexGetter? -%> >+ WEBCORE_EXPORT <%= @setting.parameterType %> <%= @setting.getterFunctionName %>() const; >+ <%- else -%> > <%= @setting.parameterType %> <%= @setting.getterFunctionName %>() const { return m_<%= @setting.name %>; } >+ <%- end -%> > <%- if @setting.hasComplexSetter? -%> > WEBCORE_EXPORT void <%= @setting.setterFunctionName %>(<%= @setting.parameterType %>); > <%- else -%> >@@ -62,10 +70,21 @@ public: > #endif > > <%- end -%> >+<%- for @setting in @inspectorOverrideSettings do -%> >+ <%- if @setting.hasComplexSetter? -%> >+ WEBCORE_EXPORT void <%= @setting.setterFunctionName %>InspectorOverride(Optional<<%= @setting.parameterType %>>); >+ <%- else -%> >+ void <%= @setting.setterFunctionName %>InspectorOverride(Optional<<%= @setting.parameterType %>> <%= @setting.name %>InspectorOverride) { m_<%= @setting.name %>InspectorOverride = <%= @setting.name %>InspectorOverride; } >+ <%- end -%> >+<%- end -%> > > private: > explicit Settings(Page*); > >+<%- for @setting in @inspectorOverrideSettings do -%> >+ Optional<<%= @setting.type %>> m_<%= @setting.name %>InspectorOverride; >+<%- end -%> >+ > <%- for @setting in @unconditionalNonBoolSetting do -%> > <%= @setting.type %> m_<%= @setting.name %>; > <%- end -%> >diff --git a/Source/WebCore/inspector/InspectorFrontendClient.h b/Source/WebCore/inspector/InspectorFrontendClient.h >index 9fd954bac43c7b09b447d1340863161727dc6183..38659886737a3070ace7f79752c595b825e413f8 100644 >--- a/Source/WebCore/inspector/InspectorFrontendClient.h >+++ b/Source/WebCore/inspector/InspectorFrontendClient.h >@@ -54,6 +54,7 @@ public: > virtual void startWindowDrag() = 0; > virtual void moveWindowBy(float x, float y) = 0; > >+ virtual bool isRemote() const = 0; > virtual String localizedStringsURL() = 0; > virtual unsigned inspectionLevel() const = 0; > virtual String backendCommandsURL() { return String(); }; >diff --git a/Source/WebCore/inspector/InspectorFrontendClientLocal.h b/Source/WebCore/inspector/InspectorFrontendClientLocal.h >index 248ea1f105491c9e6ab17d3da77b79065db0bbd5..5139eee16b569de1298f9dba9ddc07a5c66e8c30 100644 >--- a/Source/WebCore/inspector/InspectorFrontendClientLocal.h >+++ b/Source/WebCore/inspector/InspectorFrontendClientLocal.h >@@ -81,6 +81,7 @@ public: > WEBCORE_EXPORT void sendMessageToBackend(const String& message) final; > > WEBCORE_EXPORT bool isUnderTest() final; >+ bool isRemote() const final { return false; } > WEBCORE_EXPORT unsigned inspectionLevel() const final; > > WEBCORE_EXPORT bool canAttachWindow(); >diff --git a/Source/WebCore/inspector/InspectorFrontendHost.cpp b/Source/WebCore/inspector/InspectorFrontendHost.cpp >index 15b8dc0809a0f6fd649d15e2a8be605b8bb94cdb..5368e74650071bf84951fa8c46733c92174336ef 100644 >--- a/Source/WebCore/inspector/InspectorFrontendHost.cpp >+++ b/Source/WebCore/inspector/InspectorFrontendHost.cpp >@@ -254,6 +254,11 @@ void InspectorFrontendHost::moveWindowBy(float x, float y) const > m_client->moveWindowBy(x, y); > } > >+bool InspectorFrontendHost::isRemote() const >+{ >+ return m_client ? m_client->isRemote() : false; >+} >+ > String InspectorFrontendHost::localizedStringsURL() > { > return m_client ? m_client->localizedStringsURL() : String(); >diff --git a/Source/WebCore/inspector/InspectorFrontendHost.h b/Source/WebCore/inspector/InspectorFrontendHost.h >index 5242cc689463bdddbe8846f60ee7ae613bcacc10..76a6fb4d3919b5d07a7a591350f6fa7cf3160de4 100644 >--- a/Source/WebCore/inspector/InspectorFrontendHost.h >+++ b/Source/WebCore/inspector/InspectorFrontendHost.h >@@ -75,6 +75,7 @@ public: > void startWindowDrag(); > void moveWindowBy(float x, float y) const; > >+ bool isRemote() const; > String localizedStringsURL(); > String backendCommandsURL(); > String debuggableType(); >diff --git a/Source/WebCore/inspector/InspectorFrontendHost.idl b/Source/WebCore/inspector/InspectorFrontendHost.idl >index c7cbf9d110a205a47969f341d16831c5f5e49227..b1e4debfa6ce46916b1acb783f2f8a5b4480352b 100644 >--- a/Source/WebCore/inspector/InspectorFrontendHost.idl >+++ b/Source/WebCore/inspector/InspectorFrontendHost.idl >@@ -56,6 +56,7 @@ > void startWindowDrag(); > void moveWindowBy(unrestricted float x, unrestricted float y); > >+ readonly attribute boolean isRemote; > DOMString localizedStringsURL(); > DOMString backendCommandsURL(); > DOMString debuggableType(); >diff --git a/Source/WebCore/inspector/agents/InspectorPageAgent.cpp b/Source/WebCore/inspector/agents/InspectorPageAgent.cpp >index 106bd4355dd2618aa4050d0505a0a4b9022ffd4a..8dd8491f8c9265fd86170bdc4a24d453927b9e9a 100644 >--- a/Source/WebCore/inspector/agents/InspectorPageAgent.cpp >+++ b/Source/WebCore/inspector/agents/InspectorPageAgent.cpp >@@ -83,6 +83,13 @@ namespace WebCore { > > using namespace Inspector; > >+#define FOR_EACH_INSPECTOR_OVERRIDE_SETTING(macro) \ >+ macro(AuthorAndUserStylesEnabled) \ >+ macro(ImagesEnabled) \ >+ macro(NeedsSiteSpecificQuirks) \ >+ macro(ScriptEnabled) \ >+ macro(WebSecurityEnabled) >+ > static bool decodeBuffer(const char* buffer, unsigned size, const String& textEncodingName, String* result) > { > if (buffer) { >@@ -315,6 +322,13 @@ void InspectorPageAgent::disable(ErrorString&) > setShowPaintRects(unused, false); > setEmulatedMedia(unused, emptyString()); > setForcedAppearance(unused, emptyString()); >+ >+#define DISABLE_INSPECTOR_OVERRIDE_SETTING(name) \ >+ m_page.settings().set##name##InspectorOverride(WTF::nullopt); >+ >+ FOR_EACH_INSPECTOR_OVERRIDE_SETTING(DISABLE_INSPECTOR_OVERRIDE_SETTING) >+ >+#undef DISABLE_INSPECTOR_OVERRIDE_SETTING > } > > void InspectorPageAgent::reload(ErrorString&, const bool* optionalReloadFromOrigin, const bool* optionalRevalidateAllResources) >@@ -341,6 +355,37 @@ void InspectorPageAgent::navigate(ErrorString&, const String& url) > frame.loader().changeLocation(WTFMove(frameLoadRequest)); > } > >+void InspectorPageAgent::overrideSetting(ErrorString& errorString, const String& settingString, const bool* value) >+{ >+ if (settingString.isEmpty()) { >+ errorString = "Preference is empty"_s; >+ return; >+ } >+ >+ auto setting = Inspector::Protocol::InspectorHelpers::parseEnumValueFromString<Inspector::Protocol::Page::Setting>(settingString); >+ if (!setting) { >+ errorString = makeString("Unknown setting: "_s, settingString); >+ return; >+ } >+ >+ switch (setting.value()) { >+#define CASE_INSPECTOR_OVERRIDE_SETTING(name) \ >+ case Inspector::Protocol::Page::Setting::name: { \ >+ if (value) \ >+ m_page.settings().set##name##InspectorOverride(*value); \ >+ else \ >+ m_page.settings().set##name##InspectorOverride(WTF::nullopt); \ >+ return; \ >+ } \ >+ >+ FOR_EACH_INSPECTOR_OVERRIDE_SETTING(CASE_INSPECTOR_OVERRIDE_SETTING) >+ >+#undef CASE_INSPECTOR_OVERRIDE_SETTING >+ } >+ >+ ASSERT_NOT_REACHED(); >+} >+ > static Inspector::Protocol::Page::CookieSameSitePolicy cookieSameSitePolicyJSON(Cookie::SameSitePolicy policy) > { > switch (policy) { >diff --git a/Source/WebCore/inspector/agents/InspectorPageAgent.h b/Source/WebCore/inspector/agents/InspectorPageAgent.h >index e1a1da99f244879ee31175ac33140170245a1e47..41b7e07ae260b343c65b021f80e5ab1dac9ea852 100644 >--- a/Source/WebCore/inspector/agents/InspectorPageAgent.h >+++ b/Source/WebCore/inspector/agents/InspectorPageAgent.h >@@ -90,6 +90,7 @@ public: > void disable(ErrorString&) final; > void reload(ErrorString&, const bool* optionalReloadFromOrigin, const bool* optionalRevalidateAllResources) final; > void navigate(ErrorString&, const String& url) final; >+ void overrideSetting(ErrorString&, const String& setting, const bool* value) final; > void getCookies(ErrorString&, RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::Cookie>>& cookies) final; > void deleteCookie(ErrorString&, const String& cookieName, const String& url) final; > void getResourceTree(ErrorString&, RefPtr<Inspector::Protocol::Page::FrameResourceTree>&) final; >diff --git a/Source/WebCore/page/Settings.yaml b/Source/WebCore/page/Settings.yaml >index 17136e182900730265316504bda6b870080f5e11..ca4c57c869f4950881ba840d8bb649102eb3257e 100644 >--- a/Source/WebCore/page/Settings.yaml >+++ b/Source/WebCore/page/Settings.yaml >@@ -128,6 +128,7 @@ textAreasAreResizable: > authorAndUserStylesEnabled: > initial: true > onChange: setNeedsRecalcStyleInAllFrames >+ inspectorOverride: true > userStyleSheetLocation: > type: URL > onChange: userStyleSheetLocationChanged >@@ -179,6 +180,7 @@ scriptMarkupEnabled: > initial: true > needsSiteSpecificQuirks: > initial: false >+ inspectorOverride: true > domTimersThrottlingEnabled: > initial: true > webArchiveDebugModeEnabled: >@@ -385,6 +387,7 @@ asyncOverflowScrollingEnabled: > > webSecurityEnabled: > initial: true >+ inspectorOverride: true > spatialNavigationEnabled: > initial: false > >@@ -669,9 +672,11 @@ imagesEnabled: > initial: true > getter: areImagesEnabled > onChange: imagesEnabledChanged >+ inspectorOverride: true > scriptEnabled: > initial: false > getter: isScriptEnabled >+ inspectorOverride: true > pluginsEnabled: > initial: false > getter: arePluginsEnabled >diff --git a/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js b/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js >index b4962b853499680b154f7fb8e31444e3e38fdc08..7a42d89de2a8ce2056beca2fcdcd4a4745f60980 100644 >--- a/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js >+++ b/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js >@@ -264,6 +264,7 @@ localizedStrings["Could not fetch properties. Object may no longer exist."] = "C > localizedStrings["Count"] = "Count"; > localizedStrings["Create Breakpoint"] = "Create Breakpoint"; > localizedStrings["Create a new tab"] = "Create a new tab"; >+localizedStrings["Cross-Origin Restrictions"] = "Cross-Origin Restrictions"; > localizedStrings["Current"] = "Current"; > localizedStrings["Current State"] = "Current State"; > localizedStrings["Custom"] = "Custom"; >@@ -295,6 +296,7 @@ localizedStrings["Demo Audit"] = "Demo Audit"; > localizedStrings["Detach into separate window"] = "Detach into separate window"; > localizedStrings["Detached"] = "Detached"; > localizedStrings["Details"] = "Details"; >+localizedStrings["Device Settings"] = "Device Settings"; > localizedStrings["Dimensions"] = "Dimensions"; > localizedStrings["Disable Breakpoint"] = "Disable Breakpoint"; > localizedStrings["Disable Breakpoints"] = "Disable Breakpoints"; >@@ -302,6 +304,7 @@ localizedStrings["Disable Event Listener"] = "Disable Event Listener"; > localizedStrings["Disable Program"] = "Disable Program"; > localizedStrings["Disable all breakpoints (%s)"] = "Disable all breakpoints (%s)"; > localizedStrings["Disable paint flashing"] = "Disable paint flashing"; >+localizedStrings["Disable:"] = "Disable:"; > localizedStrings["Disabled"] = "Disabled"; > localizedStrings["Disk Cache"] = "Disk Cache"; > localizedStrings["Displayed Columns"] = "Displayed Columns"; >@@ -873,6 +876,7 @@ localizedStrings["Show type information"] = "Show type information"; > localizedStrings["Show warnings logged to the Console"] = "Show warnings logged to the Console"; > localizedStrings["Show:"] = "Show:"; > localizedStrings["Showing:"] = "Showing:"; >+localizedStrings["Site-specific Hacks"] = "Site-specific Hacks"; > localizedStrings["Size"] = "Size"; > localizedStrings["Size of current object plus all objects it keeps alive"] = "Size of current object plus all objects it keeps alive"; > localizedStrings["Sizes"] = "Sizes"; >diff --git a/Source/WebInspectorUI/UserInterface/Base/Main.js b/Source/WebInspectorUI/UserInterface/Base/Main.js >index e8cad5210a34355be812c2826f8f8df98cce975e..c61f9378e22dbaa78552c7a5aed234fb606cf324 100644 >--- a/Source/WebInspectorUI/UserInterface/Base/Main.js >+++ b/Source/WebInspectorUI/UserInterface/Base/Main.js >@@ -161,6 +161,7 @@ WI.loaded = function() > this.visible = false; > this._windowKeydownListeners = []; > this._targetsAvailablePromise = new WI.WrappedPromise; >+ this._overridenDeviceSettings = new Set; > > // Targets. > WI.backendTarget = null; >@@ -445,6 +446,15 @@ WI.contentLoaded = function() > this._inspectModeToolbarButton = new WI.ActivateButtonToolbarItem("inspect", elementSelectionToolTip, activatedElementSelectionToolTip, "Images/Crosshair.svg"); > this._inspectModeToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._toggleInspectMode, this); > >+ // COMPATIBILITY (iOS 12.2): Page.overrideSetting did not exist. >+ if (InspectorFrontendHost.isRemote && WI.sharedApp.debuggableType === WI.DebuggableType.Web && InspectorBackend.domains.Page && InspectorBackend.domains.Page.overrideSetting) { >+ const deviceSettingsTooltip = WI.UIString("Device Settings"); >+ this._deviceSettingsToolbarButton = new WI.ActivateButtonToolbarItem("device-settings", deviceSettingsTooltip, deviceSettingsTooltip, "Images/Device.svg"); >+ this._deviceSettingsToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._handleDeviceSettingsToolbarButtonClicked, this); >+ >+ this._deviceSettingsPopover = null; >+ } >+ > this._updateReloadToolbarButton(); > this._updateDownloadToolbarButton(); > this._updateInspectModeToolbarButton(); >@@ -470,6 +480,9 @@ WI.contentLoaded = function() > > this.toolbar.addToolbarItem(this._inspectModeToolbarButton, WI.Toolbar.Section.CenterRight); > >+ if (this._deviceSettingsToolbarButton) >+ this.toolbar.addToolbarItem(this._deviceSettingsToolbarButton, WI.Toolbar.Section.CenterRight); >+ > this._searchTabContentView = new WI.SearchTabContentView; > > if (WI.settings.experimentalEnableNewTabBar.value) { >@@ -589,6 +602,21 @@ WI.performOneTimeFrontendInitializationsUsingTarget = function(target) > } > }; > >+WI.initializeTarget = function(target) >+{ >+ if (target.PageAgent) { >+ // COMPATIBILITY (iOS 12.2): Page.overrideSetting did not exist. >+ if (target.PageAgent.overrideSetting) { >+ for (let setting of this._overridenDeviceSettings) >+ target.PageAgent.overrideSetting(setting, true); >+ } >+ >+ // COMPATIBILITY (iOS 8): Page.setShowPaintRects did not exist. >+ if (target.PageAgent.setShowPaintRects && WI.settings.showPaintRects.value) >+ target.PageAgent.setShowPaintRects(true); >+ } >+}; >+ > WI.whenTargetsAvailable = function() > { > return this._targetsAvailablePromise.promise; >@@ -1916,6 +1944,108 @@ WI._toggleInspectMode = function(event) > this.domManager.inspectModeEnabled = !this.domManager.inspectModeEnabled; > }; > >+WI._handleDeviceSettingsToolbarButtonClicked = function(event) >+{ >+ if (WI._deviceSettingsPopover) { >+ WI._deviceSettingsPopover.dismiss(); >+ WI._deviceSettingsPopover = null; >+ return; >+ } >+ >+ let updateActivatedState = () => { >+ this._deviceSettingsToolbarButton.activated = this._overridenDeviceSettings.size > 0; >+ }; >+ >+ let createContainer = (parent, title) => { >+ let container = parent.appendChild(document.createElement("div")); >+ container.classList.add("container"); >+ >+ if (title) { >+ let titleElement = container.appendChild(document.createElement("div")); >+ titleElement.textContent = title; >+ } >+ >+ return container; >+ }; >+ >+ let createColumns = (parent, count) => { >+ let columnContainer = parent.appendChild(document.createElement("div")); >+ columnContainer.classList.add("columns"); >+ >+ let columns = []; >+ for (let i = 0; i < count; ++i) { >+ let column = columnContainer.appendChild(document.createElement("div")); >+ column.classList.add("column"); >+ columns.push(column); >+ } >+ return columns; >+ }; >+ >+ let createCheckbox = (container, label, setting) => { >+ let enabled = this._overridenDeviceSettings.has(setting); >+ >+ let labelElement = container.appendChild(document.createElement("label")); >+ >+ let checkboxElement = labelElement.appendChild(document.createElement("input")); >+ checkboxElement.type = "checkbox"; >+ checkboxElement.checked = enabled; >+ checkboxElement.addEventListener("change", (event) => { >+ if (enabled) { >+ // We've just "disabled" the checkbox, so clear the override instead of applying it. >+ PageAgent.overrideSetting(setting, (error) => { >+ if (error) { >+ console.error(error); >+ return; >+ } >+ >+ this._overridenDeviceSettings.delete(setting); >+ enabled = checkboxElement.checked = false; >+ updateActivatedState(); >+ }); >+ >+ } else { >+ // Override to false since the labels are the inverse of the setting. >+ const value = false; >+ PageAgent.overrideSetting(setting, value, (error) => { >+ if (error) { >+ console.error(error); >+ return; >+ } >+ >+ this._overridenDeviceSettings.add(setting); >+ enabled = checkboxElement.checked = true; >+ updateActivatedState(); >+ }); >+ } >+ }); >+ >+ labelElement.append(label); >+ }; >+ >+ let calculateTargetFrame = () => { >+ return WI.Rect.rectFromClientRect(this._deviceSettingsToolbarButton.element.getBoundingClientRect()); >+ }; >+ >+ const preferredEdges = [WI.RectEdge.MAX_Y, WI.RectEdge.MIN_X, WI.RectEdge.MAX_X]; >+ >+ WI._deviceSettingsPopover = new WI.Popover(this); >+ WI._deviceSettingsPopover.windowResizeHandler = function(event) { >+ WI._deviceSettingsPopover.present(calculateTargetFrame(), preferredEdges); >+ }; >+ >+ let contentElement = document.createElement("div"); >+ contentElement.classList.add("device-settings-content"); >+ >+ let disableColumns = createColumns(createContainer(contentElement, WI.UIString("Disable:")), 2); >+ createCheckbox(disableColumns[0], WI.UIString("Images"), PageAgent.Setting.ImagesEnabled); >+ createCheckbox(disableColumns[0], WI.UIString("Styles"), PageAgent.Setting.AuthorAndUserStylesEnabled); >+ createCheckbox(disableColumns[0], WI.UIString("JavaScript"), PageAgent.Setting.ScriptEnabled); >+ createCheckbox(disableColumns[1], WI.UIString("Site-specific Hacks"), PageAgent.Setting.NeedsSiteSpecificQuirks); >+ createCheckbox(disableColumns[1], WI.UIString("Cross-Origin Restrictions"), PageAgent.Setting.WebSecurityEnabled); >+ >+ WI._deviceSettingsPopover.presentNewContentWithFrame(contentElement, calculateTargetFrame(), preferredEdges); >+}; >+ > WI._downloadWebArchive = function(event) > { > this.archiveMainFrame(); >@@ -2827,6 +2957,14 @@ WI.dialogWasDismissedWithRepresentedObject = function(dialog, representedObject) > WI.showRepresentedObject(representedObject, dialog.cookie); > }; > >+// Popover delegate >+ >+WI.didDismissPopover = function(popover) >+{ >+ if (popover === WI._deviceSettingsPopover) >+ WI._deviceSettingsPopover = null; >+}; >+ > WI.DockConfiguration = { > Right: "right", > Left: "left", >diff --git a/Source/WebInspectorUI/UserInterface/Images/Device.svg b/Source/WebInspectorUI/UserInterface/Images/Device.svg >new file mode 100644 >index 0000000000000000000000000000000000000000..8f0e51c7ebcd6112d7b26762d4cbe4b278df241e >--- /dev/null >+++ b/Source/WebInspectorUI/UserInterface/Images/Device.svg >@@ -0,0 +1,5 @@ >+<?xml version="1.0" encoding="utf-8"?> >+<!-- Copyright © 2019 Apple Inc. All rights reserved. --> >+<svg xmlns="http://www.w3.org/2000/svg" id="root" version="1.1" viewBox="0 0 16 16"> >+ <rect fill="currentColor" fill-opacity="0.25" stroke="currentColor" stroke-width="1" x="3.75" y="2" width="8.5" height="12" rx="0.5" ry="0.5"/> >+</svg> >diff --git a/Source/WebInspectorUI/UserInterface/Protocol/Target.js b/Source/WebInspectorUI/UserInterface/Protocol/Target.js >index d1687e2e1096db7206dd05032150a6e6424862ee..85ab058fb4414591ea74ca9023505c73e33640af 100644 >--- a/Source/WebInspectorUI/UserInterface/Protocol/Target.js >+++ b/Source/WebInspectorUI/UserInterface/Protocol/Target.js >@@ -73,11 +73,7 @@ WI.Target = class Target extends WI.Object > } > > // Non-manager specific initialization. >- // COMPATIBILITY (iOS 8): Page.setShowPaintRects did not exist. >- if (this.PageAgent) { >- if (this.PageAgent.setShowPaintRects && WI.settings.showPaintRects.value) >- this.PageAgent.setShowPaintRects(true); >- } >+ WI.initializeTarget(this); > > // Intentionally defer ConsoleAgent initialization to the end. We do this so that any > // previous initialization messages will have their responses arrive before a stream >diff --git a/Source/WebInspectorUI/UserInterface/Test/Test.js b/Source/WebInspectorUI/UserInterface/Test/Test.js >index bdcca1b9d1d15d9234f33b3da557ee1dc1caa9f2..91114521e010376537375e669e561e30231c60fc 100644 >--- a/Source/WebInspectorUI/UserInterface/Test/Test.js >+++ b/Source/WebInspectorUI/UserInterface/Test/Test.js >@@ -151,6 +151,10 @@ WI.performOneTimeFrontendInitializationsUsingTarget = function(target) > } > }; > >+WI.initializeTarget = function(target) >+{ >+}; >+ > Object.defineProperty(WI, "mainTarget", > { > get() { return WI.pageTarget || WI.backendTarget; } >diff --git a/Source/WebInspectorUI/UserInterface/Views/Main.css b/Source/WebInspectorUI/UserInterface/Views/Main.css >index e0c76c685bfa121bebaf278b35acefc459b5d2b3..f8b0e1a4791304a744d185548dd2cf65364e06d6 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/Main.css >+++ b/Source/WebInspectorUI/UserInterface/Views/Main.css >@@ -387,6 +387,33 @@ body[dir=rtl] .go-to-arrow { > background-position: 10px 10px, 10px 0px, 0 0, 0 10px; > } > >+.device-settings-content { >+ padding: 8px; >+ >+ --label-input-margin-after: 4px; >+} >+ >+.device-settings-content .columns { >+ display: flex; >+} >+ >+.device-settings-content .columns > .column { >+ display: flex; >+ flex-direction: column; >+} >+ >+.device-settings-content .columns > .column + .column { >+ -webkit-margin-start: 20px; >+} >+ >+body[dir=ltr] .device-settings-content label > input { >+ margin-right: var(--label-input-margin-after); >+} >+ >+body[dir=rtl] .device-settings-content label > input { >+ margin-left: var(--label-input-margin-after); >+} >+ > @media (prefers-color-scheme: dark) { > .go-to-arrow { > filter: invert(); >diff --git a/Source/WebInspectorUI/UserInterface/Views/Popover.js b/Source/WebInspectorUI/UserInterface/Views/Popover.js >index 7fe1d01a0c19be35aa190b87472381b07e11c4ba..876f15b72ef5c8e8d3a5be5e7b44709f3b2ffca2 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/Popover.js >+++ b/Source/WebInspectorUI/UserInterface/Views/Popover.js >@@ -255,7 +255,7 @@ WI.Popover = class Popover extends WI.Object > > function area(size) > { >- return size.width * size.height; >+ return Math.max(0, size.width) * Math.max(0, size.height); > } > > // Find if any of those fit better than the frame for the preferred edge. >@@ -269,6 +269,8 @@ WI.Popover = class Popover extends WI.Object > } > } > >+ console.assert(area(bestMetrics.contentSize) > 0); >+ > var anchorPoint; > var bestFrame = bestMetrics.frame.round(); > >@@ -400,19 +402,18 @@ WI.Popover = class Popover extends WI.Object > // Bounds of the path don't take into account the arrow, but really only the tight bounding box > // of the content contained within the frame. > let bounds; >- let arrowHeight = WI.Popover.AnchorSize.height; > switch (this._edge) { > case WI.RectEdge.MIN_X: // Displayed on the left of the target, arrow points right. >- bounds = new WI.Rect(0, 0, width - arrowHeight, height); >+ bounds = new WI.Rect(0, 0, width - WI.Popover.AnchorSize, height); > break; > case WI.RectEdge.MAX_X: // Displayed on the right of the target, arrow points left. >- bounds = new WI.Rect(arrowHeight, 0, width - arrowHeight, height); >+ bounds = new WI.Rect(WI.Popover.AnchorSize, 0, width - WI.Popover.AnchorSize, height); > break; > case WI.RectEdge.MIN_Y: // Displayed above the target, arrow points down. >- bounds = new WI.Rect(0, 0, width, height - arrowHeight); >+ bounds = new WI.Rect(0, 0, width, height - WI.Popover.AnchorSize); > break; > case WI.RectEdge.MAX_Y: // Displayed below the target, arrow points up. >- bounds = new WI.Rect(0, arrowHeight, width, height - arrowHeight); >+ bounds = new WI.Rect(0, WI.Popover.AnchorSize, width, height - WI.Popover.AnchorSize); > break; > } > >@@ -451,42 +452,38 @@ WI.Popover = class Popover extends WI.Object > var x, y; > var width = preferredSize.width + (WI.Popover.ShadowPadding * 2) + (WI.Popover.ContentPadding * 2); > var height = preferredSize.height + (WI.Popover.ShadowPadding * 2) + (WI.Popover.ContentPadding * 2); >- var arrowLength = WI.Popover.AnchorSize.height; > > switch (edge) { > case WI.RectEdge.MIN_X: // Displayed on the left of the target, arrow points right. >- width += arrowLength; >+ width += WI.Popover.AnchorSize; > x = targetFrame.origin.x - width + WI.Popover.ShadowPadding; > y = targetFrame.origin.y - (height - targetFrame.size.height) / 2; > break; > case WI.RectEdge.MAX_X: // Displayed on the right of the target, arrow points left. >- width += arrowLength; >+ width += WI.Popover.AnchorSize; > x = targetFrame.origin.x + targetFrame.size.width - WI.Popover.ShadowPadding; > y = targetFrame.origin.y - (height - targetFrame.size.height) / 2; > break; > case WI.RectEdge.MIN_Y: // Displayed above the target, arrow points down. >- height += arrowLength; >+ height += WI.Popover.AnchorSize; > x = targetFrame.origin.x - (width - targetFrame.size.width) / 2; > y = targetFrame.origin.y - height + WI.Popover.ShadowPadding; > break; > case WI.RectEdge.MAX_Y: // Displayed below the target, arrow points up. >- height += arrowLength; >+ height += WI.Popover.AnchorSize; > x = targetFrame.origin.x - (width - targetFrame.size.width) / 2; > y = targetFrame.origin.y + targetFrame.size.height - WI.Popover.ShadowPadding; > break; > } > >- if (edge === WI.RectEdge.MIN_X || edge === WI.RectEdge.MAX_X) { >- if (y < containerFrame.minY()) >- y = containerFrame.minY(); >- if (y + height > containerFrame.maxY()) >- y = containerFrame.maxY() - height; >- } else { >- if (x < containerFrame.minX()) >- x = containerFrame.minX(); >- if (x + width > containerFrame.maxX()) >- x = containerFrame.maxX() - width; >- } >+ if (edge !== WI.RectEdge.MIN_X && x < containerFrame.minX()) >+ x = containerFrame.minX(); >+ if (edge !== WI.RectEdge.MAX_X && x + width > containerFrame.maxX()) >+ x = containerFrame.maxX() - width; >+ if (edge !== WI.RectEdge.MIN_Y && y < containerFrame.minY()) >+ y = containerFrame.minY(); >+ if (edge !== WI.RectEdge.MAX_Y && y + height > containerFrame.maxY()) >+ y = containerFrame.maxY() - height; > > var preferredFrame = new WI.Rect(x, y, width, height); > var bestFrame = preferredFrame.intersectionWithRect(containerFrame); >@@ -497,11 +494,11 @@ WI.Popover = class Popover extends WI.Object > switch (edge) { > case WI.RectEdge.MIN_X: // Displayed on the left of the target, arrow points right. > case WI.RectEdge.MAX_X: // Displayed on the right of the target, arrow points left. >- width -= arrowLength; >+ width -= WI.Popover.AnchorSize; > break; > case WI.RectEdge.MIN_Y: // Displayed above the target, arrow points down. > case WI.RectEdge.MAX_Y: // Displayed below the target, arrow points up. >- height -= arrowLength; >+ height -= WI.Popover.AnchorSize; > break; > } > >@@ -514,11 +511,10 @@ WI.Popover = class Popover extends WI.Object > _drawFrame(ctx, bounds, anchorEdge) > { > let cornerRadius = WI.Popover.CornerRadius; >- let arrowHalfLength = WI.Popover.AnchorSize.width * 0.5; > let anchorPoint = this._anchorPoint; > > // Prevent the arrow from being positioned against one of the popover's rounded corners. >- let arrowPadding = cornerRadius + arrowHalfLength; >+ let arrowPadding = cornerRadius + WI.Popover.AnchorSize; > if (anchorEdge === WI.RectEdge.MIN_Y || anchorEdge === WI.RectEdge.MAX_Y) > anchorPoint.x = Number.constrain(anchorPoint.x, bounds.minX() + arrowPadding, bounds.maxX() - arrowPadding); > else >@@ -528,9 +524,9 @@ WI.Popover = class Popover extends WI.Object > switch (anchorEdge) { > case WI.RectEdge.MIN_X: // Displayed on the left of the target, arrow points right. > ctx.moveTo(bounds.maxX(), bounds.minY() + cornerRadius); >- ctx.lineTo(bounds.maxX(), anchorPoint.y - arrowHalfLength); >+ ctx.lineTo(bounds.maxX(), anchorPoint.y - WI.Popover.AnchorSize); > ctx.lineTo(anchorPoint.x, anchorPoint.y); >- ctx.lineTo(bounds.maxX(), anchorPoint.y + arrowHalfLength); >+ ctx.lineTo(bounds.maxX(), anchorPoint.y + WI.Popover.AnchorSize); > ctx.arcTo(bounds.maxX(), bounds.maxY(), bounds.minX(), bounds.maxY(), cornerRadius); > ctx.arcTo(bounds.minX(), bounds.maxY(), bounds.minX(), bounds.minY(), cornerRadius); > ctx.arcTo(bounds.minX(), bounds.minY(), bounds.maxX(), bounds.minY(), cornerRadius); >@@ -538,9 +534,9 @@ WI.Popover = class Popover extends WI.Object > break; > case WI.RectEdge.MAX_X: // Displayed on the right of the target, arrow points left. > ctx.moveTo(bounds.minX(), bounds.maxY() - cornerRadius); >- ctx.lineTo(bounds.minX(), anchorPoint.y + arrowHalfLength); >+ ctx.lineTo(bounds.minX(), anchorPoint.y + WI.Popover.AnchorSize); > ctx.lineTo(anchorPoint.x, anchorPoint.y); >- ctx.lineTo(bounds.minX(), anchorPoint.y - arrowHalfLength); >+ ctx.lineTo(bounds.minX(), anchorPoint.y - WI.Popover.AnchorSize); > ctx.arcTo(bounds.minX(), bounds.minY(), bounds.maxX(), bounds.minY(), cornerRadius); > ctx.arcTo(bounds.maxX(), bounds.minY(), bounds.maxX(), bounds.maxY(), cornerRadius); > ctx.arcTo(bounds.maxX(), bounds.maxY(), bounds.minX(), bounds.maxY(), cornerRadius); >@@ -548,9 +544,9 @@ WI.Popover = class Popover extends WI.Object > break; > case WI.RectEdge.MIN_Y: // Displayed above the target, arrow points down. > ctx.moveTo(bounds.maxX() - cornerRadius, bounds.maxY()); >- ctx.lineTo(anchorPoint.x + arrowHalfLength, bounds.maxY()); >+ ctx.lineTo(anchorPoint.x + WI.Popover.AnchorSize, bounds.maxY()); > ctx.lineTo(anchorPoint.x, anchorPoint.y); >- ctx.lineTo(anchorPoint.x - arrowHalfLength, bounds.maxY()); >+ ctx.lineTo(anchorPoint.x - WI.Popover.AnchorSize, bounds.maxY()); > ctx.arcTo(bounds.minX(), bounds.maxY(), bounds.minX(), bounds.minY(), cornerRadius); > ctx.arcTo(bounds.minX(), bounds.minY(), bounds.maxX(), bounds.minY(), cornerRadius); > ctx.arcTo(bounds.maxX(), bounds.minY(), bounds.maxX(), bounds.maxY(), cornerRadius); >@@ -558,9 +554,9 @@ WI.Popover = class Popover extends WI.Object > break; > case WI.RectEdge.MAX_Y: // Displayed below the target, arrow points up. > ctx.moveTo(bounds.minX() + cornerRadius, bounds.minY()); >- ctx.lineTo(anchorPoint.x - arrowHalfLength, bounds.minY()); >+ ctx.lineTo(anchorPoint.x - WI.Popover.AnchorSize, bounds.minY()); > ctx.lineTo(anchorPoint.x, anchorPoint.y); >- ctx.lineTo(anchorPoint.x + arrowHalfLength, bounds.minY()); >+ ctx.lineTo(anchorPoint.x + WI.Popover.AnchorSize, bounds.minY()); > ctx.arcTo(bounds.maxX(), bounds.minY(), bounds.maxX(), bounds.maxY(), cornerRadius); > ctx.arcTo(bounds.maxX(), bounds.maxY(), bounds.minX(), bounds.maxY(), cornerRadius); > ctx.arcTo(bounds.minX(), bounds.maxY(), bounds.minX(), bounds.minY(), cornerRadius); >@@ -591,7 +587,7 @@ WI.Popover.MinWidth = 40; > WI.Popover.MinHeight = 40; > WI.Popover.ShadowPadding = 5; > WI.Popover.ContentPadding = 5; >-WI.Popover.AnchorSize = new WI.Size(22, 11); >+WI.Popover.AnchorSize = 11; > WI.Popover.ShadowEdgeInsets = new WI.EdgeInsets(WI.Popover.ShadowPadding); > WI.Popover.IgnoreAutoDismissClassName = "popover-ignore-auto-dismiss"; > WI.Popover.EventPreventDismissSymbol = Symbol("popover-event-prevent-dismiss"); >diff --git a/Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.h b/Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.h >index f6e17f911220d8d3f4e346689c74ac199c4106e7..f9b67b31fcfd049848f40fc7f8f4de758e681830 100644 >--- a/Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.h >+++ b/Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.h >@@ -58,6 +58,7 @@ public: > void startWindowDrag() override; > void moveWindowBy(float x, float y) override; > >+ bool isRemote() const final { return true; } > String localizedStringsURL() override; > String backendCommandsURL() override { return m_backendCommandsURL; } > String debuggableType() override { return m_debuggableType; } >diff --git a/Source/WebKit/WebProcess/WebPage/WebInspectorUI.h b/Source/WebKit/WebProcess/WebPage/WebInspectorUI.h >index 243d48713fc8ed3a91d46e93421bfbd67c804f98..b1537dbad0bce12be51f1f4973da6e7a018532a8 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebInspectorUI.h >+++ b/Source/WebKit/WebProcess/WebPage/WebInspectorUI.h >@@ -88,6 +88,7 @@ public: > void startWindowDrag() override; > void moveWindowBy(float x, float y) override; > >+ bool isRemote() const final { return false; } > String localizedStringsURL() override; > > void bringToFront() override; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index a9285706bea1a8874ce0c8f9a72027bfa27b9f67..fb3a7bb1ce186df53a63e7dd84473533b4811407 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2019-01-25 Devin Rousso <drousso@apple.com> >+ >+ 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. >+ >+ * inspector/page/overrideSetting.html: Added. >+ * inspector/page/overrideSetting-expected.txt: Added. >+ > 2019-01-25 Simon Fraser <simon.fraser@apple.com> > > Move more scrolling tree tests into scrollingcoordinator/scrolling-tree >diff --git a/LayoutTests/inspector/page/overrideSetting-expected.txt b/LayoutTests/inspector/page/overrideSetting-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..9cb53e595972d461521892fa49993413134fea55 >--- /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)" >+ >diff --git a/LayoutTests/inspector/page/overrideSetting.html b/LayoutTests/inspector/page/overrideSetting.html >new file mode 100644 >index 0000000000000000000000000000000000000000..d75df8802c24b6ae00806cee0135a8d837c9e7d2 >--- /dev/null >+++ b/LayoutTests/inspector/page/overrideSetting.html >@@ -0,0 +1,49 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../http/tests/inspector/resources/inspector-test.js"></script> >+<script> >+ >+function printStyleProperty(property) { >+ let computedStyle = window.getComputedStyle(document.body); >+ let propertyValue = computedStyle.getPropertyValue(property); >+ TestPage.addResult(`Property "${property}" equals "${propertyValue}"`); >+} >+ >+function test() >+{ >+ let suite = InspectorTest.createAsyncSuite("Page.overrideSetting"); >+ >+ suite.addTestCase({ >+ name: "Page.overrideSetting.AuthorAndUserStylesEnabled", >+ description: "Test that author/user styles aren't applied when that setting is overridden.", >+ async test() { >+ await InspectorTest.evaluateInPage(`printStyleProperty("color")`); >+ >+ InspectorTest.log("Overriding AuthorAndUserStylesEnabled to false..."); >+ await PageAgent.overrideSetting(PageAgent.Setting.AuthorAndUserStylesEnabled, false); >+ >+ await InspectorTest.evaluateInPage(`printStyleProperty("color")`); >+ >+ InspectorTest.log("Removing AuthorAndUserStylesEnabled override..."); >+ await PageAgent.overrideSetting(PageAgent.Setting.AuthorAndUserStylesEnabled); >+ >+ await InspectorTest.evaluateInPage(`printStyleProperty("color")`); >+ }, >+ }); >+ >+ suite.runTestCasesAndFinish(); >+} >+ >+</script> >+</head> >+<body onload="runTest()"> >+ <p>Tests for the Page.overrideSetting command.</p> >+ >+ <style> >+ body { >+ color: red; >+ } >+ </style> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193813
:
360080
|
360081
|
360189
|
360190
| 360208