Title: [260895] trunk/Source/WebInspectorUI
Revision
260895
Author
[email protected]
Date
2020-04-29 07:49:03 -0700 (Wed, 29 Apr 2020)

Log Message

Web Inspector: don't immediately attempt to perform a search whenever the find string changes
https://bugs.webkit.org/show_bug.cgi?id=211164

Reviewed by Timothy Hatcher.

* UserInterface/Base/Main.js:
(WI.updateFindString):
(WI._populateFind):
* UserInterface/Views/ContentBrowser.js:
(WI.ContentBrowser.prototype.handlePopulateFindShortcut):
(WI.ContentBrowser.prototype.handleFindStringUpdated): Deleted.
Only update the `searchQuery` of the `WI.FindBanner` and `performSearch` when the find
next/previous keyboard shortcut is activated, not when the find string is populated/updated,
unless the update came from the populate find keyboard shortcut.

* UserInterface/Views/LogContentView.js:
(WI.LogContentView.prototype.handlePopulateFindShortcut):
(WI.LogContentView.prototype.handleFindNextShortcut):
(WI.LogContentView.prototype.handleFindPreviousShortcut):
(WI.LogContentView.prototype.highlightPreviousSearchMatch):
(WI.LogContentView.prototype.highlightNextSearchMatch):
(WI.LogContentView.prototype.handleFindStringUpdated): Deleted.
Ensure that the logic for performing a search if the `searchQuery` of the `WI.FindBanner`
doesn't match the current `WI.findString` is also performed when in the split console.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (260894 => 260895)


--- trunk/Source/WebInspectorUI/ChangeLog	2020-04-29 11:47:00 UTC (rev 260894)
+++ trunk/Source/WebInspectorUI/ChangeLog	2020-04-29 14:49:03 UTC (rev 260895)
@@ -1,3 +1,30 @@
+2020-04-29  Devin Rousso  <[email protected]>
+
+        Web Inspector: don't immediately attempt to perform a search whenever the find string changes
+        https://bugs.webkit.org/show_bug.cgi?id=211164
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Base/Main.js:
+        (WI.updateFindString):
+        (WI._populateFind):
+        * UserInterface/Views/ContentBrowser.js:
+        (WI.ContentBrowser.prototype.handlePopulateFindShortcut):
+        (WI.ContentBrowser.prototype.handleFindStringUpdated): Deleted.
+        Only update the `searchQuery` of the `WI.FindBanner` and `performSearch` when the find
+        next/previous keyboard shortcut is activated, not when the find string is populated/updated,
+        unless the update came from the populate find keyboard shortcut.
+
+        * UserInterface/Views/LogContentView.js:
+        (WI.LogContentView.prototype.handlePopulateFindShortcut):
+        (WI.LogContentView.prototype.handleFindNextShortcut):
+        (WI.LogContentView.prototype.handleFindPreviousShortcut):
+        (WI.LogContentView.prototype.highlightPreviousSearchMatch):
+        (WI.LogContentView.prototype.highlightNextSearchMatch):
+        (WI.LogContentView.prototype.handleFindStringUpdated): Deleted.
+        Ensure that the logic for performing a search if the `searchQuery` of the `WI.FindBanner`
+        doesn't match the current `WI.findString` is also performed when in the split console.
+
 2020-04-28  Nikita Vasilyev  <[email protected]>
 
         Web Inspector: Debug: "Outline focused element" should also outline elements with tabIndex=0

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (260894 => 260895)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2020-04-29 11:47:00 UTC (rev 260894)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2020-04-29 14:49:03 UTC (rev 260895)
@@ -1047,22 +1047,12 @@
 
 WI.updateFindString = function(findString)
 {
-    if (WI.findString === findString)
-        return;
+    if (!findString || WI.findString === findString)
+        return false;
 
     WI.findString = findString;
 
-    let focusedContentView = WI._focusedContentView();
-    if (focusedContentView && focusedContentView.supportsCustomFindBanner) {
-        focusedContentView.handleFindStringUpdated();
-        return;
-    }
-
-    let contentBrowser = WI._focusedOrVisibleContentBrowser();
-    if (contentBrowser) {
-        contentBrowser.handleFindStringUpdated();
-        return;
-    }
+    return true;
 };
 
 WI.handlePossibleLinkClick = function(event, frame, options = {})
@@ -2631,19 +2621,13 @@
 {
     let focusedContentView = WI._focusedContentView();
     if (focusedContentView && focusedContentView.supportsCustomFindBanner) {
-        let string = focusedContentView.handlePopulateFindShortcut();
-        if (string)
-            WI.findString = string;
-        focusedContentView.handleFindStringUpdated();
+        focusedContentView.handlePopulateFindShortcut();
         return;
     }
 
     let contentBrowser = WI._focusedOrVisibleContentBrowser();
     if (contentBrowser) {
-        let string = contentBrowser.handlePopulateFindShortcut();
-        if (string)
-            WI.findString = string;
-        contentBrowser.handleFindStringUpdated();
+        contentBrowser.handlePopulateFindShortcut();
         return;
     }
 };

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js (260894 => 260895)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js	2020-04-29 11:47:00 UTC (rev 260894)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js	2020-04-29 14:49:03 UTC (rev 260895)
@@ -246,20 +246,20 @@
 
     // Global ContentBrowser KeyboardShortcut handlers
 
-    handleFindStringUpdated()
+    handlePopulateFindShortcut()
     {
+        let currentContentView = this.currentContentView;
+        if (!currentContentView?.supportsSearch)
+            return;
+
+        if (!WI.updateFindString(currentContentView.searchQueryWithSelection()))
+            return;
+
         this._findBanner.searchQuery = WI.findString;
 
-        let currentContentView = this.currentContentView;
-        if (currentContentView?.supportsSearch)
-            currentContentView.performSearch(this._findBanner.searchQuery);
+        currentContentView.performSearch(this._findBanner.searchQuery);
     }
 
-    handlePopulateFindShortcut()
-    {
-        return this.currentContentView?.searchQueryWithSelection();
-    }
-
     async handleFindNextShortcut()
     {
         if (this._findBanner.searchQuery !== WI.findString) {

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js (260894 => 260895)


--- trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js	2020-04-29 11:47:00 UTC (rev 260894)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js	2020-04-29 14:49:03 UTC (rev 260895)
@@ -296,32 +296,24 @@
         this._logViewController.requestClearMessages();
     }
 
-    handleFindStringUpdated()
+    handlePopulateFindShortcut()
     {
+        if (!WI.updateFindString(this.searchQueryWithSelection()))
+            return;
+
         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);
+        this.highlightNextSearchMatch();
     }
 
     handleFindPreviousShortcut()
     {
-        if (this._findBanner.searchQuery !== WI.findString)
-            this.handleFindStringUpdated();
-
-        this.findBannerRevealPreviousResult(this._findBanner);
+        this.highlightPreviousSearchMatch();
     }
 
     findBannerRevealPreviousResult()
@@ -331,7 +323,13 @@
 
     highlightPreviousSearchMatch()
     {
-        if (!this.hasPerformedSearch || isEmptyObject(this._searchMatches))
+        if (!this.hasPerformedSearch || this._findBanner.searchQuery !== WI.findString) {
+            this._findBanner.searchQuery = WI.findString;
+
+            this.performSearch(this._findBanner.searchQuery);
+        }
+
+        if (isEmptyObject(this._searchMatches))
             return;
 
         var index = this._selectedSearchMatch ? this._searchMatches.indexOf(this._selectedSearchMatch) : this._searchMatches.length;
@@ -345,7 +343,13 @@
 
     highlightNextSearchMatch()
     {
-        if (!this.hasPerformedSearch || isEmptyObject(this._searchMatches))
+        if (!this.hasPerformedSearch || this._findBanner.searchQuery !== WI.findString) {
+            this._findBanner.searchQuery = WI.findString;
+
+            this.performSearch(this._findBanner.searchQuery);
+        }
+
+        if (isEmptyObject(this._searchMatches))
             return;
 
         var index = this._selectedSearchMatch ? this._searchMatches.indexOf(this._selectedSearchMatch) + 1 : 0;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to