RESOLVED FIXED 57862
WebKit2: Implement TextChecker on Windows
https://bugs.webkit.org/show_bug.cgi?id=57862
Summary WebKit2: Implement TextChecker on Windows
Jessie Berlin
Reported 2011-04-05 10:32:38 PDT
Attachments
Patch (Part 1) (25.43 KB, patch)
2011-04-05 13:33 PDT, Jessie Berlin
no flags
Patch (Part 2) (4.66 KB, patch)
2011-04-06 10:57 PDT, Jessie Berlin
no flags
Patch (Part 3) (14.20 KB, patch)
2011-04-06 18:02 PDT, Jessie Berlin
no flags
Patch (Part 3) Take 2 - attempt to fix Qt build (14.29 KB, patch)
2011-04-07 08:12 PDT, Jessie Berlin
no flags
Patch (Part 4) (27.49 KB, patch)
2011-04-07 15:50 PDT, Jessie Berlin
no flags
Patch (Part 5) (14.11 KB, patch)
2011-04-08 16:19 PDT, Jessie Berlin
no flags
Patch (Part 6) (26.72 KB, patch)
2011-04-10 18:37 PDT, Jessie Berlin
no flags
Part 7 (12.72 KB, patch)
2011-04-11 13:40 PDT, Jessie Berlin
no flags
Jessie Berlin
Comment 1 2011-04-05 13:33:05 PDT
Created attachment 88302 [details] Patch (Part 1)
Anders Carlsson
Comment 2 2011-04-05 17:04:25 PDT
Comment on attachment 88302 [details] Patch (Part 1) View in context: https://bugs.webkit.org/attachment.cgi?id=88302&action=review > Source/WebKit2/UIProcess/API/C/win/WKTextChecker.cpp:37 > +WKTypeID WKTextCheckerGetTypeID() > +{ > + return toAPI(APIObject::TypeTextChecker); > +} This function isn't needed.
Jessie Berlin
Comment 3 2011-04-05 20:29:29 PDT
(In reply to comment #2) > (From update of attachment 88302 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=88302&action=review > > > Source/WebKit2/UIProcess/API/C/win/WKTextChecker.cpp:37 > > +WKTypeID WKTextCheckerGetTypeID() > > +{ > > + return toAPI(APIObject::TypeTextChecker); > > +} > > This function isn't needed. Removed. Thanks for the review!
Jessie Berlin
Comment 4 2011-04-06 08:19:10 PDT
Jessie Berlin
Comment 5 2011-04-06 10:57:00 PDT
Created attachment 88468 [details] Patch (Part 2)
Anders Carlsson
Comment 6 2011-04-06 12:08:11 PDT
Comment on attachment 88468 [details] Patch (Part 2) View in context: https://bugs.webkit.org/attachment.cgi?id=88468&action=review > Source/WebKit2/UIProcess/win/WebTextCheckerClient.cpp:73 > + if (!m_client.uniqueSpellDocumentTag) Do we really need to check for null here? > Source/WebKit2/UIProcess/win/WebTextCheckerClient.cpp:81 > + if (!m_client.closeSpellDocumentWithTag) Ditto.
Jessie Berlin
Comment 7 2011-04-06 12:15:24 PDT
(In reply to comment #6) > (From update of attachment 88468 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=88468&action=review > > > Source/WebKit2/UIProcess/win/WebTextCheckerClient.cpp:73 > > + if (!m_client.uniqueSpellDocumentTag) > > Do we really need to check for null here? > > > Source/WebKit2/UIProcess/win/WebTextCheckerClient.cpp:81 > > + if (!m_client.closeSpellDocumentWithTag) > > Ditto. I talked with Anders on IRC and he said this was my call. I think I am going to leave the null checks in for parity with other clients and in case someone else ends up using it.
Jessie Berlin
Comment 8 2011-04-06 12:59:28 PDT
Jessie Berlin
Comment 9 2011-04-06 18:02:46 PDT
Created attachment 88552 [details] Patch (Part 3)
Early Warning System Bot
Comment 10 2011-04-06 18:12:48 PDT
Adam Roben (:aroben)
Comment 11 2011-04-07 05:01:55 PDT
Looks like you need to fix Qt.
Jessie Berlin
Comment 12 2011-04-07 08:12:33 PDT
Created attachment 88640 [details] Patch (Part 3) Take 2 - attempt to fix Qt build
Adam Roben (:aroben)
Comment 13 2011-04-07 10:36:08 PDT
Comment on attachment 88640 [details] Patch (Part 3) Take 2 - attempt to fix Qt build View in context: https://bugs.webkit.org/attachment.cgi?id=88640&action=review Seems like there are really two things going on here: 1) Add USE(UNIFIED_TEXT_CHECKING) guards where appropriate 2) Plumb checkSpellingOfString through to the UI process Separating those into two separate patches would be slightly clearer. But I'll review as-is. > Source/WebKit2/UIProcess/mac/TextCheckerMac.mm:303 > +void TextChecker::checkSpellingOfString(int64_t, const UChar*, uint32_t, int32_t&, int32_t&) > +{ > + notImplemented(); > +} Will this ever be called on Mac (given that WebKit2 doesn't run on Leopard or Tiger)? If not, I'd replace use ASSERT_NOT_REACHED() instead of notImplemented(). > Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp:401 > -void WebEditorClient::checkSpellingOfString(const UChar*, int, int*, int*) > +void WebEditorClient::checkSpellingOfString(const UChar* text, int length, int* misspellingLocation, int* misspellingLength) How is it possible to change this without making a similar change in the .h file?
Jessie Berlin
Comment 14 2011-04-07 10:49:57 PDT
(In reply to comment #13) > (From update of attachment 88640 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=88640&action=review > > Seems like there are really two things going on here: > > 1) Add USE(UNIFIED_TEXT_CHECKING) guards where appropriate > 2) Plumb checkSpellingOfString through to the UI process > > Separating those into two separate patches would be slightly clearer. But I'll review as-is. My apologies. Thanks for reviewing! > > > Source/WebKit2/UIProcess/mac/TextCheckerMac.mm:303 > > +void TextChecker::checkSpellingOfString(int64_t, const UChar*, uint32_t, int32_t&, int32_t&) > > +{ > > + notImplemented(); > > +} > > Will this ever be called on Mac (given that WebKit2 doesn't run on Leopard or Tiger)? If not, I'd replace use ASSERT_NOT_REACHED() instead of notImplemented(). It may, because checkSpellingOfStrings is called from a bunch of places that are not compiled out even if USE(UNIFIED_TEXT_CHECKING) is false. > > > Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp:401 > > -void WebEditorClient::checkSpellingOfString(const UChar*, int, int*, int*) > > +void WebEditorClient::checkSpellingOfString(const UChar* text, int length, int* misspellingLocation, int* misspellingLength) > > How is it possible to change this without making a similar change in the .h file? This signature matches that in the header file. I just filled in the parameter names :)
Jessie Berlin
Comment 15 2011-04-07 11:06:33 PDT
Comment on attachment 88640 [details] Patch (Part 3) Take 2 - attempt to fix Qt build Committed in http://trac.webkit.org/changeset/83188
Jessie Berlin
Comment 16 2011-04-07 15:50:12 PDT
Created attachment 88719 [details] Patch (Part 4)
Brian Weinstein
Comment 17 2011-04-07 16:59:41 PDT
Comment on attachment 88719 [details] Patch (Part 4) View in context: https://bugs.webkit.org/attachment.cgi?id=88719&action=review > Source/WebKit2/Shared/APIObject.h:110 > + TypeGrammarDetail Is there any sorting to these? If so, GrammarDetail should go above TextChecker. > Source/WebKit2/UIProcess/API/C/win/WKTextChecker.h:44 > +typedef void (*WKTextcheckerCheckGrammarOfString)(uint64_t tag, WKStringRef text, WKArrayRef* grammarDetails, int32_t* badGrammarLocation, int32_t* badGrammarLength, const void *clientInfo); Missing a capital C in WKTextcheckerCheckGrammarOfString. > Source/WebKit2/UIProcess/API/C/win/WKTextChecker.h:57 > + WKTextcheckerCheckGrammarOfString checkGrammarOfString; Ditto about missing capital C. > Source/WebKit2/UIProcess/mac/TextCheckerMac.mm:307 > + notImplemented(); A note saying where Mac implements this would be nice, since it seems like the Mac could implement it here. > Source/WebKit2/UIProcess/win/WebTextCheckerClient.cpp:102 > +{ Do you want to make sure that grammarDetails is empty when it is passed in? Or does it not matter? > Source/WebKit2/UIProcess/win/WebTextCheckerClient.cpp:103 > + if (!m_client.checkSpellingOfString) This should probably be if (!m_client.checkGrammarOfString) > Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp:420 > + int32_t resultLocation = -1; Could we use the NotFound value in WTF/NotFound.h for this?
Jessie Berlin
Comment 18 2011-04-07 17:16:32 PDT
(In reply to comment #17) > (From update of attachment 88719 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=88719&action=review > > > Source/WebKit2/Shared/APIObject.h:110 > > + TypeGrammarDetail > > Is there any sorting to these? If so, GrammarDetail should go above TextChecker. Not particularly (TypeView was already before TypeEditCommandProxy), but I sorted them (within each category). > > > Source/WebKit2/UIProcess/API/C/win/WKTextChecker.h:44 > > +typedef void (*WKTextcheckerCheckGrammarOfString)(uint64_t tag, WKStringRef text, WKArrayRef* grammarDetails, int32_t* badGrammarLocation, int32_t* badGrammarLength, const void *clientInfo); > > Missing a capital C in WKTextcheckerCheckGrammarOfString. Whoops! Fixed. > > > Source/WebKit2/UIProcess/API/C/win/WKTextChecker.h:57 > > + WKTextcheckerCheckGrammarOfString checkGrammarOfString; > > Ditto about missing capital C. Fixed. > > > Source/WebKit2/UIProcess/mac/TextCheckerMac.mm:307 > > + notImplemented(); > > A note saying where Mac implements this would be nice, since it seems like the Mac could implement it here. The Mac does not implement this. Instead, it implements checkTextOfParagraph. I will add a comment here and in checkSpellingOfString. > > > Source/WebKit2/UIProcess/win/WebTextCheckerClient.cpp:102 > > +{ > > Do you want to make sure that grammarDetails is empty when it is passed in? Or does it not matter? I don't think that matters. > > > Source/WebKit2/UIProcess/win/WebTextCheckerClient.cpp:103 > > + if (!m_client.checkSpellingOfString) > > This should probably be if (!m_client.checkGrammarOfString) Yes! Thanks for catching that. Fixed. > > > Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp:420 > > + int32_t resultLocation = -1; > > Could we use the NotFound value in WTF/NotFound.h for this? Yes, also changed checkSpellingOfString to use this.
Jessie Berlin
Comment 19 2011-04-07 17:44:15 PDT
Adam Roben (:aroben)
Comment 20 2011-04-08 06:17:01 PDT
Comment on attachment 88719 [details] Patch (Part 4) View in context: https://bugs.webkit.org/attachment.cgi?id=88719&action=review >>> Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp:420 >>> + int32_t resultLocation = -1; >> >> Could we use the NotFound value in WTF/NotFound.h for this? > > Yes, also changed checkSpellingOfString to use this. notFound is a size_t, not an int32_t. I wouldn't be surprised if this caused compiler warnings/errors on some platforms. But maybe it will be fine. At the very least it seems a little strange.
Jessie Berlin
Comment 21 2011-04-08 06:50:54 PDT
(In reply to comment #20) > (From update of attachment 88719 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=88719&action=review > > >>> Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp:420 > >>> + int32_t resultLocation = -1; > >> > >> Could we use the NotFound value in WTF/NotFound.h for this? > > > > Yes, also changed checkSpellingOfString to use this. > > notFound is a size_t, not an int32_t. I wouldn't be surprised if this caused compiler warnings/errors on some platforms. But maybe it will be fine. At the very least it seems a little strange. It did on Mac, and I changed it back to -1.
Jessie Berlin
Comment 22 2011-04-08 16:19:58 PDT
Created attachment 88892 [details] Patch (Part 5)
Jessie Berlin
Comment 23 2011-04-08 17:22:44 PDT
Jessie Berlin
Comment 24 2011-04-10 18:37:48 PDT
Created attachment 88962 [details] Patch (Part 6)
Jessie Berlin
Comment 25 2011-04-11 12:52:25 PDT
Jessie Berlin
Comment 26 2011-04-11 13:40:35 PDT
Jessie Berlin
Comment 27 2011-04-11 14:34:25 PDT
Jessie Berlin
Comment 28 2011-04-11 14:35:47 PDT
Part 7 dealt with the last of the TextCheckerWin stubs. There are some remaining TextChecker bugs, but I will deal with those separately.
Note You need to log in before you can comment on or make changes to this bug.