OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef IdleSpellCheckCallback_h | 5 #ifndef IdleSpellCheckCallback_h |
6 #define IdleSpellCheckCallback_h | 6 #define IdleSpellCheckCallback_h |
7 | 7 |
8 #include "core/dom/IdleRequestCallback.h" | 8 #include "core/dom/IdleRequestCallback.h" |
9 #include "core/dom/SynchronousMutationObserver.h" | 9 #include "core/dom/SynchronousMutationObserver.h" |
10 #include "core/editing/EphemeralRange.h" | |
11 #include "core/editing/Position.h" | |
10 #include "platform/Timer.h" | 12 #include "platform/Timer.h" |
11 | 13 |
12 namespace blink { | 14 namespace blink { |
13 | 15 |
14 class LocalFrame; | 16 class LocalFrame; |
15 class SpellCheckRequester; | 17 class SpellCheckRequester; |
16 | 18 |
17 // Main class for the implementation of idle time spell checker. | 19 // Main class for the implementation of idle time spell checker. |
18 class CORE_EXPORT IdleSpellCheckCallback final | 20 class CORE_EXPORT IdleSpellCheckCallback final |
19 : public IdleRequestCallback, | 21 : public IdleRequestCallback, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 | 65 |
64 LocalFrame& frame() const { return *m_frame; } | 66 LocalFrame& frame() const { return *m_frame; } |
65 | 67 |
66 // Returns whether spell checking is globally enabled. | 68 // Returns whether spell checking is globally enabled. |
67 bool isSpellCheckingEnabled() const; | 69 bool isSpellCheckingEnabled() const; |
68 | 70 |
69 // Calls requestIdleCallback with this IdleSpellCheckCallback. | 71 // Calls requestIdleCallback with this IdleSpellCheckCallback. |
70 void requestInvocation(); | 72 void requestInvocation(); |
71 | 73 |
72 // Functions for hot mode. | 74 // Functions for hot mode. |
75 bool isTypingInPartialWord(const Element&) const; | |
76 bool shouldCheckRootEditableInHotMode(const Element&, const Position&) const; | |
77 EphemeralRange calcHotModeCheckingRange(const Element&, | |
yosin_UTC9
2017/03/03 05:34:23
nit: s/calc/calculate/
We usually don't use abbrev
Xiaocheng
2017/03/03 06:28:28
Done.
| |
78 const Position&) const; | |
79 void hotModeCheckRootEditable(Element*, | |
80 const Position&, | |
81 HeapVector<Member<Element>>*); | |
73 void hotModeInvocation(IdleDeadline*); | 82 void hotModeInvocation(IdleDeadline*); |
74 | 83 |
75 // Transit to ColdModeTimerStarted, if possible. Sets up a timer, and requests | 84 // Transit to ColdModeTimerStarted, if possible. Sets up a timer, and requests |
76 // cold mode invocation if no critical operation occurs before timer firing. | 85 // cold mode invocation if no critical operation occurs before timer firing. |
77 void setNeedsColdModeInvocation(); | 86 void setNeedsColdModeInvocation(); |
78 | 87 |
79 // Functions for cold mode. | 88 // Functions for cold mode. |
80 void coldModeTimerFired(TimerBase*); | 89 void coldModeTimerFired(TimerBase*); |
81 void coldModeInvocation(IdleDeadline*); | 90 void coldModeInvocation(IdleDeadline*); |
82 bool coldModeFinishesFullDocument() const; | 91 bool coldModeFinishesFullDocument() const; |
83 | 92 |
84 // Implements |SynchronousMutationObserver|. | 93 // Implements |SynchronousMutationObserver|. |
85 void contextDestroyed(Document*) final; | 94 void contextDestroyed(Document*) final; |
86 | 95 |
87 State m_state; | 96 State m_state; |
88 int m_idleCallbackHandle; | 97 int m_idleCallbackHandle; |
89 mutable bool m_needsMoreColdModeInvocationForTesting; | 98 mutable bool m_needsMoreColdModeInvocationForTesting; |
90 const Member<LocalFrame> m_frame; | 99 const Member<LocalFrame> m_frame; |
91 | 100 uint64_t m_lastProcessedUndoStepSequence; |
92 TaskRunnerTimer<IdleSpellCheckCallback> m_coldModeTimer; | 101 TaskRunnerTimer<IdleSpellCheckCallback> m_coldModeTimer; |
93 }; | 102 }; |
94 | 103 |
95 } // namespace blink | 104 } // namespace blink |
96 | 105 |
97 #endif // IdleSpellCheckCallback_h | 106 #endif // IdleSpellCheckCallback_h |
OLD | NEW |