RESOLVED FIXED 73971
[Chromium] WebFrame should have an interface to invoke spellchecking in arbitrarily
https://bugs.webkit.org/show_bug.cgi?id=73971
Summary [Chromium] WebFrame should have an interface to invoke spellchecking in arbit...
Shinya Kawanaka
Reported 2011-12-06 18:24:41 PST
We should have an interface to invoke spellchecking to implement the following chromium issue. http://code.google.com/p/chromium/issues/detail?id=21225
Attachments
Patch (3.42 KB, patch)
2011-12-11 23:08 PST, Shinya Kawanaka
no flags
Patch (5.53 KB, patch)
2011-12-13 03:21 PST, Shinya Kawanaka
no flags
Patch (5.43 KB, patch)
2011-12-18 23:21 PST, Shinya Kawanaka
no flags
Patch for landing (5.41 KB, patch)
2012-01-19 18:52 PST, Shinya Kawanaka
no flags
Patch for landing (5.43 KB, patch)
2012-01-19 19:02 PST, Shinya Kawanaka
no flags
Shinya Kawanaka
Comment 1 2011-12-11 23:08:16 PST
WebKit Review Bot
Comment 2 2011-12-11 23:11:31 PST
Please wait for approval from fishd@chromium.org before submitting because this patch contains changes to the Chromium public API.
Darin Fisher (:fishd, Google)
Comment 3 2011-12-12 17:02:25 PST
Comment on attachment 118737 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=118737&action=review > Source/WebKit/chromium/public/WebFrame.h:421 > + virtual void requestTextChecking() = 0; This looks a lot like the WebSpellCheckClient::requestCheckingOfText method, although I realize that they are totally different. It seems unfortunate for those two methods, which are different, to have such similar names. This seems to be a fairly high-level function. It appears to initiate a spelling and grammar check of the selected editable text. What if there is no selection? Does it spell check anything in that case? What if there is nothing editable in the current selection? Maybe answering some of these questions could help us consider a better name for this function?
Shinya Kawanaka
Comment 4 2011-12-13 03:21:57 PST
Shinya Kawanaka
Comment 5 2011-12-13 03:30:51 PST
> This looks a lot like the WebSpellCheckClient::requestCheckingOfText method, > although I realize that they are totally different. It seems unfortunate > for those two methods, which are different, to have such similar names. The method of WebspellCheckClient is used to request spellchecking from WebKit to chromium, and my method is used to request spellchecking from chromium to WebKit. The former method is just to spellchecking, and the latter method does spellchecking and adding misspelling markers. > This seems to be a fairly high-level function. Yeah, I'm now thinking so, too... So now I changed the code to give a node to the method. > It appears to initiate a > spelling and grammar check of the selected editable text. What if there > is no selection? Does it spell check anything in that case? What if > there is nothing editable in the current selection? Maybe answering > some of these questions could help us consider a better name for this > function? Actually what I want to solve by this patch is: http://code.google.com/p/chromium/issues/detail?id=21225 Just for your information, I uploaded Chromium side patch in http://codereview.chromium.org/8907016/ So what I want to do in this function is to spellcheck some area in the document (not just selected text). If there is no node to spellcheck, this method should return immediately.
Darin Fisher (:fishd, Google)
Comment 6 2011-12-16 16:40:47 PST
Comment on attachment 118994 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=118994&action=review > Source/WebKit/chromium/public/WebFrame.h:421 > + virtual void requestTextChecking(const WebNode&) = 0; maybe this should take a WebElement instead? from the chrome side, how do you know which WebFrame to call this function on? what if the focused editable content is actually in a different frame? are you using WebView::focusedFrame() for that? > Source/WebKit/chromium/public/WebNode.h:113 > + WEBKIT_EXPORT WebElement rootEditableElement() const; it seems wrong for WebNode to know about elements. maybe this should be a function on WebElement?
Shinya Kawanaka
Comment 7 2011-12-18 20:55:41 PST
(In reply to comment #6) > (From update of attachment 118994 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=118994&action=review > > > Source/WebKit/chromium/public/WebFrame.h:421 > > + virtual void requestTextChecking(const WebNode&) = 0; > > maybe this should take a WebElement instead? Thanks. It seems better. > > from the chrome side, how do you know which WebFrame to call this > function on? what if the focused editable content is actually in > a different frame? are you using WebView::focusedFrame() for that? Yes. Does it have any problem? If so, please let me know. > > > Source/WebKit/chromium/public/WebNode.h:113 > > + WEBKIT_EXPORT WebElement rootEditableElement() const; > > it seems wrong for WebNode to know about elements. maybe this should be a function > on WebElement? When considering TextNode, it seems natural that it knows rootEditableElement, I think.
Shinya Kawanaka
Comment 8 2011-12-18 23:21:17 PST
Eric Seidel (no email)
Comment 9 2011-12-21 12:11:18 PST
Darin is your man.
Darin Fisher (:fishd, Google)
Comment 10 2012-01-18 15:33:30 PST
(In reply to comment #7) > > from the chrome side, how do you know which WebFrame to call this > > function on? what if the focused editable content is actually in > > a different frame? are you using WebView::focusedFrame() for that? > > Yes. Does it have any problem? If so, please let me know. It should be fine. I just wanted to make sure I understood the full picture. > > > Source/WebKit/chromium/public/WebNode.h:113 > > > + WEBKIT_EXPORT WebElement rootEditableElement() const; > > > > it seems wrong for WebNode to know about elements. maybe this should be a function > > on WebElement? > > When considering TextNode, it seems natural that it knows rootEditableElement, I think. OK, I see. That makes sense.
Darin Fisher (:fishd, Google)
Comment 11 2012-01-18 15:36:24 PST
Comment on attachment 119825 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=119825&action=review > Source/WebKit/chromium/src/WebFrameImpl.cpp:1306 > + RefPtr<Range> rangeToCheck = rangeOfContents(static_cast<PassRefPtr<Element> >(webElem).get()); nit: use the WebNode::unwrap helper function here. RefPtr<Range> rangeToCheck = rangeOfContents(webElem.unwrap<Element>.get());
Shinya Kawanaka
Comment 12 2012-01-19 18:52:19 PST
Created attachment 123239 [details] Patch for landing
Shinya Kawanaka
Comment 13 2012-01-19 19:02:36 PST
Created attachment 123241 [details] Patch for landing
WebKit Review Bot
Comment 14 2012-01-20 00:42:43 PST
Comment on attachment 123241 [details] Patch for landing Clearing flags on attachment: 123241 Committed r105489: <http://trac.webkit.org/changeset/105489>
WebKit Review Bot
Comment 15 2012-01-20 00:42:48 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.