Bug 14711

Summary: RenderThemeGdk's buttons are state-agnostic (pressed, hovered)
Product: WebKit Reporter: Nigel Tao <nigel.tao.gnome>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 523.x (Safari 3)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Simple Patch
none
Better Simple Patch
none
Make use of widget state in RenderThemeGdk
aroben: review+
Make use of widget state in RenderThemeGdk
aroben: review+
Follow-up for shadow state and theming bug workaround
none
Follow-up for shadow state and theming bug workaround (take two) mrowe: review+

Nigel Tao
Reported 2007-07-22 04:19:22 PDT
On the GTK platform (built using "./build-webkit --gdk") the buttons don't look any different when pressed, or when hovered over, even though the GTK theme supports this.
Attachments
Simple Patch (1.74 KB, patch)
2007-07-22 04:20 PDT, Nigel Tao
no flags
Better Simple Patch (1.78 KB, patch)
2007-07-23 05:32 PDT, Nigel Tao
no flags
Make use of widget state in RenderThemeGdk (6.40 KB, patch)
2007-07-24 11:23 PDT, Alp Toker
aroben: review+
Make use of widget state in RenderThemeGdk (6.40 KB, patch)
2007-07-24 11:27 PDT, Alp Toker
aroben: review+
Follow-up for shadow state and theming bug workaround (4.12 KB, patch)
2007-07-28 18:25 PDT, Alp Toker
no flags
Follow-up for shadow state and theming bug workaround (take two) (4.13 KB, patch)
2007-07-28 18:27 PDT, Alp Toker
mrowe: review+
Nigel Tao
Comment 1 2007-07-22 04:20:41 PDT
Created attachment 15618 [details] Simple Patch
Adam Roben (:aroben)
Comment 2 2007-07-22 12:11:39 PDT
Comment on attachment 15618 [details] Simple Patch + GtkStateType state_type = isHovered(o) + ? (isPressed(o) ? GTK_STATE_ACTIVE : GTK_STATE_PRELIGHT) + : GTK_STATE_NORMAL; I think this line would be clearer as: GtkStateType state_type = isPressed(o) ? GTK_STATE_ACTIVE : (isHovered(o) ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL); ...or... GtkStateType state_type = GTK_STATE_NORMAL; if (isPressed(o)) state_type = GTK_STATE_ACTIVE; else if (isHovered(o)) state_type = GTK_STATE_PRELIGHT; I personally prefer the second one. Also, the variable name sould be `stateType` to adhere to our style guidelines <http://webkit.org/coding/coding-style.html>
Nigel Tao
Comment 3 2007-07-23 05:32:19 PDT
Created attachment 15647 [details] Better Simple Patch
Alp Toker
Comment 4 2007-07-24 11:23:28 PDT
Created attachment 15666 [details] Make use of widget state in RenderThemeGdk
Alp Toker
Comment 5 2007-07-24 11:27:23 PDT
Created attachment 15667 [details] Make use of widget state in RenderThemeGdk Indentation corrected in this revision.
Adam Roben (:aroben)
Comment 6 2007-07-24 11:28:59 PDT
Comment on attachment 15666 [details] Make use of widget state in RenderThemeGdk isChecked(o) ? GTK_SHADOW_IN : GTK_SHADOW_OUT Perhaps this code should become another helper function called `checkedState` (or shadowState if that makes more sense in Gtk terminology) r=me
Adam Roben (:aroben)
Comment 7 2007-07-24 11:32:22 PDT
Comment on attachment 15667 [details] Make use of widget state in RenderThemeGdk r=me to this one too, same comments as above.
Alp Toker
Comment 8 2007-07-24 11:41:37 PDT
Fixed in r24595.
Nigel Tao
Comment 9 2007-07-26 06:15:38 PDT
It looks like Alp Toker's patch has landed in trunk, but the pushbuttons' backgrounds are still being (incorrectly) filled in. You can see the problem in the screenshot at http://blogs.gnome.org/nigeltao/files/2007/07/gdk-webkit-buttons.png You might want to apply this part of my patch: Index: WebCore/platform/gdk/RenderThemeGdk.cpp =================================================================== --- WebCore/platform/gdk/RenderThemeGdk.cpp (revision 24641) +++ WebCore/platform/gdk/RenderThemeGdk.cpp (working copy) @@ -288,7 +288,13 @@ { if (!m_container) { m_unmappedWindow = gtk_window_new(GTK_WINDOW_POPUP); - m_container = gtk_fixed_new(); + // Some GTK themes (i.e. Clearlooks) draw the buttons differently + // (in particular, call gtk_style_apply_default_background) if they + // are unallocated and are children of a GtkFixed widget, which is + // apparently what some "make Firefox buttons look like GTK" code + // does. To avoid this ugly look, we use a GtkHBox as a parent, + // rather than a GtkFixed. + m_container = gtk_hbox_new(false, 0); gtk_container_add(GTK_CONTAINER(m_unmappedWindow), m_container); gtk_widget_realize(m_unmappedWindow); }
Alp Toker
Comment 10 2007-07-28 18:25:01 PDT
Created attachment 15721 [details] Follow-up for shadow state and theming bug workaround
Alp Toker
Comment 11 2007-07-28 18:27:35 PDT
Created attachment 15722 [details] Follow-up for shadow state and theming bug workaround (take two) Remove the old code we're replacing this time.
Mark Rowe (bdash)
Comment 12 2007-07-28 18:32:03 PDT
Comment on attachment 15722 [details] Follow-up for shadow state and theming bug workaround (take two) r=me
Note You need to log in before you can comment on or make changes to this bug.