COMMIT_MESSAGE

 1Fix the default text color for form elements.
 2
 3[Gtk] Implement RenderThemeGtk::systemColor to apply the correct colors from the current GTK theme.

WebCore/ChangeLog

 12010-04-22 Olivier Tilloy <olivier@tilloy.net>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Fix the default text color for form elements.
 6
 7 [Gtk] Implement RenderThemeGtk::systemColor to apply the correct colors
 8 from the current GTK theme.
 9 https://bugs.webkit.org/show_bug.cgi?id=37779
 10
 11 * css/html.css:
 12 (input, textarea, keygen, select, button, isindex, datagrid):
 13 (keygen, select):
 14 * platform/gtk/RenderThemeGtk.cpp:
 15 (WebCore::RenderThemeGtk::RenderThemeGtk):
 16 (WebCore::RenderThemeGtk::systemColor):
 17 (WebCore::RenderThemeGtk::gtkButton):
 18 * platform/gtk/RenderThemeGtk.h:
 19
1202010-04-22 Gustavo Sverzut Barbieri <barbieri@profusion.mobi>
221
322 Reviewed by Eric Seidel.

WebCore/css/html.css

@@button {
304304input, textarea, keygen, select, button, isindex, datagrid {
305305 margin: 0__qem;
306306 font: -webkit-small-control;
307  color: initial;
 307 color: CaptionText;
308308 letter-spacing: normal;
309309 word-spacing: normal;
310310 line-height: normal;

@@keygen, select {
479479 -webkit-border-radius: 5px;
480480 white-space: pre;
481481 -webkit-rtl-ordering: logical;
482  color: black;
483482 background-color: white;
484483 cursor: default;
485484}

WebCore/platform/gtk/RenderThemeGtk.cpp

2525#include "RenderThemeGtk.h"
2626
2727#include "AffineTransform.h"
 28#include "CSSValueKeywords.h"
2829#include "GOwnPtr.h"
2930#include "Gradient.h"
3031#include "GraphicsContext.h"

@@static int mozGtkRefCount = 0;
123124RenderThemeGtk::RenderThemeGtk()
124125 : m_gtkWindow(0)
125126 , m_gtkContainer(0)
 127 , m_gtkButton(0)
126128 , m_gtkEntry(0)
127129 , m_gtkTreeView(0)
128130 , m_panelColor(Color::white)

@@void RenderThemeGtk::systemFont(int, FontDescription&) const
582584 notImplemented();
583585}
584586
 587Color RenderThemeGtk::systemColor(int cssValueId) const
 588{
 589 switch (cssValueId) {
 590 case CSSValueButtontext:
 591 return Color(gtkButton()->style->fg[GTK_STATE_NORMAL]);
 592 case CSSValueCaptiontext:
 593 return Color(gtkEntry()->style->fg[GTK_STATE_NORMAL]);
 594 default:
 595 return RenderTheme::systemColor(cssValueId);
 596 }
 597}
 598
585599static void gtkStyleSetCallback(GtkWidget* widget, GtkStyle* previous, RenderTheme* renderTheme)
586600{
587601 // FIXME: Make sure this function doesn't get called many times for a single GTK+ style change signal.

@@GtkContainer* RenderThemeGtk::gtkContainer() const
602616 return m_gtkContainer;
603617}
604618
 619GtkWidget* RenderThemeGtk::gtkButton() const
 620{
 621 if (m_gtkButton)
 622 return m_gtkButton;
 623
 624 m_gtkButton = gtk_button_new();
 625 g_signal_connect(m_gtkButton, "style-set", G_CALLBACK(gtkStyleSetCallback), const_cast<RenderThemeGtk*>(this));
 626 gtk_container_add(gtkContainer(), m_gtkButton);
 627 gtk_widget_realize(m_gtkButton);
 628
 629 return m_gtkButton;
 630}
 631
605632GtkWidget* RenderThemeGtk::gtkEntry() const
606633{
607634 if (m_gtkEntry)

WebCore/platform/gtk/RenderThemeGtk.h

@@public:
8282
8383 virtual void platformColorsDidChange();
8484
85  // System fonts.
 85 // System fonts and colors.
8686 virtual void systemFont(int propId, FontDescription&) const;
 87 virtual Color systemColor(int cssValueId) const;
8788
8889#if ENABLE(VIDEO)
8990 virtual String extraMediaControlsStyleSheet();

@@private:
138139 /*
139140 * hold the state
140141 */
 142 GtkWidget* gtkButton() const;
141143 GtkWidget* gtkEntry() const;
142144 GtkWidget* gtkTreeView() const;
143145

@@private:
149151
150152 mutable GtkWidget* m_gtkWindow;
151153 mutable GtkContainer* m_gtkContainer;
 154 mutable GtkWidget* m_gtkButton;
152155 mutable GtkWidget* m_gtkEntry;
153156 mutable GtkWidget* m_gtkTreeView;
154157