From 68e127daec8478dcac01254b6a364471cf3d0741 Mon Sep 17 00:00:00 2001 From: zecke Date: Sat, 29 Sep 2007 15:30:20 +0000 Subject: [PATCH] 2007-09-28 Jan Michael Alonzo 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 git-svn-id: http://svn.webkit.org/repository/webkit/trunk@25807 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- WebCore/ChangeLog | 15 ++++++++++ WebCore/platform/gtk/RenderThemeGtk.cpp | 40 ++++++++++++++++++------- 2 files changed, 45 insertions(+), 10 deletions(-) diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index 89fa4038748..5671c29717e 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,18 @@ +2007-09-28 Jan Michael Alonzo + + 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 + 2007-09-29 Holger Hans Peter Freyther Reviewed by Eric. diff --git a/WebCore/platform/gtk/RenderThemeGtk.cpp b/WebCore/platform/gtk/RenderThemeGtk.cpp index 814a9623f4a..10c14d7daf1 100644 --- a/WebCore/platform/gtk/RenderThemeGtk.cpp +++ b/WebCore/platform/gtk/RenderThemeGtk.cpp @@ -127,14 +127,16 @@ bool RenderThemeGtk::supportsFocus(EAppearance appearance) GtkStateType RenderThemeGtk::determineState(RenderObject* o) { - GtkStateType result = GTK_STATE_NORMAL; - if (!isEnabled(o)) - result = GTK_STATE_INSENSITIVE; - else if (isPressed(o)) - result = GTK_STATE_ACTIVE; - else if (isHovered(o)) - result = GTK_STATE_PRELIGHT; - return result; + if (!isEnabled(o) || isReadOnlyControl(o)) + return GTK_STATE_INSENSITIVE; + if (isPressed(o) || isFocused(o)) + return GTK_STATE_ACTIVE; + if (isHovered(o)) + return GTK_STATE_PRELIGHT; + if (isChecked(o)) + return GTK_STATE_SELECTED; + + return GTK_STATE_NORMAL; } GtkShadowType RenderThemeGtk::determineShadow(RenderObject* o) @@ -239,10 +241,17 @@ void RenderThemeGtk::adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Eleme notImplemented(); } -bool RenderThemeGtk::paintTextField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) +bool RenderThemeGtk::paintTextField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect) { // FIXME: should use theme-aware drawing - return true; + GtkWidget* entry = gtkEntry(); + IntPoint pos = i.context->translatePoint(rect.location()); + + gtk_paint_shadow(entry->style, i.context->gdkDrawable(), + determineState(o), determineShadow(o), + 0, entry, "entry", + pos.x(), pos.y(), rect.width(), rect.height()); + return false; } bool RenderThemeGtk::paintTextArea(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) @@ -292,6 +301,17 @@ GtkWidget* RenderThemeGtk::gtkRadioButton() const return m_gtkRadioButton; } +GtkWidget* RenderThemeGtk::gtkEntry() const +{ + if (!m_gtkEntry) { + m_gtkEntry = gtk_entry_new(); + gtk_container_add(GTK_CONTAINER(gtkWindowContainer()), m_gtkEntry); + gtk_widget_realize(m_gtkEntry); + } + + return m_gtkEntry; +} + GtkWidget* RenderThemeGtk::gtkWindowContainer() const { if (!m_container) { -- GitLab