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 29cddf967555d612c0707c618ee9c00cfd8db2d9..82b96a693d4cfaab30f52575594c8dfed3b01248 100644 |
--- a/third_party/WebKit/Source/core/testing/Internals.cpp |
+++ b/third_party/WebKit/Source/core/testing/Internals.cpp |
@@ -921,9 +921,23 @@ void Internals::setMarker(Document* document, |
return; |
} |
+ if (type != DocumentMarker::kSpelling && type != DocumentMarker::kGrammar) { |
+ exception_state.ThrowDOMException(kSyntaxError, |
+ "internals.setMarker() currently only " |
+ "supports spelling and grammar markers; " |
+ "attempted to add marker of type '" + |
+ marker_type + "'."); |
+ return; |
+ } |
+ |
document->UpdateStyleAndLayoutIgnorePendingStylesheets(); |
- document->Markers().AddMarker(range->StartPosition(), range->EndPosition(), |
- type.value()); |
+ if (type == DocumentMarker::kSpelling) { |
+ document->Markers().AddSpellingMarker(range->StartPosition(), |
+ range->EndPosition()); |
+ } else { |
+ document->Markers().AddGrammarMarker(range->StartPosition(), |
+ range->EndPosition()); |
+ } |
} |
unsigned Internals::markerCountForNode(Node* node, |