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 ac589d60c61b03d9f7a850e9d48cac0cc22ec765..053e1f0c98a0811ca5ac23b75cd8a621e94adc81 100644 |
--- a/third_party/WebKit/Source/core/testing/Internals.cpp |
+++ b/third_party/WebKit/Source/core/testing/Internals.cpp |
@@ -70,6 +70,7 @@ |
#include "core/editing/markers/DocumentMarker.h" |
#include "core/editing/markers/DocumentMarkerController.h" |
#include "core/editing/serializers/Serialization.h" |
+#include "core/editing/spellcheck/IdleSpellCheckCallback.h" |
#include "core/editing/spellcheck/SpellCheckRequester.h" |
#include "core/editing/spellcheck/SpellChecker.h" |
#include "core/frame/EventHandlerRegistry.h" |
@@ -1494,6 +1495,48 @@ int Internals::lastSpellCheckProcessedSequence(Document* document, |
return requester->lastProcessedSequence(); |
} |
+String Internals::idleTimeSpellCheckerState(Document* document, |
+ ExceptionState& exceptionState) { |
+ if (!document || !document->frame()) { |
+ exceptionState.throwDOMException( |
+ InvalidAccessError, |
+ "No frame can be obtained from the provided document."); |
+ return String(); |
+ } |
+ |
+ IdleSpellCheckCallback::State state = |
+ document->frame()->spellChecker().idleSpellCheckCallback().state(); |
+ switch (state) { |
+ case IdleSpellCheckCallback::State::kInactive: |
yosin_UTC9
2017/03/03 04:44:59
Optional: yet another solution is having FOR_EACH_
Xiaocheng
2017/03/03 18:56:41
Updated with FOR_EACH(V)
Thanks for the advice.
|
+ return "inactive"; |
+ case IdleSpellCheckCallback::State::kHotModeRequested: |
+ return "hot-mode-requested"; |
+ case IdleSpellCheckCallback::State::kInHotModeInvocation: |
+ return "in-hot-mode-invocation"; |
+ case IdleSpellCheckCallback::State::kColdModeTimerStarted: |
+ return "cold-mode-timer-started"; |
+ case IdleSpellCheckCallback::State::kColdModeRequested: |
+ return "cold-mode-requested"; |
+ case IdleSpellCheckCallback::State::kInColdModeInvocation: |
+ return "in-cold-mode-invocation"; |
+ } |
+} |
+ |
+void Internals::runIdleTimeSpellChecker(Document* document, |
+ ExceptionState& exceptionState) { |
+ if (!document || !document->frame()) { |
+ exceptionState.throwDOMException( |
+ InvalidAccessError, |
+ "No frame can be obtained from the provided document."); |
+ return; |
+ } |
+ |
+ document->frame() |
+ ->spellChecker() |
+ .idleSpellCheckCallback() |
+ .forceInvocationForTesting(); |
+} |
+ |
Vector<AtomicString> Internals::userPreferredLanguages() const { |
return blink::userPreferredLanguages(); |
} |