[Webkit-unassigned] [Bug 48510] [GTK] Implement WebEventFactory, WebErrors classes for WebKit2

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Feb 16 16:19:08 PST 2011


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


Martin Robinson <mrobinson at webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #82715|1                           |0
        is obsolete|                            |




--- Comment #27 from Martin Robinson <mrobinson at webkit.org>  2011-02-16 16:19:07 PST ---
(From update of attachment 82715)
View in context: https://bugs.webkit.org/attachment.cgi?id=82715&action=review

Sorry. There were many things that I missed in my previous review. Below are some suggestions.

> Source/WebCore/platform/PlatformKeyboardEvent.h:182
> +        static String keyIdentifierForGdkKeyCode(guint);
> +        static int windowsKeyCodeForKeyCode(unsigned int);
> +        static String singleCharacterString(guint);

Sorry that I missed this before! For consistency, the second should probably be windowsKeyCodeForGdkKeyCode(guint) and the third should probably be singleCharacterStringForGdkKeyCode.

> Source/WebKit2/Shared/gtk/WebEventFactory.cpp:44
> +static inline int clickCount(GdkEvent* event)
> +{
> +    switch (event->type) {
> +    case GDK_BUTTON_PRESS:

Please open a bug for proper click counting and link to the bug here with a FIXME.

> Source/WebKit2/Shared/gtk/WebEventFactory.cpp:61
> +    ASSERT_NOT_REACHED();

Might as well put this in the default case above.

> Source/WebKit2/Shared/gtk/WebEventFactory.cpp:72
> +    if (!gdk_event_get_state(event, &state))
> +        ASSERT_NOT_REACHED();

Why not just ASSERT(gdk_event_get_state(event, &state)) ?

> Source/WebKit2/Shared/gtk/WebEventFactory.cpp:78
> +    if ((state & GDK_SHIFT_MASK)
> +        || ((event->type == GDK_KEY_PRESS || event->type == GDK_KEY_RELEASE) && (event->key.keyval == GDK_KEY_3270_BackTab)))
> +        modifiers |= WebEvent::ShiftKey;

Still probably should put a comment here explaining where this comes from / why it's needed.

> Source/WebKit2/Shared/gtk/WebEventFactory.cpp:121
> +    double timestamp = gdk_event_get_time(event);

No need to cache the timestamp, just call this when you use it.

> Source/WebKit2/Shared/gtk/WebEventFactory.cpp:124
> +    WebMouseEvent::Button button = buttonForEvent(event);

Ditto.

> Source/WebKit2/Shared/gtk/WebEventFactory.cpp:129
> +    IntPoint position(x, y);

Ditto.

> Source/WebKit2/Shared/gtk/WebEventFactory.cpp:130
> +    IntPoint globalPosition(xRoot, yRoot);

Ditto.

> Source/WebKit2/Shared/gtk/WebEventFactory.cpp:131
> +    int clickcount = clickCount(event);

Ditto.

> Source/WebKit2/Shared/gtk/WebEventFactory.cpp:146
> +    default :

No space after default.

> Source/WebKit2/Shared/gtk/WebEventFactory.cpp:155
> +    WebWheelEvent::Granularity granularity = WebWheelEvent::ScrollByPixelWheelEvent;

No need to cache this.

> Source/WebKit2/Shared/gtk/WebEventFactory.cpp:157
> +    unsigned timestamp = gdk_event_get_time(reinterpret_cast<GdkEvent*>(event));

Ditto.

> Source/WebKit2/Shared/gtk/WebEventFactory.cpp:162
> +    IntPoint position(x, y);

Ditto.

> Source/WebKit2/Shared/gtk/WebEventFactory.cpp:163
> +    IntPoint globalPosition(xRoot, yRoot);

Ditto.

> Source/WebKit2/Shared/gtk/WebEventFactory.cpp:164
> +    WebEvent::Modifiers modifiers = modifiersForEvent(reinterpret_cast<GdkEvent*>(event));

Ditto.

> Source/WebKit2/Shared/gtk/WebEventFactory.cpp:179
> +    case GDK_SCROLL_RIGHT:
> +        wheelTicks = FloatSize(-1, 0);
> +        break;

This should also have a case default: with ASSERT_NOT_REACHED();

> Source/WebKit2/Shared/gtk/WebEventFactory.cpp:182
> +    // FIXME: retrieve the user setting for the number of lines to scroll on each wheel event

Please open a bug for this issue and link to the bug here.

> Source/WebKit2/Shared/gtk/WebEventFactory.cpp:184
> +    FloatSize delta(wheelTicks.width()*step, wheelTicks.height()*step);

Need spaces around the asterisks here.

> Source/WebKit2/Shared/gtk/WebEventFactory.cpp:199
> +    bool isKeypad = event->keyval >= GDK_KEY_KP_Space && event->keyval <= GDK_KEY_KP_9;

I'd like to see this split out into a static function isKeyCodeFromKeyPad or something like that.

> Source/WebKit2/Shared/gtk/WebEventFactory.cpp:205
> +    return WebKeyboardEvent(type, text, unmodifiedText, keyIdentifier, windowsVirtualKeyCode, nativeVirtualKeyCode, macCharCode,
> +                            autoRepeat, isKeypad, isSystemKey, modifiers, timestamp);

Instead of caching all these things locally, I think it makes sense to just split them out here, like so:

 return WebKeyboardEvent((event->type == GDK_KEY_RELEASE) ? WebEvent::KeyUp : WebEvent::KeyDown,
                                                    PlatformKeyboardEvent::singleCharacterString(event->keyval),
                                                    PlatformKeyboardEvent::singleCharacterString(event->keyval),
                                                    PlatformKeyboardEvent::keyIdentifierForGdkKeyCode(event->keyval),
                                                    PlatformKeyboardEvent::windowsKeyCodeForKeyCode(event->keyval),
                                                    static_cast<int>(event->keyval),
                                                    0 /* macCharCode */,
                                                    ... etc...

-- 
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