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

Unified Diff: third_party/WebKit/Source/core/testing/Internals.cpp

Issue 2765133002: [WIP] Add DocumentMarkerController::addGrammarMarker() and addSpellingMarker() (Closed)
Patch Set: Rebase Created 3 years, 9 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/testing/Internals.cpp
diff --git a/third_party/WebKit/Source/core/testing/Internals.cpp b/third_party/WebKit/Source/core/testing/Internals.cpp
index 5d1f21bee7daf3aae863895d0f2a39480d05bcca..8cee940876580d6d2ed7269a32354e0060a15164 100644
--- a/third_party/WebKit/Source/core/testing/Internals.cpp
+++ b/third_party/WebKit/Source/core/testing/Internals.cpp
@@ -919,9 +919,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) {
yosin_UTC9 2017/03/30 01:48:57 Move this check at end of function to utilize earl
+ 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(),
yosin_UTC9 2017/03/30 01:48:57 Let's use early return style.
+ range->endPosition());
+ } else {
+ document->markers().addSpellingMarker(range->startPosition(),
+ range->endPosition());
+ }
}
unsigned Internals::markerCountForNode(Node* node,

Powered by Google App Engine
This is Rietveld 408576698