- Revision
- 150633
- Author
- [email protected]
- Date
- 2013-05-24 00:12:19 -0700 (Fri, 24 May 2013)
Log Message
Typing in Safari's unified field causes unnecessary web content repaints.
<http://webkit.org/b/116703>
Reviewed by Andy Estes.
Source/WebCore:
Break out an alternate version of Page::markAllMatchesForText() that only counts the number of times
a string occurs in the page, but doesn't try to mark the occurrences.
This allows Safari to count matches for the 'Find "foo" on This Page' functionality in the unified
location bar without causing tile repaints.
* WebCore.exp.in:
* page/Page.h:
* page/Page.cpp:
(WebCore::Page::findMatchesForText):
(WebCore::Page::markAllMatchesForText):
(WebCore::Page::countFindMatches):
Renamed markAllMatchesForText() to findMatchesForText() and gave it a boolean parameter to control whether
matches should be marked or not. countFindMatches() is the new helper that doesn't mark.
Source/WebKit2:
* WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::countStringMatches):
Call WebCore::Page::countMatchesForText() instead of markAllMatchesForText(). If the search string
is found inside the page content, the renderer containing that text will no longer be repainted.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (150632 => 150633)
--- trunk/Source/WebCore/ChangeLog 2013-05-24 07:05:01 UTC (rev 150632)
+++ trunk/Source/WebCore/ChangeLog 2013-05-24 07:12:19 UTC (rev 150633)
@@ -1,3 +1,25 @@
+2013-05-24 Andreas Kling <[email protected]>
+
+ Typing in Safari's unified field causes unnecessary web content repaints.
+ <http://webkit.org/b/116703>
+
+ Reviewed by Andy Estes.
+
+ Break out an alternate version of Page::markAllMatchesForText() that only counts the number of times
+ a string occurs in the page, but doesn't try to mark the occurrences.
+ This allows Safari to count matches for the 'Find "foo" on This Page' functionality in the unified
+ location bar without causing tile repaints.
+
+ * WebCore.exp.in:
+ * page/Page.h:
+ * page/Page.cpp:
+ (WebCore::Page::findMatchesForText):
+ (WebCore::Page::markAllMatchesForText):
+ (WebCore::Page::countFindMatches):
+
+ Renamed markAllMatchesForText() to findMatchesForText() and gave it a boolean parameter to control whether
+ matches should be marked or not. countFindMatches() is the new helper that doesn't mark.
+
2013-05-23 Beth Dakin <[email protected]>
https://bugs.webkit.org/show_bug.cgi?id=116702
Modified: trunk/Source/WebCore/WebCore.exp.in (150632 => 150633)
--- trunk/Source/WebCore/WebCore.exp.in 2013-05-24 07:05:01 UTC (rev 150632)
+++ trunk/Source/WebCore/WebCore.exp.in 2013-05-24 07:12:19 UTC (rev 150633)
@@ -855,6 +855,7 @@
__ZN7WebCore4Page14setMediaVolumeEf
__ZN7WebCore4Page15addSchedulePairEN3WTF10PassRefPtrINS1_12SchedulePairEEE
__ZN7WebCore4Page15didMoveOnscreenEv
+__ZN7WebCore4Page16countFindMatchesERKN3WTF6StringEjj
__ZN7WebCore4Page16setCanStartMediaEb
__ZN7WebCore4Page16setDefersLoadingEb
__ZN7WebCore4Page17willMoveOffscreenEv
Modified: trunk/Source/WebCore/page/Page.cpp (150632 => 150633)
--- trunk/Source/WebCore/page/Page.cpp 2013-05-24 07:05:01 UTC (rev 150632)
+++ trunk/Source/WebCore/page/Page.cpp 2013-05-24 07:12:19 UTC (rev 150633)
@@ -644,28 +644,34 @@
return 0;
}
-unsigned int Page::markAllMatchesForText(const String& target, TextCaseSensitivity caseSensitivity, bool shouldHighlight, unsigned limit)
+unsigned Page::findMatchesForText(const String& target, FindOptions options, unsigned maxMatchCount, bool shouldHighlight, bool markMatches)
{
- return markAllMatchesForText(target, caseSensitivity == TextCaseInsensitive ? CaseInsensitive : 0, shouldHighlight, limit);
-}
-
-unsigned int Page::markAllMatchesForText(const String& target, FindOptions options, bool shouldHighlight, unsigned limit)
-{
if (target.isEmpty() || !mainFrame())
return 0;
- unsigned matches = 0;
+ unsigned matchCount = 0;
Frame* frame = mainFrame();
do {
- frame->editor().setMarkedTextMatchesAreHighlighted(shouldHighlight);
- matches += frame->editor().countMatchesForText(target, 0, options, limit ? (limit - matches) : 0, true, 0);
+ if (markMatches)
+ frame->editor().setMarkedTextMatchesAreHighlighted(shouldHighlight);
+ matchCount += frame->editor().countMatchesForText(target, 0, options, maxMatchCount ? (maxMatchCount - matchCount) : 0, markMatches, 0);
frame = incrementFrame(frame, true, false);
} while (frame);
- return matches;
+ return matchCount;
}
+unsigned Page::markAllMatchesForText(const String& target, FindOptions options, bool shouldHighlight, unsigned maxMatchCount)
+{
+ return findMatchesForText(target, options, shouldHighlight, maxMatchCount, /*markMatches*/ true);
+}
+
+unsigned Page::countFindMatches(const String& target, FindOptions options, unsigned maxMatchCount)
+{
+ return findMatchesForText(target, options, /*shouldHighlight*/ false, maxMatchCount, /*markMatches*/ false);
+}
+
void Page::unmarkAllTextMatches()
{
if (!mainFrame())
Modified: trunk/Source/WebCore/page/Page.h (150632 => 150633)
--- trunk/Source/WebCore/page/Page.h 2013-05-24 07:05:01 UTC (rev 150632)
+++ trunk/Source/WebCore/page/Page.h 2013-05-24 07:12:19 UTC (rev 150633)
@@ -232,9 +232,9 @@
PassRefPtr<Range> rangeOfString(const String&, Range*, FindOptions);
- unsigned markAllMatchesForText(const String&, FindOptions, bool shouldHighlight, unsigned);
- // FIXME: Switch callers over to the FindOptions version and retire this one.
- unsigned markAllMatchesForText(const String&, TextCaseSensitivity, bool shouldHighlight, unsigned);
+ unsigned countFindMatches(const String&, FindOptions, unsigned maxMatchCount);
+ unsigned markAllMatchesForText(const String&, FindOptions, bool shouldHighlight, unsigned maxMatchCount);
+
void unmarkAllTextMatches();
// find all the Ranges for the matching text.
@@ -411,6 +411,8 @@
void checkSubframeCountConsistency() const;
#endif
+ unsigned findMatchesForText(const String&, FindOptions, unsigned maxMatchCount, bool shouldHighlight, bool markMatches);
+
MediaCanStartListener* takeAnyMediaCanStartListener();
void setMinimumTimerInterval(double);
Modified: trunk/Source/WebKit2/ChangeLog (150632 => 150633)
--- trunk/Source/WebKit2/ChangeLog 2013-05-24 07:05:01 UTC (rev 150632)
+++ trunk/Source/WebKit2/ChangeLog 2013-05-24 07:12:19 UTC (rev 150633)
@@ -1,3 +1,16 @@
+2013-05-24 Andreas Kling <[email protected]>
+
+ Typing in Safari's unified field causes unnecessary web content repaints.
+ <http://webkit.org/b/116703>
+
+ Reviewed by Andy Estes.
+
+ * WebProcess/WebPage/FindController.cpp:
+ (WebKit::FindController::countStringMatches):
+
+ Call WebCore::Page::countMatchesForText() instead of markAllMatchesForText(). If the search string
+ is found inside the page content, the renderer containing that text will no longer be repainted.
+
2013-05-23 Ryuan Choi <[email protected]>
[WK2][EFL][QT] Build break after r150610
Modified: trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp (150632 => 150633)
--- trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp 2013-05-24 07:05:01 UTC (rev 150632)
+++ trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp 2013-05-24 07:12:19 UTC (rev 150633)
@@ -86,7 +86,7 @@
if (pluginView)
matchCount = pluginView->countFindMatches(string, core(options), maxMatchCount + 1);
else {
- matchCount = m_webPage->corePage()->markAllMatchesForText(string, core(options), false, maxMatchCount + 1);
+ matchCount = m_webPage->corePage()->countFindMatches(string, core(options), maxMatchCount + 1);
m_webPage->corePage()->unmarkAllTextMatches();
}