Commit 3e22c3a8 authored by xiaochengh's avatar xiaochengh Committed by Commit bot

Add new RuntimeEnabledFeature: IdleTimeSpellChecking

As the first step of implementing Idle Time Spell Checker, this patch adds
a new runtime enabled feature IdleTimeSpellChecking, and exits the existing
spell-checking code paths when the feature is enabled.

BUG=671922

Review-Url: https://codereview.chromium.org/2566043003
Cr-Commit-Position: refs/heads/master@{#437840}
parent 5ba32e3b
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include "core/loader/EmptyClients.h" #include "core/loader/EmptyClients.h"
#include "core/page/Page.h" #include "core/page/Page.h"
#include "core/page/SpellCheckerClient.h" #include "core/page/SpellCheckerClient.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/text/TextBreakIterator.h" #include "platform/text/TextBreakIterator.h"
#include "platform/text/TextCheckerClient.h" #include "platform/text/TextCheckerClient.h"
...@@ -187,6 +188,9 @@ void SpellChecker::toggleSpellCheckingEnabled() { ...@@ -187,6 +188,9 @@ void SpellChecker::toggleSpellCheckingEnabled() {
} }
void SpellChecker::didBeginEditing(Element* element) { void SpellChecker::didBeginEditing(Element* element) {
if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled())
return;
if (!isSpellCheckingEnabled()) if (!isSpellCheckingEnabled())
return; return;
...@@ -366,6 +370,9 @@ void SpellChecker::clearMisspellingsForMovingParagraphs( ...@@ -366,6 +370,9 @@ void SpellChecker::clearMisspellingsForMovingParagraphs(
void SpellChecker::markMisspellingsForMovingParagraphs( void SpellChecker::markMisspellingsForMovingParagraphs(
const VisibleSelection& movingSelection) { const VisibleSelection& movingSelection) {
if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled())
return;
// TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
// needs to be audited. See http://crbug.com/590369 for more details. // needs to be audited. See http://crbug.com/590369 for more details.
// In the long term we should use idle time spell checker to prevent // In the long term we should use idle time spell checker to prevent
...@@ -398,6 +405,9 @@ void SpellChecker::markMisspellingsInternal(const VisibleSelection& selection) { ...@@ -398,6 +405,9 @@ void SpellChecker::markMisspellingsInternal(const VisibleSelection& selection) {
void SpellChecker::markMisspellingsAfterApplyingCommand( void SpellChecker::markMisspellingsAfterApplyingCommand(
const CompositeEditCommand& cmd) { const CompositeEditCommand& cmd) {
if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled())
return;
if (!isSpellCheckingEnabled()) if (!isSpellCheckingEnabled())
return; return;
if (!isSpellCheckingEnabledFor(cmd.endingSelection())) if (!isSpellCheckingEnabledFor(cmd.endingSelection()))
...@@ -868,6 +878,9 @@ static bool shouldCheckOldSelection(const Position& oldSelectionStart) { ...@@ -868,6 +878,9 @@ static bool shouldCheckOldSelection(const Position& oldSelectionStart) {
void SpellChecker::respondToChangedSelection( void SpellChecker::respondToChangedSelection(
const Position& oldSelectionStart, const Position& oldSelectionStart,
FrameSelection::SetSelectionOptions options) { FrameSelection::SetSelectionOptions options) {
if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled())
return;
TRACE_EVENT0("blink", "SpellChecker::respondToChangedSelection"); TRACE_EVENT0("blink", "SpellChecker::respondToChangedSelection");
if (!isSpellCheckingEnabledFor(oldSelectionStart)) if (!isSpellCheckingEnabledFor(oldSelectionStart))
return; return;
...@@ -924,6 +937,9 @@ void SpellChecker::removeSpellingMarkersUnderWords( ...@@ -924,6 +937,9 @@ void SpellChecker::removeSpellingMarkersUnderWords(
} }
void SpellChecker::spellCheckAfterBlur() { void SpellChecker::spellCheckAfterBlur() {
if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled())
return;
if (!frame().selection().selection().isContentEditable()) if (!frame().selection().selection().isContentEditable())
return; return;
......
...@@ -116,6 +116,7 @@ GeometryInterfaces status=experimental, implied_by=CompositorWorker ...@@ -116,6 +116,7 @@ GeometryInterfaces status=experimental, implied_by=CompositorWorker
GetUserMedia status=stable GetUserMedia status=stable
GlobalCacheStorage status=stable GlobalCacheStorage status=stable
IDBObserver status=experimental IDBObserver status=experimental
IdleTimeSpellChecking
ImageCapture status=experimental, origin_trial_feature_name=ImageCapture ImageCapture status=experimental, origin_trial_feature_name=ImageCapture
ImageOrientation status=test ImageOrientation status=test
IndexedDBExperimental status=experimental IndexedDBExperimental status=experimental
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment