Changeset 86520 in webkit
- Timestamp:
- May 15, 2011 7:46:12 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r86507 r86520 1 2011-05-13 MORITA Hajime <morrita@google.com> 2 3 Reviewed by Ryosuke Niwa. 4 5 Refactoring: Editor::TextCheckingOptions should be replaced with TextCheckingType 6 https://bugs.webkit.org/show_bug.cgi?id=57088 7 8 Removed Editor::TextCheckingOptions and replaced it with TextCheckingTypeMask 9 No new tests, no behavior change. 10 11 * editing/Editor.cpp: 12 (WebCore::Editor::replaceSelectionWithFragment): 13 (WebCore::Editor::markMisspellingsAfterTypingToWord): 14 (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): 15 (WebCore::Editor::markMisspellingsAndBadGrammar): 16 (WebCore::Editor::resolveTextCheckingTypeMask): 17 * editing/Editor.h: 18 * platform/text/TextChecking.h: Added TextCheckingTypeShowCorrectionPanel 19 1 20 2011-05-15 Ilya Tikhonovsky <loislo@chromium.org> 2 21 -
trunk/Source/WebCore/editing/Editor.cpp
r86325 r86520 419 419 Node* nodeToCheck = m_frame->selection()->rootEditableElement(); 420 420 if (m_spellChecker->canCheckAsynchronously(nodeToCheck)) 421 m_spellChecker->requestCheckingFor( textCheckingTypeMaskFor(MarkSpelling | MarkGrammar), nodeToCheck);421 m_spellChecker->requestCheckingFor(resolveTextCheckingTypeMask(TextCheckingTypeSpelling | TextCheckingTypeGrammar), nodeToCheck); 422 422 } 423 423 … … 1974 1974 m_spellingCorrector->applyPendingCorrection(selectionAfterTyping); 1975 1975 1976 TextCheckingOptions textCheckingOptions = 0; 1976 TextCheckingTypeMask textCheckingOptions = 0; 1977 1977 1978 if (isContinuousSpellCheckingEnabled()) 1978 textCheckingOptions |= MarkSpelling;1979 textCheckingOptions |= TextCheckingTypeSpelling; 1979 1980 1980 1981 #if USE(AUTOMATIC_TEXT_REPLACEMENT) … … 1984 1985 || isAutomaticDashSubstitutionEnabled() 1985 1986 || isAutomaticTextReplacementEnabled() 1986 || ((textCheckingOptions & MarkSpelling) && isAutomaticSpellingCorrectionEnabled())))1987 textCheckingOptions |= PerformReplacement;1987 || ((textCheckingOptions & TextCheckingTypeSpelling) && isAutomaticSpellingCorrectionEnabled()))) 1988 textCheckingOptions |= TextCheckingTypeReplacement; 1988 1989 #endif 1989 if (!textCheckingOptions & ( MarkSpelling | PerformReplacement))1990 if (!textCheckingOptions & (TextCheckingTypeSpelling | TextCheckingTypeReplacement)) 1990 1991 return; 1991 1992 1992 1993 if (isGrammarCheckingEnabled()) 1993 textCheckingOptions |= MarkGrammar;1994 textCheckingOptions |= TextCheckingTypeGrammar; 1994 1995 1995 1996 VisibleSelection adjacentWords = VisibleSelection(startOfWord(wordStart, LeftWordIfOnBoundary), endOfWord(wordStart, RightWordIfOnBoundary)); 1996 if (textCheckingOptions & MarkGrammar) {1997 if (textCheckingOptions & TextCheckingTypeGrammar) { 1997 1998 VisibleSelection selectedSentence = VisibleSelection(startOfSentence(wordStart), endOfSentence(wordStart)); 1998 1999 markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, adjacentWords.toNormalizedRange().get(), selectedSentence.toNormalizedRange().get()); … … 2109 2110 } 2110 2111 2111 void Editor::markAllMisspellingsAndBadGrammarInRanges(TextChecking OptionstextCheckingOptions, Range* spellingRange, Range* grammarRange)2112 void Editor::markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeMask textCheckingOptions, Range* spellingRange, Range* grammarRange) 2112 2113 { 2113 2114 #if USE(UNIFIED_TEXT_CHECKING) … … 2115 2116 ASSERT(!m_spellingCorrector->hasPendingCorrection()); 2116 2117 2117 bool shouldMarkSpelling = textCheckingOptions & MarkSpelling;2118 bool shouldMarkGrammar = textCheckingOptions & MarkGrammar;2119 bool shouldPerformReplacement = textCheckingOptions & PerformReplacement;2120 bool shouldShowCorrectionPanel = textCheckingOptions & ShowCorrectionPanel;2121 bool shouldCheckForCorrection = shouldShowCorrectionPanel || (textCheckingOptions & CheckForCorrection);2118 bool shouldMarkSpelling = textCheckingOptions & TextCheckingTypeSpelling; 2119 bool shouldMarkGrammar = textCheckingOptions & TextCheckingTypeGrammar; 2120 bool shouldPerformReplacement = textCheckingOptions & TextCheckingTypeReplacement; 2121 bool shouldShowCorrectionPanel = textCheckingOptions & TextCheckingTypeShowCorrectionPanel; 2122 bool shouldCheckForCorrection = shouldShowCorrectionPanel || (textCheckingOptions & TextCheckingTypeCorrection); 2122 2123 2123 2124 // This function is called with selections already expanded to word boundaries. … … 2166 2167 if (shouldMarkGrammar) 2167 2168 textChecker()->checkTextOfParagraph(grammarParagraph.textCharacters(), grammarParagraph.textLength(), 2168 textCheckingTypeMaskFor(textCheckingOptions), results);2169 resolveTextCheckingTypeMask(textCheckingOptions), results); 2169 2170 else 2170 2171 textChecker()->checkTextOfParagraph(spellingParagraph.textCharacters(), spellingParagraph.textLength(), 2171 textCheckingTypeMaskFor(textCheckingOptions), results);2172 resolveTextCheckingTypeMask(textCheckingOptions), results); 2172 2173 2173 2174 … … 2336 2337 if (!isContinuousSpellCheckingEnabled()) 2337 2338 return; 2338 TextChecking Options textCheckingOptions = MarkSpelling | CheckForCorrection;2339 TextCheckingTypeMask textCheckingOptions = TextCheckingTypeSpelling | TextCheckingTypeCorrection; 2339 2340 if (markGrammar && isGrammarCheckingEnabled()) 2340 textCheckingOptions |= MarkGrammar;2341 textCheckingOptions |= TextCheckingTypeGrammar; 2341 2342 markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, spellingSelection.toNormalizedRange().get(), grammarSelection.toNormalizedRange().get()); 2342 2343 #else … … 3227 3228 } 3228 3229 3229 TextCheckingTypeMask Editor:: textCheckingTypeMaskFor(TextCheckingOptionstextCheckingOptions)3230 { 3231 bool shouldMarkSpelling = textCheckingOptions & MarkSpelling;3232 bool shouldMarkGrammar = textCheckingOptions & MarkGrammar;3233 bool shouldShowCorrectionPanel = textCheckingOptions & ShowCorrectionPanel;3234 bool shouldCheckForCorrection = shouldShowCorrectionPanel || (textCheckingOptions & CheckForCorrection);3230 TextCheckingTypeMask Editor::resolveTextCheckingTypeMask(TextCheckingTypeMask textCheckingOptions) 3231 { 3232 bool shouldMarkSpelling = textCheckingOptions & TextCheckingTypeSpelling; 3233 bool shouldMarkGrammar = textCheckingOptions & TextCheckingTypeGrammar; 3234 bool shouldShowCorrectionPanel = textCheckingOptions & TextCheckingTypeShowCorrectionPanel; 3235 bool shouldCheckForCorrection = shouldShowCorrectionPanel || (textCheckingOptions & TextCheckingTypeCorrection); 3235 3236 3236 3237 TextCheckingTypeMask checkingTypes = 0; … … 3243 3244 3244 3245 #if USE(AUTOMATIC_TEXT_REPLACEMENT) 3245 bool shouldPerformReplacement = textCheckingOptions & PerformReplacement;3246 bool shouldPerformReplacement = textCheckingOptions & TextCheckingTypeReplacement; 3246 3247 if (shouldPerformReplacement) { 3247 3248 if (isAutomaticLinkDetectionEnabled()) -
trunk/Source/WebCore/editing/Editor.h
r86295 r86520 224 224 void markMisspellingsAndBadGrammar(const VisibleSelection& spellingSelection, bool markGrammar, const VisibleSelection& grammarSelection); 225 225 226 enum TextCheckingOptionFlags {227 MarkSpelling = 1 << 0,228 MarkGrammar = 1 << 1,229 PerformReplacement = 1 << 2,230 ShowCorrectionPanel = 1 << 3,231 CheckForCorrection = 1 << 4,232 };233 typedef unsigned TextCheckingOptions;234 235 226 #if USE(AUTOMATIC_TEXT_REPLACEMENT) 236 227 void uppercaseWord(); … … 252 243 #endif 253 244 254 void markAllMisspellingsAndBadGrammarInRanges(TextChecking Options, Range* spellingRange, Range* grammarRange);245 void markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeMask, Range* spellingRange, Range* grammarRange); 255 246 void changeBackToReplacedString(const String& replacedString); 256 247 … … 415 406 void revealSelectionAfterEditingOperation(); 416 407 void markMisspellingsOrBadGrammar(const VisibleSelection&, bool checkSpelling, RefPtr<Range>& firstMisspellingRange); 417 TextCheckingTypeMask textCheckingTypeMaskFor(TextCheckingOptions);408 TextCheckingTypeMask resolveTextCheckingTypeMask(TextCheckingTypeMask); 418 409 419 410 void selectComposition(); -
trunk/Source/WebCore/platform/text/TextChecking.h
r85036 r86520 48 48 TextCheckingTypeDash = 1 << 7, 49 49 TextCheckingTypeReplacement = 1 << 8, 50 TextCheckingTypeCorrection = 1 << 9 50 TextCheckingTypeCorrection = 1 << 9, 51 TextCheckingTypeShowCorrectionPanel = 1 << 10 51 52 }; 52 53
Note: See TracChangeset
for help on using the changeset viewer.