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 8a6db89202326e36d1c7df21e9b3dcbd4337df44..2cad1e68760c169b91c08aafaab0ce648cc051f1 100644 |
--- a/third_party/WebKit/Source/core/testing/Internals.cpp |
+++ b/third_party/WebKit/Source/core/testing/Internals.cpp |
@@ -962,9 +962,25 @@ void Internals::setMarker(Document* document, |
return; |
} |
+ // Grammar and Spelling markers are the only marker types that can be set with |
+ // just a range |
+ if (type != DocumentMarker::Grammar && type != DocumentMarker::Spelling) { |
+ exceptionState.throwDOMException( |
+ SyntaxError, |
+ "Marker of type '" + markerType + |
+ "' was provided; type must be either Grammar or Spelling."); |
+ return; |
+ } |
+ |
document->updateStyleAndLayoutIgnorePendingStylesheets(); |
- document->markers().addMarker(range->startPosition(), range->endPosition(), |
- type.value()); |
+ |
+ if (type == DocumentMarker::Grammar) { |
+ document->markers().addGrammarMarker(range->startPosition(), |
+ range->endPosition()); |
+ } else { |
+ document->markers().addSpellingMarker(range->startPosition(), |
+ range->endPosition()); |
+ } |
} |
unsigned Internals::markerCountForNode(Node* node, |