Changeset 76351 in webkit


Ignore:
Timestamp:
Jan 21, 2011 9:21:51 AM (13 years ago)
Author:
Carlos Garcia Campos
Message:

2011-01-21 Carlos Garcia Campos <cgarcia@igalia.com>

Reviewed by Martin Robinson.

[GTK] Show caps lock indicator in password fields
https://bugs.webkit.org/show_bug.cgi?id=52878

Test: manual-tests/password-caps-lock.html

  • platform/gtk/KeyEventGtk.cpp: (WebCore::PlatformKeyboardEvent::currentCapsLockState): Implement currentCapsLockState() using GDK API.
  • platform/gtk/RenderThemeGtk.cpp: (WebCore::RenderThemeGtk::paintCapsLockIndicator): Paint an icon in the password field when the caps lock modifier is locked.
  • platform/gtk/RenderThemeGtk.h:

2011-01-21 Carlos Garcia Campos <cgarcia@igalia.com>

Reviewed by Martin Robinson.

[GTK] Show caps lock indicator in password fields
https://bugs.webkit.org/show_bug.cgi?id=52878

Test: manual-tests/password-caps-lock.html

  • webkit/webkitwebview.cpp: (webkit_web_view_key_release_event): Call capsLockStateMayHaveChanged() when caps lock key is pressed.
Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r76348 r76351  
     12011-01-21  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        [GTK] Show caps lock indicator in password fields
     6        https://bugs.webkit.org/show_bug.cgi?id=52878
     7
     8        Test: manual-tests/password-caps-lock.html
     9
     10        * platform/gtk/KeyEventGtk.cpp:
     11        (WebCore::PlatformKeyboardEvent::currentCapsLockState): Implement
     12        currentCapsLockState() using GDK API.
     13        * platform/gtk/RenderThemeGtk.cpp:
     14        (WebCore::RenderThemeGtk::paintCapsLockIndicator): Paint an icon
     15        in the password field when the caps lock modifier is locked.
     16        * platform/gtk/RenderThemeGtk.h:
     17
    1182011-01-21  Pavel Podivilov  <podivilov@chromium.org>
    219
  • trunk/Source/WebCore/platform/gtk/KeyEventGtk.cpp

    r67206 r76351  
    584584bool PlatformKeyboardEvent::currentCapsLockState()
    585585{
    586     notImplemented();
    587     return false;
     586    return gdk_keymap_get_caps_lock_state(gdk_keymap_get_default());
    588587}
    589588
  • trunk/Source/WebCore/platform/gtk/RenderThemeGtk.cpp

    r76192 r76351  
    310310}
    311311
     312bool RenderThemeGtk::paintCapsLockIndicator(RenderObject* renderObject, const PaintInfo& paintInfo, const IntRect& rect)
     313{
     314    // The other paint methods don't need to check whether painting is disabled because RenderTheme already checks it
     315    // before calling them, but paintCapsLockIndicator() is called by RenderTextControlSingleLine which doesn't check it.
     316    if (paintInfo.context->paintingDisabled())
     317        return true;
     318
     319    GRefPtr<GdkPixbuf> icon = getStockIcon(GTK_TYPE_ENTRY, GTK_STOCK_CAPS_LOCK_WARNING,
     320                                           gtkTextDirection(renderObject->style()->direction()),
     321                                           gtkIconState(this, renderObject), GTK_ICON_SIZE_MENU);
     322
     323    // GTK+ locates the icon right aligned in the entry. The given rectangle is already
     324    // centered vertically by RenderTextControlSingleLine.
     325    IntPoint iconPosition(rect.x() + rect.width() - gdk_pixbuf_get_width(icon.get()), rect.y());
     326    paintGdkPixbuf(paintInfo.context, icon.get(), iconPosition);
     327    return true;
     328}
     329
    312330void RenderThemeGtk::adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle* style, Element*) const
    313331{
  • trunk/Source/WebCore/platform/gtk/RenderThemeGtk.h

    r76192 r76351  
    170170#endif
    171171
     172    virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const IntRect&);
     173
    172174private:
    173175    void platformInit();
  • trunk/Source/WebKit/gtk/ChangeLog

    r76130 r76351  
     12011-01-21  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        [GTK] Show caps lock indicator in password fields
     6        https://bugs.webkit.org/show_bug.cgi?id=52878
     7
     8        Test: manual-tests/password-caps-lock.html
     9
     10        * webkit/webkitwebview.cpp:
     11        (webkit_web_view_key_release_event): Call
     12        capsLockStateMayHaveChanged() when caps lock key is pressed.
     13
    1142011-01-19  Joone Hur  <joone.hur@collabora.co.uk>
    215
  • trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp

    r75782 r76351  
    790790    if (!frame->view())
    791791        return FALSE;
     792
     793    if (event->keyval == GDK_Caps_Lock)
     794        frame->eventHandler()->capsLockStateMayHaveChanged();
    792795
    793796    PlatformKeyboardEvent keyboardEvent(event);
Note: See TracChangeset for help on using the changeset viewer.