[Webkit-unassigned] [Bug 25639] Spellcheck disabling does not disable context menu

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu May 13 14:15:09 PDT 2010


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





--- Comment #7 from Darin Adler <darin at apple.com>  2010-05-13 14:15:07 PST ---
(From update of attachment 55937)
Comments in Skipped files start with "#" rather than "//".

You have a TODO to add a bug number. Please do that.

> +    if (subView) {
> +        NSMenu* menu = [subView menuForEvent:event];
> +        if (shouldPrintMenuItems) {
> +            printf("ContextMenuItems: ");
> +            for (int i = 0; i < [menu numberOfItems]; ++i) {

It doesn't make sense to set up the menu local variable before checking the shouldPrintMenuItems.

> +                if (i > 0)
> +                    printf(", ");
> +                NSMenuItem* menuItem = [menu itemAtIndex:i];
> +                printf("%s", [menuItem isSeparatorItem] ? "----" : [[menuItem title] UTF8String]);

Since menu item titles are localized, it might be better to log something else, perhaps the selector, reformatted in to the style of a WebCore editor command name.

    SEL selector = [menuItem action];
    char commandName[256];
    strcpy(commandName, sel_getName(selector));
    size_t commandName Length = strlen(commandName);
    if (commandNameLength >= 2 && commandName[commandNameLength - 1] == ':') {
        commandName[0] = toupper(commandName[0]);
        commandName[commandNameLength - 1] = '\0';
    }

Using printf with a constant string or a string of just "%s" is an anti-pattern. fputs(stdio, <string>) is better.

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



More information about the webkit-unassigned mailing list