Web Inspector: find dialog does not populate search string from system find pasteboard
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Apr 2020 21:43:13 +0000 (21:43 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Apr 2020 21:43:13 +0000 (21:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=113588
<rdar://problem/19281466>

Reviewed by Brian Burg.

Source/WebInspectorUI:

* UserInterface/Protocol/InspectorFrontendAPI.js:
(InspectorFrontendAPI.updateFindString): Added.
* UserInterface/Base/Main.js:
(WI.contentLoaded):
(WI.updateFindString): Added.
(WI._populateFind):
(WI._findNext):
(WI._findPrevious):
* UserInterface/Views/ContentBrowser.js:
(WI.ContentBrowser.prototype.handleFindStringUpdated): Added.
(WI.ContentBrowser.prototype.handlePopulateFindShortcut):
(WI.ContentBrowser.prototype.handleFindNextShortcut):
(WI.ContentBrowser.prototype.handleFindPreviousShortcut):
* UserInterface/Views/LogContentView.js:
(WI.LogContentView.prototype.handleFindStringUpdated): Added.
(WI.LogContentView.prototype.handlePopulateFindShortcut):
(WI.LogContentView.prototype.handleFindNextShortcut):
(WI.LogContentView.prototype.handleFindPreviousShortcut):
When the find string gets updated, tell the active view. The `findNextKeyboardShortcut` and
`findPreviousKeyboardShortcut` will also update the related `WI.FindBanner` when invoked if
the current search query does not match the find string.

* UserInterface/Test/Test.js:
(WI.updateFindString): Added.

Source/WebKit:

* UIProcess/Inspector/mac/WKInspectorWKWebView.h:
* UIProcess/Inspector/mac/WKInspectorWKWebView.mm:
(-[WKInspectorWKWebView dealloc]): Added.
(-[WKInspectorWKWebView setInspectorWKWebViewDelegate:]):
(-[WKInspectorWKWebView becomeFirstResponder]): Added.
(-[WKInspectorWKWebView _handleWindowDidBecomeKey:]): Added.
* UIProcess/Inspector/mac/WKInspectorViewController.h:
* UIProcess/Inspector/mac/WKInspectorViewController.mm:
(-[WKInspectorViewController inspectorWKWebViewDidBecomeActive:]): Added.
* UIProcess/Inspector/WebInspectorProxy.h:
* UIProcess/Inspector/mac/WebInspectorProxyMac.mm:
(-[WKWebInspectorProxyObjCAdapter inspectorViewControllerDidBecomeActive:]): Added.
(WebKit::WebInspectorProxy::didBecomeActive): Added.
* UIProcess/Inspector/RemoteWebInspectorProxy.h:
* UIProcess/Inspector/mac/RemoteWebInspectorProxyMac.mm:
(-[WKRemoteWebInspectorProxyObjCAdapter inspectorWKWebViewDidBecomeActive:]): Added.
(WebKit::RemoteWebInspectorProxy::didBecomeActive): Added.
Add a new delegate call chain that notifies the inspector proxy about when the inspector web
view becomes active, at which point the inspector proxy can get the current find string and
sent it to the inspector page.

* WebProcess/Inspector/WebInspectorUI.messages.in:
* WebProcess/Inspector/WebInspectorUI.h:
* WebProcess/Inspector/WebInspectorUI.cpp:
(WebKit::WebInspectorUI::updateFindString): Added.
* WebProcess/Inspector/RemoteWebInspectorUI.messages.in:
* WebProcess/Inspector/RemoteWebInspectorUI.h:
* WebProcess/Inspector/RemoteWebInspectorUI.cpp:
(WebKit::RemoteWebInspectorUI::updateFindString): Added.
Pass along the new find string to the frontend via `InspectorFrontendAPI.updateFindString`.

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

21 files changed:
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Base/Main.js
Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js
Source/WebInspectorUI/UserInterface/Test/Test.js
Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js
Source/WebInspectorUI/UserInterface/Views/LogContentView.js
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/Inspector/RemoteWebInspectorProxy.h
Source/WebKit/UIProcess/Inspector/WebInspectorProxy.h
Source/WebKit/UIProcess/Inspector/mac/RemoteWebInspectorProxyMac.mm
Source/WebKit/UIProcess/Inspector/mac/WKInspectorViewController.h
Source/WebKit/UIProcess/Inspector/mac/WKInspectorViewController.mm
Source/WebKit/UIProcess/Inspector/mac/WKInspectorWKWebView.h
Source/WebKit/UIProcess/Inspector/mac/WKInspectorWKWebView.mm
Source/WebKit/UIProcess/Inspector/mac/WebInspectorProxyMac.mm
Source/WebKit/WebProcess/Inspector/RemoteWebInspectorUI.cpp
Source/WebKit/WebProcess/Inspector/RemoteWebInspectorUI.h
Source/WebKit/WebProcess/Inspector/RemoteWebInspectorUI.messages.in
Source/WebKit/WebProcess/Inspector/WebInspectorUI.cpp
Source/WebKit/WebProcess/Inspector/WebInspectorUI.h
Source/WebKit/WebProcess/Inspector/WebInspectorUI.messages.in

index cc32c93..f5ca40a 100644 (file)
@@ -1,3 +1,36 @@
+2020-04-28  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: find dialog does not populate search string from system find pasteboard
+        https://bugs.webkit.org/show_bug.cgi?id=113588
+        <rdar://problem/19281466>
+
+        Reviewed by Brian Burg.
+
+        * UserInterface/Protocol/InspectorFrontendAPI.js:
+        (InspectorFrontendAPI.updateFindString): Added.
+        * UserInterface/Base/Main.js:
+        (WI.contentLoaded):
+        (WI.updateFindString): Added.
+        (WI._populateFind):
+        (WI._findNext):
+        (WI._findPrevious):
+        * UserInterface/Views/ContentBrowser.js:
+        (WI.ContentBrowser.prototype.handleFindStringUpdated): Added.
+        (WI.ContentBrowser.prototype.handlePopulateFindShortcut):
+        (WI.ContentBrowser.prototype.handleFindNextShortcut):
+        (WI.ContentBrowser.prototype.handleFindPreviousShortcut):
+        * UserInterface/Views/LogContentView.js:
+        (WI.LogContentView.prototype.handleFindStringUpdated): Added.
+        (WI.LogContentView.prototype.handlePopulateFindShortcut):
+        (WI.LogContentView.prototype.handleFindNextShortcut):
+        (WI.LogContentView.prototype.handleFindPreviousShortcut):
+        When the find string gets updated, tell the active view. The `findNextKeyboardShortcut` and
+        `findPreviousKeyboardShortcut` will also update the related `WI.FindBanner` when invoked if
+        the current search query does not match the find string.
+
+        * UserInterface/Test/Test.js:
+        (WI.updateFindString): Added.
+
 2020-04-28  Christopher Reid  <chris.reid@sony.com>
 
         [Win] Bundle Inspector Resources in Release builds
index 9120c07..0649756 100644 (file)
@@ -290,7 +290,7 @@ WI.contentLoaded = function()
 
     WI.clearKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "K", WI._clear);
 
-    // FIXME: <https://webkit.org/b/151310> Web Inspector: Command-E should propagate to other search fields (including the system)
+    WI.findString = "";
     WI.populateFindKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "E", WI._populateFind);
     WI.populateFindKeyboardShortcut.implicitlyPreventsDefault = false;
     WI.findNextKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "G", WI._findNext);
@@ -1045,6 +1045,26 @@ WI.updateVisibilityState = function(visible)
     WI.notifications.dispatchEventToListeners(WI.Notification.VisibilityStateDidChange);
 };
 
+WI.updateFindString = function(findString)
+{
+    if (WI.findString === findString)
+        return;
+
+    WI.findString = findString;
+
+    let focusedContentView = WI._focusedContentView();
+    if (focusedContentView && focusedContentView.supportsCustomFindBanner) {
+        focusedContentView.handleFindStringUpdated();
+        return;
+    }
+
+    let contentBrowser = WI._focusedOrVisibleContentBrowser();
+    if (contentBrowser) {
+        contentBrowser.handleFindStringUpdated();
+        return;
+    }
+};
+
 WI.handlePossibleLinkClick = function(event, frame, options = {})
 {
     let anchorElement = event.target.closest("a");
@@ -2610,55 +2630,52 @@ WI._clear = function(event)
 WI._populateFind = function(event)
 {
     let focusedContentView = WI._focusedContentView();
-    if (!focusedContentView)
-        return;
-
-    if (focusedContentView.supportsCustomFindBanner) {
-        focusedContentView.handlePopulateFindShortcut();
+    if (focusedContentView && focusedContentView.supportsCustomFindBanner) {
+        let string = focusedContentView.handlePopulateFindShortcut();
+        if (string)
+            WI.findString = string;
+        focusedContentView.handleFindStringUpdated();
         return;
     }
 
     let contentBrowser = WI._focusedOrVisibleContentBrowser();
-    if (!contentBrowser)
+    if (contentBrowser) {
+        let string = contentBrowser.handlePopulateFindShortcut();
+        if (string)
+            WI.findString = string;
+        contentBrowser.handleFindStringUpdated();
         return;
-
-    contentBrowser.handlePopulateFindShortcut();
+    }
 };
 
 WI._findNext = function(event)
 {
     let focusedContentView = WI._focusedContentView();
-    if (!focusedContentView)
-        return;
-
-    if (focusedContentView.supportsCustomFindBanner) {
+    if (focusedContentView?.supportsCustomFindBanner) {
         focusedContentView.handleFindNextShortcut();
         return;
     }
 
     let contentBrowser = WI._focusedOrVisibleContentBrowser();
-    if (!contentBrowser)
+    if (contentBrowser) {
+        contentBrowser.handleFindNextShortcut();
         return;
-
-    contentBrowser.handleFindNextShortcut();
+    }
 };
 
 WI._findPrevious = function(event)
 {
     let focusedContentView = WI._focusedContentView();
-    if (!focusedContentView)
-        return;
-
-    if (focusedContentView.supportsCustomFindBanner) {
+    if (focusedContentView?.supportsCustomFindBanner) {
         focusedContentView.handleFindPreviousShortcut();
         return;
     }
 
     let contentBrowser = WI._focusedOrVisibleContentBrowser();
-    if (!contentBrowser)
+    if (contentBrowser) {
+        contentBrowser.handleFindPreviousShortcut();
         return;
-
-    contentBrowser.handleFindPreviousShortcut();
+    }
 };
 
 WI._copy = function(event)
index d2dbe1d..a34b107 100644 (file)
@@ -91,6 +91,11 @@ InspectorFrontendAPI = {
         WI.updateVisibilityState(visible);
     },
 
+    updateFindString: function(findString)
+    {
+        WI.updateFindString(findString);
+    },
+
     setDiagnosticLoggingAvailable: function(available)
     {
         if (WI.diagnosticController)
index 6e05d92..d3f2d57 100644 (file)
@@ -177,6 +177,7 @@ WI.resolvedLayoutDirection = () => { return InspectorFrontendHost.userInterfaceL
 WI.updateDockedState = () => {};
 WI.updateDockingAvailability = () => {};
 WI.updateVisibilityState = () => {};
+WI.updateFindString = () => {};
 
 // FIXME: <https://webkit.org/b/201149> Web Inspector: replace all uses of `window.*Agent` with a target-specific call
 (function() {
index 2a2867a..75d978d 100644 (file)
@@ -246,28 +246,53 @@ WI.ContentBrowser = class ContentBrowser extends WI.View
 
     // Global ContentBrowser KeyboardShortcut handlers
 
-    handlePopulateFindShortcut()
+    handleFindStringUpdated()
     {
-        let currentContentView = this.currentContentView;
-        if (!currentContentView || !currentContentView.supportsSearch)
-            return;
-
-        let searchQuery = currentContentView.searchQueryWithSelection();
-        if (!searchQuery)
-            return;
+        this._findBanner.searchQuery = WI.findString;
 
-        this._findBanner.searchQuery = searchQuery;
+        let currentContentView = this.currentContentView;
+        if (currentContentView?.supportsSearch)
+            currentContentView.performSearch(this._findBanner.searchQuery);
+    }
 
-        currentContentView.performSearch(this._findBanner.searchQuery);
+    handlePopulateFindShortcut()
+    {
+        return this.currentContentView?.searchQueryWithSelection();
     }
 
-    handleFindNextShortcut()
+    async handleFindNextShortcut()
     {
+        if (this._findBanner.searchQuery !== WI.findString) {
+            let searchQuery = WI.findString;
+            this._findBanner.searchQuery = searchQuery;
+
+            let currentContentView = this.currentContentView;
+            if (currentContentView?.supportsSearch) {
+                currentContentView.performSearch(this._findBanner.searchQuery);
+                await currentContentView.awaitEvent(WI.ContentView.Event.NumberOfSearchResultsDidChange);
+                if (this._findBanner.searchQuery !== searchQuery || this.currentContentView !== currentContentView)
+                    return;
+            }
+        }
+
         this.findBannerRevealNextResult(this._findBanner);
     }
 
-    handleFindPreviousShortcut()
+    async handleFindPreviousShortcut()
     {
+        if (this._findBanner.searchQuery !== WI.findString) {
+            let searchQuery = WI.findString;
+            this._findBanner.searchQuery = searchQuery;
+
+            let currentContentView = this.currentContentView;
+            if (currentContentView?.supportsSearch) {
+                currentContentView.performSearch(this._findBanner.searchQuery);
+                await currentContentView.awaitEvent(WI.ContentView.Event.NumberOfSearchResultsDidChange);
+                if (this._findBanner.searchQuery !== searchQuery || this.currentContentView !== currentContentView)
+                    return;
+            }
+        }
+
         this.findBannerRevealPreviousResult(this._findBanner);
     }
 
index 622ed80..152b8a1 100644 (file)
@@ -296,24 +296,31 @@ WI.LogContentView = class LogContentView extends WI.ContentView
         this._logViewController.requestClearMessages();
     }
 
-    handlePopulateFindShortcut()
+    handleFindStringUpdated()
     {
-        let searchQuery = this.searchQueryWithSelection();
-        if (!searchQuery)
-            return;
-
-        this._findBanner.searchQuery = searchQuery;
+        this._findBanner.searchQuery = WI.findString;
 
         this.performSearch(this._findBanner.searchQuery);
     }
 
+    handlePopulateFindShortcut()
+    {
+        return this.searchQueryWithSelection();
+    }
+
     handleFindNextShortcut()
     {
+        if (this._findBanner.searchQuery !== WI.findString)
+            this.handleFindStringUpdated();
+
         this.findBannerRevealNextResult(this._findBanner);
     }
 
     handleFindPreviousShortcut()
     {
+        if (this._findBanner.searchQuery !== WI.findString)
+            this.handleFindStringUpdated();
+
         this.findBannerRevealPreviousResult(this._findBanner);
     }
 
index abff0de..3a7bf02 100644 (file)
@@ -1,3 +1,42 @@
+2020-04-28  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: find dialog does not populate search string from system find pasteboard
+        https://bugs.webkit.org/show_bug.cgi?id=113588
+        <rdar://problem/19281466>
+
+        Reviewed by Brian Burg.
+
+        * UIProcess/Inspector/mac/WKInspectorWKWebView.h:
+        * UIProcess/Inspector/mac/WKInspectorWKWebView.mm:
+        (-[WKInspectorWKWebView dealloc]): Added.
+        (-[WKInspectorWKWebView setInspectorWKWebViewDelegate:]):
+        (-[WKInspectorWKWebView becomeFirstResponder]): Added.
+        (-[WKInspectorWKWebView _handleWindowDidBecomeKey:]): Added.
+        * UIProcess/Inspector/mac/WKInspectorViewController.h:
+        * UIProcess/Inspector/mac/WKInspectorViewController.mm:
+        (-[WKInspectorViewController inspectorWKWebViewDidBecomeActive:]): Added.
+        * UIProcess/Inspector/WebInspectorProxy.h:
+        * UIProcess/Inspector/mac/WebInspectorProxyMac.mm:
+        (-[WKWebInspectorProxyObjCAdapter inspectorViewControllerDidBecomeActive:]): Added.
+        (WebKit::WebInspectorProxy::didBecomeActive): Added.
+        * UIProcess/Inspector/RemoteWebInspectorProxy.h:
+        * UIProcess/Inspector/mac/RemoteWebInspectorProxyMac.mm:
+        (-[WKRemoteWebInspectorProxyObjCAdapter inspectorWKWebViewDidBecomeActive:]): Added.
+        (WebKit::RemoteWebInspectorProxy::didBecomeActive): Added.
+        Add a new delegate call chain that notifies the inspector proxy about when the inspector web
+        view becomes active, at which point the inspector proxy can get the current find string and
+        sent it to the inspector page.
+
+        * WebProcess/Inspector/WebInspectorUI.messages.in:
+        * WebProcess/Inspector/WebInspectorUI.h:
+        * WebProcess/Inspector/WebInspectorUI.cpp:
+        (WebKit::WebInspectorUI::updateFindString): Added.
+        * WebProcess/Inspector/RemoteWebInspectorUI.messages.in:
+        * WebProcess/Inspector/RemoteWebInspectorUI.h:
+        * WebProcess/Inspector/RemoteWebInspectorUI.cpp:
+        (WebKit::RemoteWebInspectorUI::updateFindString): Added.
+        Pass along the new find string to the frontend via `InspectorFrontendAPI.updateFindString`.
+
 2020-04-28  Daniel Bates  <dabates@apple.com>
 
         Remove unused WebPage::focusTextInputContext()
index 2137575..d4b9787 100644 (file)
@@ -90,6 +90,8 @@ public:
     WKWebView *webView() const;
 
     const WebCore::FloatRect& sheetRect() const { return m_sheetRect; }
+
+    void didBecomeActive();
 #endif
 
 #if PLATFORM(GTK)
index 46e3424..eb0b81e 100644 (file)
@@ -113,6 +113,8 @@ public:
     enum class InspectionTargetType { Local, Remote };
     static RetainPtr<NSWindow> createFrontendWindow(NSRect savedWindowFrame, InspectionTargetType);
 
+    void didBecomeActive();
+
     void updateInspectorWindowTitle() const;
     void inspectedViewFrameDidChange(CGFloat = 0);
     void windowFrameDidChange();
index 514fd4a..f1b2b51 100644 (file)
@@ -28,6 +28,7 @@
 
 #if PLATFORM(MAC) && ENABLE(REMOTE_INSPECTOR)
 
+#import "GlobalFindInPageState.h"
 #import "RemoteWebInspectorProxyMessages.h"
 #import "RemoteWebInspectorUIMessages.h"
 #import "WKFrameInfo.h"
     return self;
 }
 
+- (void)inspectorWKWebViewDidBecomeActive:(WKInspectorViewController *)inspectorViewController
+{
+    _inspectorProxy->didBecomeActive();
+}
+
 - (void)inspectorViewControllerInspectorDidCrash:(WKInspectorViewController *)inspectorViewController
 {
     _inspectorProxy->closeFromCrash();
@@ -88,6 +94,11 @@ WKWebView *RemoteWebInspectorProxy::webView() const
     return m_inspectorView.get().webView;
 }
 
+void RemoteWebInspectorProxy::didBecomeActive()
+{
+    m_inspectorPage->send(Messages::RemoteWebInspectorUI::UpdateFindString(WebKit::stringForFind()));
+}
+
 WebPageProxy* RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow()
 {
     m_objCAdapter = adoptNS([[WKRemoteWebInspectorProxyObjCAdapter alloc] initWithRemoteWebInspectorProxy:this]);
index 70dce14..babd332 100644 (file)
@@ -51,6 +51,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 @protocol WKInspectorViewControllerDelegate <NSObject>
 @optional
+- (void)inspectorViewControllerDidBecomeActive:(WKInspectorViewController *)inspectorViewController;
 - (void)inspectorViewControllerInspectorDidCrash:(WKInspectorViewController *)inspectorViewController;
 - (BOOL)inspectorViewControllerInspectorIsUnderTest:(WKInspectorViewController *)inspectorViewController;
 - (void)inspectorViewController:(WKInspectorViewController *)inspectorViewController willMoveToWindow:(NSWindow *)newWindow;
index a61f1ed..f407ae1 100644 (file)
 
 // MARK: WKInspectorWKWebViewDelegate methods
 
+- (void)inspectorWKWebViewDidBecomeActive:(WKInspectorWKWebView *)webView
+{
+    if ([_delegate respondsToSelector:@selector(inspectorViewControllerDidBecomeActive:)])
+        [_delegate inspectorViewControllerDidBecomeActive:self];
+}
+
 - (void)inspectorWKWebViewReload:(WKInspectorWKWebView *)webView
 {
     if (!_inspectedPage)
index b2190b3..d74e7fe 100644 (file)
@@ -35,6 +35,7 @@
 
 @protocol WKInspectorWKWebViewDelegate
 @required
+- (void)inspectorWKWebViewDidBecomeActive:(WKInspectorWKWebView *)webView;
 - (void)inspectorWKWebViewReload:(WKInspectorWKWebView *)webView;
 - (void)inspectorWKWebViewReloadFromOrigin:(WKInspectorWKWebView *)webView;
 - (void)inspectorWKWebView:(WKInspectorWKWebView *)webView willMoveToWindow:(NSWindow *)newWindow;
index 4bfef4a..08d149e 100644 (file)
     WeakObjCPtr<id <WKInspectorWKWebViewDelegate>> _inspectorWKWebViewDelegate;
 }
 
+- (void)dealloc
+{
+    [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidBecomeKeyNotification object:nil];
+
+    [super dealloc];
+}
+
 - (NSRect)_opaqueRectForWindowMoveWhenInTitlebar
 {
     // This convinces AppKit to allow window moves when clicking anywhere in the titlebar (top 22pt)
 
 - (void)setInspectorWKWebViewDelegate:(id <WKInspectorWKWebViewDelegate>)delegate
 {
+    if (!!_inspectorWKWebViewDelegate)
+        [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidBecomeKeyNotification object:nil];
+
     _inspectorWKWebViewDelegate = delegate;
+
+    if (!!_inspectorWKWebViewDelegate)
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_handleWindowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:nil];
 }
 
 - (IBAction)reload:(id)sender
     [self.inspectorWKWebViewDelegate inspectorWKWebViewDidMoveToWindow:self];
 }
 
+- (BOOL)becomeFirstResponder
+{
+    BOOL result = [super becomeFirstResponder];
+    [self.inspectorWKWebViewDelegate inspectorWKWebViewDidBecomeActive:self];
+    return result;
+}
+
+- (void)_handleWindowDidBecomeKey:(NSNotification *)notification
+{
+    if (notification.object == self.window)
+        [self.inspectorWKWebViewDelegate inspectorWKWebViewDidBecomeActive:self];
+}
+
 @end
 
 #endif
index 6b31de5..b366393 100644 (file)
@@ -28,6 +28,7 @@
 
 #if PLATFORM(MAC)
 
+#import "GlobalFindInPageState.h"
 #import "WKInspectorPrivateMac.h"
 #import "WKInspectorViewController.h"
 #import "WKViewInternal.h"
@@ -163,6 +164,12 @@ static void* kWindowContentLayoutObserverContext = &kWindowContentLayoutObserver
 
 // MARK: WKInspectorViewControllerDelegate methods
 
+- (void)inspectorViewControllerDidBecomeActive:(WKInspectorViewController *)inspectorViewController
+{
+    if (_inspectorProxy)
+        _inspectorProxy->didBecomeActive();
+}
+
 - (void)inspectorViewControllerInspectorDidCrash:(WKInspectorViewController *)inspectorViewController
 {
     if (_inspectorProxy)
@@ -191,6 +198,11 @@ static void* kWindowContentLayoutObserverContext = &kWindowContentLayoutObserver
 namespace WebKit {
 using namespace WebCore;
 
+void WebInspectorProxy::didBecomeActive()
+{
+    m_inspectorPage->send(Messages::WebInspectorUI::UpdateFindString(WebKit::stringForFind()));
+}
+
 void WebInspectorProxy::attachmentViewDidChange(NSView *oldView, NSView *newView)
 {
     [[NSNotificationCenter defaultCenter] removeObserver:m_objCAdapter.get() name:NSViewFrameDidChangeNotification object:oldView];
index 5fcc9f8..ccdacca 100644 (file)
@@ -67,6 +67,11 @@ void RemoteWebInspectorUI::initialize(DebuggableInfoData&& debuggableInfo, const
     m_frontendAPIDispatcher.dispatchCommand("setDockingUnavailable"_s, true);
 }
 
+void RemoteWebInspectorUI::updateFindString(const String& findString)
+{
+    m_frontendAPIDispatcher.dispatchCommand("updateFindString"_s, findString);
+}
+
 void RemoteWebInspectorUI::didSave(const String& url)
 {
     m_frontendAPIDispatcher.dispatchCommand("savedURL"_s, url);
index 667a657..ca4af72 100644 (file)
@@ -50,6 +50,7 @@ public:
 
     // Called by RemoteWebInspectorUI messages
     void initialize(DebuggableInfoData&&, const String& backendCommandsURL);
+    void updateFindString(const String&);
     void didSave(const String& url);
     void didAppend(const String& url);
     void sendMessageToFrontend(const String&);
index 2bf7e4c..3e202c1 100644 (file)
@@ -23,6 +23,8 @@
 messages -> RemoteWebInspectorUI {
     Initialize(struct WebKit::DebuggableInfoData debuggableInfo, String backendCommandsURL)
 
+    UpdateFindString(String findString)
+
 #if ENABLE(INSPECTOR_TELEMETRY)
     SetDiagnosticLoggingAvailable(bool available)
 #endif
index c5c5b76..3b3ac9f 100644 (file)
@@ -269,6 +269,11 @@ void WebInspectorUI::setIsVisible(bool visible)
     m_frontendAPIDispatcher.dispatchCommand("setIsVisible"_s, visible);
 }
 
+void WebInspectorUI::updateFindString(const String& findString)
+{
+    m_frontendAPIDispatcher.dispatchCommand("updateFindString"_s, findString);
+}
+
 void WebInspectorUI::changeAttachedWindowHeight(unsigned height)
 {
     WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::SetAttachedWindowHeight(height), m_inspectedPageIdentifier);
index c6b8715..779027a 100644 (file)
@@ -79,6 +79,8 @@ public:
 
     void setIsVisible(bool);
 
+    void updateFindString(const String&);
+
     void didSave(const String& url);
     void didAppend(const String& url);
 
index 94f1385..88a20f8 100644 (file)
@@ -30,6 +30,7 @@ messages -> WebInspectorUI {
     Detached()
     SetDockingUnavailable(bool unavailable)
     SetIsVisible(bool visible)
+    UpdateFindString(String findString)
 
 #if ENABLE(INSPECTOR_TELEMETRY)
     SetDiagnosticLoggingAvailable(bool available)