<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[27037] trunk/WebCore</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/27037">27037</a></dd>
<dt>Author</dt> <dd>alp</dd>
<dt>Date</dt> <dd>2007-10-25 05:36:54 -0700 (Thu, 25 Oct 2007)</dd>
</dl>

<h3>Log Message</h3>
<pre>2007-10-25  Alp Toker  &lt;alp@atoker.com&gt;

        Reviewed by Mark Rowe.

        Add support for list box theme colors and styled menu list buttons.

        Remove obsolete FIXMEs.

        * platform/gtk/RenderThemeGtk.cpp:
        (WebCore::RenderThemeGtk::RenderThemeGtk):
        (WebCore::RenderThemeGtk::paintCheckbox):
        (WebCore::RenderThemeGtk::paintRadio):
        (WebCore::RenderThemeGtk::paintButton):
        (WebCore::RenderThemeGtk::adjustMenuListStyle):
        (WebCore::RenderThemeGtk::paintMenuList):
        (WebCore::RenderThemeGtk::activeListBoxSelectionBackgroundColor):
        (WebCore::RenderThemeGtk::inactiveListBoxSelectionBackgroundColor):
        (WebCore::RenderThemeGtk::activeListBoxSelectionForegroundColor):
        (WebCore::RenderThemeGtk::inactiveListBoxSelectionForegroundColor):
        (WebCore::RenderThemeGtk::gtkTreeView):
        * platform/gtk/RenderThemeGtk.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCoreplatformgtkRenderThemeGtkcpp">trunk/WebCore/platform/gtk/RenderThemeGtk.cpp</a></li>
<li><a href="#trunkWebCoreplatformgtkRenderThemeGtkh">trunk/WebCore/platform/gtk/RenderThemeGtk.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (27036 => 27037)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2007-10-25 11:55:17 UTC (rev 27036)
+++ trunk/WebCore/ChangeLog        2007-10-25 12:36:54 UTC (rev 27037)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2007-10-25  Alp Toker  &lt;alp@atoker.com&gt;
+
+        Reviewed by Mark Rowe.
+
+        Add support for list box theme colors and styled menu list buttons.
+
+        Remove obsolete FIXMEs.
+
+        * platform/gtk/RenderThemeGtk.cpp:
+        (WebCore::RenderThemeGtk::RenderThemeGtk):
+        (WebCore::RenderThemeGtk::paintCheckbox):
+        (WebCore::RenderThemeGtk::paintRadio):
+        (WebCore::RenderThemeGtk::paintButton):
+        (WebCore::RenderThemeGtk::adjustMenuListStyle):
+        (WebCore::RenderThemeGtk::paintMenuList):
+        (WebCore::RenderThemeGtk::activeListBoxSelectionBackgroundColor):
+        (WebCore::RenderThemeGtk::inactiveListBoxSelectionBackgroundColor):
+        (WebCore::RenderThemeGtk::activeListBoxSelectionForegroundColor):
+        (WebCore::RenderThemeGtk::inactiveListBoxSelectionForegroundColor):
+        (WebCore::RenderThemeGtk::gtkTreeView):
+        * platform/gtk/RenderThemeGtk.h:
+
</ins><span class="cx"> 2007-10-25  Eric Seidel  &lt;eric@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Geoff.
</span></span></pre></div>
<a id="trunkWebCoreplatformgtkRenderThemeGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/gtk/RenderThemeGtk.cpp (27036 => 27037)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/gtk/RenderThemeGtk.cpp        2007-10-25 11:55:17 UTC (rev 27036)
+++ trunk/WebCore/platform/gtk/RenderThemeGtk.cpp        2007-10-25 12:36:54 UTC (rev 27037)
</span><span class="lines">@@ -77,6 +77,7 @@
</span><span class="cx">     , m_gtkRadioButton(0)
</span><span class="cx">     , m_gtkEntry(0)
</span><span class="cx">     , m_gtkEditable(0)
</span><ins>+    , m_gtkTreeView(0)
</ins><span class="cx">     , m_unmappedWindow(0)
</span><span class="cx">     , m_container(0)
</span><span class="cx"> {
</span><span class="lines">@@ -180,7 +181,6 @@
</span><span class="cx"> 
</span><span class="cx"> bool RenderThemeGtk::paintCheckbox(RenderObject* o, const RenderObject::PaintInfo&amp; i, const IntRect&amp; rect)
</span><span class="cx"> {
</span><del>-    // FIXME: is it the right thing to do?
</del><span class="cx">     GtkWidget* checkbox = gtkCheckbox();
</span><span class="cx">     IntPoint pos = i.context-&gt;translatePoint(rect.location());
</span><span class="cx">     gtk_paint_check(checkbox-&gt;style, i.context-&gt;gdkDrawable(),
</span><span class="lines">@@ -213,7 +213,6 @@
</span><span class="cx"> 
</span><span class="cx"> bool RenderThemeGtk::paintRadio(RenderObject* o, const RenderObject::PaintInfo&amp; i, const IntRect&amp; rect)
</span><span class="cx"> { 
</span><del>-    // FIXME: is it the right thing to do?
</del><span class="cx">     GtkWidget* radio = gtkRadioButton();
</span><span class="cx">     IntPoint pos = i.context-&gt;translatePoint(rect.location());
</span><span class="cx">     gtk_paint_option(radio-&gt;style, i.context-&gt;gdkDrawable(),
</span><span class="lines">@@ -226,7 +225,6 @@
</span><span class="cx"> 
</span><span class="cx"> bool RenderThemeGtk::paintButton(RenderObject* o, const RenderObject::PaintInfo&amp; i, const IntRect&amp; rect) 
</span><span class="cx"> { 
</span><del>-    // FIXME: should use theme-aware drawing. This should honor the state as well
</del><span class="cx">     GtkWidget* button = gtkButton();
</span><span class="cx">     IntPoint pos = i.context-&gt;translatePoint(rect.location());
</span><span class="cx">     gtk_paint_box(button-&gt;style, i.context-&gt;gdkDrawable(),
</span><span class="lines">@@ -236,6 +234,23 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void RenderThemeGtk::adjustMenuListStyle(CSSStyleSelector* selector, RenderStyle* style, WebCore::Element* e) const
+{
+    addIntrinsicMargins(style);
+}
+
+bool RenderThemeGtk::paintMenuList(RenderObject* o, const RenderObject::PaintInfo&amp; i, const IntRect&amp; rect)
+{
+    // TODO: Render a real menu list button, not just a box
+    GtkWidget* button = gtkButton();
+    IntPoint pos = i.context-&gt;translatePoint(rect.location());
+    gtk_paint_box(button-&gt;style, i.context-&gt;gdkDrawable(),
+                  determineState(o), determineShadow(o),
+                  NULL, button, NULL,
+                  pos.x(), pos.y(), rect.width(), rect.height());
+    return false;
+}
+
</ins><span class="cx"> void RenderThemeGtk::adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Element* e) const 
</span><span class="cx"> { 
</span><span class="cx">     notImplemented(); 
</span><span class="lines">@@ -292,6 +307,34 @@
</span><span class="cx">     return Color(color.red &gt;&gt; 8, color.green &gt;&gt; 8, color.blue &gt;&gt; 8);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+Color RenderThemeGtk::activeListBoxSelectionBackgroundColor() const
+{
+    GtkWidget* widget = gtkTreeView();
+    GdkColor color = widget-&gt;style-&gt;base[GTK_STATE_SELECTED];
+    return Color(color.red &gt;&gt; 8, color.green &gt;&gt; 8, color.blue &gt;&gt; 8);
+}
+
+Color RenderThemeGtk::inactiveListBoxSelectionBackgroundColor() const
+{
+    GtkWidget* widget = gtkTreeView();
+    GdkColor color = widget-&gt;style-&gt;base[GTK_STATE_ACTIVE];
+    return Color(color.red &gt;&gt; 8, color.green &gt;&gt; 8, color.blue &gt;&gt; 8);
+}
+
+Color RenderThemeGtk::activeListBoxSelectionForegroundColor() const
+{
+    GtkWidget* widget = gtkTreeView();
+    GdkColor color = widget-&gt;style-&gt;text[GTK_STATE_SELECTED];
+    return Color(color.red &gt;&gt; 8, color.green &gt;&gt; 8, color.blue &gt;&gt; 8);
+}
+
+Color RenderThemeGtk::inactiveListBoxSelectionForegroundColor() const
+{
+    GtkWidget* widget = gtkTreeView();
+    GdkColor color = widget-&gt;style-&gt;text[GTK_STATE_ACTIVE];
+    return Color(color.red &gt;&gt; 8, color.green &gt;&gt; 8, color.blue &gt;&gt; 8);
+}
+
</ins><span class="cx"> void RenderThemeGtk::systemFont(int propId, FontDescription&amp;) const
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -346,6 +389,18 @@
</span><span class="cx">     return m_gtkEntry;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+GtkWidget* RenderThemeGtk::gtkTreeView() const
+{
+    if (!m_gtkTreeView) {
+        m_gtkTreeView = gtk_tree_view_new();
+        g_signal_connect(m_gtkTreeView, &quot;style-set&quot;, G_CALLBACK(gtkStyleSet), theme());
+        gtk_container_add(GTK_CONTAINER(gtkWindowContainer()), m_gtkTreeView);
+        gtk_widget_realize(m_gtkTreeView);
+    }
+
+    return m_gtkTreeView;
+}
+
</ins><span class="cx"> GtkWidget* RenderThemeGtk::gtkWindowContainer() const
</span><span class="cx"> {
</span><span class="cx">     if (!m_container) {
</span></span></pre></div>
<a id="trunkWebCoreplatformgtkRenderThemeGtkh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/gtk/RenderThemeGtk.h (27036 => 27037)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/gtk/RenderThemeGtk.h        2007-10-25 11:55:17 UTC (rev 27036)
+++ trunk/WebCore/platform/gtk/RenderThemeGtk.h        2007-10-25 12:36:54 UTC (rev 27037)
</span><span class="lines">@@ -53,6 +53,12 @@
</span><span class="cx">     virtual Color platformActiveSelectionForegroundColor() const;
</span><span class="cx">     virtual Color platformInactiveSelectionForegroundColor() const;
</span><span class="cx"> 
</span><ins>+    // List Box selection color
+    virtual Color activeListBoxSelectionBackgroundColor() const;
+    virtual Color activeListBoxSelectionForegroundColor() const;
+    virtual Color inactiveListBoxSelectionBackgroundColor() const;
+    virtual Color inactiveListBoxSelectionForegroundColor() const;
+
</ins><span class="cx">     // System fonts.
</span><span class="cx">     virtual void systemFont(int propId, FontDescription&amp;) const;
</span><span class="cx"> 
</span><span class="lines">@@ -71,6 +77,9 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool paintTextArea(RenderObject*, const RenderObject::PaintInfo&amp;, const IntRect&amp;);
</span><span class="cx"> 
</span><ins>+    virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+    virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&amp;, const IntRect&amp;);
+
</ins><span class="cx"> private:
</span><span class="cx">     void addIntrinsicMargins(RenderStyle*) const;
</span><span class="cx">     void close();
</span><span class="lines">@@ -91,6 +100,7 @@
</span><span class="cx">     GtkWidget* gtkRadioButton() const;
</span><span class="cx">     GtkWidget* gtkEntry() const;
</span><span class="cx">     GtkWidget* gtkEditable() const;
</span><ins>+    GtkWidget* gtkTreeView() const;
</ins><span class="cx"> 
</span><span class="cx">     /*
</span><span class="cx">      * unmapped GdkWindow having a container. This is holding all
</span><span class="lines">@@ -104,6 +114,7 @@
</span><span class="cx">     mutable GtkWidget* m_gtkRadioButton;
</span><span class="cx">     mutable GtkWidget* m_gtkEntry;
</span><span class="cx">     mutable GtkWidget* m_gtkEditable;
</span><ins>+    mutable GtkWidget* m_gtkTreeView;
</ins><span class="cx"> 
</span><span class="cx">     mutable GtkWidget* m_unmappedWindow;
</span><span class="cx">     mutable GtkWidget* m_container;
</span></span></pre>
</div>
</div>

</body>
</html>