Bug 15254

Summary: [gtk] implement theme-aware drawing of text field or text area
Product: WebKit Reporter: Jan Alonzo <jmalonzo>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Enhancement    
Priority: P2    
Version: 523.x (Safari 3)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
implement theme-aware drawing of text fields and text area
aroben: review-
theme drawing of text entries
aroben: review+
gtk theme-based drawing of text entries mrowe: review+

Description Jan Alonzo 2007-09-21 18:39:46 PDT
Hi! Attached is a patch that makes the text field or text area conform to the current gtk theme.
Comment 1 Jan Alonzo 2007-09-21 18:42:01 PDT
Created attachment 16344 [details]
implement theme-aware drawing of text fields and text area
Comment 2 Adam Roben (:aroben) 2007-09-22 13:24:51 PDT
Comment on attachment 16344 [details]
implement theme-aware drawing of text fields and text area

+    else if (isChecked(o))
+        result = GTK_STATE_SELECTED;

Is this really needed for drawing text fields? Or is this just something that was missing and you added it while you were touching the code?

+    gtk_paint_shadow(entry->style, i.context->gdkDrawable(),
+                     determineState(o), determineShadow(o),
+                     NULL, entry, "entry",
+                     pos.x(), pos.y(), rect.width(), rect.height());

Since this is C++ code, please use 0 instead of NULL.

+    if (GTK_WIDGET_HAS_FOCUS(entry))
+    {

As per <http://webkit.org/coding/coding-style.html>, please pur the brace on the same line as the if.

r- so the above can be fixed. Once that's done I'll r+ it.
Comment 3 Jan Alonzo 2007-09-22 14:50:28 PDT
Created attachment 16351 [details]
theme drawing of text entries 

This patch incorporates aroben's coding style suggestions. I left the isChecked in determineState but added a separate line in the ChangeLog for the change, not really required to fix this bug but nevertheless missing from the checks.

Thanks.
Comment 4 Adam Roben (:aroben) 2007-09-22 14:53:03 PDT
Comment on attachment 16351 [details]
theme drawing of text entries 

r=me. Thanks for fixing it up!
Comment 5 Holger Freyther 2007-09-28 08:21:32 PDT
(In reply to comment #4)
> (From update of attachment 16351 [details] [edit])
> r=me. Thanks for fixing it up!
> 

I'm not going to say r=- but I think
if (GTK_WIDGET_HAS_FOCUS(entry)) {} is a dead code path and something like if (isFocused(renderObject)) should be used.
Comment 6 Jan Alonzo 2007-09-28 15:25:25 PDT
Created attachment 16435 [details]
gtk theme-based drawing of text entries

Update the patch based on zecke and bdash's comments
Comment 7 Mark Rowe (bdash) 2007-09-28 15:29:45 PDT
Comment on attachment 16435 [details]
gtk theme-based drawing of text entries

Two comments:  You have tabs in your ChangeLog entry, and you don't need the "else"s when you have a series of if's with early returns.
Comment 8 Mark Rowe (bdash) 2007-09-28 15:30:35 PDT
Comment on attachment 16435 [details]
gtk theme-based drawing of text entries

Those two issues can be fixed by whomever lands the change.  No need to jump through the hoops of uploading a new patch to get those minor points addressed.
Comment 9 Holger Freyther 2007-09-29 08:53:43 PDT
Landed in r25807. The comments by Mark were taken into account.