| Index: third_party/WebKit/Source/core/testing/Internals.cpp
|
| diff --git a/third_party/WebKit/Source/core/testing/Internals.cpp b/third_party/WebKit/Source/core/testing/Internals.cpp
|
| index df57f797e4dad5e9b2a5a16abc7851e4a9bd0269..1864a6e2308eff5cf026a32b1c430f4e64d0f088 100644
|
| --- a/third_party/WebKit/Source/core/testing/Internals.cpp
|
| +++ b/third_party/WebKit/Source/core/testing/Internals.cpp
|
| @@ -954,7 +954,7 @@ unsigned Internals::activeMarkerCountForNode(Node* node) {
|
|
|
| unsigned activeMarkerCount = 0;
|
| for (const auto& marker : markers) {
|
| - if (marker->activeMatch())
|
| + if (marker->activeMatch() == DocumentMarker::MatchStatus::Active)
|
| activeMarkerCount++;
|
| }
|
|
|
| @@ -1004,14 +1004,34 @@ String Internals::markerDescriptionForNode(Node* node,
|
| return marker->description();
|
| }
|
|
|
| -void Internals::addTextMatchMarker(const Range* range, bool isActive) {
|
| +static WTF::Optional<DocumentMarker::MatchStatus> matchStatusFrom(
|
| + const String& matchStatus) {
|
| + if (equalIgnoringCase(matchStatus, "Active"))
|
| + return DocumentMarker::MatchStatus::Active;
|
| + if (equalIgnoringCase(matchStatus, "Inactive"))
|
| + return DocumentMarker::MatchStatus::Inactive;
|
| + return WTF::nullopt;
|
| +}
|
| +
|
| +void Internals::addTextMatchMarker(const Range* range,
|
| + const String& matchStatus,
|
| + ExceptionState& exceptionState) {
|
| DCHECK(range);
|
| if (!range->ownerDocument().view())
|
| return;
|
|
|
| + WTF::Optional<DocumentMarker::MatchStatus> matchStatusEnum =
|
| + matchStatusFrom(matchStatus);
|
| + if (!matchStatusEnum) {
|
| + exceptionState.throwDOMException(
|
| + SyntaxError,
|
| + "The match status provided ('" + matchStatus + "') is invalid.");
|
| + return;
|
| + }
|
| +
|
| range->ownerDocument().updateStyleAndLayoutIgnorePendingStylesheets();
|
| range->ownerDocument().markers().addTextMatchMarker(EphemeralRange(range),
|
| - isActive);
|
| + matchStatusEnum.value());
|
|
|
| // This simulates what the production code does after
|
| // DocumentMarkerController::addTextMatchMarker().
|
| @@ -1052,10 +1072,12 @@ void Internals::addCompositionMarker(const Range* range,
|
| void Internals::setMarkersActive(Node* node,
|
| unsigned startOffset,
|
| unsigned endOffset,
|
| - bool active) {
|
| + bool isActive) {
|
| DCHECK(node);
|
| - node->document().markers().setMarkersActive(node, startOffset, endOffset,
|
| - active);
|
| + node->document().markers().setMarkersActive(
|
| + node, startOffset, endOffset,
|
| + isActive ? DocumentMarker::MatchStatus::Active
|
| + : DocumentMarker::MatchStatus::Inactive);
|
| }
|
|
|
| void Internals::setMarkedTextMatchesAreHighlighted(Document* document,
|
|
|