RESOLVED FIXED 47885
[Win][DRT] should have LayoutTestController.hasSpellingMarker()
https://bugs.webkit.org/show_bug.cgi?id=47885
Summary [Win][DRT] should have LayoutTestController.hasSpellingMarker()
Hajime Morrita
Reported 2010-10-18 23:15:57 PDT
Implement LayoutTestController.hasSpellingMarker() on windows port.
Attachments
Patch (8.61 KB, patch)
2010-10-19 06:50 PDT, Hajime Morrita
no flags
Patch (7.39 KB, patch)
2010-10-19 20:24 PDT, Hajime Morrita
no flags
Patch (8.30 KB, patch)
2010-10-21 20:49 PDT, Hajime Morrita
tkent: review+
Hajime Morrita
Comment 1 2010-10-19 06:50:43 PDT
Hajime Morrita
Comment 2 2010-10-19 06:51:55 PDT
The word list is ported from Chromium's MockSpellChecker which is used to Chromium DRT and known to work.
Ryosuke Niwa
Comment 3 2010-10-19 09:33:11 PDT
Comment on attachment 71162 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=71162&action=review > WebKitTools/DumpRenderTree/win/EditingDelegate.cpp:357 > +static int findIndexOfAlpha(const TCHAR* str) Please spell out alphabet. indexOfFirstAlphabet sounds better. > WebKitTools/DumpRenderTree/win/EditingDelegate.cpp:365 > +static int findIndexOfNonAlpha(const TCHAR* str) Ditto. > WebKitTools/DumpRenderTree/win/EditingDelegate.cpp:410 > + // The following words are used by unit tests. > + TEXT("ifmmp"), > + TEXT("qwertyuiopasd"), > + TEXT("qwertyuiopasdf"), Aren't these chromium specific misspelled words?
Hajime Morrita
Comment 4 2010-10-19 20:24:29 PDT
Hajime Morrita
Comment 5 2010-10-19 20:25:45 PDT
Hi Ryosuke, thank you for taking a look! I updated the patch. > > WebKitTools/DumpRenderTree/win/EditingDelegate.cpp:357 > > +static int findIndexOfAlpha(const TCHAR* str) > > Please spell out alphabet. indexOfFirstAlphabet sounds better. Done. > > > WebKitTools/DumpRenderTree/win/EditingDelegate.cpp:365 > > +static int findIndexOfNonAlpha(const TCHAR* str) > > Ditto. Done. > > > WebKitTools/DumpRenderTree/win/EditingDelegate.cpp:410 > > + // The following words are used by unit tests. > > + TEXT("ifmmp"), > > + TEXT("qwertyuiopasd"), > > + TEXT("qwertyuiopasdf"), > > Aren't these chromium specific misspelled words? Yes, I removed them.
Ryosuke Niwa
Comment 6 2010-10-19 20:32:16 PDT
Comment on attachment 71242 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=71242&action=review > WebKitTools/DumpRenderTree/win/EditingDelegate.cpp:371 > +static int indexOfFirstNonAlphabet(const TCHAR* text) > +{ > + const TCHAR* cursor = text; > + while (*cursor && isalpha(*cursor)) > + ++cursor; > + return *cursor ? (cursor - text) : -1; > +}; Might be better to rename text to startOfWord and rename this function to lengthOfWord? "first non-alphabet" sounds confusing. If we do that, we can modify this function to always return cursor - text. > WebKitTools/DumpRenderTree/win/EditingDelegate.cpp:416 > + if (-1 == wordLength) > + wordLength = textString.size() - wordStart; so that we can get rid of these two statements.
Kent Tamura
Comment 7 2010-10-21 19:10:16 PDT
Comment on attachment 71242 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=71242&action=review > WebKitTools/DumpRenderTree/win/EditingDelegate.cpp:357 > +static int indexOfFirstAlphabet(const TCHAR* text) The function names should be indexOfFirstWordCharacter because misspelled words might contain digits in the future. We don't need to change the implementation for now. > WebKitTools/DumpRenderTree/win/EditingDelegate.cpp:365 > +static int indexOfFirstNonAlphabet(const TCHAR* text) ditto. This should be indexOfFirstNonWordCharacter, or lengthOfWord as Niwa-san's suggestion.
Hajime Morrita
Comment 8 2010-10-21 20:49:01 PDT
Hajime Morrita
Comment 9 2010-10-21 20:50:00 PDT
Nisa-san, Kent-san, thank you for reviewing this! I update the patch. > > WebKitTools/DumpRenderTree/win/EditingDelegate.cpp:357 > > +static int indexOfFirstAlphabet(const TCHAR* text) > > The function names should be indexOfFirstWordCharacter because misspelled words might contain digits in the future. > We don't need to change the implementation for now. Agreed and renamed. > > > WebKitTools/DumpRenderTree/win/EditingDelegate.cpp:365 > > +static int indexOfFirstNonAlphabet(const TCHAR* text) > > ditto. This should be indexOfFirstNonWordCharacter, or lengthOfWord as Niwa-san's suggestion. Done.
Kent Tamura
Comment 10 2010-10-21 22:28:43 PDT
Comment on attachment 71522 [details] Patch Looks good.
Hajime Morrita
Comment 11 2010-10-21 22:35:38 PDT
Note You need to log in before you can comment on or make changes to this bug.