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

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

Issue 2457523003: Support 'insertReplacementText' for spellcheck (Closed)
Patch Set: fix for chongz's nit Created 4 years, 2 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 516e77e6cae6eb43cd98e2da9b08250c461bee79..fbb4bb0472a69ed833026b3febe3c62fee4e84fd 100644
--- a/third_party/WebKit/Source/core/testing/Internals.cpp
+++ b/third_party/WebKit/Source/core/testing/Internals.cpp
@@ -1791,6 +1791,17 @@ StaticNodeList* Internals::nodesFromRect(Document* document,
return StaticNodeList::adopt(matches);
}
+void Internals::setSpellingMarker(Document* document) {
+ DCHECK(document);
yosin_UTC9 2016/10/28 04:06:14 Please throw an exception rather than DCHECK(). Cl
+ DCHECK(document->frame());
+
Xiaocheng 2016/10/28 02:55:24 Please call |document->updateStyleAndLayoutIgnoreP
+ EphemeralRange range =
+ document->frame()->selection().selection().toNormalizedEphemeralRange();
+ document->markers().addMarker(range.startPosition(), range.endPosition(),
+ DocumentMarker::Spelling);
+ document->updateStyleAndLayoutIgnorePendingStylesheets();
Xiaocheng 2016/10/28 02:55:24 I don't think we should update layout here.
+}
+
bool Internals::hasSpellingMarker(Document* document, int from, int length) {
ASSERT(document);
if (!document->frame())
@@ -1810,6 +1821,14 @@ void Internals::setSpellCheckingEnabled(bool enabled) {
contextDocument()->frame()->spellChecker().toggleSpellCheckingEnabled();
}
+void Internals::replaceMisspelled(Document* document,
+ const String& replacement) {
+ DCHECK(document);
yosin_UTC9 2016/10/28 04:06:14 Please throw an exception rather than DCHECK(). Cl
+ DCHECK(document->frame());
+
Xiaocheng 2016/10/28 02:55:23 Please call document->updateStyleAndLayoutIgnorePe
+ document->frame()->spellChecker().replaceMisspelledRange(replacement);
+}
+
bool Internals::canHyphenate(const AtomicString& locale) {
return LayoutLocale::valueOrDefault(LayoutLocale::get(locale))
.getHyphenation();

Powered by Google App Engine
This is Rietveld 408576698