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

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

Issue 2895253003: Split general DocumentMarkerController::AddMarker() method into spelling/grammar versions (Closed)
Patch Set: Split off InputMethodControllerTest changes, make other requested changes Created 3 years, 7 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 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,

Powered by Google App Engine
This is Rietveld 408576698