[Webkit-unassigned] [Bug 15616] [GTK] Add spell checking (and grammar?)

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Mar 12 07:14:46 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=15616





------- Comment #6 from gns at gnome.org  2009-03-12 07:14 PDT -------
(From update of attachment 28348)
First, some style issues:

> --- a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
> +++ b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
> @@ -1,3 +1,4 @@
> +/* vim: set sw=4 ts=4 sts=4 et: */

I'm all for having markers for vim and emacs, to ease our lives, but I think
they should be done in a different patch. If you work on this, please cover all
of the GTK+-related files with vim and emacs markings =D

> -void EditorClient::checkSpellingOfString(const UChar*, int, int*, int*)
> +void EditorClient::checkSpellingOfString(const UChar* text, int length, int* misspellingLocation, int* misspellingLength)
>  {
> -    notImplemented();
> +    const gchar *ctext;

The * should be to the left here.

> +    ctext = g_strstrip (g_utf16_to_utf8(const_cast<gunichar2*>(text), length, 
> +                NULL, NULL, NULL));

Use 0 instead of NULL on C++-only files. Also, there is an additional space
between the function name and the parens. I think you can keep the 0's in the
same line, too. It won't be overly long.

> +    g_debug("checking spelling of string %s, %d", 
> +                ctext, length);

Remember to remove those when submitting the final patch.

> +    GList *langs = NULL;

* to the left

> +    int i = 0;
> +    while (ctext[i] != ' ' && i < length)
> +        i++;

Looks like a for would be more idiomatic here, since this while is exactly
mimmicking for behavior.

> +        if (result == 0)
> +        {
> +            *misspellingLocation = -1;
> +        }
> +        else if (result > 0)
> +        {
> +            *misspellingLocation = 1;
> +        }

No bracers when you only have one line. If you were going to use bracers,
though, they should be like this:

if (blah) {
    ...
} else {
    ...
}


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list