Title: [240540] trunk
Revision
240540
Author
[email protected]
Date
2019-01-25 19:57:17 -0800 (Fri, 25 Jan 2019)

Log Message

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/_javascript_Core:

* 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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (240539 => 240540)


--- trunk/LayoutTests/ChangeLog	2019-01-26 03:38:57 UTC (rev 240539)
+++ trunk/LayoutTests/ChangeLog	2019-01-26 03:57:17 UTC (rev 240540)
@@ -1,3 +1,14 @@
+2019-01-25  Devin Rousso  <[email protected]>
+
+        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  Jer Noble  <[email protected]>
 
         <video> elements not in the DOM should be allowed to AirPlay

Added: trunk/LayoutTests/inspector/page/overrideSetting-expected.txt (0 => 240540)


--- trunk/LayoutTests/inspector/page/overrideSetting-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/page/overrideSetting-expected.txt	2019-01-26 03:57:17 UTC (rev 240540)
@@ -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)"
+

Added: trunk/LayoutTests/inspector/page/overrideSetting.html (0 => 240540)


--- trunk/LayoutTests/inspector/page/overrideSetting.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/page/overrideSetting.html	2019-01-26 03:57:17 UTC (rev 240540)
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<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>

Modified: trunk/Source/_javascript_Core/ChangeLog (240539 => 240540)


--- trunk/Source/_javascript_Core/ChangeLog	2019-01-26 03:38:57 UTC (rev 240539)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-01-26 03:57:17 UTC (rev 240540)
@@ -1,3 +1,14 @@
+2019-01-25  Devin Rousso  <[email protected]>
+
+        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  Keith Rollin  <[email protected]>
 
         Update Xcode projects with "Check .xcfilelists" build phase

Modified: trunk/Source/_javascript_Core/inspector/protocol/Page.json (240539 => 240540)


--- trunk/Source/_javascript_Core/inspector/protocol/Page.json	2019-01-26 03:38:57 UTC (rev 240539)
+++ trunk/Source/_javascript_Core/inspector/protocol/Page.json	2019-01-26 03:57:17 UTC (rev 240540)
@@ -4,6 +4,18 @@
     "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",
             "enum": ["Document", "Stylesheet", "Image", "Font", "Script", "XHR", "Fetch", "Ping", "Beacon", "WebSocket", "Other"],
@@ -118,6 +130,14 @@
             ]
         },
         {
+            "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.",
             "returns": [

Modified: trunk/Source/WebCore/ChangeLog (240539 => 240540)


--- trunk/Source/WebCore/ChangeLog	2019-01-26 03:38:57 UTC (rev 240539)
+++ trunk/Source/WebCore/ChangeLog	2019-01-26 03:57:17 UTC (rev 240540)
@@ -1,3 +1,34 @@
+2019-01-25  Devin Rousso  <[email protected]>
+
+        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  Wenson Hsieh  <[email protected]>
 
         Document::updateMainArticleElementAfterLayout() should be a no-op when no client depends on knowing the main article element

Modified: trunk/Source/WebCore/Scripts/GenerateSettings.rb (240539 => 240540)


--- trunk/Source/WebCore/Scripts/GenerateSettings.rb	2019-01-26 03:38:57 UTC (rev 240539)
+++ trunk/Source/WebCore/Scripts/GenerateSettings.rb	2019-01-26 03:57:17 UTC (rev 240540)
@@ -68,6 +68,7 @@
   attr_accessor :conditional
   attr_accessor :onChange
   attr_accessor :getter
+  attr_accessor :inspectorOverride
   
   def initialize(name, opts)
     @name = name
@@ -76,6 +77,7 @@
     @conditional = opts["conditional"]
     @_onChange_ = opts["onChange"]
     @getter = opts["getter"]
+    @inspectorOverride = opts["inspectorOverride"]
   end
 
   def valueType?
@@ -113,6 +115,10 @@
     @onChange != nil
   end
 
+  def hasComplexGetter?
+    hasInspectorOverride?
+  end
+
   def setterFunctionName
     if @name.start_with?("css", "xss", "ftp", "dom", "dns")
       "set" + @name[0..2].upcase + @name[[email protected]]
@@ -124,6 +130,10 @@
   def getterFunctionName
     @getter || @name
   end
+
+  def hasInspectorOverride?
+    @inspectorOverride == true
+  end
 end
 
 class Conditional
@@ -131,6 +141,7 @@
   attr_accessor :settings
   attr_accessor :boolSettings
   attr_accessor :nonBoolSettings
+  attr_accessor :settingsWithComplexGetters
   attr_accessor :settingsWithComplexSetters
 
   def initialize(condition, settings)
@@ -139,6 +150,7 @@
     
     @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 @@
   attr_accessor :unconditionalSetting
   attr_accessor :unconditionalBoolSetting
   attr_accessor :unconditionalNonBoolSetting
+  attr_accessor :unconditionalSettingWithComplexGetters
   attr_accessor :unconditionalSettingWithComplexSetters
   attr_accessor :conditionals
   
@@ -161,7 +174,9 @@
     @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 = {}

Modified: trunk/Source/WebCore/Scripts/SettingsTemplates/Settings.cpp.erb (240539 => 240540)


--- trunk/Source/WebCore/Scripts/SettingsTemplates/Settings.cpp.erb	2019-01-26 03:38:57 UTC (rev 240539)
+++ trunk/Source/WebCore/Scripts/SettingsTemplates/Settings.cpp.erb	2019-01-26 03:57:17 UTC (rev 240540)
@@ -71,6 +71,17 @@
 {
 }
 
+<%- 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 @@
 
 <%- 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 %>)
 {
@@ -97,4 +118,16 @@
 
 <%- 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 -%>
+}

Modified: trunk/Source/WebCore/Scripts/SettingsTemplates/Settings.h.erb (240539 => 240540)


--- trunk/Source/WebCore/Scripts/SettingsTemplates/Settings.h.erb	2019-01-26 03:38:57 UTC (rev 240539)
+++ trunk/Source/WebCore/Scripts/SettingsTemplates/Settings.h.erb	2019-01-26 03:57:17 UTC (rev 240540)
@@ -41,7 +41,11 @@
     ~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 @@
 <%- 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 @@
 #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 -%>

Modified: trunk/Source/WebCore/inspector/InspectorFrontendClient.h (240539 => 240540)


--- trunk/Source/WebCore/inspector/InspectorFrontendClient.h	2019-01-26 03:38:57 UTC (rev 240539)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClient.h	2019-01-26 03:57:17 UTC (rev 240540)
@@ -54,6 +54,7 @@
     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(); };

Modified: trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h (240539 => 240540)


--- trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h	2019-01-26 03:38:57 UTC (rev 240539)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h	2019-01-26 03:57:17 UTC (rev 240540)
@@ -81,6 +81,7 @@
     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();

Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp (240539 => 240540)


--- trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp	2019-01-26 03:38:57 UTC (rev 240539)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp	2019-01-26 03:57:17 UTC (rev 240540)
@@ -254,6 +254,11 @@
         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();

Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.h (240539 => 240540)


--- trunk/Source/WebCore/inspector/InspectorFrontendHost.h	2019-01-26 03:38:57 UTC (rev 240539)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.h	2019-01-26 03:57:17 UTC (rev 240540)
@@ -75,6 +75,7 @@
     void startWindowDrag();
     void moveWindowBy(float x, float y) const;
 
+    bool isRemote() const;
     String localizedStringsURL();
     String backendCommandsURL();
     String debuggableType();

Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.idl (240539 => 240540)


--- trunk/Source/WebCore/inspector/InspectorFrontendHost.idl	2019-01-26 03:38:57 UTC (rev 240539)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.idl	2019-01-26 03:57:17 UTC (rev 240540)
@@ -56,6 +56,7 @@
     void startWindowDrag();
     void moveWindowBy(unrestricted float x, unrestricted float y);
 
+    readonly attribute boolean isRemote;
     DOMString localizedStringsURL();
     DOMString backendCommandsURL();
     DOMString debuggableType();

Modified: trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp (240539 => 240540)


--- trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp	2019-01-26 03:38:57 UTC (rev 240539)
+++ trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp	2019-01-26 03:57:17 UTC (rev 240540)
@@ -83,6 +83,13 @@
 
 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 @@
     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 @@
     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) {

Modified: trunk/Source/WebCore/inspector/agents/InspectorPageAgent.h (240539 => 240540)


--- trunk/Source/WebCore/inspector/agents/InspectorPageAgent.h	2019-01-26 03:38:57 UTC (rev 240539)
+++ trunk/Source/WebCore/inspector/agents/InspectorPageAgent.h	2019-01-26 03:57:17 UTC (rev 240540)
@@ -90,6 +90,7 @@
     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;

Modified: trunk/Source/WebCore/page/Settings.yaml (240539 => 240540)


--- trunk/Source/WebCore/page/Settings.yaml	2019-01-26 03:38:57 UTC (rev 240539)
+++ trunk/Source/WebCore/page/Settings.yaml	2019-01-26 03:57:17 UTC (rev 240540)
@@ -128,6 +128,7 @@
 authorAndUserStylesEnabled:
   initial: true
   onChange: setNeedsRecalcStyleInAllFrames
+  inspectorOverride: true
 userStyleSheetLocation:
   type: URL
   onChange: userStyleSheetLocationChanged
@@ -179,6 +180,7 @@
   initial: true
 needsSiteSpecificQuirks:
   initial: false
+  inspectorOverride: true
 domTimersThrottlingEnabled:
   initial: true
 webArchiveDebugModeEnabled:
@@ -385,6 +387,7 @@
 
 webSecurityEnabled:
   initial: true
+  inspectorOverride: true
 spatialNavigationEnabled:
   initial: false
 
@@ -669,9 +672,11 @@
   initial: true
   getter: areImagesEnabled
   onChange: imagesEnabledChanged
+  inspectorOverride: true
 scriptEnabled:
   initial: false
   getter: isScriptEnabled
+  inspectorOverride: true
 pluginsEnabled:
   initial: false
   getter: arePluginsEnabled

Modified: trunk/Source/WebInspectorUI/ChangeLog (240539 => 240540)


--- trunk/Source/WebInspectorUI/ChangeLog	2019-01-26 03:38:57 UTC (rev 240539)
+++ trunk/Source/WebInspectorUI/ChangeLog	2019-01-26 03:57:17 UTC (rev 240540)
@@ -1,5 +1,44 @@
 2019-01-25  Devin Rousso  <[email protected]>
 
+        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  <[email protected]>
+
         Web Inspector: Audit: unable to import audits
         https://bugs.webkit.org/show_bug.cgi?id=193861
 

Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (240539 => 240540)


--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2019-01-26 03:38:57 UTC (rev 240539)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2019-01-26 03:57:17 UTC (rev 240540)
@@ -264,6 +264,7 @@
 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["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 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 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";

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (240539 => 240540)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2019-01-26 03:38:57 UTC (rev 240539)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2019-01-26 03:57:17 UTC (rev 240540)
@@ -161,6 +161,7 @@
     this.visible = false;
     this._windowKeydownListeners = [];
     this._targetsAvailablePromise = new WI.WrappedPromise;
+    this._overridenDeviceSettings = new Set;
 
     // Targets.
     WI.backendTarget = null;
@@ -445,6 +446,15 @@
     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 @@
 
     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.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 @@
     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.showRepresentedObject(representedObject, dialog.cookie);
 };
 
+// Popover delegate
+
+WI.didDismissPopover = function(popover)
+{
+    if (popover === WI._deviceSettingsPopover)
+        WI._deviceSettingsPopover = null;
+};
+
 WI.DockConfiguration = {
     Right: "right",
     Left: "left",

Added: trunk/Source/WebInspectorUI/UserInterface/Images/Device.svg (0 => 240540)


--- trunk/Source/WebInspectorUI/UserInterface/Images/Device.svg	                        (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Images/Device.svg	2019-01-26 03:57:17 UTC (rev 240540)
@@ -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>

Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/Target.js (240539 => 240540)


--- trunk/Source/WebInspectorUI/UserInterface/Protocol/Target.js	2019-01-26 03:38:57 UTC (rev 240539)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/Target.js	2019-01-26 03:57:17 UTC (rev 240540)
@@ -73,11 +73,7 @@
         }
 
         // 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

Modified: trunk/Source/WebInspectorUI/UserInterface/Test/Test.js (240539 => 240540)


--- trunk/Source/WebInspectorUI/UserInterface/Test/Test.js	2019-01-26 03:38:57 UTC (rev 240539)
+++ trunk/Source/WebInspectorUI/UserInterface/Test/Test.js	2019-01-26 03:57:17 UTC (rev 240540)
@@ -151,6 +151,10 @@
     }
 };
 
+WI.initializeTarget = function(target)
+{
+};
+
 Object.defineProperty(WI, "mainTarget",
 {
     get() { return WI.pageTarget || WI.backendTarget; }

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/Main.css (240539 => 240540)


--- trunk/Source/WebInspectorUI/UserInterface/Views/Main.css	2019-01-26 03:38:57 UTC (rev 240539)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/Main.css	2019-01-26 03:57:17 UTC (rev 240540)
@@ -387,6 +387,33 @@
     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();

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/Popover.js (240539 => 240540)


--- trunk/Source/WebInspectorUI/UserInterface/Views/Popover.js	2019-01-26 03:38:57 UTC (rev 240539)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/Popover.js	2019-01-26 03:57:17 UTC (rev 240540)
@@ -255,7 +255,7 @@
 
         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 @@
             }
         }
 
+        console.assert(area(bestMetrics.contentSize) > 0);
+
         var anchorPoint;
         var bestFrame = bestMetrics.frame.round();
 
@@ -400,19 +402,18 @@
         // 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 @@
         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 @@
         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 @@
     _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 @@
         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 @@
             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 @@
             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 @@
             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.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");

Modified: trunk/Source/WebKit/ChangeLog (240539 => 240540)


--- trunk/Source/WebKit/ChangeLog	2019-01-26 03:38:57 UTC (rev 240539)
+++ trunk/Source/WebKit/ChangeLog	2019-01-26 03:57:17 UTC (rev 240540)
@@ -1,3 +1,16 @@
+2019-01-25  Devin Rousso  <[email protected]>
+
+        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  Dean Jackson  <[email protected]>
 
         REGRESSION: Some USDz from 3rd party websites don't go directly to AR QL

Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.h (240539 => 240540)


--- trunk/Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.h	2019-01-26 03:38:57 UTC (rev 240539)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.h	2019-01-26 03:57:17 UTC (rev 240540)
@@ -58,6 +58,7 @@
     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; }

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebInspectorUI.h (240539 => 240540)


--- trunk/Source/WebKit/WebProcess/WebPage/WebInspectorUI.h	2019-01-26 03:38:57 UTC (rev 240539)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebInspectorUI.h	2019-01-26 03:57:17 UTC (rev 240540)
@@ -88,6 +88,7 @@
     void startWindowDrag() override;
     void moveWindowBy(float x, float y) override;
 
+    bool isRemote() const final { return false; }
     String localizedStringsURL() override;
 
     void bringToFront() override;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to