| 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 34bf1b830912ff027d8882feafa153da6434f8de..3996c799ec8235daff7c1d88bbbe53f75bb1a35d 100644
|
| --- a/third_party/WebKit/Source/core/testing/Internals.cpp
|
| +++ b/third_party/WebKit/Source/core/testing/Internals.cpp
|
| @@ -1791,25 +1791,66 @@ StaticNodeList* Internals::nodesFromRect(Document* document,
|
| return StaticNodeList::adopt(matches);
|
| }
|
|
|
| -bool Internals::hasSpellingMarker(Document* document, int from, int length) {
|
| - ASSERT(document);
|
| - if (!document->frame())
|
| +void Internals::setSpellingMarker(Document* document,
|
| + ExceptionState& exceptionState) {
|
| + if (!document || !document->frame()) {
|
| + exceptionState.throwDOMException(
|
| + InvalidAccessError,
|
| + "No frame can be obtained from the provided document.");
|
| + return;
|
| + }
|
| +
|
| + document->updateStyleAndLayoutIgnorePendingStylesheets();
|
| + EphemeralRange range =
|
| + document->frame()->selection().selection().toNormalizedEphemeralRange();
|
| + document->markers().addMarker(range.startPosition(), range.endPosition(),
|
| + DocumentMarker::Spelling);
|
| +}
|
| +
|
| +bool Internals::hasSpellingMarker(Document* document,
|
| + int from,
|
| + int length,
|
| + ExceptionState& exceptionState) {
|
| + if (!document || !document->frame()) {
|
| + exceptionState.throwDOMException(
|
| + InvalidAccessError,
|
| + "No frame can be obtained from the provided document.");
|
| return false;
|
| + }
|
|
|
| document->updateStyleAndLayoutIgnorePendingStylesheets();
|
| return document->frame()->spellChecker().selectionStartHasMarkerFor(
|
| DocumentMarker::Spelling, from, length);
|
| }
|
|
|
| -void Internals::setSpellCheckingEnabled(bool enabled) {
|
| - if (!contextDocument() || !contextDocument()->frame())
|
| +void Internals::setSpellCheckingEnabled(bool enabled,
|
| + ExceptionState& exceptionState) {
|
| + if (!contextDocument() || !contextDocument()->frame()) {
|
| + exceptionState.throwDOMException(
|
| + InvalidAccessError,
|
| + "No frame can be obtained from the provided document.");
|
| return;
|
| + }
|
|
|
| if (enabled !=
|
| contextDocument()->frame()->spellChecker().isSpellCheckingEnabled())
|
| contextDocument()->frame()->spellChecker().toggleSpellCheckingEnabled();
|
| }
|
|
|
| +void Internals::replaceMisspelled(Document* document,
|
| + const String& replacement,
|
| + ExceptionState& exceptionState) {
|
| + if (!document || !document->frame()) {
|
| + exceptionState.throwDOMException(
|
| + InvalidAccessError,
|
| + "No frame can be obtained from the provided document.");
|
| + return;
|
| + }
|
| +
|
| + document->updateStyleAndLayoutIgnorePendingStylesheets();
|
| + document->frame()->spellChecker().replaceMisspelledRange(replacement);
|
| +}
|
| +
|
| bool Internals::canHyphenate(const AtomicString& locale) {
|
| return LayoutLocale::valueOrDefault(LayoutLocale::get(locale))
|
| .getHyphenation();
|
| @@ -1847,10 +1888,16 @@ String Internals::dumpRefCountedInstanceCounts() const {
|
| return WTF::dumpRefCountedInstanceCounts();
|
| }
|
|
|
| -bool Internals::hasGrammarMarker(Document* document, int from, int length) {
|
| - ASSERT(document);
|
| - if (!document->frame())
|
| +bool Internals::hasGrammarMarker(Document* document,
|
| + int from,
|
| + int length,
|
| + ExceptionState& exceptionState) {
|
| + if (!document || !document->frame()) {
|
| + exceptionState.throwDOMException(
|
| + InvalidAccessError,
|
| + "No frame can be obtained from the provided document.");
|
| return false;
|
| + }
|
|
|
| document->updateStyleAndLayoutIgnorePendingStylesheets();
|
| return document->frame()->spellChecker().selectionStartHasMarkerFor(
|
|
|