<!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" />
<title>[195123] releases/WebKitGTK/webkit-2.10/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { 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 #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#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>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/195123">195123</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2016-01-15 04:38:14 -0800 (Fri, 15 Jan 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/194847">r194847</a> - [GTK] Cleanup RenderThemeGtk
https://bugs.webkit.org/show_bug.cgi?id=152888
Reviewed by Michael Catanzaro.
Use a common path for GTK+ 3.19 and previous versions, simplifying
the code and removing a lot of ifdefs.
- createStyleContext() now receives a theme part enum value, and
an optional parent GtkStyleContext. It encapsulates all the
differences between GTK+ 3.19 and previous version leaving the
rendering code common and free of ifdefs.
- Stock icons support have been removed, simplifying the code
that now always renders symbolic icons, updating the colors
depending on the current state.
- Media button and colors have been removed, because they are
unused now that we render the media controls with CSS.
- ComboBox separators support has also been removed. In GTK+ 3.19
combo boxes no longer have separators and most of the GTK+
themes don't use the either, so it's better to simple not render
them anymore in WebKit either.
- Code to paint caps lock indicator has been removed too, since
caps lock indicator is now shadow dom and automatically
rendered by WebCore.
* rendering/RenderThemeGtk.cpp:
(WebCore::createStyleContext):
(WebCore::loadThemedIcon):
(WebCore::gtkIconStateFlags):
(WebCore::RenderThemeGtk::adjustRepaintRect):
(WebCore::setToggleSize):
(WebCore::paintToggle):
(WebCore::RenderThemeGtk::setCheckboxSize):
(WebCore::RenderThemeGtk::paintCheckbox):
(WebCore::RenderThemeGtk::setRadioSize):
(WebCore::RenderThemeGtk::paintRadio):
(WebCore::RenderThemeGtk::paintButton):
(WebCore::getComboBoxMetrics):
(WebCore::RenderThemeGtk::popupInternalPaddingLeft):
(WebCore::RenderThemeGtk::popupInternalPaddingRight):
(WebCore::RenderThemeGtk::popupInternalPaddingTop):
(WebCore::RenderThemeGtk::popupInternalPaddingBottom):
(WebCore::RenderThemeGtk::paintMenuList):
(WebCore::RenderThemeGtk::paintTextField):
(WebCore::adjustSearchFieldIconStyle):
(WebCore::RenderThemeGtk::adjustSearchFieldResultsDecorationPartStyle):
(WebCore::paintIcon):
(WebCore::paintEntryIcon):
(WebCore::RenderThemeGtk::paintSearchFieldResultsDecorationPart):
(WebCore::RenderThemeGtk::adjustSearchFieldCancelButtonStyle):
(WebCore::RenderThemeGtk::paintSearchFieldCancelButton):
(WebCore::RenderThemeGtk::shouldHaveCapsLockIndicator):
(WebCore::RenderThemeGtk::paintSliderTrack):
(WebCore::RenderThemeGtk::paintSliderThumb):
(WebCore::RenderThemeGtk::adjustSliderThumbSize):
(WebCore::RenderThemeGtk::paintProgressBar):
(WebCore::RenderThemeGtk::adjustInnerSpinButtonStyle):
(WebCore::paintSpinArrowButton):
(WebCore::RenderThemeGtk::paintInnerSpinButton):
(WebCore::styleColor):
(WebCore::RenderThemeGtk::platformActiveSelectionBackgroundColor):
(WebCore::RenderThemeGtk::platformInactiveSelectionBackgroundColor):
(WebCore::RenderThemeGtk::platformActiveSelectionForegroundColor):
(WebCore::RenderThemeGtk::platformInactiveSelectionForegroundColor):
(WebCore::RenderThemeGtk::platformActiveListBoxSelectionBackgroundColor):
(WebCore::RenderThemeGtk::platformInactiveListBoxSelectionBackgroundColor):
(WebCore::RenderThemeGtk::platformActiveListBoxSelectionForegroundColor):
(WebCore::RenderThemeGtk::platformInactiveListBoxSelectionForegroundColor):
(WebCore::RenderThemeGtk::systemColor):
(WebCore::RenderThemeGtk::paintMediaButton):
(WebCore::RenderThemeGtk::paintMediaFullscreenButton):
(WebCore::RenderThemeGtk::paintMediaMuteButton):
(WebCore::RenderThemeGtk::paintMediaPlayButton):
(WebCore::RenderThemeGtk::paintMediaSeekBackButton):
(WebCore::RenderThemeGtk::paintMediaSeekForwardButton):
(WebCore::RenderThemeGtk::paintMediaToggleClosedCaptionsButton):
* rendering/RenderThemeGtk.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit210SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebCorerenderingRenderThemeGtkcpp">releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderThemeGtk.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebCorerenderingRenderThemeGtkh">releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderThemeGtk.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit210SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog (195122 => 195123)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog        2016-01-15 12:37:54 UTC (rev 195122)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog        2016-01-15 12:38:14 UTC (rev 195123)
</span><span class="lines">@@ -1,5 +1,85 @@
</span><span class="cx"> 2016-01-11 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><ins>+ [GTK] Cleanup RenderThemeGtk
+ https://bugs.webkit.org/show_bug.cgi?id=152888
+
+ Reviewed by Michael Catanzaro.
+
+ Use a common path for GTK+ 3.19 and previous versions, simplifying
+ the code and removing a lot of ifdefs.
+
+ - createStyleContext() now receives a theme part enum value, and
+ an optional parent GtkStyleContext. It encapsulates all the
+ differences between GTK+ 3.19 and previous version leaving the
+ rendering code common and free of ifdefs.
+ - Stock icons support have been removed, simplifying the code
+ that now always renders symbolic icons, updating the colors
+ depending on the current state.
+ - Media button and colors have been removed, because they are
+ unused now that we render the media controls with CSS.
+ - ComboBox separators support has also been removed. In GTK+ 3.19
+ combo boxes no longer have separators and most of the GTK+
+ themes don't use the either, so it's better to simple not render
+ them anymore in WebKit either.
+ - Code to paint caps lock indicator has been removed too, since
+ caps lock indicator is now shadow dom and automatically
+ rendered by WebCore.
+
+ * rendering/RenderThemeGtk.cpp:
+ (WebCore::createStyleContext):
+ (WebCore::loadThemedIcon):
+ (WebCore::gtkIconStateFlags):
+ (WebCore::RenderThemeGtk::adjustRepaintRect):
+ (WebCore::setToggleSize):
+ (WebCore::paintToggle):
+ (WebCore::RenderThemeGtk::setCheckboxSize):
+ (WebCore::RenderThemeGtk::paintCheckbox):
+ (WebCore::RenderThemeGtk::setRadioSize):
+ (WebCore::RenderThemeGtk::paintRadio):
+ (WebCore::RenderThemeGtk::paintButton):
+ (WebCore::getComboBoxMetrics):
+ (WebCore::RenderThemeGtk::popupInternalPaddingLeft):
+ (WebCore::RenderThemeGtk::popupInternalPaddingRight):
+ (WebCore::RenderThemeGtk::popupInternalPaddingTop):
+ (WebCore::RenderThemeGtk::popupInternalPaddingBottom):
+ (WebCore::RenderThemeGtk::paintMenuList):
+ (WebCore::RenderThemeGtk::paintTextField):
+ (WebCore::adjustSearchFieldIconStyle):
+ (WebCore::RenderThemeGtk::adjustSearchFieldResultsDecorationPartStyle):
+ (WebCore::paintIcon):
+ (WebCore::paintEntryIcon):
+ (WebCore::RenderThemeGtk::paintSearchFieldResultsDecorationPart):
+ (WebCore::RenderThemeGtk::adjustSearchFieldCancelButtonStyle):
+ (WebCore::RenderThemeGtk::paintSearchFieldCancelButton):
+ (WebCore::RenderThemeGtk::shouldHaveCapsLockIndicator):
+ (WebCore::RenderThemeGtk::paintSliderTrack):
+ (WebCore::RenderThemeGtk::paintSliderThumb):
+ (WebCore::RenderThemeGtk::adjustSliderThumbSize):
+ (WebCore::RenderThemeGtk::paintProgressBar):
+ (WebCore::RenderThemeGtk::adjustInnerSpinButtonStyle):
+ (WebCore::paintSpinArrowButton):
+ (WebCore::RenderThemeGtk::paintInnerSpinButton):
+ (WebCore::styleColor):
+ (WebCore::RenderThemeGtk::platformActiveSelectionBackgroundColor):
+ (WebCore::RenderThemeGtk::platformInactiveSelectionBackgroundColor):
+ (WebCore::RenderThemeGtk::platformActiveSelectionForegroundColor):
+ (WebCore::RenderThemeGtk::platformInactiveSelectionForegroundColor):
+ (WebCore::RenderThemeGtk::platformActiveListBoxSelectionBackgroundColor):
+ (WebCore::RenderThemeGtk::platformInactiveListBoxSelectionBackgroundColor):
+ (WebCore::RenderThemeGtk::platformActiveListBoxSelectionForegroundColor):
+ (WebCore::RenderThemeGtk::platformInactiveListBoxSelectionForegroundColor):
+ (WebCore::RenderThemeGtk::systemColor):
+ (WebCore::RenderThemeGtk::paintMediaButton):
+ (WebCore::RenderThemeGtk::paintMediaFullscreenButton):
+ (WebCore::RenderThemeGtk::paintMediaMuteButton):
+ (WebCore::RenderThemeGtk::paintMediaPlayButton):
+ (WebCore::RenderThemeGtk::paintMediaSeekBackButton):
+ (WebCore::RenderThemeGtk::paintMediaSeekForwardButton):
+ (WebCore::RenderThemeGtk::paintMediaToggleClosedCaptionsButton):
+ * rendering/RenderThemeGtk.h:
+
+2016-01-11 Carlos Garcia Campos <cgarcia@igalia.com>
+
</ins><span class="cx"> [GTK] Cleanup ScrollbarThemeGtk
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=152830
</span><span class="cx">
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceWebCorerenderingRenderThemeGtkcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderThemeGtk.cpp (195122 => 195123)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderThemeGtk.cpp        2016-01-15 12:37:54 UTC (rev 195122)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderThemeGtk.cpp        2016-01-15 12:38:14 UTC (rev 195123)
</span><span class="lines">@@ -137,13 +137,41 @@
</span><span class="cx"> // This is the default value defined by GTK+, where it was defined as MIN_ARROW_WIDTH in gtkspinbutton.c.
</span><span class="cx"> static const int minSpinButtonArrowSize = 6;
</span><span class="cx">
</span><ins>+enum RenderThemePart {
+ Entry,
+ EntrySelection,
+ EntryIconLeft,
+ EntryIconRight,
+ Button,
+ CheckButton,
+ CheckButtonCheck,
+ RadioButton,
+ RadioButtonRadio,
+ ComboBox,
+ ComboBoxButton,
+ ComboBoxArrow,
+ Scale,
+ ScaleTrough,
+ ScaleSlider,
+ ProgressBar,
+ ProgressBarTrough,
+ ProgressBarProgress,
+ ListBox,
+ SpinButton,
+ SpinButtonUpButton,
+ SpinButtonDownButton,
+#if ENABLE(VIDEO)
+ MediaButton,
+#endif
+};
+
</ins><span class="cx"> static void gtkStyleChangedCallback(GObject*, GParamSpec*)
</span><span class="cx"> {
</span><span class="cx"> static_cast<ScrollbarThemeGtk*>(ScrollbarTheme::theme())->themeChanged();
</span><span class="cx"> Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static GRefPtr<GtkStyleContext> createStyleContext(GType widgetType)
</del><ins>+static GRefPtr<GtkStyleContext> createStyleContext(RenderThemePart themePart, GtkStyleContext* parent = nullptr)
</ins><span class="cx"> {
</span><span class="cx"> static bool initialized = false;
</span><span class="cx"> if (!initialized) {
</span><span class="lines">@@ -153,170 +181,213 @@
</span><span class="cx"> initialized = true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- GRefPtr<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new());
- gtk_widget_path_append_type(path.get(), widgetType);
</del><ins>+ GRefPtr<GtkWidgetPath> path = adoptGRef(parent ? gtk_widget_path_copy(gtk_style_context_get_path(parent)) : gtk_widget_path_new());
</ins><span class="cx">
</span><ins>+ switch (themePart) {
+ case Entry:
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_ENTRY);
</ins><span class="cx"> #if GTK_CHECK_VERSION(3, 19, 2)
</span><del>- // Pick a good default object path for the style context based on the widget type. This will
- // usually need to be overridden manually, but it doesn't hurt to have a good default.
- if (widgetType == GTK_TYPE_ENTRY)
- gtk_widget_path_iter_set_object_name(path.get(), 0, "entry");
- else if (widgetType == GTK_TYPE_ARROW)
- gtk_widget_path_iter_set_object_name(path.get(), 0, "button"); // Note: not a typo.
- else if (widgetType == GTK_TYPE_BUTTON) {
- gtk_widget_path_iter_set_object_name(path.get(), 0, "button");
- gtk_widget_path_iter_add_class(path.get(), 0, "text-button");
- } else if (widgetType == GTK_TYPE_SCALE)
- gtk_widget_path_iter_set_object_name(path.get(), 0, "scale");
- else if (widgetType == GTK_TYPE_SEPARATOR)
- gtk_widget_path_iter_set_object_name(path.get(), 0, "separator");
- else if (widgetType == GTK_TYPE_PROGRESS_BAR)
- gtk_widget_path_iter_set_object_name(path.get(), 0, "progressbar");
- else if (widgetType == GTK_TYPE_SPIN_BUTTON)
- gtk_widget_path_iter_set_object_name(path.get(), 0, "spinbutton");
- else if (widgetType == GTK_TYPE_TREE_VIEW) {
- gtk_widget_path_iter_set_object_name(path.get(), 0, "treeview");
- gtk_widget_path_iter_add_class(path.get(), 0, "view");
- } else if (widgetType == GTK_TYPE_CHECK_BUTTON)
- gtk_widget_path_iter_set_object_name(path.get(), 0, "checkbutton");
- else if (widgetType == GTK_TYPE_RADIO_BUTTON)
- gtk_widget_path_iter_set_object_name(path.get(), 0, "radiobutton");
- else if (widgetType == GTK_TYPE_COMBO_BOX)
- gtk_widget_path_iter_set_object_name(path.get(), 0, "combobox");
</del><ins>+ gtk_widget_path_iter_set_object_name(path.get(), -1, "entry");
</ins><span class="cx"> #else
</span><del>- if (widgetType == GTK_TYPE_ENTRY)
- gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_ENTRY);
- else if (widgetType == GTK_TYPE_ARROW)
- gtk_widget_path_iter_add_class(path.get(), 0, "arrow");
- else if (widgetType == GTK_TYPE_BUTTON) {
- gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_BUTTON);
- gtk_widget_path_iter_add_class(path.get(), 0, "text-button");
- } else if (widgetType == GTK_TYPE_SCALE)
- gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_SCALE);
- else if (widgetType == GTK_TYPE_SEPARATOR)
- gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_SEPARATOR);
- else if (widgetType == GTK_TYPE_PROGRESS_BAR)
- gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_PROGRESSBAR);
- else if (widgetType == GTK_TYPE_SPIN_BUTTON)
- gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_SPINBUTTON);
- else if (widgetType == GTK_TYPE_TREE_VIEW)
- gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_VIEW);
- else if (widgetType == GTK_TYPE_CHECK_BUTTON)
- gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_CHECK);
- else if (widgetType == GTK_TYPE_RADIO_BUTTON)
- gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_RADIO);
</del><ins>+ gtk_widget_path_iter_add_class(path.get(), -1, GTK_STYLE_CLASS_ENTRY);
</ins><span class="cx"> #endif
</span><ins>+ break;
+ case EntrySelection:
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_ENTRY);
+#if GTK_CHECK_VERSION(3, 19, 2)
+ gtk_widget_path_iter_set_object_name(path.get(), -1, "selection");
+#else
+ gtk_widget_path_iter_add_class(path.get(), -1, GTK_STYLE_CLASS_ENTRY);
+#endif
+ break;
+ case EntryIconLeft:
+ case EntryIconRight:
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_ENTRY);
+#if GTK_CHECK_VERSION(3, 19, 2)
+ gtk_widget_path_iter_set_object_name(path.get(), -1, "image");
+ gtk_widget_path_iter_add_class(path.get(), -1, themePart == EntryIconLeft ? "left" : "right");
+#endif
+ break;
+ case Button:
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_BUTTON);
+#if GTK_CHECK_VERSION(3, 19, 2)
+ gtk_widget_path_iter_set_object_name(path.get(), -1, "button");
+#else
+ gtk_widget_path_iter_add_class(path.get(), -1, GTK_STYLE_CLASS_BUTTON);
+#endif
+ gtk_widget_path_iter_add_class(path.get(), -1, "text-button");
+ break;
+ case CheckButton:
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_CHECK_BUTTON);
+#if GTK_CHECK_VERSION(3, 19, 2)
+ gtk_widget_path_iter_set_object_name(path.get(), -1, "checkbutton");
+#else
+ gtk_widget_path_iter_add_class(path.get(), -1, GTK_STYLE_CLASS_CHECK);
+#endif
+ break;
+ case CheckButtonCheck:
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_CHECK_BUTTON);
+#if GTK_CHECK_VERSION(3, 19, 2)
+ gtk_widget_path_iter_set_object_name(path.get(), -1, "check");
+#else
+ gtk_widget_path_iter_add_class(path.get(), -1, GTK_STYLE_CLASS_CHECK);
+#endif
+ break;
+ case RadioButton:
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_RADIO_BUTTON);
+#if GTK_CHECK_VERSION(3, 19, 2)
+ gtk_widget_path_iter_set_object_name(path.get(), -1, "radiobutton");
+#else
+ gtk_widget_path_iter_add_class(path.get(), -1, GTK_STYLE_CLASS_RADIO);
+#endif
+ break;
+ case RadioButtonRadio:
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_RADIO_BUTTON);
+#if GTK_CHECK_VERSION(3, 19, 2)
+ gtk_widget_path_iter_set_object_name(path.get(), -1, "radio");
+#else
+ gtk_widget_path_iter_add_class(path.get(), -1, GTK_STYLE_CLASS_RADIO);
+#endif
+ break;
+ case ComboBox:
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_COMBO_BOX);
+#if GTK_CHECK_VERSION(3, 19, 2)
+ gtk_widget_path_iter_set_object_name(path.get(), -1, "combobox");
+#endif
+ break;
+ case ComboBoxButton:
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_BUTTON);
+#if GTK_CHECK_VERSION(3, 19, 2)
+ gtk_widget_path_iter_set_object_name(path.get(), -1, "button");
+#else
+ gtk_widget_path_iter_add_class(path.get(), -1, GTK_STYLE_CLASS_BUTTON);
+#endif
+ gtk_widget_path_iter_add_class(path.get(), -1, "text-button");
+ gtk_widget_path_iter_add_class(path.get(), -1, "combo");
+ break;
+ case ComboBoxArrow:
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_ARROW);
+#if GTK_CHECK_VERSION(3, 19, 2)
+ gtk_widget_path_iter_set_object_name(path.get(), -1, "arrow");
+#else
+ gtk_widget_path_iter_add_class(path.get(), -1, "arrow");
+#endif
+ break;
+ case Scale:
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SCALE);
+#if GTK_CHECK_VERSION(3, 19, 2)
+ gtk_widget_path_iter_set_object_name(path.get(), -1, "scale");
+#else
+ gtk_widget_path_iter_add_class(path.get(), -1, GTK_STYLE_CLASS_SCALE);
+#endif
+ break;
+ case ScaleTrough:
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SCALE);
+#if GTK_CHECK_VERSION(3, 19, 2)
+ gtk_widget_path_iter_set_object_name(path.get(), -1, "trough");
+#else
+ gtk_widget_path_iter_add_class(path.get(), -1, GTK_STYLE_CLASS_SCALE);
+ gtk_widget_path_iter_add_class(path.get(), -1, GTK_STYLE_CLASS_TROUGH);
+#endif
+ break;
+ case ScaleSlider:
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SCALE);
+#if GTK_CHECK_VERSION(3, 19, 2)
+ gtk_widget_path_iter_set_object_name(path.get(), -1, "slider");
+#else
+ gtk_widget_path_iter_add_class(path.get(), -1, GTK_STYLE_CLASS_SCALE);
+ gtk_widget_path_iter_add_class(path.get(), -1, GTK_STYLE_CLASS_SLIDER);
+#endif
+ break;
+ case ProgressBar:
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_PROGRESS_BAR);
+#if GTK_CHECK_VERSION(3, 19, 2)
+ gtk_widget_path_iter_set_object_name(path.get(), -1, "progressbar");
+#else
+ gtk_widget_path_iter_add_class(path.get(), -1, GTK_STYLE_CLASS_PROGRESSBAR);
+#endif
+ gtk_widget_path_iter_add_class(path.get(), -1, GTK_STYLE_CLASS_HORIZONTAL);
+ break;
+ case ProgressBarTrough:
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_PROGRESS_BAR);
+#if GTK_CHECK_VERSION(3, 19, 2)
+ gtk_widget_path_iter_set_object_name(path.get(), -1, "trough");
+#else
+ gtk_widget_path_iter_add_class(path.get(), -1, GTK_STYLE_CLASS_PROGRESSBAR);
+ gtk_widget_path_iter_add_class(path.get(), -1, GTK_STYLE_CLASS_TROUGH);
+#endif
+ break;
+ case ProgressBarProgress:
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_PROGRESS_BAR);
+#if GTK_CHECK_VERSION(3, 19, 2)
+ gtk_widget_path_iter_set_object_name(path.get(), -1, "progress");
+#else
+ gtk_widget_path_iter_add_class(path.get(), -1, GTK_STYLE_CLASS_PROGRESSBAR);
+#endif
+ break;
+ case ListBox:
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_TREE_VIEW);
+#if GTK_CHECK_VERSION(3, 19, 2)
+ gtk_widget_path_iter_set_object_name(path.get(), -1, "treeview");
+#endif
+ gtk_widget_path_iter_add_class(path.get(), -1, GTK_STYLE_CLASS_VIEW);
+ break;
+ case SpinButton:
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SPIN_BUTTON);
+#if GTK_CHECK_VERSION(3, 19, 2)
+ gtk_widget_path_iter_set_object_name(path.get(), -1, "spinbutton");
+#else
+ gtk_widget_path_iter_add_class(path.get(), -1, GTK_STYLE_CLASS_SPINBUTTON);
+#endif
+ gtk_widget_path_iter_add_class(path.get(), -1, GTK_STYLE_CLASS_HORIZONTAL);
+ break;
+ case SpinButtonUpButton:
+ case SpinButtonDownButton:
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SPIN_BUTTON);
+#if GTK_CHECK_VERSION(3, 19, 2)
+ gtk_widget_path_iter_set_object_name(path.get(), -1, "button");
+ gtk_widget_path_iter_add_class(path.get(), -1, themePart == SpinButtonUpButton ? "up" : "down");
+#else
+ gtk_widget_path_iter_add_class(path.get(), -1, GTK_STYLE_CLASS_SPINBUTTON);
+ gtk_widget_path_iter_add_class(path.get(), -1, GTK_STYLE_CLASS_BUTTON);
+#endif
+ break;
+#if ENABLE(VIDEO)
+ case MediaButton:
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_IMAGE);
+#if GTK_CHECK_VERSION(3, 19, 2)
+ gtk_widget_path_iter_set_object_name(path.get(), -1, "image");
+#else
+ gtk_widget_path_iter_add_class(path.get(), -1, GTK_STYLE_CLASS_IMAGE);
+#endif
+ break;
+#endif // ENABLE(VIDEO)
+ }
</ins><span class="cx">
</span><span class="cx"> GRefPtr<GtkStyleContext> context = adoptGRef(gtk_style_context_new());
</span><span class="cx"> gtk_style_context_set_path(context.get(), path.get());
</span><del>-
</del><ins>+ gtk_style_context_set_parent(context.get(), parent);
</ins><span class="cx"> return context;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static GRefPtr<GdkPixbuf> getStockIconForWidgetType(GType widgetType, const char* iconName, gint direction, gint state, gint iconSize)
</del><ins>+static GRefPtr<GdkPixbuf> loadThemedIcon(GtkStyleContext* context, const char* iconName, GtkIconSize iconSize)
</ins><span class="cx"> {
</span><del>- ASSERT(iconName);
-
- GRefPtr<GtkStyleContext> context = createStyleContext(widgetType);
- GtkIconSet* iconSet = gtk_style_context_lookup_icon_set(context.get(), iconName);
-
- guint flags = 0;
- if (state == GTK_STATE_PRELIGHT)
- flags |= GTK_STATE_FLAG_PRELIGHT;
- else if (state == GTK_STATE_INSENSITIVE)
- flags |= GTK_STATE_FLAG_INSENSITIVE;
-
- gtk_style_context_set_state(context.get(), static_cast<GtkStateFlags>(flags));
- gtk_style_context_set_direction(context.get(), static_cast<GtkTextDirection>(direction));
- GdkPixbuf* icon = gtk_icon_set_render_icon_pixbuf(iconSet, context.get(), static_cast<GtkIconSize>(iconSize));
-
- return adoptGRef(icon);
-}
-
-static GRefPtr<GdkPixbuf> getStockSymbolicIconForWidgetType(GType widgetType, const char* symbolicIconName, const char* fallbackStockIconName, gint direction, gint state, gint iconSize)
-{
- GRefPtr<GtkStyleContext> context = createStyleContext(widgetType);
-
- guint flags = 0;
- if (state == GTK_STATE_PRELIGHT)
- flags |= GTK_STATE_FLAG_PRELIGHT;
- else if (state == GTK_STATE_INSENSITIVE)
- flags |= GTK_STATE_FLAG_INSENSITIVE;
-
- gtk_style_context_set_state(context.get(), static_cast<GtkStateFlags>(flags));
- gtk_style_context_set_direction(context.get(), static_cast<GtkTextDirection>(direction));
-
- GUniquePtr<GtkIconInfo> info(gtk_icon_theme_lookup_icon(gtk_icon_theme_get_default(), symbolicIconName, iconSize,
- static_cast<GtkIconLookupFlags>(GTK_ICON_LOOKUP_FORCE_SVG | GTK_ICON_LOOKUP_FORCE_SIZE)));
- GdkPixbuf* icon = nullptr;
- if (info)
- icon = gtk_icon_info_load_symbolic_for_context(info.get(), context.get(), nullptr, nullptr);
-
- if (!icon) {
- if (!fallbackStockIconName)
- return nullptr;
- return getStockIconForWidgetType(widgetType, fallbackStockIconName, direction, state, iconSize);
- }
-
- return adoptGRef(icon);
-}
-
-#if ENABLE(VIDEO)
-static HTMLMediaElement* getMediaElementFromRenderObject(const RenderObject& o)
-{
- Node* node = o.node();
- Node* mediaNode = node ? node->shadowHost() : nullptr;
- if (!mediaNode)
- mediaNode = node;
- if (!is<HTMLMediaElement>(mediaNode))
</del><ins>+ GRefPtr<GIcon> icon = adoptGRef(g_themed_icon_new(iconName));
+ unsigned lookupFlags = GTK_ICON_LOOKUP_USE_BUILTIN | GTK_ICON_LOOKUP_FORCE_SIZE | GTK_ICON_LOOKUP_FORCE_SVG;
+ GtkTextDirection direction = gtk_style_context_get_direction(context);
+ if (direction & GTK_TEXT_DIR_LTR)
+ lookupFlags |= GTK_ICON_LOOKUP_DIR_LTR;
+ else if (direction & GTK_TEXT_DIR_RTL)
+ lookupFlags |= GTK_ICON_LOOKUP_DIR_RTL;
+ int width, height;
+ gtk_icon_size_lookup(iconSize, &width, &height);
+ GRefPtr<GtkIconInfo> iconInfo = adoptGRef(gtk_icon_theme_lookup_by_gicon(gtk_icon_theme_get_default(), icon.get(), std::min(width, height), static_cast<GtkIconLookupFlags>(lookupFlags)));
+ if (!iconInfo)
</ins><span class="cx"> return nullptr;
</span><span class="cx">
</span><del>- return downcast<HTMLMediaElement>(mediaNode);
</del><ins>+ return adoptGRef(gtk_icon_info_load_symbolic_for_context(iconInfo.get(), context, nullptr, nullptr));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void RenderThemeGtk::initMediaColors()
-{
- GdkRGBA color;
- GRefPtr<GtkStyleContext> containerContext = createStyleContext(GTK_TYPE_CONTAINER);
-
- gtk_style_context_set_state(containerContext.get(), GTK_STATE_FLAG_NORMAL);
- gtk_style_context_get_background_color(containerContext.get(), gtk_style_context_get_state(containerContext.get()), &color);
- m_panelColor = color;
- gtk_style_context_set_state(containerContext.get(), GTK_STATE_FLAG_ACTIVE);
- gtk_style_context_get_background_color(containerContext.get(), gtk_style_context_get_state(containerContext.get()), &color);
- m_sliderColor = color;
- gtk_style_context_set_state(containerContext.get(), GTK_STATE_FLAG_SELECTED);
- gtk_style_context_get_background_color(containerContext.get(), gtk_style_context_get_state(containerContext.get()), &color);
- m_sliderThumbColor = color;
-}
-
-void RenderThemeGtk::initMediaButtons()
-{
- static bool iconsInitialized = false;
-
- if (iconsInitialized)
- return;
-
- GRefPtr<GtkIconFactory> iconFactory = adoptGRef(gtk_icon_factory_new());
- GtkIconSource* iconSource = gtk_icon_source_new();
- const char* icons[] = { "audio-volume-high", "audio-volume-muted" };
-
- gtk_icon_factory_add_default(iconFactory.get());
-
- for (size_t i = 0; i < G_N_ELEMENTS(icons); ++i) {
- gtk_icon_source_set_icon_name(iconSource, icons[i]);
- GtkIconSet* iconSet = gtk_icon_set_new();
- gtk_icon_set_add_source(iconSet, iconSource);
- gtk_icon_factory_add(iconFactory.get(), icons[i], iconSet);
- gtk_icon_set_unref(iconSet);
- }
-
- gtk_icon_source_free(iconSource);
-
- iconsInitialized = true;
-}
-#endif
-
</del><span class="cx"> static bool nodeHasPseudo(Node* node, const char* pseudo)
</span><span class="cx"> {
</span><span class="cx"> RefPtr<Node> attributeNode = node->attributes()->getNamedItem("pseudo");
</span><span class="lines">@@ -337,19 +408,6 @@
</span><span class="cx"> return element.classNames().contains(className);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RenderThemeGtk::RenderThemeGtk()
- : m_panelColor(Color::white)
- , m_sliderColor(Color::white)
- , m_sliderThumbColor(Color::white)
- , m_mediaIconSize(16)
- , m_mediaSliderHeight(14)
-{
-#if ENABLE(VIDEO)
- initMediaColors();
- initMediaButtons();
-#endif
-}
-
</del><span class="cx"> RenderThemeGtk::~RenderThemeGtk()
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -403,16 +461,16 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static GtkStateType gtkIconState(RenderTheme* theme, const RenderObject& renderObject)
</del><ins>+static GtkStateFlags gtkIconStateFlags(RenderTheme* theme, const RenderObject& renderObject)
</ins><span class="cx"> {
</span><span class="cx"> if (!theme->isEnabled(renderObject))
</span><del>- return GTK_STATE_INSENSITIVE;
</del><ins>+ return GTK_STATE_FLAG_INSENSITIVE;
</ins><span class="cx"> if (theme->isPressed(renderObject))
</span><del>- return GTK_STATE_ACTIVE;
</del><ins>+ return GTK_STATE_FLAG_ACTIVE;
</ins><span class="cx"> if (theme->isHovered(renderObject))
</span><del>- return GTK_STATE_PRELIGHT;
</del><ins>+ return GTK_STATE_FLAG_PRELIGHT;
</ins><span class="cx">
</span><del>- return GTK_STATE_NORMAL;
</del><ins>+ return GTK_STATE_FLAG_NORMAL;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static void adjustRectForFocus(GtkStyleContext* context, FloatRect& rect)
</span><span class="lines">@@ -430,7 +488,7 @@
</span><span class="cx"> switch (part) {
</span><span class="cx"> case CheckboxPart:
</span><span class="cx"> case RadioPart:
</span><del>- context = createStyleContext(part == CheckboxPart ? GTK_TYPE_CHECK_BUTTON : GTK_TYPE_RADIO_BUTTON);
</del><ins>+ context = createStyleContext(part == CheckboxPart ? CheckButton : RadioButton);
</ins><span class="cx">
</span><span class="cx"> gint indicatorSpacing;
</span><span class="cx"> gtk_style_context_get_style(context.get(), "indicator-spacing", &indicatorSpacing, nullptr);
</span><span class="lines">@@ -439,17 +497,17 @@
</span><span class="cx"> return;
</span><span class="cx"> case SliderVerticalPart:
</span><span class="cx"> case SliderHorizontalPart:
</span><del>- context = createStyleContext(GTK_TYPE_SCALE);
</del><ins>+ context = createStyleContext(ScaleSlider);
</ins><span class="cx"> break;
</span><span class="cx"> case ButtonPart:
</span><span class="cx"> case MenulistButtonPart:
</span><span class="cx"> case MenulistPart:
</span><del>- context = createStyleContext(GTK_TYPE_BUTTON);
</del><ins>+ context = createStyleContext(Button);
</ins><span class="cx"> checkInteriorFocus = true;
</span><span class="cx"> break;
</span><span class="cx"> case TextFieldPart:
</span><span class="cx"> case TextAreaPart:
</span><del>- context = createStyleContext(GTK_TYPE_ENTRY);
</del><ins>+ context = createStyleContext(Entry);
</ins><span class="cx"> checkInteriorFocus = true;
</span><span class="cx"> break;
</span><span class="cx"> default:
</span><span class="lines">@@ -473,14 +531,13 @@
</span><span class="cx"> style.setLineHeight(RenderStyle::initialLineHeight());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void setToggleSize(GType widgetType, RenderStyle& style)
</del><ins>+static void setToggleSize(RenderThemePart themePart, RenderStyle& style)
</ins><span class="cx"> {
</span><del>- GRefPtr<GtkStyleContext> context = createStyleContext(widgetType);
-
</del><span class="cx"> // The width and height are both specified, so we shouldn't change them.
</span><span class="cx"> if (!style.width().isIntrinsicOrAuto() && !style.height().isAuto())
</span><span class="cx"> return;
</span><span class="cx">
</span><ins>+ GRefPtr<GtkStyleContext> context = createStyleContext(themePart);
</ins><span class="cx"> // Other ports hard-code this to 13. GTK+ users tend to demand the native look.
</span><span class="cx"> gint indicatorSize;
</span><span class="cx"> gtk_style_context_get_style(context.get(), "indicator-size", &indicatorSize, nullptr);
</span><span class="lines">@@ -492,40 +549,28 @@
</span><span class="cx"> style.setHeight(Length(indicatorSize, Fixed));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void paintToggle(const RenderThemeGtk* theme, GType widgetType, const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& fullRect)
</del><ins>+static void paintToggle(const RenderThemeGtk* theme, RenderThemePart themePart, const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& fullRect)
</ins><span class="cx"> {
</span><del>- GRefPtr<GtkStyleContext> context = createStyleContext(widgetType);
-#if GTK_CHECK_VERSION(3, 19, 2)
- GRefPtr<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new());
</del><ins>+ GRefPtr<GtkStyleContext> parentContext = createStyleContext(themePart);
+ GRefPtr<GtkStyleContext> context = createStyleContext(themePart == CheckButton ? CheckButtonCheck : RadioButtonRadio, parentContext.get());
+ gtk_style_context_set_direction(context.get(), static_cast<GtkTextDirection>(gtkTextDirection(renderObject.style().direction())));
</ins><span class="cx">
</span><del>- if (widgetType == GTK_TYPE_CHECK_BUTTON) {
- if (theme->isChecked(renderObject) || theme->isIndeterminate(renderObject)) {
- gtk_widget_path_append_type(path.get(), GTK_TYPE_CHECK_BUTTON);
- gtk_widget_path_iter_set_object_name(path.get(), 0, "checkbutton");
- } else {
- gtk_widget_path_append_type(path.get(), GTK_TYPE_CHECK_BUTTON);
- gtk_widget_path_iter_set_object_name(path.get(), 0, "button");
- gtk_widget_path_iter_add_class(path.get(), 0, "check");
- }
-
- gtk_widget_path_append_type(path.get(), GTK_TYPE_CHECK_BUTTON);
- gtk_widget_path_iter_set_object_name(path.get(), 1, "check");
- } else if (widgetType == GTK_TYPE_RADIO_BUTTON) {
- if (theme->isChecked(renderObject) || theme->isIndeterminate(renderObject)) {
- gtk_widget_path_append_type(path.get(), GTK_TYPE_RADIO_BUTTON);
- gtk_widget_path_iter_set_object_name(path.get(), 0, "radiobutton");
- } else {
- gtk_widget_path_append_type(path.get(), GTK_TYPE_RADIO_BUTTON);
- gtk_widget_path_iter_set_object_name(path.get(), 0, "button");
- gtk_widget_path_iter_add_class(path.get(), 0, "radio");
- }
-
- gtk_widget_path_append_type(path.get(), GTK_TYPE_RADIO_BUTTON);
- gtk_widget_path_iter_set_object_name(path.get(), 1, "radio");
- }
-
- gtk_style_context_set_path(context.get(), path.get());
</del><ins>+ unsigned flags = 0;
+ if (!theme->isEnabled(renderObject))
+ flags |= GTK_STATE_FLAG_INSENSITIVE;
+ else if (theme->isHovered(renderObject))
+ flags |= GTK_STATE_FLAG_PRELIGHT;
+ if (theme->isIndeterminate(renderObject))
+ flags |= GTK_STATE_FLAG_INCONSISTENT;
+ else if (theme->isChecked(renderObject))
+#if GTK_CHECK_VERSION(3, 13, 7)
+ flags |= GTK_STATE_FLAG_CHECKED;
+#else
+ flags |= GTK_STATE_FLAG_ACTIVE;
</ins><span class="cx"> #endif
</span><ins>+ if (theme->isPressed(renderObject))
+ flags |= GTK_STATE_FLAG_SELECTED;
+ gtk_style_context_set_state(context.get(), static_cast<GtkStateFlags>(flags));
</ins><span class="cx">
</span><span class="cx"> // Some themes do not render large toggle buttons properly, so we simply
</span><span class="cx"> // shrink the rectangle back down to the default size and then center it
</span><span class="lines">@@ -544,32 +589,10 @@
</span><span class="cx"> rect.setHeight(indicatorSize); // In case rect.height() was equal to indicatorSize + 1.
</span><span class="cx"> }
</span><span class="cx">
</span><del>- gtk_style_context_set_direction(context.get(), static_cast<GtkTextDirection>(gtkTextDirection(renderObject.style().direction())));
</del><ins>+ gtk_render_background(context.get(), paintInfo.context->platformContext()->cr(), rect.x(), rect.y(), rect.width(), rect.height());
+ gtk_render_frame(context.get(), paintInfo.context->platformContext()->cr(), rect.x(), rect.y(), rect.width(), rect.height());
</ins><span class="cx">
</span><del>-#if GTK_CHECK_VERSION(3, 19, 2)
- gtk_style_context_add_class(context.get(), "toggle");
-#else
- gtk_style_context_add_class(context.get(), widgetType == GTK_TYPE_CHECK_BUTTON ? GTK_STYLE_CLASS_CHECK : GTK_STYLE_CLASS_RADIO);
-#endif
-
- guint flags = 0;
- if (!theme->isEnabled(renderObject))
- flags |= GTK_STATE_FLAG_INSENSITIVE;
- else if (theme->isHovered(renderObject))
- flags |= GTK_STATE_FLAG_PRELIGHT;
- if (theme->isIndeterminate(renderObject))
- flags |= GTK_STATE_FLAG_INCONSISTENT;
- else if (theme->isChecked(renderObject))
-#if GTK_CHECK_VERSION(3, 13, 7)
- flags |= GTK_STATE_FLAG_CHECKED;
-#else
- flags |= GTK_STATE_FLAG_ACTIVE;
-#endif
- if (theme->isPressed(renderObject))
- flags |= GTK_STATE_FLAG_SELECTED;
- gtk_style_context_set_state(context.get(), static_cast<GtkStateFlags>(flags));
-
- if (widgetType == GTK_TYPE_CHECK_BUTTON)
</del><ins>+ if (themePart == CheckButton)
</ins><span class="cx"> gtk_render_check(context.get(), paintInfo.context->platformContext()->cr(), rect.x(), rect.y(), rect.width(), rect.height());
</span><span class="cx"> else
</span><span class="cx"> gtk_render_option(context.get(), paintInfo.context->platformContext()->cr(), rect.x(), rect.y(), rect.width(), rect.height());
</span><span class="lines">@@ -586,23 +609,23 @@
</span><span class="cx">
</span><span class="cx"> void RenderThemeGtk::setCheckboxSize(RenderStyle& style) const
</span><span class="cx"> {
</span><del>- setToggleSize(GTK_TYPE_CHECK_BUTTON, style);
</del><ins>+ setToggleSize(CheckButton, style);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool RenderThemeGtk::paintCheckbox(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect)
</span><span class="cx"> {
</span><del>- paintToggle(this, GTK_TYPE_CHECK_BUTTON, renderObject, paintInfo, rect);
</del><ins>+ paintToggle(this, CheckButton, renderObject, paintInfo, rect);
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void RenderThemeGtk::setRadioSize(RenderStyle& style) const
</span><span class="cx"> {
</span><del>- setToggleSize(GTK_TYPE_RADIO_BUTTON, style);
</del><ins>+ setToggleSize(RadioButton, style);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool RenderThemeGtk::paintRadio(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect)
</span><span class="cx"> {
</span><del>- paintToggle(this, GTK_TYPE_RADIO_BUTTON, renderObject, paintInfo, rect);
</del><ins>+ paintToggle(this, RadioButton, renderObject, paintInfo, rect);
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -674,15 +697,9 @@
</span><span class="cx"> }
</span><span class="cx"> bool RenderThemeGtk::paintButton(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect)
</span><span class="cx"> {
</span><del>- GRefPtr<GtkStyleContext> context = createStyleContext(GTK_TYPE_BUTTON);
-
</del><ins>+ GRefPtr<GtkStyleContext> context = createStyleContext(Button);
</ins><span class="cx"> gtk_style_context_set_direction(context.get(), static_cast<GtkTextDirection>(gtkTextDirection(renderObject.style().direction())));
</span><del>-#if !GTK_CHECK_VERSION(3, 19, 2)
- gtk_style_context_add_class(context.get(), GTK_STYLE_CLASS_BUTTON);
-#endif
-
</del><span class="cx"> renderButton(this, context.get(), renderObject, paintInfo, rect);
</span><del>-
</del><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -700,30 +717,16 @@
</span><span class="cx"> adjustMenuListStyle(styleResolver, style, e);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void getComboBoxMetrics(RenderStyle& style, GtkBorder& border, int& focus, int& separator)
</del><ins>+static void getComboBoxMetrics(RenderStyle& style, GtkBorder& border, int& focus)
</ins><span class="cx"> {
</span><span class="cx"> // If this menu list button isn't drawn using the native theme, we
</span><span class="cx"> // don't add any extra padding beyond what WebCore already uses.
</span><span class="cx"> if (style.appearance() == NoControlPart)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- GRefPtr<GtkStyleContext> context = createStyleContext(GTK_TYPE_COMBO_BOX);
-#if GTK_CHECK_VERSION(3, 19, 2)
- GRefPtr<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new());
-
- gtk_widget_path_append_type(path.get(), GTK_TYPE_COMBO_BOX);
- gtk_widget_path_iter_set_object_name(path.get(), 0, "combobox");
-
- gtk_widget_path_append_type(path.get(), GTK_TYPE_COMBO_BOX);
- gtk_widget_path_iter_set_object_name(path.get(), 1, "button");
- gtk_widget_path_iter_add_class(path.get(), 1, "combo");
-
- gtk_style_context_set_path(context.get(), path.get());
-#else
- gtk_style_context_add_class(context.get(), GTK_STYLE_CLASS_BUTTON);
-#endif
</del><ins>+ GRefPtr<GtkStyleContext> parentContext = createStyleContext(ComboBox);
+ GRefPtr<GtkStyleContext> context = createStyleContext(ComboBoxButton, parentContext.get());
</ins><span class="cx"> gtk_style_context_set_direction(context.get(), static_cast<GtkTextDirection>(gtkTextDirection(style.direction())));
</span><del>-
</del><span class="cx"> gtk_style_context_set_state(context.get(), static_cast<GtkStateFlags>(0));
</span><span class="cx"> gtk_style_context_get_border(context.get(), gtk_style_context_get_state(context.get()), &border);
</span><span class="cx">
</span><span class="lines">@@ -731,61 +734,43 @@
</span><span class="cx"> gint focusWidth, focusPad;
</span><span class="cx"> gtk_style_context_get_style(context.get(), "interior-focus", &interiorFocus, "focus-line-width", &focusWidth, "focus-padding", &focusPad, nullptr);
</span><span class="cx"> focus = interiorFocus ? focusWidth + focusPad : 0;
</span><del>-
- context = createStyleContext(GTK_TYPE_SEPARATOR);
-
- GtkTextDirection direction = static_cast<GtkTextDirection>(gtkTextDirection(style.direction()));
- gtk_style_context_set_direction(context.get(), direction);
-#if !GTK_CHECK_VERSION(3, 19, 2)
- gtk_style_context_add_class(context.get(), "separator");
-#endif
-
- gboolean wideSeparators;
- gint separatorWidth;
- gtk_style_context_get_style(context.get(), "wide-separators", &wideSeparators, "separator-width", &separatorWidth, nullptr);
-
- // GTK+ always uses border.left, regardless of text direction. See gtkseperator.c.
- if (!wideSeparators)
- separatorWidth = border.left;
-
- separator = separatorWidth;
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> int RenderThemeGtk::popupInternalPaddingLeft(RenderStyle& style) const
</span><span class="cx"> {
</span><span class="cx"> GtkBorder borderWidth = { 0, 0, 0, 0 };
</span><del>- int focusWidth = 0, separatorWidth = 0;
- getComboBoxMetrics(style, borderWidth, focusWidth, separatorWidth);
</del><ins>+ int focusWidth = 0;
+ getComboBoxMetrics(style, borderWidth, focusWidth);
</ins><span class="cx"> int left = borderWidth.left + focusWidth;
</span><span class="cx"> if (style.direction() == RTL)
</span><del>- left += separatorWidth + minArrowSize;
</del><ins>+ left += minArrowSize;
</ins><span class="cx"> return left;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> int RenderThemeGtk::popupInternalPaddingRight(RenderStyle& style) const
</span><span class="cx"> {
</span><span class="cx"> GtkBorder borderWidth = { 0, 0, 0, 0 };
</span><del>- int focusWidth = 0, separatorWidth = 0;
- getComboBoxMetrics(style, borderWidth, focusWidth, separatorWidth);
</del><ins>+ int focusWidth = 0;
+ getComboBoxMetrics(style, borderWidth, focusWidth);
</ins><span class="cx"> int right = borderWidth.right + focusWidth;
</span><span class="cx"> if (style.direction() == LTR)
</span><del>- right += separatorWidth + minArrowSize;
</del><ins>+ right += minArrowSize;
</ins><span class="cx"> return right;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> int RenderThemeGtk::popupInternalPaddingTop(RenderStyle& style) const
</span><span class="cx"> {
</span><span class="cx"> GtkBorder borderWidth = { 0, 0, 0, 0 };
</span><del>- int focusWidth = 0, separatorWidth = 0;
- getComboBoxMetrics(style, borderWidth, focusWidth, separatorWidth);
</del><ins>+ int focusWidth = 0;
+ getComboBoxMetrics(style, borderWidth, focusWidth);
</ins><span class="cx"> return borderWidth.top + focusWidth;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> int RenderThemeGtk::popupInternalPaddingBottom(RenderStyle& style) const
</span><span class="cx"> {
</span><span class="cx"> GtkBorder borderWidth = { 0, 0, 0, 0 };
</span><del>- int focusWidth = 0, separatorWidth = 0;
- getComboBoxMetrics(style, borderWidth, focusWidth, separatorWidth);
</del><ins>+ int focusWidth = 0;
+ getComboBoxMetrics(style, borderWidth, focusWidth);
</ins><span class="cx"> return borderWidth.bottom + focusWidth;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -797,12 +782,11 @@
</span><span class="cx"> cairo_t* cairoContext = paintInfo.context->platformContext()->cr();
</span><span class="cx"> GtkTextDirection direction = static_cast<GtkTextDirection>(gtkTextDirection(renderObject.style().direction()));
</span><span class="cx">
</span><ins>+ GRefPtr<GtkStyleContext> parentStyleContext = createStyleContext(ComboBox);
+
</ins><span class="cx"> // Paint the button.
</span><del>- GRefPtr<GtkStyleContext> buttonStyleContext = createStyleContext(GTK_TYPE_BUTTON);
</del><ins>+ GRefPtr<GtkStyleContext> buttonStyleContext = createStyleContext(ComboBoxButton, parentStyleContext.get());
</ins><span class="cx"> gtk_style_context_set_direction(buttonStyleContext.get(), direction);
</span><del>-#if !GTK_CHECK_VERSION(3, 19, 2)
- gtk_style_context_add_class(buttonStyleContext.get(), GTK_STYLE_CLASS_BUTTON);
-#endif
</del><span class="cx"> renderButton(this, buttonStyleContext.get(), renderObject, paintInfo, rect);
</span><span class="cx">
</span><span class="cx"> // Get the inner rectangle.
</span><span class="lines">@@ -836,16 +820,16 @@
</span><span class="cx"> innerRect.setHeight(std::max(1, innerRect.height()));
</span><span class="cx">
</span><span class="cx"> // Paint the arrow.
</span><del>- GRefPtr<GtkStyleContext> arrowStyleContext = createStyleContext(GTK_TYPE_ARROW);
-
</del><ins>+ GRefPtr<GtkStyleContext> arrowStyleContext = createStyleContext(ComboBoxArrow, buttonStyleContext.get());
</ins><span class="cx"> gtk_style_context_set_direction(arrowStyleContext.get(), direction);
</span><del>-#if !GTK_CHECK_VERSION(3, 19, 2)
- gtk_style_context_add_class(arrowStyleContext.get(), "arrow");
- gtk_style_context_add_class(arrowStyleContext.get(), GTK_STYLE_CLASS_BUTTON);
-#endif
</del><span class="cx">
</span><ins>+#if GTK_CHECK_VERSION(3, 19, 2)
+ // arrow-scaling style property is now deprecated and ignored.
+ gfloat arrowScaling = 1.;
+#else
</ins><span class="cx"> gfloat arrowScaling;
</span><del>- gtk_style_context_get_style(arrowStyleContext.get(), "arrow-scaling", &arrowScaling, nullptr);
</del><ins>+ gtk_style_context_get_style(parentStyleContext.get(), "arrow-scaling", &arrowScaling, nullptr);
+#endif
</ins><span class="cx">
</span><span class="cx"> IntSize arrowSize(minArrowSize, innerRect.height());
</span><span class="cx"> FloatPoint arrowPosition(innerRect.location());
</span><span class="lines">@@ -860,56 +844,6 @@
</span><span class="cx"> gtk_style_context_set_state(arrowStyleContext.get(), state);
</span><span class="cx"> gtk_render_arrow(arrowStyleContext.get(), cairoContext, G_PI, arrowPosition.x(), arrowPosition.y(), extent);
</span><span class="cx">
</span><del>- // Paint the separator if needed.
- GRefPtr<GtkStyleContext> separatorStyleContext = createStyleContext(GTK_TYPE_COMBO_BOX);
-#if GTK_CHECK_VERSION(3, 19, 2)
- GRefPtr<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new());
-
- gtk_widget_path_append_type(path.get(), GTK_TYPE_SEPARATOR);
- gtk_widget_path_iter_set_object_name(path.get(), 0, "separator");
-
- gtk_style_context_set_path(separatorStyleContext.get(), path.get());
-#else
- gtk_style_context_add_class(separatorStyleContext.get(), "separator");
-#endif
-
- gtk_style_context_set_direction(separatorStyleContext.get(), direction);
-
- gboolean wideSeparators;
- gint separatorWidth;
- gtk_style_context_get_style(separatorStyleContext.get(), "wide-separators", &wideSeparators, "separator-width", &separatorWidth, nullptr);
- if (wideSeparators && !separatorWidth)
- return false;
-
- gtk_style_context_set_state(separatorStyleContext.get(), state);
- IntPoint separatorPosition(arrowPosition.x(), innerRect.y());
- if (wideSeparators) {
- if (direction == GTK_TEXT_DIR_LTR)
- separatorPosition.move(-separatorWidth, 0);
- else
- separatorPosition.move(arrowSize.width(), 0);
-
- gtk_render_frame(separatorStyleContext.get(), cairoContext, separatorPosition.x(), separatorPosition.y(), separatorWidth, innerRect.height());
- } else {
- GtkBorder padding;
- gtk_style_context_get_padding(separatorStyleContext.get(), gtk_style_context_get_state(separatorStyleContext.get()), &padding);
- GtkBorder border;
- gtk_style_context_get_border(separatorStyleContext.get(), gtk_style_context_get_state(separatorStyleContext.get()), &border);
-
- if (direction == GTK_TEXT_DIR_LTR)
- separatorPosition.move(-(padding.left + border.left), 0);
- else
- separatorPosition.move(arrowSize.width(), 0);
-
- cairo_save(cairoContext);
-
- // An extra clip prevents the separator bleeding outside of the specified rectangle because of subpixel positioning.
- cairo_rectangle(cairoContext, separatorPosition.x(), separatorPosition.y(), border.left, innerRect.height());
- cairo_clip(cairoContext);
- gtk_render_line(separatorStyleContext.get(), cairoContext, separatorPosition.x(), separatorPosition.y(), separatorPosition.x(), innerRect.maxY());
- cairo_restore(cairoContext);
- }
-
</del><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -920,12 +854,8 @@
</span><span class="cx">
</span><span class="cx"> bool RenderThemeGtk::paintTextField(const RenderObject& renderObject, const PaintInfo& paintInfo, const FloatRect& rect)
</span><span class="cx"> {
</span><del>- GRefPtr<GtkStyleContext> context = createStyleContext(GTK_TYPE_ENTRY);
-
</del><ins>+ GRefPtr<GtkStyleContext> context = createStyleContext(Entry);
</ins><span class="cx"> gtk_style_context_set_direction(context.get(), static_cast<GtkTextDirection>(gtkTextDirection(renderObject.style().direction())));
</span><del>-#if !GTK_CHECK_VERSION(3, 19, 2)
- gtk_style_context_add_class(context.get(), GTK_STYLE_CLASS_ENTRY);
-#endif
</del><span class="cx">
</span><span class="cx"> guint flags = 0;
</span><span class="cx"> if (!isEnabled(renderObject) || isReadOnlyControl(renderObject))
</span><span class="lines">@@ -956,23 +886,6 @@
</span><span class="cx"> return paintTextField(o, i, r);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void paintGdkPixbuf(GraphicsContext* context, const GdkPixbuf* icon, const IntRect& iconRect)
-{
- IntSize iconSize(gdk_pixbuf_get_width(icon), gdk_pixbuf_get_height(icon));
- GRefPtr<GdkPixbuf> scaledIcon;
- if (iconRect.size() != iconSize) {
- // We could use cairo_scale() here but cairo/pixman downscale quality is quite bad.
- scaledIcon = adoptGRef(gdk_pixbuf_scale_simple(icon, iconRect.width(), iconRect.height(), GDK_INTERP_BILINEAR));
- icon = scaledIcon.get();
- }
-
- cairo_t* cr = context->platformContext()->cr();
- cairo_save(cr);
- gdk_cairo_set_source_pixbuf(cr, icon, iconRect.x(), iconRect.y());
- cairo_paint(cr);
- cairo_restore(cr);
-}
-
</del><span class="cx"> // Defined in GTK+ (gtk/gtkiconfactory.c)
</span><span class="cx"> static const gint gtkIconSizeMenu = 16;
</span><span class="cx"> static const gint gtkIconSizeSmallToolbar = 18;
</span><span class="lines">@@ -1007,27 +920,33 @@
</span><span class="cx"> return paintSearchFieldResultsDecorationPart(o, i, rect);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void adjustSearchFieldIconStyle(RenderStyle& style)
</del><ins>+static void adjustSearchFieldIconStyle(RenderThemePart themePart, RenderStyle& style)
</ins><span class="cx"> {
</span><span class="cx"> style.resetBorder();
</span><span class="cx"> style.resetPadding();
</span><span class="cx">
</span><ins>+ GRefPtr<GtkStyleContext> parentContext = createStyleContext(Entry);
+ GRefPtr<GtkStyleContext> context = createStyleContext(themePart, parentContext.get());
+
+ GtkBorder padding;
+ gtk_style_context_get_padding(context.get(), gtk_style_context_get_state(context.get()), &padding);
+
</ins><span class="cx"> // Get the icon size based on the font size.
</span><span class="cx"> int fontSize = style.fontSize();
</span><span class="cx"> if (fontSize < gtkIconSizeMenu) {
</span><del>- style.setWidth(Length(fontSize, Fixed));
- style.setHeight(Length(fontSize, Fixed));
</del><ins>+ style.setWidth(Length(fontSize + (padding.left + padding.right), Fixed));
+ style.setHeight(Length(fontSize + (padding.top + padding.bottom), Fixed));
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx"> gint width = 0, height = 0;
</span><span class="cx"> gtk_icon_size_lookup(getIconSizeForPixelSize(fontSize), &width, &height);
</span><del>- style.setWidth(Length(width, Fixed));
- style.setHeight(Length(height, Fixed));
</del><ins>+ style.setWidth(Length(width + (padding.left + padding.right), Fixed));
+ style.setHeight(Length(height + (padding.top + padding.bottom), Fixed));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void RenderThemeGtk::adjustSearchFieldResultsDecorationPartStyle(StyleResolver&, RenderStyle& style, Element*) const
</span><span class="cx"> {
</span><del>- adjustSearchFieldIconStyle(style);
</del><ins>+ adjustSearchFieldIconStyle(EntryIconLeft, style);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static IntRect centerRectVerticallyInParentInputElement(const RenderObject& renderObject, const IntRect& rect)
</span><span class="lines">@@ -1053,23 +972,41 @@
</span><span class="cx"> return scaledRect;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static bool paintIcon(GtkStyleContext* context, GraphicsContext& graphicsContext, const IntRect& rect, const char* iconName)
+{
+ GRefPtr<GdkPixbuf> icon = loadThemedIcon(context, iconName, getIconSizeForPixelSize(rect.height()));
+ if (!icon)
+ return false;
+
+ if (gdk_pixbuf_get_width(icon.get()) > rect.width() || gdk_pixbuf_get_height(icon.get()) > rect.height())
+ icon = adoptGRef(gdk_pixbuf_scale_simple(icon.get(), rect.width(), rect.height(), GDK_INTERP_BILINEAR));
+
+ gtk_render_icon(context, graphicsContext.platformContext()->cr(), icon.get(), rect.x(), rect.y());
+ return true;
+}
+
+static bool paintEntryIcon(RenderThemePart themePart, const char* iconName, GraphicsContext& graphicsContext, const IntRect& rect, GtkTextDirection direction, GtkStateFlags state)
+{
+ GRefPtr<GtkStyleContext> parentContext = createStyleContext(Entry);
+ GRefPtr<GtkStyleContext> context = createStyleContext(themePart, parentContext.get());
+ gtk_style_context_set_direction(context.get(), direction);
+ gtk_style_context_set_state(context.get(), state);
+ return paintIcon(context.get(), graphicsContext, rect, iconName);
+}
+
</ins><span class="cx"> bool RenderThemeGtk::paintSearchFieldResultsDecorationPart(const RenderBox& renderObject, const PaintInfo& paintInfo, const IntRect& rect)
</span><span class="cx"> {
</span><span class="cx"> IntRect iconRect = centerRectVerticallyInParentInputElement(renderObject, rect);
</span><span class="cx"> if (iconRect.isEmpty())
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- GRefPtr<GdkPixbuf> icon = getStockIconForWidgetType(GTK_TYPE_ENTRY, GTK_STOCK_FIND,
- gtkTextDirection(renderObject.style().direction()),
- gtkIconState(this, renderObject),
- getIconSizeForPixelSize(rect.height()));
- paintGdkPixbuf(paintInfo.context, icon.get(), iconRect);
- return false;
</del><ins>+ return paintEntryIcon(EntryIconLeft, "edit-find-symbolic", *paintInfo.context, iconRect, gtkTextDirection(renderObject.style().direction()),
+ gtkIconStateFlags(this, renderObject));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void RenderThemeGtk::adjustSearchFieldCancelButtonStyle(StyleResolver&, RenderStyle& style, Element*) const
</span><span class="cx"> {
</span><del>- adjustSearchFieldIconStyle(style);
</del><ins>+ adjustSearchFieldIconStyle(EntryIconRight, style);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool RenderThemeGtk::paintSearchFieldCancelButton(const RenderBox& renderObject, const PaintInfo& paintInfo, const IntRect& rect)
</span><span class="lines">@@ -1078,12 +1015,8 @@
</span><span class="cx"> if (iconRect.isEmpty())
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- GRefPtr<GdkPixbuf> icon = getStockIconForWidgetType(GTK_TYPE_ENTRY, GTK_STOCK_CLEAR,
- gtkTextDirection(renderObject.style().direction()),
- gtkIconState(this, renderObject),
- getIconSizeForPixelSize(rect.height()));
- paintGdkPixbuf(paintInfo.context, icon.get(), iconRect);
- return false;
</del><ins>+ return paintEntryIcon(EntryIconRight, "edit-clear-symbolic", *paintInfo.context, iconRect, gtkTextDirection(renderObject.style().direction()),
+ gtkIconStateFlags(this, renderObject));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void RenderThemeGtk::adjustSearchFieldStyle(StyleResolver&, RenderStyle& style, Element*) const
</span><span class="lines">@@ -1098,28 +1031,9 @@
</span><span class="cx"> return paintTextField(o, i, rect);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool RenderThemeGtk::paintCapsLockIndicator(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect)
</del><ins>+bool RenderThemeGtk::shouldHaveCapsLockIndicator(HTMLInputElement& element) const
</ins><span class="cx"> {
</span><del>- // The other paint methods don't need to check whether painting is disabled because RenderTheme already checks it
- // before calling them, but paintCapsLockIndicator() is called by RenderTextControlSingleLine which doesn't check it.
- if (paintInfo.context->paintingDisabled())
- return true;
-
- int iconSize = std::min(rect.width(), rect.height());
- GRefPtr<GdkPixbuf> icon = getStockIconForWidgetType(GTK_TYPE_ENTRY, GTK_STOCK_CAPS_LOCK_WARNING, gtkTextDirection(renderObject.style().direction()), 0, getIconSizeForPixelSize(iconSize));
-
- // Only re-scale the icon when it's smaller than the minimum icon size.
- if (iconSize >= gtkIconSizeMenu)
- iconSize = gdk_pixbuf_get_height(icon.get());
-
- // GTK+ locates the icon right aligned in the entry. The given rectangle is already
- // centered vertically by RenderTextControlSingleLine.
- IntRect iconRect(
- rect.x() + rect.width() - iconSize,
- rect.y() + (rect.height() - iconSize) / 2,
- iconSize, iconSize);
- paintGdkPixbuf(paintInfo.context, icon.get(), iconRect);
- return true;
</del><ins>+ return element.isPasswordField();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void RenderThemeGtk::adjustSliderTrackStyle(StyleResolver&, RenderStyle& style, Element*) const
</span><span class="lines">@@ -1133,40 +1047,15 @@
</span><span class="cx"> style.setBoxShadow(nullptr);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void applySliderStyleContextClasses(GtkStyleContext* context, ControlPart part)
-{
-#if !GTK_CHECK_VERSION(3, 19, 2)
- gtk_style_context_add_class(context, GTK_STYLE_CLASS_SCALE);
-#endif
- if (part == SliderHorizontalPart || part == SliderThumbHorizontalPart)
- gtk_style_context_add_class(context, GTK_STYLE_CLASS_HORIZONTAL);
- else if (part == SliderVerticalPart || part == SliderThumbVerticalPart)
- gtk_style_context_add_class(context, GTK_STYLE_CLASS_VERTICAL);
-}
-
</del><span class="cx"> bool RenderThemeGtk::paintSliderTrack(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect)
</span><span class="cx"> {
</span><span class="cx"> ControlPart part = renderObject.style().appearance();
</span><del>- ASSERT_UNUSED(part, part == SliderHorizontalPart || part == SliderVerticalPart || part == MediaVolumeSliderPart);
</del><ins>+ ASSERT_UNUSED(part, part == SliderHorizontalPart || part == SliderVerticalPart);
</ins><span class="cx">
</span><del>- GRefPtr<GtkStyleContext> context = createStyleContext(GTK_TYPE_SCALE);
-#if GTK_CHECK_VERSION(3, 19, 2)
- GRefPtr<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new());
-
- gtk_widget_path_append_type(path.get(), GTK_TYPE_SCALE);
- gtk_widget_path_iter_set_object_name(path.get(), 0, "scale");
-
- gtk_widget_path_append_type(path.get(), GTK_TYPE_SCALE);
- gtk_widget_path_iter_set_object_name(path.get(), 1, "trough");
-
- gtk_style_context_set_path(context.get(), path.get());
-#endif
-
</del><ins>+ GRefPtr<GtkStyleContext> parentContext = createStyleContext(Scale);
+ gtk_style_context_add_class(parentContext.get(), part == SliderHorizontalPart ? GTK_STYLE_CLASS_HORIZONTAL : GTK_STYLE_CLASS_VERTICAL);
+ GRefPtr<GtkStyleContext> context = createStyleContext(ScaleTrough, parentContext.get());
</ins><span class="cx"> gtk_style_context_set_direction(context.get(), gtkTextDirection(renderObject.style().direction()));
</span><del>- applySliderStyleContextClasses(context.get(), part);
-#if !GTK_CHECK_VERSION(3, 19, 2)
- gtk_style_context_add_class(context.get(), GTK_STYLE_CLASS_TROUGH);
-#endif
</del><span class="cx">
</span><span class="cx"> if (!isEnabled(renderObject))
</span><span class="cx"> gtk_style_context_set_state(context.get(), GTK_STATE_FLAG_INSENSITIVE);
</span><span class="lines">@@ -1188,27 +1077,14 @@
</span><span class="cx"> bool RenderThemeGtk::paintSliderThumb(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect)
</span><span class="cx"> {
</span><span class="cx"> ControlPart part = renderObject.style().appearance();
</span><del>- ASSERT(part == SliderThumbHorizontalPart || part == SliderThumbVerticalPart || part == MediaVolumeSliderThumbPart);
</del><ins>+ ASSERT(part == SliderThumbHorizontalPart || part == SliderThumbVerticalPart);
</ins><span class="cx">
</span><del>- GRefPtr<GtkStyleContext> context = createStyleContext(GTK_TYPE_SCALE);
-#if GTK_CHECK_VERSION(3, 19, 2)
</del><span class="cx"> // FIXME: The entire slider is too wide, stretching the thumb into an oval rather than a circle.
</span><del>- GRefPtr<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new());
-
- gtk_widget_path_append_type(path.get(), GTK_TYPE_SCALE);
- gtk_widget_path_iter_set_object_name(path.get(), 0, "scale");
-
- gtk_widget_path_append_type(path.get(), GTK_TYPE_SCALE);
- gtk_widget_path_iter_set_object_name(path.get(), 1, "trough");
-
- gtk_widget_path_append_type(path.get(), GTK_TYPE_SCALE);
- gtk_widget_path_iter_set_object_name(path.get(), 2, "slider");
-
- gtk_style_context_set_path(context.get(), path.get());
-#endif
-
</del><ins>+ GRefPtr<GtkStyleContext> parentContext = createStyleContext(Scale);
+ gtk_style_context_add_class(parentContext.get(), part == SliderThumbHorizontalPart ? GTK_STYLE_CLASS_HORIZONTAL : GTK_STYLE_CLASS_VERTICAL);
+ GRefPtr<GtkStyleContext> troughContext = createStyleContext(ScaleTrough, parentContext.get());
+ GRefPtr<GtkStyleContext> context = createStyleContext(ScaleSlider, troughContext.get());
</ins><span class="cx"> gtk_style_context_set_direction(context.get(), gtkTextDirection(renderObject.style().direction()));
</span><del>- applySliderStyleContextClasses(context.get(), part);
</del><span class="cx">
</span><span class="cx"> guint flags = 0;
</span><span class="cx"> if (!isEnabled(renderObject))
</span><span class="lines">@@ -1231,7 +1107,7 @@
</span><span class="cx"> if (part != SliderThumbHorizontalPart && part != SliderThumbVerticalPart)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- GRefPtr<GtkStyleContext> context = createStyleContext(GTK_TYPE_SCALE);
</del><ins>+ GRefPtr<GtkStyleContext> context = createStyleContext(Scale);
</ins><span class="cx"> gint sliderWidth, sliderLength;
</span><span class="cx"> gtk_style_context_get_style(context.get(), "slider-width", &sliderWidth, "slider-length", &sliderLength, nullptr);
</span><span class="cx"> if (part == SliderThumbHorizontalPart) {
</span><span class="lines">@@ -1239,7 +1115,7 @@
</span><span class="cx"> style.setHeight(Length(sliderWidth, Fixed));
</span><span class="cx"> return;
</span><span class="cx"> }
</span><del>- ASSERT(part == SliderThumbVerticalPart || part == MediaVolumeSliderThumbPart);
</del><ins>+ ASSERT(part == SliderThumbVerticalPart);
</ins><span class="cx"> style.setWidth(Length(sliderWidth, Fixed));
</span><span class="cx"> style.setHeight(Length(sliderLength, Fixed));
</span><span class="cx"> }
</span><span class="lines">@@ -1249,43 +1125,13 @@
</span><span class="cx"> if (!renderObject.isProgress())
</span><span class="cx"> return true;
</span><span class="cx">
</span><del>- GRefPtr<GtkStyleContext> context = createStyleContext(GTK_TYPE_PROGRESS_BAR);
-#if GTK_CHECK_VERSION(3, 19, 2)
- GRefPtr<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new());
</del><ins>+ GRefPtr<GtkStyleContext> parentContext = createStyleContext(ProgressBar);
+ GRefPtr<GtkStyleContext> troughContext = createStyleContext(ProgressBarTrough, parentContext.get());
+ GRefPtr<GtkStyleContext> context = createStyleContext(ProgressBarProgress, troughContext.get());
</ins><span class="cx">
</span><del>- gtk_widget_path_append_type(path.get(), GTK_TYPE_PROGRESS_BAR);
- gtk_widget_path_iter_set_object_name(path.get(), 0, "progressbar");
</del><ins>+ gtk_render_background(troughContext.get(), paintInfo.context->platformContext()->cr(), rect.x(), rect.y(), rect.width(), rect.height());
+ gtk_render_frame(troughContext.get(), paintInfo.context->platformContext()->cr(), rect.x(), rect.y(), rect.width(), rect.height());
</ins><span class="cx">
</span><del>- gtk_widget_path_append_type(path.get(), GTK_TYPE_PROGRESS_BAR);
- gtk_widget_path_iter_set_object_name(path.get(), 1, "trough");
-
- gtk_style_context_set_path(context.get(), path.get());
-#else
- gtk_style_context_save(context.get());
- gtk_style_context_add_class(context.get(), GTK_STYLE_CLASS_TROUGH);
-#endif
-
- gtk_render_background(context.get(), paintInfo.context->platformContext()->cr(), rect.x(), rect.y(), rect.width(), rect.height());
- gtk_render_frame(context.get(), paintInfo.context->platformContext()->cr(), rect.x(), rect.y(), rect.width(), rect.height());
-
-#if GTK_CHECK_VERSION(3, 19, 2)
- path = adoptGRef(gtk_widget_path_new());
-
- gtk_widget_path_append_type(path.get(), GTK_TYPE_PROGRESS_BAR);
- gtk_widget_path_iter_set_object_name(path.get(), 0, "progressbar");
-
- gtk_widget_path_append_type(path.get(), GTK_TYPE_PROGRESS_BAR);
- gtk_widget_path_iter_set_object_name(path.get(), 1, "trough");
-
- gtk_widget_path_append_type(path.get(), GTK_TYPE_PROGRESS_BAR);
- gtk_widget_path_iter_set_object_name(path.get(), 2, "progress");
-
- gtk_style_context_set_path(context.get(), path.get());
-#else
- gtk_style_context_restore(context.get());
- gtk_style_context_add_class(context.get(), GTK_STYLE_CLASS_PROGRESSBAR);
-#endif
-
</del><span class="cx"> gtk_style_context_set_state(context.get(), static_cast<GtkStateFlags>(0));
</span><span class="cx">
</span><span class="cx"> GtkBorder padding;
</span><span class="lines">@@ -1322,7 +1168,7 @@
</span><span class="cx">
</span><span class="cx"> void RenderThemeGtk::adjustInnerSpinButtonStyle(StyleResolver&, RenderStyle& style, Element*) const
</span><span class="cx"> {
</span><del>- GRefPtr<GtkStyleContext> context = createStyleContext(GTK_TYPE_SPIN_BUTTON);
</del><ins>+ GRefPtr<GtkStyleContext> context = createStyleContext(SpinButton);
</ins><span class="cx">
</span><span class="cx"> GtkBorder padding;
</span><span class="cx"> gtk_style_context_get_padding(context.get(), gtk_style_context_get_state(context.get()), &padding);
</span><span class="lines">@@ -1332,29 +1178,13 @@
</span><span class="cx"> style.setMinWidth(Length(width, Fixed));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void paintSpinArrowButton(RenderTheme* theme, GtkStyleContext* context, const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect, GtkArrowType arrowType)
</del><ins>+static void paintSpinArrowButton(RenderTheme* theme, GtkStyleContext* parentContext, const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect, GtkArrowType arrowType)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(arrowType == GTK_ARROW_UP || arrowType == GTK_ARROW_DOWN);
</span><span class="cx">
</span><del>- gtk_style_context_save(context);
-
-#if GTK_CHECK_VERSION(3, 19, 2)
- GRefPtr<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new());
-
- gtk_widget_path_append_type(path.get(), GTK_TYPE_SPIN_BUTTON);
- gtk_widget_path_iter_set_object_name(path.get(), 0, "spinbutton");
-
- gtk_widget_path_append_type(path.get(), GTK_TYPE_SPIN_BUTTON);
- gtk_widget_path_iter_set_object_name(path.get(), 1, "button");
- gtk_widget_path_iter_add_class(path.get(), 1, arrowType == GTK_ARROW_UP ? "up" : "down");
-
- gtk_style_context_set_path(context, path.get());
-#else
- gtk_style_context_add_class(context, GTK_STYLE_CLASS_BUTTON);
-#endif
-
- GtkTextDirection direction = gtk_style_context_get_direction(context);
- guint state = static_cast<guint>(gtk_style_context_get_state(context));
</del><ins>+ GRefPtr<GtkStyleContext> context = createStyleContext(arrowType == GTK_ARROW_UP ? SpinButtonUpButton : SpinButtonDownButton, parentContext);
+ GtkTextDirection direction = gtk_style_context_get_direction(context.get());
+ guint state = static_cast<guint>(gtk_style_context_get_state(context.get()));
</ins><span class="cx"> if (!(state & GTK_STATE_FLAG_INSENSITIVE)) {
</span><span class="cx"> if (theme->isPressed(renderObject)) {
</span><span class="cx"> if ((arrowType == GTK_ARROW_UP && theme->isSpinUpButtonPartPressed(renderObject))
</span><span class="lines">@@ -1366,11 +1196,11 @@
</span><span class="cx"> state |= GTK_STATE_FLAG_PRELIGHT;
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- gtk_style_context_set_state(context, static_cast<GtkStateFlags>(state));
</del><ins>+ gtk_style_context_set_state(context.get(), static_cast<GtkStateFlags>(state));
</ins><span class="cx">
</span><span class="cx"> // Paint button.
</span><span class="cx"> IntRect buttonRect(rect);
</span><del>- guint junction = gtk_style_context_get_junction_sides(context);
</del><ins>+ guint junction = gtk_style_context_get_junction_sides(context.get());
</ins><span class="cx"> if (arrowType == GTK_ARROW_UP)
</span><span class="cx"> junction |= GTK_JUNCTION_BOTTOM;
</span><span class="cx"> else {
</span><span class="lines">@@ -1378,10 +1208,10 @@
</span><span class="cx"> buttonRect.move(0, rect.height() / 2);
</span><span class="cx"> }
</span><span class="cx"> buttonRect.setHeight(rect.height() / 2);
</span><del>- gtk_style_context_set_junction_sides(context, static_cast<GtkJunctionSides>(junction));
</del><ins>+ gtk_style_context_set_junction_sides(context.get(), static_cast<GtkJunctionSides>(junction));
</ins><span class="cx">
</span><del>- gtk_render_background(context, paintInfo.context->platformContext()->cr(), buttonRect.x(), buttonRect.y(), buttonRect.width(), buttonRect.height());
- gtk_render_frame(context, paintInfo.context->platformContext()->cr(), buttonRect.x(), buttonRect.y(), buttonRect.width(), buttonRect.height());
</del><ins>+ gtk_render_background(context.get(), paintInfo.context->platformContext()->cr(), buttonRect.x(), buttonRect.y(), buttonRect.width(), buttonRect.height());
+ gtk_render_frame(context.get(), paintInfo.context->platformContext()->cr(), buttonRect.x(), buttonRect.y(), buttonRect.width(), buttonRect.height());
</ins><span class="cx">
</span><span class="cx"> // Paint arrow centered inside button.
</span><span class="cx"> // This code is based on gtkspinbutton.c code.
</span><span class="lines">@@ -1407,25 +1237,20 @@
</span><span class="cx"> gint height = (width + 1) / 2;
</span><span class="cx">
</span><span class="cx"> arrowRect.move((arrowRect.width() - width) / 2, (arrowRect.height() - height) / 2);
</span><del>- gtk_render_arrow(context, paintInfo.context->platformContext()->cr(), angle, arrowRect.x(), arrowRect.y(), width);
-
- gtk_style_context_restore(context);
</del><ins>+ gtk_render_arrow(context.get(), paintInfo.context->platformContext()->cr(), angle, arrowRect.x(), arrowRect.y(), width);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool RenderThemeGtk::paintInnerSpinButton(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect)
</span><span class="cx"> {
</span><del>- GRefPtr<GtkStyleContext> context = createStyleContext(GTK_TYPE_SPIN_BUTTON);
</del><ins>+ GRefPtr<GtkStyleContext> context = createStyleContext(SpinButton);
+ gtk_style_context_set_direction(context.get(), gtkTextDirection(renderObject.style().direction()));
</ins><span class="cx">
</span><del>- GtkTextDirection direction = static_cast<GtkTextDirection>(gtkTextDirection(renderObject.style().direction()));
- gtk_style_context_set_direction(context.get(), direction);
-
</del><span class="cx"> guint flags = 0;
</span><span class="cx"> if (!isEnabled(renderObject) || isReadOnlyControl(renderObject))
</span><span class="cx"> flags |= GTK_STATE_FLAG_INSENSITIVE;
</span><span class="cx"> else if (isFocused(renderObject))
</span><span class="cx"> flags |= GTK_STATE_FLAG_FOCUSED;
</span><span class="cx"> gtk_style_context_set_state(context.get(), static_cast<GtkStateFlags>(flags));
</span><del>- gtk_style_context_remove_class(context.get(), GTK_STYLE_CLASS_ENTRY);
</del><span class="cx">
</span><span class="cx"> paintSpinArrowButton(this, context.get(), renderObject, paintInfo, rect, GTK_ARROW_UP);
</span><span class="cx"> paintSpinArrowButton(this, context.get(), renderObject, paintInfo, rect, GTK_ARROW_DOWN);
</span><span class="lines">@@ -1450,23 +1275,16 @@
</span><span class="cx">
</span><span class="cx"> enum StyleColorType { StyleColorBackground, StyleColorForeground };
</span><span class="cx">
</span><del>-static Color styleColor(GType widgetType, GtkStateFlags state, StyleColorType colorType)
</del><ins>+static Color styleColor(RenderThemePart themePart, GtkStateFlags state, StyleColorType colorType)
</ins><span class="cx"> {
</span><del>- GRefPtr<GtkStyleContext> context = createStyleContext(widgetType);
-#if GTK_CHECK_VERSION(3, 19, 2)
- if (widgetType == GTK_TYPE_ENTRY) {
- GRefPtr<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new());
-
- gtk_widget_path_append_type(path.get(), GTK_TYPE_ENTRY);
- gtk_widget_path_iter_set_object_name(path.get(), 0, "entry");
-
- gtk_widget_path_append_type(path.get(), GTK_TYPE_ENTRY);
- gtk_widget_path_iter_set_object_name(path.get(), 1, "selection");
-
- gtk_style_context_set_path(context.get(), path.get());
</del><ins>+ GRefPtr<GtkStyleContext> parentContext;
+ RenderThemePart part = themePart;
+ if (themePart == Entry && (state & GTK_STATE_FLAG_SELECTED)) {
+ parentContext = createStyleContext(Entry);
+ part = EntrySelection;
</ins><span class="cx"> }
</span><del>-#endif
</del><span class="cx">
</span><ins>+ GRefPtr<GtkStyleContext> context = createStyleContext(part, parentContext.get());
</ins><span class="cx"> gtk_style_context_set_state(context.get(), state);
</span><span class="cx">
</span><span class="cx"> GdkRGBA gdkRGBAColor;
</span><span class="lines">@@ -1479,51 +1297,51 @@
</span><span class="cx">
</span><span class="cx"> Color RenderThemeGtk::platformActiveSelectionBackgroundColor() const
</span><span class="cx"> {
</span><del>- return styleColor(GTK_TYPE_ENTRY, static_cast<GtkStateFlags>(GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED), StyleColorBackground);
</del><ins>+ return styleColor(Entry, static_cast<GtkStateFlags>(GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED), StyleColorBackground);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Color RenderThemeGtk::platformInactiveSelectionBackgroundColor() const
</span><span class="cx"> {
</span><del>- return styleColor(GTK_TYPE_ENTRY, GTK_STATE_FLAG_SELECTED, StyleColorBackground);
</del><ins>+ return styleColor(Entry, GTK_STATE_FLAG_SELECTED, StyleColorBackground);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Color RenderThemeGtk::platformActiveSelectionForegroundColor() const
</span><span class="cx"> {
</span><del>- return styleColor(GTK_TYPE_ENTRY, static_cast<GtkStateFlags>(GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED), StyleColorForeground);
</del><ins>+ return styleColor(Entry, static_cast<GtkStateFlags>(GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED), StyleColorForeground);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Color RenderThemeGtk::platformInactiveSelectionForegroundColor() const
</span><span class="cx"> {
</span><del>- return styleColor(GTK_TYPE_ENTRY, GTK_STATE_FLAG_SELECTED, StyleColorForeground);
</del><ins>+ return styleColor(Entry, GTK_STATE_FLAG_SELECTED, StyleColorForeground);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Color RenderThemeGtk::platformActiveListBoxSelectionBackgroundColor() const
</span><span class="cx"> {
</span><del>- return styleColor(GTK_TYPE_TREE_VIEW, static_cast<GtkStateFlags>(GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED), StyleColorBackground);
</del><ins>+ return styleColor(ListBox, static_cast<GtkStateFlags>(GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED), StyleColorBackground);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Color RenderThemeGtk::platformInactiveListBoxSelectionBackgroundColor() const
</span><span class="cx"> {
</span><del>- return styleColor(GTK_TYPE_TREE_VIEW, GTK_STATE_FLAG_SELECTED, StyleColorBackground);
</del><ins>+ return styleColor(ListBox, GTK_STATE_FLAG_SELECTED, StyleColorBackground);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Color RenderThemeGtk::platformActiveListBoxSelectionForegroundColor() const
</span><span class="cx"> {
</span><del>- return styleColor(GTK_TYPE_TREE_VIEW, static_cast<GtkStateFlags>(GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED), StyleColorForeground);
</del><ins>+ return styleColor(ListBox, static_cast<GtkStateFlags>(GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED), StyleColorForeground);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Color RenderThemeGtk::platformInactiveListBoxSelectionForegroundColor() const
</span><span class="cx"> {
</span><del>- return styleColor(GTK_TYPE_TREE_VIEW, GTK_STATE_FLAG_SELECTED, StyleColorForeground);
</del><ins>+ return styleColor(ListBox, GTK_STATE_FLAG_SELECTED, StyleColorForeground);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Color RenderThemeGtk::systemColor(CSSValueID cssValueId) const
</span><span class="cx"> {
</span><span class="cx"> switch (cssValueId) {
</span><span class="cx"> case CSSValueButtontext:
</span><del>- return styleColor(GTK_TYPE_BUTTON, GTK_STATE_FLAG_ACTIVE, StyleColorForeground);
</del><ins>+ return styleColor(Button, GTK_STATE_FLAG_ACTIVE, StyleColorForeground);
</ins><span class="cx"> case CSSValueCaptiontext:
</span><del>- return styleColor(GTK_TYPE_ENTRY, GTK_STATE_FLAG_ACTIVE, StyleColorForeground);
</del><ins>+ return styleColor(Entry, GTK_STATE_FLAG_ACTIVE, StyleColorForeground);
</ins><span class="cx"> default:
</span><span class="cx"> return RenderTheme::systemColor(cssValueId);
</span><span class="cx"> }
</span><span class="lines">@@ -1531,9 +1349,6 @@
</span><span class="cx">
</span><span class="cx"> void RenderThemeGtk::platformColorsDidChange()
</span><span class="cx"> {
</span><del>-#if ENABLE(VIDEO)
- initMediaColors();
-#endif
</del><span class="cx"> RenderTheme::platformColorsDidChange();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1550,16 +1365,14 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-bool RenderThemeGtk::paintMediaButton(const RenderObject& renderObject, GraphicsContext* context, const IntRect& rect, const char* symbolicIconName, const char* fallbackStockIconName)
</del><ins>+bool RenderThemeGtk::paintMediaButton(const RenderObject& renderObject, GraphicsContext& graphicsContext, const IntRect& rect, const char* iconName)
</ins><span class="cx"> {
</span><del>- IntRect iconRect(
- rect.x() + (rect.width() - m_mediaIconSize) / 2,
- rect.y() + (rect.height() - m_mediaIconSize) / 2,
- m_mediaIconSize, m_mediaIconSize);
- GRefPtr<GdkPixbuf> icon = getStockSymbolicIconForWidgetType(GTK_TYPE_CONTAINER, symbolicIconName, fallbackStockIconName,
- gtkTextDirection(renderObject.style().direction()), gtkIconState(this, renderObject), iconRect.width());
- paintGdkPixbuf(context, icon.get(), iconRect);
- return true;
</del><ins>+ GRefPtr<GtkStyleContext> context = createStyleContext(MediaButton);
+ gtk_style_context_set_direction(context.get(), gtkTextDirection(renderObject.style().direction()));
+ gtk_style_context_set_state(context.get(), gtkIconStateFlags(this, renderObject));
+ static const unsigned mediaIconSize = 16;
+ IntRect iconRect(rect.x() + (rect.width() - mediaIconSize) / 2, rect.y() + (rect.height() - mediaIconSize) / 2, mediaIconSize, mediaIconSize);
+ return paintIcon(context.get(), graphicsContext, iconRect, iconName);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool RenderThemeGtk::hasOwnDisabledStateHandlingFor(ControlPart part) const
</span><span class="lines">@@ -1569,19 +1382,20 @@
</span><span class="cx">
</span><span class="cx"> bool RenderThemeGtk::paintMediaFullscreenButton(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect)
</span><span class="cx"> {
</span><del>- return paintMediaButton(renderObject, paintInfo.context, rect, "view-fullscreen-symbolic", GTK_STOCK_FULLSCREEN);
</del><ins>+ return paintMediaButton(renderObject, *paintInfo.context, rect, "view-fullscreen-symbolic");
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool RenderThemeGtk::paintMediaMuteButton(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect)
</span><span class="cx"> {
</span><del>- HTMLMediaElement* mediaElement = getMediaElementFromRenderObject(renderObject);
- if (!mediaElement)
</del><ins>+ Node* node = renderObject.node();
+ if (!node)
</ins><span class="cx"> return false;
</span><ins>+ Node* mediaNode = node->shadowHost();
+ if (!is<HTMLMediaElement>(mediaNode))
+ return false;
</ins><span class="cx">
</span><del>- bool muted = mediaElement->muted();
- return paintMediaButton(renderObject, paintInfo.context, rect,
- muted ? "audio-volume-muted-symbolic" : "audio-volume-high-symbolic",
- muted ? "audio-volume-muted" : "audio-volume-high");
</del><ins>+ HTMLMediaElement* mediaElement = downcast<HTMLMediaElement>(mediaNode);
+ return paintMediaButton(renderObject, *paintInfo.context, rect, mediaElement->muted() ? "audio-volume-muted-symbolic" : "audio-volume-high-symbolic");
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool RenderThemeGtk::paintMediaPlayButton(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect)
</span><span class="lines">@@ -1592,36 +1406,24 @@
</span><span class="cx">
</span><span class="cx"> if (!nodeHasPseudo(node, "-webkit-media-controls-play-button"))
</span><span class="cx"> return false;
</span><del>- bool showPlayButton = nodeHasClass(node, "paused");
</del><span class="cx">
</span><del>- return paintMediaButton(renderObject, paintInfo.context, rect,
- showPlayButton ? "media-playback-start-symbolic" : "media-playback-pause-symbolic",
- showPlayButton ? GTK_STOCK_MEDIA_PLAY : GTK_STOCK_MEDIA_PAUSE);
</del><ins>+ return paintMediaButton(renderObject, *paintInfo.context, rect, nodeHasClass(node, "paused") ? "media-playback-start-symbolic" : "media-playback-pause-symbolic");
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool RenderThemeGtk::paintMediaSeekBackButton(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect)
</span><span class="cx"> {
</span><del>- return paintMediaButton(renderObject, paintInfo.context, rect, "media-seek-backward-symbolic", GTK_STOCK_MEDIA_REWIND);
</del><ins>+ return paintMediaButton(renderObject, *paintInfo.context, rect, "media-seek-backward-symbolic");
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool RenderThemeGtk::paintMediaSeekForwardButton(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect)
</span><span class="cx"> {
</span><del>- return paintMediaButton(renderObject, paintInfo.context, rect, "media-seek-forward-symbolic", GTK_STOCK_MEDIA_FORWARD);
</del><ins>+ return paintMediaButton(renderObject, *paintInfo.context, rect, "media-seek-forward-symbolic");
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx"> bool RenderThemeGtk::paintMediaToggleClosedCaptionsButton(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect)
</span><span class="cx"> {
</span><del>- IntRect iconRect(rect.x() + (rect.width() - m_mediaIconSize) / 2, rect.y() + (rect.height() - m_mediaIconSize) / 2,
- m_mediaIconSize, m_mediaIconSize);
- GRefPtr<GdkPixbuf> icon = getStockSymbolicIconForWidgetType(GTK_TYPE_CONTAINER, "media-view-subtitles-symbolic", nullptr,
- gtkTextDirection(renderObject.style().direction()), gtkIconState(this, renderObject), iconRect.width());
- if (!icon) {
- icon = getStockSymbolicIconForWidgetType(GTK_TYPE_CONTAINER, "user-invisible-symbolic", GTK_STOCK_JUSTIFY_FILL,
- gtkTextDirection(renderObject.style().direction()), gtkIconState(this, renderObject), iconRect.width());
- }
- paintGdkPixbuf(paintInfo.context, icon.get(), iconRect);
- return true;
</del><ins>+ return paintMediaButton(renderObject, *paintInfo.context, rect, "media-view-subtitles-symbolic");
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceWebCorerenderingRenderThemeGtkh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderThemeGtk.h (195122 => 195123)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderThemeGtk.h        2016-01-15 12:37:54 UTC (rev 195122)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderThemeGtk.h        2016-01-15 12:38:14 UTC (rev 195123)
</span><span class="lines">@@ -102,8 +102,9 @@
</span><span class="cx"> #endif
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+ virtual bool shouldHaveCapsLockIndicator(HTMLInputElement&) const override;
+
</ins><span class="cx"> private:
</span><del>- RenderThemeGtk();
</del><span class="cx"> virtual ~RenderThemeGtk();
</span><span class="cx">
</span><span class="cx"> virtual bool paintCheckbox(const RenderObject&, const PaintInfo&, const IntRect&) override;
</span><span class="lines">@@ -153,8 +154,6 @@
</span><span class="cx"> virtual void adjustSliderThumbSize(RenderStyle&, Element*) const override;
</span><span class="cx">
</span><span class="cx"> #if ENABLE(VIDEO)
</span><del>- void initMediaColors();
- void initMediaButtons();
</del><span class="cx"> virtual bool hasOwnDisabledStateHandlingFor(ControlPart) const override;
</span><span class="cx"> virtual bool paintMediaFullscreenButton(const RenderObject&, const PaintInfo&, const IntRect&) override;
</span><span class="cx"> virtual bool paintMediaPlayButton(const RenderObject&, const PaintInfo&, const IntRect&) override;
</span><span class="lines">@@ -177,8 +176,6 @@
</span><span class="cx"> virtual void adjustProgressBarStyle(StyleResolver&, RenderStyle&, Element*) const override;
</span><span class="cx"> virtual bool paintProgressBar(const RenderObject&, const PaintInfo&, const IntRect&) override;
</span><span class="cx">
</span><del>- virtual bool paintCapsLockIndicator(const RenderObject&, const PaintInfo&, const IntRect&) override;
-
</del><span class="cx"> virtual void adjustInnerSpinButtonStyle(StyleResolver&, RenderStyle&, Element*) const override;
</span><span class="cx"> virtual bool paintInnerSpinButton(const RenderObject&, const PaintInfo&, const IntRect&) override;
</span><span class="cx">
</span><span class="lines">@@ -187,16 +184,10 @@
</span><span class="cx"> static void setTextInputBorders(RenderStyle&);
</span><span class="cx">
</span><span class="cx"> #if ENABLE(VIDEO)
</span><del>- bool paintMediaButton(const RenderObject&, GraphicsContext*, const IntRect&, const char* symbolicIconName, const char* fallbackStockIconName);
</del><ins>+ bool paintMediaButton(const RenderObject&, GraphicsContext&, const IntRect&, const char* iconName);
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> static IntRect calculateProgressRect(const RenderObject&, const IntRect&);
</span><del>-
- mutable Color m_panelColor;
- mutable Color m_sliderColor;
- mutable Color m_sliderThumbColor;
- const int m_mediaIconSize;
- const int m_mediaSliderHeight;
</del><span class="cx"> #endif // GTK_API_VERSION_2
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>