Changeset 25807 in webkit


Ignore:
Timestamp:
Sep 29, 2007 8:30:20 AM (17 years ago)
Author:
zecke
Message:

2007-09-28 Jan Michael Alonzo <jmalonzo@unpluggable.com>

Reviewed by Mark.

-Fix http://bugs.webkit.org/show_bug.cgi?id=15254.

  • platform/gtk/RenderThemeGtk.cpp: (WebCore::RenderThemeGtk::determineState):
    • Apply state if control is readonly
    • Added state GTK_STATE_SELECTED of object is checked
    • Apply GTK_STATE_ACTIVE if RenderObject isFocused()

(WebCore::RenderThemeGtk::paintTextField):
(WebCore::RenderThemeGtk::gtkEntry):

  • Implemented theme-aware text field based on gtk/gtkentry.c implementation
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r25806 r25807  
     12007-09-28  Jan Michael Alonzo  <jmalonzo@unpluggable.com>
     2
     3        Reviewed by Mark.
     4
     5        -Fix http://bugs.webkit.org/show_bug.cgi?id=15254.
     6
     7        * platform/gtk/RenderThemeGtk.cpp:
     8        (WebCore::RenderThemeGtk::determineState):
     9            - Apply state if control is readonly
     10            - Added state GTK_STATE_SELECTED of object is checked
     11            - Apply GTK_STATE_ACTIVE if RenderObject isFocused()
     12        (WebCore::RenderThemeGtk::paintTextField):
     13        (WebCore::RenderThemeGtk::gtkEntry):
     14            - Implemented theme-aware text field based on gtk/gtkentry.c implementation
     15
    1162007-09-29  Holger Hans Peter Freyther  <zecke@selfish.org>
    217
  • trunk/WebCore/platform/gtk/RenderThemeGtk.cpp

    r25754 r25807  
    128128GtkStateType RenderThemeGtk::determineState(RenderObject* o)
    129129{
    130     GtkStateType result = GTK_STATE_NORMAL;
    131     if (!isEnabled(o))
    132         result = GTK_STATE_INSENSITIVE;
    133     else if (isPressed(o))
    134         result = GTK_STATE_ACTIVE;
    135     else if (isHovered(o))
    136         result = GTK_STATE_PRELIGHT;
    137     return result;
     130    if (!isEnabled(o) || isReadOnlyControl(o))
     131        return GTK_STATE_INSENSITIVE;
     132    if (isPressed(o) || isFocused(o))
     133        return GTK_STATE_ACTIVE;
     134    if (isHovered(o))
     135        return GTK_STATE_PRELIGHT;
     136    if (isChecked(o))
     137        return GTK_STATE_SELECTED;
     138
     139    return GTK_STATE_NORMAL;
    138140}
    139141
     
    240242}
    241243
    242 bool RenderThemeGtk::paintTextField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
     244bool RenderThemeGtk::paintTextField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect)
    243245{
    244246    // FIXME: should use theme-aware drawing
    245     return true;
     247    GtkWidget* entry = gtkEntry();
     248    IntPoint pos = i.context->translatePoint(rect.location());
     249
     250    gtk_paint_shadow(entry->style, i.context->gdkDrawable(),
     251                     determineState(o), determineShadow(o),
     252                     0, entry, "entry",
     253                     pos.x(), pos.y(), rect.width(), rect.height());
     254    return false;
    246255}
    247256
     
    291300
    292301    return m_gtkRadioButton;
     302}
     303
     304GtkWidget* RenderThemeGtk::gtkEntry() const
     305{
     306    if (!m_gtkEntry) {
     307        m_gtkEntry = gtk_entry_new();
     308        gtk_container_add(GTK_CONTAINER(gtkWindowContainer()), m_gtkEntry);
     309        gtk_widget_realize(m_gtkEntry);
     310    }
     311
     312    return m_gtkEntry;
    293313}
    294314
Note: See TracChangeset for help on using the changeset viewer.