Web Inspector: Debug: "Reset Web Inspector" should also clear the saved window size...
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Jul 2019 07:47:12 +0000 (07:47 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Jul 2019 07:47:12 +0000 (07:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=198956

Reviewed by Matt Baker.

Source/WebCore:

* inspector/InspectorFrontendClient.h:

* inspector/InspectorFrontendClientLocal.h:
* inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorFrontendClientLocal::Settings::deleteProperty): Added.
(WebCore::InspectorFrontendClientLocal::resetWindowState): Added.

* inspector/InspectorFrontendHost.idl:
* inspector/InspectorFrontendHost.h:
* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::reset): Added.

Source/WebInspectorUI:

* UserInterface/Base/Main.js:
(WI.reset): Added.

* UserInterface/Views/SettingsTabContentView.js:
(WI.SettingsTabContentView.prototype._createDebugSettingsView):

Source/WebKit:

* UIProcess/WebPreferences.h:
* UIProcess/WebPreferences.cpp:
(WebKit::WebPreferences::deleteKey): Added.
* UIProcess/gtk/WebPreferencesGtk.cpp:
(WebKit::WebPreferences::platformDeleteKey): Added.
* UIProcess/mac/WebPreferencesMac.mm:
(WebKit::WebPreferences::platformDeleteKey): Added.
* UIProcess/wpe/WebPreferencesWPE.cpp:
(WebKit::WebPreferences::platformDeleteKey): Added.
* UIProcess/win/WebPreferencesWin.cpp:
(WebKit::WebPreferences::platformDeleteKey): Added.
* Shared/WebPreferencesStore.h:
* Shared/WebPreferencesStore.cpp:
(WebKit::WebPreferencesStore::deleteKey): Added.

* UIProcess/WebInspectorProxy.messages.in:
* UIProcess/WebInspectorProxy.h:
* UIProcess/WebInspectorProxy.cpp:
(WebKit::WebInspectorProxy::resetWindowState): Added.
(WebKit::WebInspectorProxy::platformResetWindowState): Added.
* UIProcess/gtk/WebInspectorProxyGtk.cpp:
(WebKit::WebInspectorProxy::platformResetWindowState): Added.
* UIProcess/mac/WebInspectorProxyMac.mm:
(WebKit::WebInspectorProxy::platformResetWindowState): Added.
* UIProcess/wpe/WebInspectorProxyWPE.cpp:
(WebKit::WebInspectorProxy::platformResetWindowState): Added.
* UIProcess/win/WebInspectorProxyWin.cpp:
(WebKit::WebInspectorProxy::platformResetWindowState): Added.
* WebProcess/WebPage/WebInspectorUI.h:
* WebProcess/WebPage/WebInspectorUI.cpp:
(WebKit::WebInspectorUI::resetWindowState): Added.

* UIProcess/RemoteWebInspectorProxy.messages.in:
* UIProcess/RemoteWebInspectorProxy.h:
* UIProcess/RemoteWebInspectorProxy.cpp:
(WebKit::RemoteWebInspectorProxy::resetWindowState): Added.
(WebKit::RemoteWebInspectorProxy::platformResetWindowState): Added.
* UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp:
(WebKit::RemoteWebInspectorProxy::platformResetWindowState): Added.
* UIProcess/mac/RemoteWebInspectorProxyMac.mm:
(WebKit::RemoteWebInspectorProxy::platformResetWindowState): Added.
* UIProcess/win/RemoteWebInspectorProxyWin.cpp:
(WebKit::RemoteWebInspectorProxy::platformResetWindowState): Added.
* WebProcess/WebPage/RemoteWebInspectorUI.h:
* WebProcess/WebPage/RemoteWebInspectorUI.cpp:
(WebKit::RemoteWebInspectorUI::resetWindowState): Added.

Source/WebKitLegacy/cf:

* WebCoreSupport/WebInspectorClientCF.cpp:
(deleteSetting): Added.
(WebInspectorClient::deleteInspectorStartsAttached): Added.
(WebInspectorClient::deleteInspectorAttachDisabled): Added.
(WebInspectorClient::createFrontendSettings):

Source/WebKitLegacy/ios:

* WebCoreSupport/WebInspectorClientIOS.mm:
(WebInspectorFrontendClient::resetWindowState): Added.

Source/WebKitLegacy/mac:

* WebCoreSupport/WebInspectorClient.h:
* WebCoreSupport/WebInspectorClient.mm:
(WebInspectorFrontendClient::resetWindowState): Added.

Source/WebKitLegacy/win:

* WebCoreSupport/WebInspectorClient.h:
* WebCoreSupport/WebInspectorClient.cpp:
(WebInspectorFrontendClient::resetWindowState): Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247043 268f45cc-cd09-0410-ab3c-d52691b4dbfc

46 files changed:
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorFrontendClient.h
Source/WebCore/inspector/InspectorFrontendClientLocal.cpp
Source/WebCore/inspector/InspectorFrontendClientLocal.h
Source/WebCore/inspector/InspectorFrontendHost.cpp
Source/WebCore/inspector/InspectorFrontendHost.h
Source/WebCore/inspector/InspectorFrontendHost.idl
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Base/Main.js
Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPreferencesStore.cpp
Source/WebKit/Shared/WebPreferencesStore.h
Source/WebKit/UIProcess/RemoteWebInspectorProxy.cpp
Source/WebKit/UIProcess/RemoteWebInspectorProxy.h
Source/WebKit/UIProcess/RemoteWebInspectorProxy.messages.in
Source/WebKit/UIProcess/WebInspectorProxy.cpp
Source/WebKit/UIProcess/WebInspectorProxy.h
Source/WebKit/UIProcess/WebInspectorProxy.messages.in
Source/WebKit/UIProcess/WebPreferences.cpp
Source/WebKit/UIProcess/WebPreferences.h
Source/WebKit/UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp
Source/WebKit/UIProcess/gtk/WebInspectorProxyGtk.cpp
Source/WebKit/UIProcess/gtk/WebPreferencesGtk.cpp
Source/WebKit/UIProcess/mac/RemoteWebInspectorProxyMac.mm
Source/WebKit/UIProcess/mac/WebInspectorProxyMac.mm
Source/WebKit/UIProcess/mac/WebPreferencesMac.mm
Source/WebKit/UIProcess/win/RemoteWebInspectorProxyWin.cpp
Source/WebKit/UIProcess/win/WebInspectorProxyWin.cpp
Source/WebKit/UIProcess/win/WebPreferencesWin.cpp
Source/WebKit/UIProcess/wpe/WebInspectorProxyWPE.cpp
Source/WebKit/UIProcess/wpe/WebPreferencesWPE.cpp
Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.cpp
Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.h
Source/WebKit/WebProcess/WebPage/WebInspectorUI.cpp
Source/WebKit/WebProcess/WebPage/WebInspectorUI.h
Source/WebKitLegacy/cf/ChangeLog
Source/WebKitLegacy/cf/WebCoreSupport/WebInspectorClientCF.cpp
Source/WebKitLegacy/ios/ChangeLog
Source/WebKitLegacy/ios/WebCoreSupport/WebInspectorClientIOS.mm
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebCoreSupport/WebInspectorClient.h
Source/WebKitLegacy/mac/WebCoreSupport/WebInspectorClient.mm
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/WebCoreSupport/WebInspectorClient.cpp
Source/WebKitLegacy/win/WebCoreSupport/WebInspectorClient.h

index da5999f..72cdba7 100644 (file)
@@ -1,3 +1,22 @@
+2019-07-02  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: Debug: "Reset Web Inspector" should also clear the saved window size and attachment side
+        https://bugs.webkit.org/show_bug.cgi?id=198956
+
+        Reviewed by Matt Baker.
+
+        * inspector/InspectorFrontendClient.h:
+
+        * inspector/InspectorFrontendClientLocal.h:
+        * inspector/InspectorFrontendClientLocal.cpp:
+        (WebCore::InspectorFrontendClientLocal::Settings::deleteProperty): Added.
+        (WebCore::InspectorFrontendClientLocal::resetWindowState): Added.
+
+        * inspector/InspectorFrontendHost.idl:
+        * inspector/InspectorFrontendHost.h:
+        * inspector/InspectorFrontendHost.cpp:
+        (WebCore::InspectorFrontendHost::reset): Added.
+
 2019-07-01  Zalan Bujtas  <zalan@apple.com>
 
         [Text autosizing] [iPadOS] AutosizeStatus::idempotentTextSize returns the computed font size in certain cases.
index 00ce825..7cf3c2a 100644 (file)
@@ -65,6 +65,7 @@ public:
     virtual void bringToFront() = 0;
     virtual void closeWindow() = 0;
     virtual void reopen() = 0;
+    virtual void resetState() = 0;
 
     virtual UserInterfaceLayoutDirection userInterfaceLayoutDirection() const = 0;
 
index ea6af54..a4e2154 100644 (file)
@@ -127,6 +127,10 @@ void InspectorFrontendClientLocal::Settings::setProperty(const String&, const St
 {
 }
 
+void InspectorFrontendClientLocal::Settings::deleteProperty(const String&)
+{
+}
+
 InspectorFrontendClientLocal::InspectorFrontendClientLocal(InspectorController* inspectedPageController, Page* frontendPage, std::unique_ptr<Settings> settings)
     : m_inspectedPageController(inspectedPageController)
     , m_frontendPage(frontendPage)
@@ -146,6 +150,11 @@ InspectorFrontendClientLocal::~InspectorFrontendClientLocal()
     m_dispatchTask->reset();
 }
 
+void InspectorFrontendClientLocal::resetState()
+{
+    m_settings->deleteProperty(inspectorAttachedHeightSetting);
+}
+
 void InspectorFrontendClientLocal::windowObjectCleared()
 {
     if (m_frontendHost)
index ae26cca..ce3b707 100644 (file)
@@ -55,11 +55,14 @@ public:
         virtual ~Settings() = default;
         virtual String getProperty(const String& name);
         virtual void setProperty(const String& name, const String& value);
+        virtual void deleteProperty(const String& name);
     };
 
     WEBCORE_EXPORT InspectorFrontendClientLocal(InspectorController* inspectedPageController, Page* frontendPage, std::unique_ptr<Settings>);
     WEBCORE_EXPORT virtual ~InspectorFrontendClientLocal();
 
+    WEBCORE_EXPORT void resetState() override;
+
     WEBCORE_EXPORT void windowObjectCleared() final;
     WEBCORE_EXPORT void frontendLoaded() override;
 
index 71ca44b..9fa6ab1 100644 (file)
@@ -197,6 +197,13 @@ void InspectorFrontendHost::reopen()
         m_client->reopen();
 }
 
+void InspectorFrontendHost::reset()
+{
+    if (m_client)
+        m_client->resetState();
+    reopen();
+}
+
 void InspectorFrontendHost::bringToFront()
 {
     if (m_client)
index 3017cb7..56b89df 100644 (file)
@@ -55,9 +55,10 @@ public:
     WEBCORE_EXPORT void addSelfToGlobalObjectInWorld(DOMWrapperWorld&);
 
     void loaded();
-    void requestSetDockSide(const String&);
     void closeWindow();
     void reopen();
+    void reset();
+
     void bringToFront();
     void inspectedURLChanged(const String&);
 
@@ -69,6 +70,8 @@ public:
 
     String userInterfaceLayoutDirection();
 
+    void requestSetDockSide(const String&);
+
     void setAttachedWindowHeight(unsigned);
     void setAttachedWindowWidth(unsigned);
 
index 023a39c..90b3afc 100644 (file)
@@ -37,6 +37,8 @@
     void loaded();
     void closeWindow();
     void reopen();
+    void reset();
+
     void bringToFront();
     void inspectedURLChanged(DOMString newURL);
 
index 5028ad7..e07aafd 100644 (file)
@@ -1,5 +1,18 @@
 2019-07-02  Devin Rousso  <drousso@apple.com>
 
+        Web Inspector: Debug: "Reset Web Inspector" should also clear the saved window size and attachment side
+        https://bugs.webkit.org/show_bug.cgi?id=198956
+
+        Reviewed by Matt Baker.
+
+        * UserInterface/Base/Main.js:
+        (WI.reset): Added.
+
+        * UserInterface/Views/SettingsTabContentView.js:
+        (WI.SettingsTabContentView.prototype._createDebugSettingsView):
+
+2019-07-02  Devin Rousso  <drousso@apple.com>
+
         Web Inspector: Audit: missing demo audits for WebInspectorAudit functions
         https://bugs.webkit.org/show_bug.cgi?id=198719
 
index 5bfde51..eeda649 100644 (file)
@@ -3220,6 +3220,13 @@ WI.assumingMainTarget = function()
     return WI.mainTarget;
 };
 
+WI.reset = async function()
+{
+    await WI.ObjectStore.reset();
+    WI.Setting.reset();
+    InspectorFrontendHost.reset();
+};
+
 WI.isEngineeringBuild = false;
 
 // OpenResourceDialog delegate
index 14aaded..53fd2c7 100644 (file)
@@ -392,10 +392,8 @@ WI.SettingsTabContentView = class SettingsTabContentView extends WI.TabContentVi
 
         let resetInspectorButton = document.createElement("button");
         resetInspectorButton.textContent = WI.unlocalizedString("Reset Web Inspector");
-        resetInspectorButton.addEventListener("click", async (event) => {
-            await WI.ObjectStore.reset();
-            WI.Setting.reset();
-            InspectorFrontendHost.reopen();
+        resetInspectorButton.addEventListener("click", (event) => {
+            WI.reset();
         });
         this._debugSettingsView.addCenteredContainer(resetInspectorButton);
 
index c325a15..2919bc8 100644 (file)
@@ -1,3 +1,57 @@
+2019-07-02  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: Debug: "Reset Web Inspector" should also clear the saved window size and attachment side
+        https://bugs.webkit.org/show_bug.cgi?id=198956
+
+        Reviewed by Matt Baker.
+
+        * UIProcess/WebPreferences.h:
+        * UIProcess/WebPreferences.cpp:
+        (WebKit::WebPreferences::deleteKey): Added.
+        * UIProcess/gtk/WebPreferencesGtk.cpp:
+        (WebKit::WebPreferences::platformDeleteKey): Added.
+        * UIProcess/mac/WebPreferencesMac.mm:
+        (WebKit::WebPreferences::platformDeleteKey): Added.
+        * UIProcess/wpe/WebPreferencesWPE.cpp:
+        (WebKit::WebPreferences::platformDeleteKey): Added.
+        * UIProcess/win/WebPreferencesWin.cpp:
+        (WebKit::WebPreferences::platformDeleteKey): Added.
+        * Shared/WebPreferencesStore.h:
+        * Shared/WebPreferencesStore.cpp:
+        (WebKit::WebPreferencesStore::deleteKey): Added.
+
+        * UIProcess/WebInspectorProxy.messages.in:
+        * UIProcess/WebInspectorProxy.h:
+        * UIProcess/WebInspectorProxy.cpp:
+        (WebKit::WebInspectorProxy::resetWindowState): Added.
+        (WebKit::WebInspectorProxy::platformResetWindowState): Added.
+        * UIProcess/gtk/WebInspectorProxyGtk.cpp:
+        (WebKit::WebInspectorProxy::platformResetWindowState): Added.
+        * UIProcess/mac/WebInspectorProxyMac.mm:
+        (WebKit::WebInspectorProxy::platformResetWindowState): Added.
+        * UIProcess/wpe/WebInspectorProxyWPE.cpp:
+        (WebKit::WebInspectorProxy::platformResetWindowState): Added.
+        * UIProcess/win/WebInspectorProxyWin.cpp:
+        (WebKit::WebInspectorProxy::platformResetWindowState): Added.
+        * WebProcess/WebPage/WebInspectorUI.h:
+        * WebProcess/WebPage/WebInspectorUI.cpp:
+        (WebKit::WebInspectorUI::resetWindowState): Added.
+
+        * UIProcess/RemoteWebInspectorProxy.messages.in:
+        * UIProcess/RemoteWebInspectorProxy.h:
+        * UIProcess/RemoteWebInspectorProxy.cpp:
+        (WebKit::RemoteWebInspectorProxy::resetWindowState): Added.
+        (WebKit::RemoteWebInspectorProxy::platformResetWindowState): Added.
+        * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp:
+        (WebKit::RemoteWebInspectorProxy::platformResetWindowState): Added.
+        * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
+        (WebKit::RemoteWebInspectorProxy::platformResetWindowState): Added.
+        * UIProcess/win/RemoteWebInspectorProxyWin.cpp:
+        (WebKit::RemoteWebInspectorProxy::platformResetWindowState): Added.
+        * WebProcess/WebPage/RemoteWebInspectorUI.h:
+        * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
+        (WebKit::RemoteWebInspectorUI::resetWindowState): Added.
+
 2019-07-01  Chris Dumez  <cdumez@apple.com>
 
         Remove virtual functions on WebProcessLifetimeObserver that are unused after r245540
index 503628e..bbcee41 100644 (file)
@@ -173,4 +173,10 @@ void WebPreferencesStore::setOverrideDefaultsDoubleValueForKey(const String& key
     m_overriddenDefaults.set(key, Value(value));
 }
 
+void WebPreferencesStore::deleteKey(const String& key)
+{
+    m_values.remove(key);
+    m_overriddenDefaults.remove(key);
+}
+
 } // namespace WebKit
index 4b39686..8a4a0bf 100644 (file)
@@ -58,6 +58,8 @@ struct WebPreferencesStore {
     void setOverrideDefaultsUInt32ValueForKey(const String& key, uint32_t value);
     void setOverrideDefaultsDoubleValueForKey(const String& key, double value);
 
+    void deleteKey(const String& key);
+
     // For WebKitTestRunner usage.
     static void overrideBoolValueForKey(const String& key, bool value);
     static void removeTestRunnerOverrides();
index 6679d45..4aa3444 100644 (file)
@@ -102,6 +102,11 @@ void RemoteWebInspectorProxy::reopen()
     load(m_debuggableType, m_backendCommandsURL);
 }
 
+void RemoteWebInspectorProxy::resetState()
+{
+    platformResetState();
+}
+
 void RemoteWebInspectorProxy::bringToFront()
 {
     platformBringToFront();
@@ -177,6 +182,7 @@ WebPageProxy* RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow()
     return nullptr;
 }
 
+void RemoteWebInspectorProxy::platformResetState() { }
 void RemoteWebInspectorProxy::platformBringToFront() { }
 void RemoteWebInspectorProxy::platformSave(const String&, const String&, bool, bool) { }
 void RemoteWebInspectorProxy::platformAppend(const String&, const String&) { }
index 5ebbb68..5802993 100644 (file)
@@ -107,6 +107,7 @@ private:
     // RemoteWebInspectorProxy messages.
     void frontendDidClose();
     void reopen();
+    void resetState();
     void bringToFront();
     void save(const String& filename, const String& content, bool base64Encoded, bool forceSaveAs);
     void append(const String& filename, const String& content);
@@ -122,6 +123,7 @@ private:
     // Platform implementations.
     WebPageProxy* platformCreateFrontendPageAndWindow();
     void platformCloseFrontendPageAndWindow();
+    void platformResetState();
     void platformBringToFront();
     void platformSave(const String& filename, const String& content, bool base64Encoded, bool forceSaveAs);
     void platformAppend(const String& filename, const String& content);
index b787235..be091b7 100644 (file)
@@ -23,6 +23,7 @@
 messages -> RemoteWebInspectorProxy {
     FrontendDidClose()
     Reopen()
+    ResetState()
     BringToFront()
 
     Save(String filename, String content, bool base64Encoded, bool forceSaveAs)
index 12bb261..6bbf85b 100644 (file)
@@ -182,6 +182,17 @@ void WebInspectorProxy::reopen()
     show();
 }
 
+void WebInspectorProxy::resetState()
+{
+    inspectorPagePreferences().deleteInspectorAttachedHeight();
+    inspectorPagePreferences().deleteInspectorAttachedWidth();
+    inspectorPagePreferences().deleteInspectorAttachmentSide();
+    inspectorPagePreferences().deleteInspectorStartsAttached();
+    inspectorPagePreferences().deleteInspectorWindowFrame();
+
+    platformResetState();
+}
+
 void WebInspectorProxy::reset()
 {
     if (m_inspectedPage) {
@@ -626,6 +637,11 @@ void WebInspectorProxy::platformInvalidate()
     notImplemented();
 }
 
+void WebInspectorProxy::platformResetState()
+{
+    notImplemented();
+}
+
 void WebInspectorProxy::platformBringToFront()
 {
     notImplemented();
index 6aaeb81..8be27d4 100644 (file)
@@ -101,6 +101,7 @@ public:
     void close();
     void closeForCrash();
     void reopen();
+    void resetState();
 
     void reset();
     void updateForNewPageProcess(WebPageProxy*);
@@ -189,6 +190,7 @@ private:
 
     void platformDidCloseForCrash();
     void platformInvalidate();
+    void platformResetState();
     void platformBringToFront();
     void platformBringInspectedPageToFront();
     void platformHide();
index 1284bd4..7d4a99d 100644 (file)
@@ -30,6 +30,7 @@ messages -> WebInspectorProxy {
     DidClose()
     BringToFront()
     Reopen()
+    ResetState()
 
     InspectedURLChanged(String urlString)
     ShowCertificate(WebCore::CertificateInfo certificateInfo)
index 7002db2..aa1a217 100644 (file)
@@ -178,6 +178,13 @@ void WebPreferences::updateFloatValueForKey(const String& key, float value)
     update(); // FIXME: Only send over the changed key and value.
 }
 
+void WebPreferences::deleteKey(const String& key)
+{
+    m_store.deleteKey(key);
+    platformDeleteKey(key);
+    update(); // FIXME: Only send over the changed key and value.
+}
+
 void WebPreferences::updatePrivateBrowsingValue(bool value)
 {
     platformUpdateBoolValueForKey(WebPreferencesKey::privateBrowsingEnabledKey(), value);
@@ -208,7 +215,11 @@ void WebPreferences::updatePrivateBrowsingValue(bool value)
         if (!m_store.set##TypeName##ValueForKey(WebPreferencesKey::KeyLower##Key(), value)) \
             return; \
         update##TypeName##ValueForKey(WebPreferencesKey::KeyLower##Key(), value); \
-        \
+    } \
+    \
+    void WebPreferences::delete##KeyUpper() \
+    { \
+        deleteKey(WebPreferencesKey::KeyLower##Key()); \
     } \
     \
     Type WebPreferences::KeyLower() const \
index 317f740..12061f6 100644 (file)
@@ -35,6 +35,7 @@
 
 #define DECLARE_PREFERENCE_GETTER_AND_SETTERS(KeyUpper, KeyLower, TypeName, Type, DefaultValue, HumanReadableName, HumanReadableDescription) \
     void set##KeyUpper(const Type& value); \
+    void delete##KeyUpper(); \
     Type KeyLower() const;
 
 namespace WebKit {
@@ -98,6 +99,9 @@ private:
     void platformUpdateDoubleValueForKey(const String& key, double value);
     void platformUpdateFloatValueForKey(const String& key, float value);
 
+    void deleteKey(const String& key);
+    void platformDeleteKey(const String& key);
+
     void updatePrivateBrowsingValue(bool value);
 
     void registerDefaultBoolValueForKey(const String&, bool);
index c1ac043..796655c 100644 (file)
@@ -89,6 +89,10 @@ void RemoteWebInspectorProxy::platformCloseFrontendPageAndWindow()
         gtk_widget_destroy(m_window);
 }
 
+void RemoteWebInspectorProxy::platformResetState()
+{
+}
+
 void RemoteWebInspectorProxy::platformBringToFront()
 {
     if (m_window)
index 28c2078..8527198 100644 (file)
@@ -302,6 +302,10 @@ void WebInspectorProxy::platformHide()
     notImplemented();
 }
 
+void WebInspectorProxy::platformResetState()
+{
+}
+
 void WebInspectorProxy::platformBringToFront()
 {
     if (m_isOpening)
index eca423b..9847f96 100644 (file)
@@ -65,6 +65,11 @@ void WebPreferences::platformUpdateFloatValueForKey(const String&, float)
     notImplemented();
 }
 
+void WebPreferences::platformDeleteKey(const String&)
+{
+    notImplemented();
+}
+
 bool WebPreferences::platformGetStringUserValueForKey(const String&, String&)
 {
     notImplemented();
index 760a1d0..349ced3 100644 (file)
@@ -123,6 +123,11 @@ void RemoteWebInspectorProxy::platformCloseFrontendPageAndWindow()
         m_objCAdapter = nil;
 }
 
+void RemoteWebInspectorProxy::platformResetState()
+{
+    [NSWindow removeFrameUsingName:[m_window frameAutosaveName]];
+}
+
 void RemoteWebInspectorProxy::platformBringToFront()
 {
     [m_window makeKeyAndOrderFront:nil];
index 007d87d..29c6140 100644 (file)
@@ -361,6 +361,11 @@ void WebInspectorProxy::platformHide()
     }
 }
 
+void WebInspectorProxy::platformResetState()
+{
+    inspectedPage()->pageGroup().preferences().deleteInspectorWindowFrame();
+}
+
 void WebInspectorProxy::platformBringToFront()
 {
     // If the Web Inspector is no longer in the same window as the inspected view,
index abe295c..ab4ad00 100644 (file)
@@ -198,4 +198,12 @@ void WebPreferences::platformUpdateFloatValueForKey(const String& key, float val
     [[NSUserDefaults standardUserDefaults] setFloat:value forKey:makeKey(m_identifier, m_keyPrefix, key)];
 }
 
+void WebPreferences::platformDeleteKey(const String& key)
+{
+    if (!m_identifier)
+        return;
+
+    [[NSUserDefaults standardUserDefaults] removeObjectForKey:makeKey(m_identifier, m_keyPrefix, key)];
+}
+
 } // namespace WebKit
index 0da1e53..390c2b9 100644 (file)
@@ -129,6 +129,7 @@ WebPageProxy* RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow()
     return m_webView->page();
 }
 
+void RemoteWebInspectorProxy::platformResetState() { }
 void RemoteWebInspectorProxy::platformBringToFront() { }
 void RemoteWebInspectorProxy::platformSave(const String&, const String&, bool, bool) { }
 void RemoteWebInspectorProxy::platformAppend(const String&, const String&) { }
index a7fcce1..4e30ef4 100644 (file)
@@ -374,6 +374,11 @@ void WebInspectorProxy::platformHide()
     notImplemented();
 }
 
+void WebInspectorProxy::platformResetState()
+{
+    notImplemented();
+}
+
 void WebInspectorProxy::platformBringToFront()
 {
     notImplemented();
index a20c4db..2d2bf42 100644 (file)
@@ -61,6 +61,11 @@ void WebPreferences::platformUpdateFloatValueForKey(const String&, float)
     notImplemented();
 }
 
+void WebPreferences::platformDeleteKey(const String&)
+{
+    notImplemented();
+}
+
 bool WebPreferences::platformGetStringUserValueForKey(const String&, String&)
 {
     notImplemented();
index 552771b..f33e3b4 100644 (file)
@@ -65,6 +65,11 @@ void WebInspectorProxy::platformHide()
     notImplemented();
 }
 
+void WebInspectorProxy::platformResetState()
+{
+    notImplemented();
+}
+
 void WebInspectorProxy::platformBringToFront()
 {
     notImplemented();
index ff81fcd..48f2b25 100644 (file)
@@ -60,6 +60,11 @@ void WebPreferences::platformUpdateFloatValueForKey(const String&, float)
     notImplemented();
 }
 
+void WebPreferences::platformDeleteKey(const String&)
+{
+    notImplemented();
+}
+
 bool WebPreferences::platformGetStringUserValueForKey(const String&, String&)
 {
     notImplemented();
index 0544045..d4b8b00 100644 (file)
@@ -139,6 +139,11 @@ void RemoteWebInspectorUI::reopen()
     WebProcess::singleton().parentProcessConnection()->send(Messages::RemoteWebInspectorProxy::Reopen(), m_page.pageID());
 }
 
+void RemoteWebInspectorUI::resetState()
+{
+    WebProcess::singleton().parentProcessConnection()->send(Messages::RemoteWebInspectorProxy::ResetState(), m_page.pageID());
+}
+
 void RemoteWebInspectorUI::openInNewTab(const String& url)
 {
     WebProcess::singleton().parentProcessConnection()->send(Messages::RemoteWebInspectorProxy::OpenInNewTab(url), m_page.pageID());
index 6213110..2552996 100644 (file)
@@ -70,6 +70,7 @@ public:
     void bringToFront() override;
     void closeWindow() override;
     void reopen() override;
+    void resetState() override;
 
     void openInNewTab(const String& url) override;
     void save(const String& url, const String& content, bool base64Encoded, bool forceSaveAs) override;
index bcff8e2..6e242d9 100644 (file)
@@ -176,6 +176,11 @@ void WebInspectorUI::reopen()
     WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::Reopen(), m_inspectedPageIdentifier);
 }
 
+void WebInspectorUI::resetState()
+{
+    WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::ResetState(), m_inspectedPageIdentifier);
+}
+
 WebCore::UserInterfaceLayoutDirection WebInspectorUI::userInterfaceLayoutDirection() const
 {
     return m_page.corePage()->userInterfaceLayoutDirection();
index 9424bfe..8beb13f 100644 (file)
@@ -96,6 +96,7 @@ public:
     void bringToFront() override;
     void closeWindow() override;
     void reopen() override;
+    void resetState() override;
 
     WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() const override;
 
index 92a1f05..d2e8cb2 100644 (file)
@@ -1,3 +1,16 @@
+2019-07-02  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: Debug: "Reset Web Inspector" should also clear the saved window size and attachment side
+        https://bugs.webkit.org/show_bug.cgi?id=198956
+
+        Reviewed by Matt Baker.
+
+        * WebCoreSupport/WebInspectorClientCF.cpp:
+        (deleteSetting): Added.
+        (WebInspectorClient::deleteInspectorStartsAttached): Added.
+        (WebInspectorClient::deleteInspectorAttachDisabled): Added.
+        (WebInspectorClient::createFrontendSettings):
+
 2018-01-30  Don Olmstead  <don.olmstead@sony.com>
 
         JSExports.h should be included as <JavaScriptCore/JSExportMacros.h>
index 515bb9b..20cfe39 100644 (file)
@@ -89,6 +89,11 @@ static void storeSetting(const String& key, const String& setting)
     CFPreferencesSetAppValue(createKeyForPreferences(key).get(), setting.createCFString().get(), kCFPreferencesCurrentApplication);
 }
 
+static void deleteSetting(const String& key)
+{
+    CFPreferencesSetAppValue(createKeyForPreferences(key).get(), nullptr, kCFPreferencesCurrentApplication);
+}
+
 void WebInspectorClient::sendMessageToFrontend(const String& message)
 {
     doDispatchMessageOnFrontendPage(m_frontendPage, message);
@@ -108,6 +113,11 @@ void WebInspectorClient::setInspectorAttachDisabled(bool disabled)
     storeSetting(inspectorAttachDisabledSetting, disabled ? "true" : "false");
 }
 
+void WebInspectorClient::deleteInspectorStartsAttached()
+{
+    deleteSetting(inspectorAttachDisabledSetting);
+}
+
 bool WebInspectorClient::inspectorStartsAttached()
 {
     String value;
@@ -122,6 +132,11 @@ void WebInspectorClient::setInspectorStartsAttached(bool attached)
     storeSetting(inspectorStartsAttachedSetting, attached ? "true" : "false");
 }
 
+void WebInspectorClient::deleteInspectorAttachDisabled()
+{
+    deleteSetting(inspectorStartsAttachedSetting);
+}
+
 std::unique_ptr<WebCore::InspectorFrontendClientLocal::Settings> WebInspectorClient::createFrontendSettings()
 {
     class InspectorFrontendSettingsCF : public WebCore::InspectorFrontendClientLocal::Settings {
@@ -138,6 +153,11 @@ std::unique_ptr<WebCore::InspectorFrontendClientLocal::Settings> WebInspectorCli
         {
             storeSetting(name, value);
         }
+
+        virtual void deleteProperty(const String& name)
+        {
+            deleteSetting(name);
+        }
     };
     return std::make_unique<InspectorFrontendSettingsCF>();
 }
index 61f0904..f952e63 100644 (file)
@@ -1,3 +1,13 @@
+2019-07-02  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: Debug: "Reset Web Inspector" should also clear the saved window size and attachment side
+        https://bugs.webkit.org/show_bug.cgi?id=198956
+
+        Reviewed by Matt Baker.
+
+        * WebCoreSupport/WebInspectorClientIOS.mm:
+        (WebInspectorFrontendClient::resetWindowState): Added.
+
 2019-06-27  Beth Dakin  <bdakin@apple.com>
 
         Upstream use of MACCATALYST
index 0716980..5296f12 100644 (file)
@@ -127,6 +127,7 @@ String WebInspectorFrontendClient::localizedStringsURL() { return String(); }
 void WebInspectorFrontendClient::bringToFront() { }
 void WebInspectorFrontendClient::closeWindow() { }
 void WebInspectorFrontendClient::reopen() { }
+void WebInspectorFrontendClient::resetState() { }
 void WebInspectorFrontendClient::attachWindow(DockSide) { }
 void WebInspectorFrontendClient::detachWindow() { }
 void WebInspectorFrontendClient::setAttachedWindowHeight(unsigned) { }
index c2c0d11..f1dd4a1 100644 (file)
@@ -1,3 +1,14 @@
+2019-07-02  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: Debug: "Reset Web Inspector" should also clear the saved window size and attachment side
+        https://bugs.webkit.org/show_bug.cgi?id=198956
+
+        Reviewed by Matt Baker.
+
+        * WebCoreSupport/WebInspectorClient.h:
+        * WebCoreSupport/WebInspectorClient.mm:
+        (WebInspectorFrontendClient::resetWindowState): Added.
+
 2019-06-28  Timothy Hatcher  <timothy@apple.com>
 
         Rename effectiveAppearanceIsInactive and useInactiveAppearance to better match UIUserInterfaceLevel.
index 4a25a6c..bd7f62f 100644 (file)
@@ -83,9 +83,11 @@ public:
 
     bool inspectorStartsAttached();
     void setInspectorStartsAttached(bool);
+    void deleteInspectorStartsAttached();
 
     bool inspectorAttachDisabled();
     void setInspectorAttachDisabled(bool);
+    void deleteInspectorAttachDisabled();
 
     void windowFullScreenDidChange();
 
@@ -119,6 +121,7 @@ public:
     void bringToFront() override;
     void closeWindow() override;
     void reopen() override;
+    void resetState() override;
 
     void attachWindow(DockSide) override;
     void detachWindow() override;
index 1b903af..1c00809 100644 (file)
@@ -256,6 +256,17 @@ void WebInspectorFrontendClient::reopen()
     [inspector show:nil];
 }
 
+void WebInspectorFrontendClient::resetState()
+{
+    InspectorFrontendClientLocal::resetState();
+
+    auto* inspectorClient = [m_frontendWindowController inspectorClient];
+    inspectorClient->deleteInspectorStartsAttached();
+    inspectorClient->deleteInspectorAttachDisabled();
+
+    [NSWindow removeFrameUsingName:[[m_frontendWindowController window] frameAutosaveName]];
+}
+
 void WebInspectorFrontendClient::attachWindow(DockSide)
 {
     if ([m_frontendWindowController.get() attached])
index bacc0d4..a3b003c 100644 (file)
@@ -1,3 +1,14 @@
+2019-07-02  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: Debug: "Reset Web Inspector" should also clear the saved window size and attachment side
+        https://bugs.webkit.org/show_bug.cgi?id=198956
+
+        Reviewed by Matt Baker.
+
+        * WebCoreSupport/WebInspectorClient.h:
+        * WebCoreSupport/WebInspectorClient.cpp:
+        (WebInspectorFrontendClient::resetWindowState): Added.
+
 2019-06-30  Fujii Hironori  <Hironori.Fujii@sony.com>
 
         [Win] Multiline mode of tooltip control does word-wrapping very slowly
index a0d769d..e4dc75e 100644 (file)
@@ -278,6 +278,14 @@ void WebInspectorFrontendClient::reopen()
         inspectedPage->inspectorController().show();
 }
 
+void WebInspectorFrontendClient::resetState()
+{
+    InspectorFrontendClientLocal::resetState();
+
+    m_inspectorClient->deleteInspectorStartsAttached();
+    m_inspectorClient->deleteInspectorAttachDisabled();
+}
+
 void WebInspectorFrontendClient::attachWindow(DockSide)
 {
     if (m_attached)
index 1733a72..95c9afa 100644 (file)
@@ -68,9 +68,11 @@ public:
 
     bool inspectorStartsAttached();
     void setInspectorStartsAttached(bool);
+    void deleteInspectorStartsAttached();
 
     bool inspectorAttachDisabled();
     void setInspectorAttachDisabled(bool);
+    void deleteInspectorAttachDisabled();
 
     void releaseFrontend();
 
@@ -104,6 +106,7 @@ public:
     void bringToFront() override;
     void closeWindow() override;
     void reopen() override;
+    void resetState() override;
 
     void setAttachedWindowHeight(unsigned) override;
     void setAttachedWindowWidth(unsigned) override;