Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Unified Diff: third_party/WebKit/Source/web/TextFinder.cpp

Issue 2801483002: Add DocumentMarker::MatchStatus enum for text match markers (Closed)
Patch Set: Update tests Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/web/TextFinder.cpp
diff --git a/third_party/WebKit/Source/web/TextFinder.cpp b/third_party/WebKit/Source/web/TextFinder.cpp
index 7fd1db6032c3ba42c1a40bff96e934d7b7e55391..8a8e08d31073c79c752b61addfb6794892c18e88 100644
--- a/third_party/WebKit/Source/web/TextFinder.cpp
+++ b/third_party/WebKit/Source/web/TextFinder.cpp
@@ -116,7 +116,7 @@ bool TextFinder::find(int identifier,
if (!options.findNext)
unmarkAllTextMatches();
else
- setMarkerActive(m_activeMatch.get(), false);
+ setMarkerActive(m_activeMatch.get(), DocumentMarker::MatchStatus::Inactive);
if (m_activeMatch &&
&m_activeMatch->ownerDocument() != ownerFrame().frame()->document())
@@ -174,7 +174,8 @@ bool TextFinder::find(int identifier,
bool wasActiveFrame = m_currentActiveMatchFrame;
m_currentActiveMatchFrame = true;
- bool isActive = setMarkerActive(m_activeMatch.get(), true);
+ bool isActive =
+ setMarkerActive(m_activeMatch.get(), DocumentMarker::MatchStatus::Active);
if (activeNow)
*activeNow = isActive;
@@ -222,7 +223,7 @@ bool TextFinder::find(int identifier,
void TextFinder::clearActiveFindMatch() {
m_currentActiveMatchFrame = false;
- setMarkerActive(m_activeMatch.get(), false);
+ setMarkerActive(m_activeMatch.get(), DocumentMarker::MatchStatus::Inactive);
resetActiveMatch();
}
@@ -397,7 +398,9 @@ void TextFinder::scopeStringMatches(int identifier,
}
ownerFrame().frame()->document()->markers().addTextMatchMarker(
- EphemeralRange(resultRange), foundActiveMatch);
+ EphemeralRange(resultRange),
+ foundActiveMatch ? DocumentMarker::MatchStatus::Active
+ : DocumentMarker::MatchStatus::Inactive);
m_findMatchesCache.push_back(
FindMatch(resultRange, m_lastMatchCount + matchCount));
@@ -631,10 +634,12 @@ int TextFinder::selectFindMatch(unsigned index, WebRect* selectionRect) {
m_currentActiveMatchFrame = true;
ownerFrame().viewImpl()->setFocusedFrame(&ownerFrame());
- if (m_activeMatch)
- setMarkerActive(m_activeMatch.get(), false);
+ if (m_activeMatch) {
+ setMarkerActive(m_activeMatch.get(),
+ DocumentMarker::MatchStatus::Inactive);
+ }
m_activeMatch = range;
- setMarkerActive(m_activeMatch.get(), true);
+ setMarkerActive(m_activeMatch.get(), DocumentMarker::MatchStatus::Active);
// Clear any user selection, to make sure Find Next continues on from the
// match we just activated.
@@ -691,11 +696,12 @@ TextFinder::TextFinder(WebLocalFrameImpl& ownerFrame)
TextFinder::~TextFinder() {}
-bool TextFinder::setMarkerActive(Range* range, bool active) {
+bool TextFinder::setMarkerActive(Range* range,
+ DocumentMarker::MatchStatus matchStatus) {
if (!range || range->collapsed())
return false;
return ownerFrame().frame()->document()->markers().setMarkersActive(
- EphemeralRange(range), active);
+ EphemeralRange(range), matchStatus);
}
void TextFinder::unmarkAllTextMatches() {

Powered by Google App Engine
This is Rietveld 408576698