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

Unified Diff: third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.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/core/editing/markers/DocumentMarkerController.cpp
diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
index 34506d1809171ca1ef41fdc04d995e252f4aa773..27859dcb95dda2bd04109604f4243295e2f90d26 100644
--- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
@@ -107,8 +107,9 @@ void DocumentMarkerController::addMarker(const Position& start,
}
}
-void DocumentMarkerController::addTextMatchMarker(const EphemeralRange& range,
- bool activeMatch) {
+void DocumentMarkerController::addTextMatchMarker(
+ const EphemeralRange& range,
+ DocumentMarker::MatchStatus activeMatch) {
DCHECK(!m_document->needsLayoutTreeUpdate());
// Use a TextIterator to visit the potentially multiple nodes the range
@@ -777,8 +778,9 @@ void DocumentMarkerController::shiftMarkers(Node* node,
}
}
-bool DocumentMarkerController::setMarkersActive(const EphemeralRange& range,
- bool active) {
+bool DocumentMarkerController::setMarkersActive(
+ const EphemeralRange& range,
+ DocumentMarker::MatchStatus matchStatus) {
if (!possiblyHasMarkers(DocumentMarker::AllMarkers()))
return false;
@@ -798,15 +800,16 @@ bool DocumentMarkerController::setMarkersActive(const EphemeralRange& range,
for (Node& node : range.nodes()) {
int startOffset = node == startContainer ? containerStartOffset : 0;
int endOffset = node == endContainer ? containerEndOffset : INT_MAX;
- markerFound |= setMarkersActive(&node, startOffset, endOffset, active);
+ markerFound |= setMarkersActive(&node, startOffset, endOffset, matchStatus);
}
return markerFound;
}
-bool DocumentMarkerController::setMarkersActive(Node* node,
- unsigned startOffset,
- unsigned endOffset,
- bool active) {
+bool DocumentMarkerController::setMarkersActive(
+ Node* node,
+ unsigned startOffset,
+ unsigned endOffset,
+ DocumentMarker::MatchStatus matchStatus) {
MarkerLists* markers = m_markers.at(node);
if (!markers)
return false;
@@ -825,7 +828,7 @@ bool DocumentMarkerController::setMarkersActive(Node* node,
if ((*marker)->startOffset() >= endOffset)
break;
- (*marker)->setActiveMatch(active);
+ (*marker)->setActiveMatch(matchStatus);
docDirty = true;
}
@@ -860,7 +863,8 @@ void DocumentMarkerController::showMarkers() const {
builder.append(":");
builder.appendNumber(marker->endOffset());
builder.append("](");
- builder.appendNumber(marker->activeMatch());
+ builder.appendNumber(marker->activeMatch() ==
+ DocumentMarker::MatchStatus::Active);
builder.append(")");
}
}

Powered by Google App Engine
This is Rietveld 408576698