Bug 69242

Summary: Unified spell-checking and legacy spell checking should be easy to switch
Product: WebKit Reporter: Shinya Kawanaka <shinyak>
Component: HTML EditingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: morrita, shinyak, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 69128    
Attachments:
Description Flags
Test Patch
none
Patch
none
Patch
none
Patch none

Description Shinya Kawanaka 2011-10-02 22:53:13 PDT
Editor class has two difference code paths for spell-checking:
(1) checkTextOfParagraph() for Snow Leopard or later
(2) checkSpellingOfString() and checkGrammarOfString() for other platforms.
These paths should be unified so that improving spell-checking code is easy.

After 69241 is resolved, static #if-statement USE(UNIFIED_TEXT_CHECKING) in WebCore should be converted to dynamic if-statement so that using checkTextOfParagraph() becomes easy in non-SL or non-Lion platform.
Comment 1 Shinya Kawanaka 2011-10-11 02:46:41 PDT
Created attachment 110490 [details]
Test Patch
Comment 2 WebKit Review Bot 2011-10-11 02:49:24 PDT
Attachment 110490 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/CMakeLists.txt', u'Source/W..." exit_code: 1

Source/WebCore/editing/TextCheckingHelper.h:99:  The parameter name "frame" adds no information, so it should be removed.  [readability/parameter_name] [5]
Total errors found: 1 in 12 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Shinya Kawanaka 2011-10-12 03:56:51 PDT
Created attachment 110661 [details]
Patch
Comment 4 Hajime Morrita 2011-10-16 22:02:01 PDT
Comment on attachment 110661 [details]
Patch

Hi, Thanks for doing this!
WebKit generally prefers early-return style instead of if-else. 
In this case, it also helps to keep diff small.
Comment 5 Shinya Kawanaka 2011-10-17 04:28:42 PDT
Created attachment 111242 [details]
Patch
Comment 6 Shinya Kawanaka 2011-10-17 04:29:46 PDT
(In reply to comment #4)
> (From update of attachment 110661 [details])
> Hi, Thanks for doing this!
> WebKit generally prefers early-return style instead of if-else. 
> In this case, it also helps to keep diff small.

Hi, I tried to keep early-return style as much as possible.
If not enough, please tell me...
Comment 7 Hajime Morrita 2011-10-17 04:47:35 PDT
Comment on attachment 111242 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=111242&action=review

Generally looks fine. Could you take these small cleanup?

> Source/WebCore/editing/Editor.cpp:1682
> +    if (unifiedTextCheckerEnabled(m_frame)) {

Could you wrap this conditional as a Editor method?

> Source/WebCore/editing/Editor.cpp:2040
> +    }

Why not simply ASSERT(unifiedTextCheckerEnabled(m_frame)) ?

> Source/WebCore/editing/Editor.cpp:2239
> +    }

Ditto.

> Source/WebCore/editing/TextCheckingHelper.cpp:230
> +    if (!m_range || !unifiedTextCheckerEnabled(m_range->ownerDocument()->frame()))

Could you extract this criteria as a method of TextCheckingHelper?

> Source/WebCore/editing/TextCheckingHelper.cpp:509
> +    if (!m_range || !unifiedTextCheckerEnabled(m_range->ownerDocument()->frame()))

Ditto.

> Source/WebCore/editing/TextCheckingHelper.h:30
> +class Settings;

It looks we don't need this.
Comment 8 Shinya Kawanaka 2011-10-17 05:42:14 PDT
Created attachment 111251 [details]
Patch
Comment 9 WebKit Review Bot 2011-10-17 05:46:00 PDT
Attachment 111251 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/update-webkit', '--chromium']" exit_code: 2

Updating OpenSource
Current branch master is up to date.
Updating chromium port dependencies using gclient...
Error: Can't switch the checkout to http://v8.googlecode.com/svn/branches/3.6@9637; UUID don't match and there is local changes in /mnt/git/webkit-style-queue/Source/WebKit/chromium/v8. Delete the directory and try again.
Re-trying 'depot_tools/gclient sync'
Error: Can't switch the checkout to http://v8.googlecode.com/svn/branches/3.6@9637; UUID don't match and there is local changes in /mnt/git/webkit-style-queue/Source/WebKit/chromium/v8. Delete the directory and try again.
Re-trying 'depot_tools/gclient sync'
Error: Can't switch the checkout to http://v8.googlecode.com/svn/branches/3.6@9637; UUID don't match and there is local changes in /mnt/git/webkit-style-queue/Source/WebKit/chromium/v8. Delete the directory and try again.
Error: 'depot_tools/gclient sync' failed 3 tries and returned 256 at Tools/Scripts/update-webkit-chromium line 107.
Re-trying 'depot_tools/gclient sync'
No such file or directory at Tools/Scripts/update-webkit line 104.


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 10 Hajime Morrita 2011-10-17 18:02:00 PDT
Comment on attachment 111251 [details]
Patch

r+ed. And cq+ing.
Comment 11 WebKit Review Bot 2011-10-17 18:37:56 PDT
Comment on attachment 111251 [details]
Patch

Clearing flags on attachment: 111251

Committed r97696: <http://trac.webkit.org/changeset/97696>
Comment 12 WebKit Review Bot 2011-10-17 18:38:01 PDT
All reviewed patches have been landed.  Closing bug.