Changeset 143192 in webkit
- Timestamp:
- Feb 18, 2013 3:33:43 AM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r143188 r143192 1 2013-02-18 Grzegorz Czajkowski <g.czajkowski@samsung.com> 2 3 [WK2][EFL] Unified text checker implementation 4 https://bugs.webkit.org/show_bug.cgi?id=107682 5 6 Reviewed by Anders Carlsson. 7 8 No new tests, covered by editing/spelling tests. 9 10 * platform/text/TextChecking.h: 11 (WebCore): 12 Enabling unified text checker feature for WebKit-EFL. 13 1 14 2013-02-18 Nico Weber <thakis@chromium.org> 2 15 -
trunk/Source/WebCore/platform/text/TextChecking.h
r141387 r143192 40 40 #define WTF_USE_GRAMMAR_CHECKING 1 41 41 42 #if (PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060)) || PLATFORM(BLACKBERRY) 42 #if (PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060)) || PLATFORM(BLACKBERRY) || PLATFORM(EFL) 43 43 #define WTF_USE_UNIFIED_TEXT_CHECKING 1 44 44 #endif -
trunk/Source/WebKit/efl/ChangeLog
r142977 r143192 1 2013-02-18 Grzegorz Czajkowski <g.czajkowski@samsung.com> 2 3 [WK2][EFL] Unified text checker implementation 4 https://bugs.webkit.org/show_bug.cgi?id=107682 5 6 Reviewed by Anders Carlsson. 7 8 Add an empty checkTextOfParagraph implementation for WK1-EFL 9 to do not break build when WTF_USE_UNIFIED_TEXT_CHECKING 10 is enabled. 11 12 * WebCoreSupport/EditorClientEfl.h: 13 (EditorClientEfl): 14 (WebCore::EditorClientEfl::checkTextOfParagraph): 15 1 16 2013-02-15 Allan Sandfeld Jensen <allan.jensen@digia.com> 2 17 -
trunk/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.h
r142576 r143192 151 151 virtual void setInputMethodState(bool enabled); 152 152 virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>) { } 153 #if USE(UNIFIED_TEXT_CHECKING) 154 virtual void checkTextOfParagraph(const UChar*, int, TextCheckingTypeMask, Vector<TextCheckingResult>&) { } 155 #endif 153 156 virtual TextCheckerClient* textChecker() { return this; } 154 157 -
trunk/Source/WebKit2/ChangeLog
r143190 r143192 1 2013-02-18 Grzegorz Czajkowski <g.czajkowski@samsung.com> 2 3 [WK2][EFL] Unified text checker implementation 4 https://bugs.webkit.org/show_bug.cgi?id=107682 5 6 Reviewed by Anders Carlsson. 7 8 * UIProcess/efl/TextCheckerEfl.cpp: 9 (WebKit): 10 (WebKit::nextWordOffset): 11 Helper function to determine the word offset to do not call 12 client's checkSpellingOfString for the word separators. 13 14 (WebKit::TextChecker::checkTextOfParagraph): 15 Allow to check spelling for multiple words, 16 their misspelling location and length are saved to the vector. 17 18 * WebProcess/WebCoreSupport/WebEditorClient.h: 19 Add UNIFIED_TEXT_CHECKING guard to checkTextOfParagraph. 20 21 * WebProcess/WebCoreSupport/efl/WebEditorClientEfl.cpp: 22 (WebKit): 23 (WebKit::WebEditorClient::checkTextOfParagraph): 24 As spelling implementation is exposed to UIProcess, 25 send a meesage to UIProcess to call TextChecker::checkTextOfParagraph. 26 1 27 2013-02-18 Christophe Dumez <ch.dumez@sisa.samsung.com> 2 28 -
trunk/Source/WebKit2/UIProcess/efl/TextCheckerEfl.cpp
r141387 r143192 32 32 33 33 #if ENABLE(SPELLCHECK) 34 #include "TextBreakIterator.h" 34 35 #include "WebTextChecker.h" 35 36 #endif … … 124 125 #endif 125 126 } 127 128 #if USE(UNIFIED_TEXT_CHECKING) 129 static int nextWordOffset(const UChar* text, int length, int currentOffset) 130 { 131 // FIXME: avoid creating textIterator object here, it could be passed as a parameter. 132 // isTextBreak() leaves the iterator pointing to the first boundary position at 133 // or after "offset" (ubrk_isBoundary side effect). 134 // For many word separators, the method doesn't properly determine the boundaries 135 // without resetting the iterator. 136 TextBreakIterator* textIterator = wordBreakIterator(text, length); 137 if (!textIterator) 138 return currentOffset; 139 140 int wordOffset = currentOffset; 141 while (wordOffset < length && isTextBreak(textIterator, wordOffset)) 142 ++wordOffset; 143 144 // Do not treat the word's boundary as a separator. 145 if (!currentOffset && wordOffset == 1) 146 return currentOffset; 147 148 // Omit multiple separators. 149 if ((wordOffset - currentOffset) > 1) 150 --wordOffset; 151 152 return wordOffset; 153 } 154 155 Vector<TextCheckingResult> TextChecker::checkTextOfParagraph(int64_t spellDocumentTag, const UChar* text, int length, uint64_t checkingTypes) 156 { 157 Vector<TextCheckingResult> paragraphCheckingResult; 158 #if ENABLE(SPELLCHECK) 159 if (checkingTypes & TextCheckingTypeSpelling) { 160 TextBreakIterator* textIterator = wordBreakIterator(text, length); 161 if (!textIterator) 162 return paragraphCheckingResult; 163 164 // Omit the word separators at the beginning/end of the text to don't unnecessarily 165 // involve the client to check spelling for them. 166 int offset = nextWordOffset(text, length, 0); 167 int lengthStrip = length; 168 while (lengthStrip > 0 && isTextBreak(textIterator, lengthStrip - 1)) 169 --lengthStrip; 170 171 while (offset >= 0 && offset < lengthStrip) { 172 int32_t misspellingLocation = -1; 173 int32_t misspellingLength = 0; 174 checkSpellingOfString(spellDocumentTag, text + offset, lengthStrip - offset, misspellingLocation, misspellingLength); 175 if (!misspellingLength) 176 break; 177 178 TextCheckingResult misspellingResult; 179 misspellingResult.type = TextCheckingTypeSpelling; 180 misspellingResult.location = offset + misspellingLocation; 181 misspellingResult.length = misspellingLength; 182 paragraphCheckingResult.append(misspellingResult); 183 offset += misspellingLocation + misspellingLength; 184 // Generally, we end up checking at the word separator, move to the adjacent word. 185 offset = nextWordOffset(text, lengthStrip, offset); 186 } 187 } 188 #else 189 UNUSED_PARAM(spellDocumentTag); 190 UNUSED_PARAM(text); 191 UNUSED_PARAM(length); 192 UNUSED_PARAM(checkingTypes); 193 #endif 194 return paragraphCheckingResult; 195 } 196 #endif 126 197 127 198 void TextChecker::checkSpellingOfString(int64_t spellDocumentTag, const UChar* text, uint32_t length, int32_t& misspellingLocation, int32_t& misspellingLength) -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h
r142908 r143192 143 143 virtual String getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord) OVERRIDE; 144 144 virtual void checkGrammarOfString(const UChar*, int length, Vector<WebCore::GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength) OVERRIDE; 145 #if PLATFORM(MAC)145 #if USE(UNIFIED_TEXT_CHECKING) 146 146 virtual void checkTextOfParagraph(const UChar* text, int length, WebCore::TextCheckingTypeMask checkingTypes, Vector<WebCore::TextCheckingResult>& results) OVERRIDE; 147 147 #endif -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebEditorClientEfl.cpp
r141387 r143192 61 61 } 62 62 63 #if USE(UNIFIED_TEXT_CHECKING) 64 void WebEditorClient::checkTextOfParagraph(const UChar* text, int length, WebCore::TextCheckingTypeMask checkingTypes, Vector<TextCheckingResult>& results) 65 { 66 m_page->sendSync(Messages::WebPageProxy::CheckTextOfParagraph(String(text, length), checkingTypes), Messages::WebPageProxy::CheckTextOfParagraph::Reply(results)); 63 67 } 68 #endif 69 70 }
Note: See TracChangeset
for help on using the changeset viewer.