Changeset 260847 in webkit
- Timestamp:
- Apr 28, 2020 2:43:13 PM (4 years ago)
- Location:
- trunk/Source
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r260844 r260847 1 2020-04-28 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: find dialog does not populate search string from system find pasteboard 4 https://bugs.webkit.org/show_bug.cgi?id=113588 5 <rdar://problem/19281466> 6 7 Reviewed by Brian Burg. 8 9 * UserInterface/Protocol/InspectorFrontendAPI.js: 10 (InspectorFrontendAPI.updateFindString): Added. 11 * UserInterface/Base/Main.js: 12 (WI.contentLoaded): 13 (WI.updateFindString): Added. 14 (WI._populateFind): 15 (WI._findNext): 16 (WI._findPrevious): 17 * UserInterface/Views/ContentBrowser.js: 18 (WI.ContentBrowser.prototype.handleFindStringUpdated): Added. 19 (WI.ContentBrowser.prototype.handlePopulateFindShortcut): 20 (WI.ContentBrowser.prototype.handleFindNextShortcut): 21 (WI.ContentBrowser.prototype.handleFindPreviousShortcut): 22 * UserInterface/Views/LogContentView.js: 23 (WI.LogContentView.prototype.handleFindStringUpdated): Added. 24 (WI.LogContentView.prototype.handlePopulateFindShortcut): 25 (WI.LogContentView.prototype.handleFindNextShortcut): 26 (WI.LogContentView.prototype.handleFindPreviousShortcut): 27 When the find string gets updated, tell the active view. The `findNextKeyboardShortcut` and 28 `findPreviousKeyboardShortcut` will also update the related `WI.FindBanner` when invoked if 29 the current search query does not match the find string. 30 31 * UserInterface/Test/Test.js: 32 (WI.updateFindString): Added. 33 1 34 2020-04-28 Christopher Reid <chris.reid@sony.com> 2 35 -
trunk/Source/WebInspectorUI/UserInterface/Base/Main.js
r260502 r260847 291 291 WI.clearKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "K", WI._clear); 292 292 293 // FIXME: <https://webkit.org/b/151310> Web Inspector: Command-E should propagate to other search fields (including the system)293 WI.findString = ""; 294 294 WI.populateFindKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "E", WI._populateFind); 295 295 WI.populateFindKeyboardShortcut.implicitlyPreventsDefault = false; … … 1044 1044 WI.visible = visible; 1045 1045 WI.notifications.dispatchEventToListeners(WI.Notification.VisibilityStateDidChange); 1046 }; 1047 1048 WI.updateFindString = function(findString) 1049 { 1050 if (WI.findString === findString) 1051 return; 1052 1053 WI.findString = findString; 1054 1055 let focusedContentView = WI._focusedContentView(); 1056 if (focusedContentView && focusedContentView.supportsCustomFindBanner) { 1057 focusedContentView.handleFindStringUpdated(); 1058 return; 1059 } 1060 1061 let contentBrowser = WI._focusedOrVisibleContentBrowser(); 1062 if (contentBrowser) { 1063 contentBrowser.handleFindStringUpdated(); 1064 return; 1065 } 1046 1066 }; 1047 1067 … … 2611 2631 { 2612 2632 let focusedContentView = WI._focusedContentView(); 2613 if ( !focusedContentView)2614 return;2615 2616 if (focusedContentView.supportsCustomFindBanner) {2617 focusedContentView.handle PopulateFindShortcut();2633 if (focusedContentView && focusedContentView.supportsCustomFindBanner) { 2634 let string = focusedContentView.handlePopulateFindShortcut(); 2635 if (string) 2636 WI.findString = string; 2637 focusedContentView.handleFindStringUpdated(); 2618 2638 return; 2619 2639 } 2620 2640 2621 2641 let contentBrowser = WI._focusedOrVisibleContentBrowser(); 2622 if (!contentBrowser) 2623 return; 2624 2625 contentBrowser.handlePopulateFindShortcut(); 2642 if (contentBrowser) { 2643 let string = contentBrowser.handlePopulateFindShortcut(); 2644 if (string) 2645 WI.findString = string; 2646 contentBrowser.handleFindStringUpdated(); 2647 return; 2648 } 2626 2649 }; 2627 2650 … … 2629 2652 { 2630 2653 let focusedContentView = WI._focusedContentView(); 2631 if (!focusedContentView) 2632 return; 2633 2634 if (focusedContentView.supportsCustomFindBanner) { 2654 if (focusedContentView?.supportsCustomFindBanner) { 2635 2655 focusedContentView.handleFindNextShortcut(); 2636 2656 return; … … 2638 2658 2639 2659 let contentBrowser = WI._focusedOrVisibleContentBrowser(); 2640 if ( !contentBrowser)2641 return;2642 2643 contentBrowser.handleFindNextShortcut();2660 if (contentBrowser) { 2661 contentBrowser.handleFindNextShortcut(); 2662 return; 2663 } 2644 2664 }; 2645 2665 … … 2647 2667 { 2648 2668 let focusedContentView = WI._focusedContentView(); 2649 if (!focusedContentView) 2650 return; 2651 2652 if (focusedContentView.supportsCustomFindBanner) { 2669 if (focusedContentView?.supportsCustomFindBanner) { 2653 2670 focusedContentView.handleFindPreviousShortcut(); 2654 2671 return; … … 2656 2673 2657 2674 let contentBrowser = WI._focusedOrVisibleContentBrowser(); 2658 if ( !contentBrowser)2659 return;2660 2661 contentBrowser.handleFindPreviousShortcut();2675 if (contentBrowser) { 2676 contentBrowser.handleFindPreviousShortcut(); 2677 return; 2678 } 2662 2679 }; 2663 2680 -
trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js
r253591 r260847 92 92 }, 93 93 94 updateFindString: function(findString) 95 { 96 WI.updateFindString(findString); 97 }, 98 94 99 setDiagnosticLoggingAvailable: function(available) 95 100 { -
trunk/Source/WebInspectorUI/UserInterface/Test/Test.js
r257410 r260847 178 178 WI.updateDockingAvailability = () => {}; 179 179 WI.updateVisibilityState = () => {}; 180 WI.updateFindString = () => {}; 180 181 181 182 // FIXME: <https://webkit.org/b/201149> Web Inspector: replace all uses of `window.*Agent` with a target-specific call -
trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js
r249301 r260847 247 247 // Global ContentBrowser KeyboardShortcut handlers 248 248 249 handleFindStringUpdated() 250 { 251 this._findBanner.searchQuery = WI.findString; 252 253 let currentContentView = this.currentContentView; 254 if (currentContentView?.supportsSearch) 255 currentContentView.performSearch(this._findBanner.searchQuery); 256 } 257 249 258 handlePopulateFindShortcut() 250 259 { 251 let currentContentView = this.currentContentView; 252 if (!currentContentView || !currentContentView.supportsSearch) 253 return; 254 255 let searchQuery = currentContentView.searchQueryWithSelection(); 256 if (!searchQuery) 257 return; 258 259 this._findBanner.searchQuery = searchQuery; 260 261 currentContentView.performSearch(this._findBanner.searchQuery); 262 } 263 264 handleFindNextShortcut() 265 { 260 return this.currentContentView?.searchQueryWithSelection(); 261 } 262 263 async handleFindNextShortcut() 264 { 265 if (this._findBanner.searchQuery !== WI.findString) { 266 let searchQuery = WI.findString; 267 this._findBanner.searchQuery = searchQuery; 268 269 let currentContentView = this.currentContentView; 270 if (currentContentView?.supportsSearch) { 271 currentContentView.performSearch(this._findBanner.searchQuery); 272 await currentContentView.awaitEvent(WI.ContentView.Event.NumberOfSearchResultsDidChange); 273 if (this._findBanner.searchQuery !== searchQuery || this.currentContentView !== currentContentView) 274 return; 275 } 276 } 277 266 278 this.findBannerRevealNextResult(this._findBanner); 267 279 } 268 280 269 handleFindPreviousShortcut() 270 { 281 async handleFindPreviousShortcut() 282 { 283 if (this._findBanner.searchQuery !== WI.findString) { 284 let searchQuery = WI.findString; 285 this._findBanner.searchQuery = searchQuery; 286 287 let currentContentView = this.currentContentView; 288 if (currentContentView?.supportsSearch) { 289 currentContentView.performSearch(this._findBanner.searchQuery); 290 await currentContentView.awaitEvent(WI.ContentView.Event.NumberOfSearchResultsDidChange); 291 if (this._findBanner.searchQuery !== searchQuery || this.currentContentView !== currentContentView) 292 return; 293 } 294 } 295 271 296 this.findBannerRevealPreviousResult(this._findBanner); 272 297 } -
trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js
r260589 r260847 297 297 } 298 298 299 handleFindStringUpdated() 300 { 301 this._findBanner.searchQuery = WI.findString; 302 303 this.performSearch(this._findBanner.searchQuery); 304 } 305 299 306 handlePopulateFindShortcut() 300 307 { 301 let searchQuery = this.searchQueryWithSelection(); 302 if (!searchQuery) 303 return; 304 305 this._findBanner.searchQuery = searchQuery; 306 307 this.performSearch(this._findBanner.searchQuery); 308 return this.searchQueryWithSelection(); 308 309 } 309 310 310 311 handleFindNextShortcut() 311 312 { 313 if (this._findBanner.searchQuery !== WI.findString) 314 this.handleFindStringUpdated(); 315 312 316 this.findBannerRevealNextResult(this._findBanner); 313 317 } … … 315 319 handleFindPreviousShortcut() 316 320 { 321 if (this._findBanner.searchQuery !== WI.findString) 322 this.handleFindStringUpdated(); 323 317 324 this.findBannerRevealPreviousResult(this._findBanner); 318 325 } -
trunk/Source/WebKit/ChangeLog
r260846 r260847 1 2020-04-28 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: find dialog does not populate search string from system find pasteboard 4 https://bugs.webkit.org/show_bug.cgi?id=113588 5 <rdar://problem/19281466> 6 7 Reviewed by Brian Burg. 8 9 * UIProcess/Inspector/mac/WKInspectorWKWebView.h: 10 * UIProcess/Inspector/mac/WKInspectorWKWebView.mm: 11 (-[WKInspectorWKWebView dealloc]): Added. 12 (-[WKInspectorWKWebView setInspectorWKWebViewDelegate:]): 13 (-[WKInspectorWKWebView becomeFirstResponder]): Added. 14 (-[WKInspectorWKWebView _handleWindowDidBecomeKey:]): Added. 15 * UIProcess/Inspector/mac/WKInspectorViewController.h: 16 * UIProcess/Inspector/mac/WKInspectorViewController.mm: 17 (-[WKInspectorViewController inspectorWKWebViewDidBecomeActive:]): Added. 18 * UIProcess/Inspector/WebInspectorProxy.h: 19 * UIProcess/Inspector/mac/WebInspectorProxyMac.mm: 20 (-[WKWebInspectorProxyObjCAdapter inspectorViewControllerDidBecomeActive:]): Added. 21 (WebKit::WebInspectorProxy::didBecomeActive): Added. 22 * UIProcess/Inspector/RemoteWebInspectorProxy.h: 23 * UIProcess/Inspector/mac/RemoteWebInspectorProxyMac.mm: 24 (-[WKRemoteWebInspectorProxyObjCAdapter inspectorWKWebViewDidBecomeActive:]): Added. 25 (WebKit::RemoteWebInspectorProxy::didBecomeActive): Added. 26 Add a new delegate call chain that notifies the inspector proxy about when the inspector web 27 view becomes active, at which point the inspector proxy can get the current find string and 28 sent it to the inspector page. 29 30 * WebProcess/Inspector/WebInspectorUI.messages.in: 31 * WebProcess/Inspector/WebInspectorUI.h: 32 * WebProcess/Inspector/WebInspectorUI.cpp: 33 (WebKit::WebInspectorUI::updateFindString): Added. 34 * WebProcess/Inspector/RemoteWebInspectorUI.messages.in: 35 * WebProcess/Inspector/RemoteWebInspectorUI.h: 36 * WebProcess/Inspector/RemoteWebInspectorUI.cpp: 37 (WebKit::RemoteWebInspectorUI::updateFindString): Added. 38 Pass along the new find string to the frontend via `InspectorFrontendAPI.updateFindString`. 39 1 40 2020-04-28 Daniel Bates <dabates@apple.com> 2 41 -
trunk/Source/WebKit/UIProcess/Inspector/RemoteWebInspectorProxy.h
r257835 r260847 91 91 92 92 const WebCore::FloatRect& sheetRect() const { return m_sheetRect; } 93 94 void didBecomeActive(); 93 95 #endif 94 96 -
trunk/Source/WebKit/UIProcess/Inspector/WebInspectorProxy.h
r259103 r260847 114 114 static RetainPtr<NSWindow> createFrontendWindow(NSRect savedWindowFrame, InspectionTargetType); 115 115 116 void didBecomeActive(); 117 116 118 void updateInspectorWindowTitle() const; 117 119 void inspectedViewFrameDidChange(CGFloat = 0); -
trunk/Source/WebKit/UIProcess/Inspector/mac/RemoteWebInspectorProxyMac.mm
r257835 r260847 29 29 #if PLATFORM(MAC) && ENABLE(REMOTE_INSPECTOR) 30 30 31 #import "GlobalFindInPageState.h" 31 32 #import "RemoteWebInspectorProxyMessages.h" 32 33 #import "RemoteWebInspectorUIMessages.h" … … 69 70 } 70 71 72 - (void)inspectorWKWebViewDidBecomeActive:(WKInspectorViewController *)inspectorViewController 73 { 74 _inspectorProxy->didBecomeActive(); 75 } 76 71 77 - (void)inspectorViewControllerInspectorDidCrash:(WKInspectorViewController *)inspectorViewController 72 78 { … … 87 93 { 88 94 return m_inspectorView.get().webView; 95 } 96 97 void RemoteWebInspectorProxy::didBecomeActive() 98 { 99 m_inspectorPage->send(Messages::RemoteWebInspectorUI::UpdateFindString(WebKit::stringForFind())); 89 100 } 90 101 -
trunk/Source/WebKit/UIProcess/Inspector/mac/WKInspectorViewController.h
r260366 r260847 52 52 @protocol WKInspectorViewControllerDelegate <NSObject> 53 53 @optional 54 - (void)inspectorViewControllerDidBecomeActive:(WKInspectorViewController *)inspectorViewController; 54 55 - (void)inspectorViewControllerInspectorDidCrash:(WKInspectorViewController *)inspectorViewController; 55 56 - (BOOL)inspectorViewControllerInspectorIsUnderTest:(WKInspectorViewController *)inspectorViewController; -
trunk/Source/WebKit/UIProcess/Inspector/mac/WKInspectorViewController.mm
r255961 r260847 236 236 // MARK: WKInspectorWKWebViewDelegate methods 237 237 238 - (void)inspectorWKWebViewDidBecomeActive:(WKInspectorWKWebView *)webView 239 { 240 if ([_delegate respondsToSelector:@selector(inspectorViewControllerDidBecomeActive:)]) 241 [_delegate inspectorViewControllerDidBecomeActive:self]; 242 } 243 238 244 - (void)inspectorWKWebViewReload:(WKInspectorWKWebView *)webView 239 245 { -
trunk/Source/WebKit/UIProcess/Inspector/mac/WKInspectorWKWebView.h
r260366 r260847 36 36 @protocol WKInspectorWKWebViewDelegate 37 37 @required 38 - (void)inspectorWKWebViewDidBecomeActive:(WKInspectorWKWebView *)webView; 38 39 - (void)inspectorWKWebViewReload:(WKInspectorWKWebView *)webView; 39 40 - (void)inspectorWKWebViewReloadFromOrigin:(WKInspectorWKWebView *)webView; -
trunk/Source/WebKit/UIProcess/Inspector/mac/WKInspectorWKWebView.mm
r255214 r260847 36 36 } 37 37 38 - (void)dealloc 39 { 40 [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidBecomeKeyNotification object:nil]; 41 42 [super dealloc]; 43 } 44 38 45 - (NSRect)_opaqueRectForWindowMoveWhenInTitlebar 39 46 { … … 55 62 - (void)setInspectorWKWebViewDelegate:(id <WKInspectorWKWebViewDelegate>)delegate 56 63 { 64 if (!!_inspectorWKWebViewDelegate) 65 [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidBecomeKeyNotification object:nil]; 66 57 67 _inspectorWKWebViewDelegate = delegate; 68 69 if (!!_inspectorWKWebViewDelegate) 70 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_handleWindowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:nil]; 58 71 } 59 72 … … 80 93 } 81 94 95 - (BOOL)becomeFirstResponder 96 { 97 BOOL result = [super becomeFirstResponder]; 98 [self.inspectorWKWebViewDelegate inspectorWKWebViewDidBecomeActive:self]; 99 return result; 100 } 101 102 - (void)_handleWindowDidBecomeKey:(NSNotification *)notification 103 { 104 if (notification.object == self.window) 105 [self.inspectorWKWebViewDelegate inspectorWKWebViewDidBecomeActive:self]; 106 } 107 82 108 @end 83 109 -
trunk/Source/WebKit/UIProcess/Inspector/mac/WebInspectorProxyMac.mm
r257835 r260847 29 29 #if PLATFORM(MAC) 30 30 31 #import "GlobalFindInPageState.h" 31 32 #import "WKInspectorPrivateMac.h" 32 33 #import "WKInspectorViewController.h" … … 164 165 // MARK: WKInspectorViewControllerDelegate methods 165 166 167 - (void)inspectorViewControllerDidBecomeActive:(WKInspectorViewController *)inspectorViewController 168 { 169 if (_inspectorProxy) 170 _inspectorProxy->didBecomeActive(); 171 } 172 166 173 - (void)inspectorViewControllerInspectorDidCrash:(WKInspectorViewController *)inspectorViewController 167 174 { … … 191 198 namespace WebKit { 192 199 using namespace WebCore; 200 201 void WebInspectorProxy::didBecomeActive() 202 { 203 m_inspectorPage->send(Messages::WebInspectorUI::UpdateFindString(WebKit::stringForFind())); 204 } 193 205 194 206 void WebInspectorProxy::attachmentViewDidChange(NSView *oldView, NSView *newView) -
trunk/Source/WebKit/WebProcess/Inspector/RemoteWebInspectorUI.cpp
r257835 r260847 68 68 } 69 69 70 void RemoteWebInspectorUI::updateFindString(const String& findString) 71 { 72 m_frontendAPIDispatcher.dispatchCommand("updateFindString"_s, findString); 73 } 74 70 75 void RemoteWebInspectorUI::didSave(const String& url) 71 76 { -
trunk/Source/WebKit/WebProcess/Inspector/RemoteWebInspectorUI.h
r257835 r260847 51 51 // Called by RemoteWebInspectorUI messages 52 52 void initialize(DebuggableInfoData&&, const String& backendCommandsURL); 53 void updateFindString(const String&); 53 54 void didSave(const String& url); 54 55 void didAppend(const String& url); -
trunk/Source/WebKit/WebProcess/Inspector/RemoteWebInspectorUI.messages.in
r255214 r260847 24 24 Initialize(struct WebKit::DebuggableInfoData debuggableInfo, String backendCommandsURL) 25 25 26 UpdateFindString(String findString) 27 26 28 #if ENABLE(INSPECTOR_TELEMETRY) 27 29 SetDiagnosticLoggingAvailable(bool available) -
trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUI.cpp
r257835 r260847 270 270 } 271 271 272 void WebInspectorUI::updateFindString(const String& findString) 273 { 274 m_frontendAPIDispatcher.dispatchCommand("updateFindString"_s, findString); 275 } 276 272 277 void WebInspectorUI::changeAttachedWindowHeight(unsigned height) 273 278 { -
trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUI.h
r257835 r260847 79 79 80 80 void setIsVisible(bool); 81 82 void updateFindString(const String&); 81 83 82 84 void didSave(const String& url); -
trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUI.messages.in
r255214 r260847 31 31 SetDockingUnavailable(bool unavailable) 32 32 SetIsVisible(bool visible) 33 UpdateFindString(String findString) 33 34 34 35 #if ENABLE(INSPECTOR_TELEMETRY)
Note: See TracChangeset
for help on using the changeset viewer.