<!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  &lt;cgarcia@igalia.com&gt;
</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  &lt;cgarcia@igalia.com&gt;
+
</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&lt;ScrollbarThemeGtk*&gt;(ScrollbarTheme::theme())-&gt;themeChanged();
</span><span class="cx">     Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static GRefPtr&lt;GtkStyleContext&gt; createStyleContext(GType widgetType)
</del><ins>+static GRefPtr&lt;GtkStyleContext&gt; 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&lt;GtkWidgetPath&gt; path = adoptGRef(gtk_widget_path_new());
-    gtk_widget_path_append_type(path.get(), widgetType);
</del><ins>+    GRefPtr&lt;GtkWidgetPath&gt; 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, &quot;entry&quot;);
-    else if (widgetType == GTK_TYPE_ARROW)
-        gtk_widget_path_iter_set_object_name(path.get(), 0, &quot;button&quot;); // Note: not a typo.
-    else if (widgetType == GTK_TYPE_BUTTON) {
-        gtk_widget_path_iter_set_object_name(path.get(), 0, &quot;button&quot;);
-        gtk_widget_path_iter_add_class(path.get(), 0, &quot;text-button&quot;);
-    } else if (widgetType == GTK_TYPE_SCALE)
-        gtk_widget_path_iter_set_object_name(path.get(), 0, &quot;scale&quot;);
-    else if (widgetType == GTK_TYPE_SEPARATOR)
-        gtk_widget_path_iter_set_object_name(path.get(), 0, &quot;separator&quot;);
-    else if (widgetType == GTK_TYPE_PROGRESS_BAR)
-        gtk_widget_path_iter_set_object_name(path.get(), 0, &quot;progressbar&quot;);
-    else if (widgetType == GTK_TYPE_SPIN_BUTTON)
-        gtk_widget_path_iter_set_object_name(path.get(), 0, &quot;spinbutton&quot;);
-    else if (widgetType == GTK_TYPE_TREE_VIEW) {
-        gtk_widget_path_iter_set_object_name(path.get(), 0, &quot;treeview&quot;);
-        gtk_widget_path_iter_add_class(path.get(), 0, &quot;view&quot;);
-    } else if (widgetType == GTK_TYPE_CHECK_BUTTON)
-        gtk_widget_path_iter_set_object_name(path.get(), 0, &quot;checkbutton&quot;);
-    else if (widgetType == GTK_TYPE_RADIO_BUTTON)
-        gtk_widget_path_iter_set_object_name(path.get(), 0, &quot;radiobutton&quot;);
-    else if (widgetType == GTK_TYPE_COMBO_BOX)
-        gtk_widget_path_iter_set_object_name(path.get(), 0, &quot;combobox&quot;);
</del><ins>+        gtk_widget_path_iter_set_object_name(path.get(), -1, &quot;entry&quot;);
</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, &quot;arrow&quot;);
-    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, &quot;text-button&quot;);
-    } 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, &quot;selection&quot;);
+#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, &quot;image&quot;);
+        gtk_widget_path_iter_add_class(path.get(), -1, themePart == EntryIconLeft ? &quot;left&quot; : &quot;right&quot;);
+#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, &quot;button&quot;);
+#else
+        gtk_widget_path_iter_add_class(path.get(), -1, GTK_STYLE_CLASS_BUTTON);
+#endif
+        gtk_widget_path_iter_add_class(path.get(), -1, &quot;text-button&quot;);
+        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, &quot;checkbutton&quot;);
+#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, &quot;check&quot;);
+#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, &quot;radiobutton&quot;);
+#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, &quot;radio&quot;);
+#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, &quot;combobox&quot;);
+#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, &quot;button&quot;);
+#else
+        gtk_widget_path_iter_add_class(path.get(), -1, GTK_STYLE_CLASS_BUTTON);
+#endif
+        gtk_widget_path_iter_add_class(path.get(), -1, &quot;text-button&quot;);
+        gtk_widget_path_iter_add_class(path.get(), -1, &quot;combo&quot;);
+        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, &quot;arrow&quot;);
+#else
+        gtk_widget_path_iter_add_class(path.get(), -1, &quot;arrow&quot;);
+#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, &quot;scale&quot;);
+#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, &quot;trough&quot;);
+#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, &quot;slider&quot;);
+#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, &quot;progressbar&quot;);
+#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, &quot;trough&quot;);
+#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, &quot;progress&quot;);
+#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, &quot;treeview&quot;);
+#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, &quot;spinbutton&quot;);
+#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, &quot;button&quot;);
+        gtk_widget_path_iter_add_class(path.get(), -1, themePart == SpinButtonUpButton ? &quot;up&quot; : &quot;down&quot;);
+#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, &quot;image&quot;);
+#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&lt;GtkStyleContext&gt; 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&lt;GdkPixbuf&gt; getStockIconForWidgetType(GType widgetType, const char* iconName, gint direction, gint state, gint iconSize)
</del><ins>+static GRefPtr&lt;GdkPixbuf&gt; loadThemedIcon(GtkStyleContext* context, const char* iconName, GtkIconSize iconSize)
</ins><span class="cx"> {
</span><del>-    ASSERT(iconName);
-
-    GRefPtr&lt;GtkStyleContext&gt; 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&lt;GtkStateFlags&gt;(flags));
-    gtk_style_context_set_direction(context.get(), static_cast&lt;GtkTextDirection&gt;(direction));
-    GdkPixbuf* icon = gtk_icon_set_render_icon_pixbuf(iconSet, context.get(), static_cast&lt;GtkIconSize&gt;(iconSize));
-
-    return adoptGRef(icon);
-}
-
-static GRefPtr&lt;GdkPixbuf&gt; getStockSymbolicIconForWidgetType(GType widgetType, const char* symbolicIconName, const char* fallbackStockIconName, gint direction, gint state, gint iconSize)
-{
-    GRefPtr&lt;GtkStyleContext&gt; 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&lt;GtkStateFlags&gt;(flags));
-    gtk_style_context_set_direction(context.get(), static_cast&lt;GtkTextDirection&gt;(direction));
-
-    GUniquePtr&lt;GtkIconInfo&gt; info(gtk_icon_theme_lookup_icon(gtk_icon_theme_get_default(), symbolicIconName, iconSize,
-        static_cast&lt;GtkIconLookupFlags&gt;(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&amp; o)
-{
-    Node* node = o.node();
-    Node* mediaNode = node ? node-&gt;shadowHost() : nullptr;
-    if (!mediaNode)
-        mediaNode = node;
-    if (!is&lt;HTMLMediaElement&gt;(mediaNode))
</del><ins>+    GRefPtr&lt;GIcon&gt; 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 &amp; GTK_TEXT_DIR_LTR)
+        lookupFlags |= GTK_ICON_LOOKUP_DIR_LTR;
+    else if (direction &amp; GTK_TEXT_DIR_RTL)
+        lookupFlags |= GTK_ICON_LOOKUP_DIR_RTL;
+    int width, height;
+    gtk_icon_size_lookup(iconSize, &amp;width, &amp;height);
+    GRefPtr&lt;GtkIconInfo&gt; iconInfo = adoptGRef(gtk_icon_theme_lookup_by_gicon(gtk_icon_theme_get_default(), icon.get(), std::min(width, height), static_cast&lt;GtkIconLookupFlags&gt;(lookupFlags)));
+    if (!iconInfo)
</ins><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    return downcast&lt;HTMLMediaElement&gt;(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&lt;GtkStyleContext&gt; 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()), &amp;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()), &amp;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()), &amp;color);
-    m_sliderThumbColor = color;
-}
-
-void RenderThemeGtk::initMediaButtons()
-{
-    static bool iconsInitialized = false;
-
-    if (iconsInitialized)
-        return;
-
-    GRefPtr&lt;GtkIconFactory&gt; iconFactory = adoptGRef(gtk_icon_factory_new());
-    GtkIconSource* iconSource = gtk_icon_source_new();
-    const char* icons[] = { &quot;audio-volume-high&quot;, &quot;audio-volume-muted&quot; };
-
-    gtk_icon_factory_add_default(iconFactory.get());
-
-    for (size_t i = 0; i &lt; 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&lt;Node&gt; attributeNode = node-&gt;attributes()-&gt;getNamedItem(&quot;pseudo&quot;);
</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&amp; renderObject)
</del><ins>+static GtkStateFlags gtkIconStateFlags(RenderTheme* theme, const RenderObject&amp; renderObject)
</ins><span class="cx"> {
</span><span class="cx">     if (!theme-&gt;isEnabled(renderObject))
</span><del>-        return GTK_STATE_INSENSITIVE;
</del><ins>+        return GTK_STATE_FLAG_INSENSITIVE;
</ins><span class="cx">     if (theme-&gt;isPressed(renderObject))
</span><del>-        return GTK_STATE_ACTIVE;
</del><ins>+        return GTK_STATE_FLAG_ACTIVE;
</ins><span class="cx">     if (theme-&gt;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&amp; 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(), &quot;indicator-spacing&quot;, &amp;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&amp; style)
</del><ins>+static void setToggleSize(RenderThemePart themePart, RenderStyle&amp; style)
</ins><span class="cx"> {
</span><del>-    GRefPtr&lt;GtkStyleContext&gt; 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() &amp;&amp; !style.height().isAuto())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    GRefPtr&lt;GtkStyleContext&gt; 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(), &quot;indicator-size&quot;, &amp;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&amp; renderObject, const PaintInfo&amp; paintInfo, const IntRect&amp; fullRect)
</del><ins>+static void paintToggle(const RenderThemeGtk* theme, RenderThemePart themePart, const RenderObject&amp; renderObject, const PaintInfo&amp; paintInfo, const IntRect&amp; fullRect)
</ins><span class="cx"> {
</span><del>-    GRefPtr&lt;GtkStyleContext&gt; context = createStyleContext(widgetType);
-#if GTK_CHECK_VERSION(3, 19, 2)
-    GRefPtr&lt;GtkWidgetPath&gt; path = adoptGRef(gtk_widget_path_new());
</del><ins>+    GRefPtr&lt;GtkStyleContext&gt; parentContext = createStyleContext(themePart);
+    GRefPtr&lt;GtkStyleContext&gt; context = createStyleContext(themePart == CheckButton ? CheckButtonCheck : RadioButtonRadio, parentContext.get());
+    gtk_style_context_set_direction(context.get(), static_cast&lt;GtkTextDirection&gt;(gtkTextDirection(renderObject.style().direction())));
</ins><span class="cx"> 
</span><del>-    if (widgetType == GTK_TYPE_CHECK_BUTTON) {
-        if (theme-&gt;isChecked(renderObject) || theme-&gt;isIndeterminate(renderObject)) {
-            gtk_widget_path_append_type(path.get(), GTK_TYPE_CHECK_BUTTON);
-            gtk_widget_path_iter_set_object_name(path.get(), 0, &quot;checkbutton&quot;);
-        } else {
-            gtk_widget_path_append_type(path.get(), GTK_TYPE_CHECK_BUTTON);
-            gtk_widget_path_iter_set_object_name(path.get(), 0, &quot;button&quot;);
-            gtk_widget_path_iter_add_class(path.get(), 0, &quot;check&quot;);
-        }
-
-        gtk_widget_path_append_type(path.get(), GTK_TYPE_CHECK_BUTTON);
-        gtk_widget_path_iter_set_object_name(path.get(), 1, &quot;check&quot;);
-    } else if (widgetType == GTK_TYPE_RADIO_BUTTON) {
-        if (theme-&gt;isChecked(renderObject) || theme-&gt;isIndeterminate(renderObject)) {
-            gtk_widget_path_append_type(path.get(), GTK_TYPE_RADIO_BUTTON);
-            gtk_widget_path_iter_set_object_name(path.get(), 0, &quot;radiobutton&quot;);
-        } else {
-            gtk_widget_path_append_type(path.get(), GTK_TYPE_RADIO_BUTTON);
-            gtk_widget_path_iter_set_object_name(path.get(), 0, &quot;button&quot;);
-            gtk_widget_path_iter_add_class(path.get(), 0, &quot;radio&quot;);
-        }
-
-        gtk_widget_path_append_type(path.get(), GTK_TYPE_RADIO_BUTTON);
-        gtk_widget_path_iter_set_object_name(path.get(), 1, &quot;radio&quot;);
-    }
-
-    gtk_style_context_set_path(context.get(), path.get());
</del><ins>+    unsigned flags = 0;
+    if (!theme-&gt;isEnabled(renderObject))
+        flags |= GTK_STATE_FLAG_INSENSITIVE;
+    else if (theme-&gt;isHovered(renderObject))
+        flags |= GTK_STATE_FLAG_PRELIGHT;
+    if (theme-&gt;isIndeterminate(renderObject))
+        flags |= GTK_STATE_FLAG_INCONSISTENT;
+    else if (theme-&gt;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-&gt;isPressed(renderObject))
+        flags |= GTK_STATE_FLAG_SELECTED;
+    gtk_style_context_set_state(context.get(), static_cast&lt;GtkStateFlags&gt;(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&lt;GtkTextDirection&gt;(gtkTextDirection(renderObject.style().direction())));
</del><ins>+    gtk_render_background(context.get(), paintInfo.context-&gt;platformContext()-&gt;cr(), rect.x(), rect.y(), rect.width(), rect.height());
+    gtk_render_frame(context.get(), paintInfo.context-&gt;platformContext()-&gt;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(), &quot;toggle&quot;);
-#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-&gt;isEnabled(renderObject))
-        flags |= GTK_STATE_FLAG_INSENSITIVE;
-    else if (theme-&gt;isHovered(renderObject))
-        flags |= GTK_STATE_FLAG_PRELIGHT;
-    if (theme-&gt;isIndeterminate(renderObject))
-        flags |= GTK_STATE_FLAG_INCONSISTENT;
-    else if (theme-&gt;isChecked(renderObject))
-#if GTK_CHECK_VERSION(3, 13, 7)
-        flags |= GTK_STATE_FLAG_CHECKED;
-#else
-        flags |= GTK_STATE_FLAG_ACTIVE;
-#endif
-    if (theme-&gt;isPressed(renderObject))
-        flags |= GTK_STATE_FLAG_SELECTED;
-    gtk_style_context_set_state(context.get(), static_cast&lt;GtkStateFlags&gt;(flags));
-
-    if (widgetType == GTK_TYPE_CHECK_BUTTON)
</del><ins>+    if (themePart == CheckButton)
</ins><span class="cx">         gtk_render_check(context.get(), paintInfo.context-&gt;platformContext()-&gt;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-&gt;platformContext()-&gt;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&amp; 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&amp; renderObject, const PaintInfo&amp; paintInfo, const IntRect&amp; 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&amp; 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&amp; renderObject, const PaintInfo&amp; paintInfo, const IntRect&amp; 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&amp; renderObject, const PaintInfo&amp; paintInfo, const IntRect&amp; rect)
</span><span class="cx"> {
</span><del>-    GRefPtr&lt;GtkStyleContext&gt; context = createStyleContext(GTK_TYPE_BUTTON);
-
</del><ins>+    GRefPtr&lt;GtkStyleContext&gt; context = createStyleContext(Button);
</ins><span class="cx">     gtk_style_context_set_direction(context.get(), static_cast&lt;GtkTextDirection&gt;(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&amp; style, GtkBorder&amp; border, int&amp; focus, int&amp; separator)
</del><ins>+static void getComboBoxMetrics(RenderStyle&amp; style, GtkBorder&amp; border, int&amp; 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&lt;GtkStyleContext&gt; context = createStyleContext(GTK_TYPE_COMBO_BOX);
-#if GTK_CHECK_VERSION(3, 19, 2)
-    GRefPtr&lt;GtkWidgetPath&gt; 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, &quot;combobox&quot;);
-
-    gtk_widget_path_append_type(path.get(), GTK_TYPE_COMBO_BOX);
-    gtk_widget_path_iter_set_object_name(path.get(), 1, &quot;button&quot;);
-    gtk_widget_path_iter_add_class(path.get(), 1, &quot;combo&quot;);
-
-    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&lt;GtkStyleContext&gt; parentContext = createStyleContext(ComboBox);
+    GRefPtr&lt;GtkStyleContext&gt; context = createStyleContext(ComboBoxButton, parentContext.get());
</ins><span class="cx">     gtk_style_context_set_direction(context.get(), static_cast&lt;GtkTextDirection&gt;(gtkTextDirection(style.direction())));
</span><del>-
</del><span class="cx">     gtk_style_context_set_state(context.get(), static_cast&lt;GtkStateFlags&gt;(0));
</span><span class="cx">     gtk_style_context_get_border(context.get(), gtk_style_context_get_state(context.get()), &amp;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(), &quot;interior-focus&quot;, &amp;interiorFocus, &quot;focus-line-width&quot;, &amp;focusWidth, &quot;focus-padding&quot;, &amp;focusPad, nullptr);
</span><span class="cx">     focus = interiorFocus ? focusWidth + focusPad : 0;
</span><del>-
-    context = createStyleContext(GTK_TYPE_SEPARATOR);
-
-    GtkTextDirection direction = static_cast&lt;GtkTextDirection&gt;(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(), &quot;separator&quot;);
-#endif
-
-    gboolean wideSeparators;
-    gint separatorWidth;
-    gtk_style_context_get_style(context.get(), &quot;wide-separators&quot;, &amp;wideSeparators, &quot;separator-width&quot;, &amp;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&amp; 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&amp; 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&amp; 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&amp; 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-&gt;platformContext()-&gt;cr();
</span><span class="cx">     GtkTextDirection direction = static_cast&lt;GtkTextDirection&gt;(gtkTextDirection(renderObject.style().direction()));
</span><span class="cx"> 
</span><ins>+    GRefPtr&lt;GtkStyleContext&gt; parentStyleContext = createStyleContext(ComboBox);
+
</ins><span class="cx">     // Paint the button.
</span><del>-    GRefPtr&lt;GtkStyleContext&gt; buttonStyleContext = createStyleContext(GTK_TYPE_BUTTON);
</del><ins>+    GRefPtr&lt;GtkStyleContext&gt; 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&lt;GtkStyleContext&gt; arrowStyleContext = createStyleContext(GTK_TYPE_ARROW);
-
</del><ins>+    GRefPtr&lt;GtkStyleContext&gt; 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(), &quot;arrow&quot;);
-    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(), &quot;arrow-scaling&quot;, &amp;arrowScaling, nullptr);
</del><ins>+    gtk_style_context_get_style(parentStyleContext.get(), &quot;arrow-scaling&quot;, &amp;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&lt;GtkStyleContext&gt; separatorStyleContext = createStyleContext(GTK_TYPE_COMBO_BOX);
-#if GTK_CHECK_VERSION(3, 19, 2)
-    GRefPtr&lt;GtkWidgetPath&gt; 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, &quot;separator&quot;);
-
-    gtk_style_context_set_path(separatorStyleContext.get(), path.get());
-#else
-    gtk_style_context_add_class(separatorStyleContext.get(), &quot;separator&quot;);
-#endif
-
-    gtk_style_context_set_direction(separatorStyleContext.get(), direction);
-
-    gboolean wideSeparators;
-    gint separatorWidth;
-    gtk_style_context_get_style(separatorStyleContext.get(), &quot;wide-separators&quot;, &amp;wideSeparators, &quot;separator-width&quot;, &amp;separatorWidth, nullptr);
-    if (wideSeparators &amp;&amp; !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()), &amp;padding);
-        GtkBorder border;
-        gtk_style_context_get_border(separatorStyleContext.get(), gtk_style_context_get_state(separatorStyleContext.get()), &amp;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&amp; renderObject, const PaintInfo&amp; paintInfo, const FloatRect&amp; rect)
</span><span class="cx"> {
</span><del>-    GRefPtr&lt;GtkStyleContext&gt; context = createStyleContext(GTK_TYPE_ENTRY);
-
</del><ins>+    GRefPtr&lt;GtkStyleContext&gt; context = createStyleContext(Entry);
</ins><span class="cx">     gtk_style_context_set_direction(context.get(), static_cast&lt;GtkTextDirection&gt;(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&amp; iconRect)
-{
-    IntSize iconSize(gdk_pixbuf_get_width(icon), gdk_pixbuf_get_height(icon));
-    GRefPtr&lt;GdkPixbuf&gt; 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-&gt;platformContext()-&gt;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&amp; style)
</del><ins>+static void adjustSearchFieldIconStyle(RenderThemePart themePart, RenderStyle&amp; style)
</ins><span class="cx"> {
</span><span class="cx">     style.resetBorder();
</span><span class="cx">     style.resetPadding();
</span><span class="cx"> 
</span><ins>+    GRefPtr&lt;GtkStyleContext&gt; parentContext = createStyleContext(Entry);
+    GRefPtr&lt;GtkStyleContext&gt; context = createStyleContext(themePart, parentContext.get());
+
+    GtkBorder padding;
+    gtk_style_context_get_padding(context.get(), gtk_style_context_get_state(context.get()), &amp;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 &lt; 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), &amp;width, &amp;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&amp;, RenderStyle&amp; 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&amp; renderObject, const IntRect&amp; 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&amp; graphicsContext, const IntRect&amp; rect, const char* iconName)
+{
+    GRefPtr&lt;GdkPixbuf&gt; icon = loadThemedIcon(context, iconName, getIconSizeForPixelSize(rect.height()));
+    if (!icon)
+        return false;
+
+    if (gdk_pixbuf_get_width(icon.get()) &gt; rect.width() || gdk_pixbuf_get_height(icon.get()) &gt; rect.height())
+        icon = adoptGRef(gdk_pixbuf_scale_simple(icon.get(), rect.width(), rect.height(), GDK_INTERP_BILINEAR));
+
+    gtk_render_icon(context, graphicsContext.platformContext()-&gt;cr(), icon.get(), rect.x(), rect.y());
+    return true;
+}
+
+static bool paintEntryIcon(RenderThemePart themePart, const char* iconName, GraphicsContext&amp; graphicsContext, const IntRect&amp; rect, GtkTextDirection direction, GtkStateFlags state)
+{
+    GRefPtr&lt;GtkStyleContext&gt; parentContext = createStyleContext(Entry);
+    GRefPtr&lt;GtkStyleContext&gt; 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&amp; renderObject, const PaintInfo&amp; paintInfo, const IntRect&amp; 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&lt;GdkPixbuf&gt; 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, &quot;edit-find-symbolic&quot;, *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&amp;, RenderStyle&amp; 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&amp; renderObject, const PaintInfo&amp; paintInfo, const IntRect&amp; 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&lt;GdkPixbuf&gt; 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, &quot;edit-clear-symbolic&quot;, *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&amp;, RenderStyle&amp; 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&amp; renderObject, const PaintInfo&amp; paintInfo, const IntRect&amp; rect)
</del><ins>+bool RenderThemeGtk::shouldHaveCapsLockIndicator(HTMLInputElement&amp; 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-&gt;paintingDisabled())
-        return true;
-
-    int iconSize = std::min(rect.width(), rect.height());
-    GRefPtr&lt;GdkPixbuf&gt; 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 &gt;= 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&amp;, RenderStyle&amp; 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&amp; renderObject, const PaintInfo&amp; paintInfo, const IntRect&amp; 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&lt;GtkStyleContext&gt; context = createStyleContext(GTK_TYPE_SCALE);
-#if GTK_CHECK_VERSION(3, 19, 2)
-    GRefPtr&lt;GtkWidgetPath&gt; 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, &quot;scale&quot;);
-
-    gtk_widget_path_append_type(path.get(), GTK_TYPE_SCALE);
-    gtk_widget_path_iter_set_object_name(path.get(), 1, &quot;trough&quot;);
-
-    gtk_style_context_set_path(context.get(), path.get());
-#endif
-
</del><ins>+    GRefPtr&lt;GtkStyleContext&gt; parentContext = createStyleContext(Scale);
+    gtk_style_context_add_class(parentContext.get(), part == SliderHorizontalPart ? GTK_STYLE_CLASS_HORIZONTAL : GTK_STYLE_CLASS_VERTICAL);
+    GRefPtr&lt;GtkStyleContext&gt; 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&amp; renderObject, const PaintInfo&amp; paintInfo, const IntRect&amp; 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&lt;GtkStyleContext&gt; 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&lt;GtkWidgetPath&gt; 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, &quot;scale&quot;);
-
-    gtk_widget_path_append_type(path.get(), GTK_TYPE_SCALE);
-    gtk_widget_path_iter_set_object_name(path.get(), 1, &quot;trough&quot;);
-
-    gtk_widget_path_append_type(path.get(), GTK_TYPE_SCALE);
-    gtk_widget_path_iter_set_object_name(path.get(), 2, &quot;slider&quot;);
-
-    gtk_style_context_set_path(context.get(), path.get());
-#endif
-
</del><ins>+    GRefPtr&lt;GtkStyleContext&gt; parentContext = createStyleContext(Scale);
+    gtk_style_context_add_class(parentContext.get(), part == SliderThumbHorizontalPart ? GTK_STYLE_CLASS_HORIZONTAL : GTK_STYLE_CLASS_VERTICAL);
+    GRefPtr&lt;GtkStyleContext&gt; troughContext = createStyleContext(ScaleTrough, parentContext.get());
+    GRefPtr&lt;GtkStyleContext&gt; 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 &amp;&amp; part != SliderThumbVerticalPart)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    GRefPtr&lt;GtkStyleContext&gt; context = createStyleContext(GTK_TYPE_SCALE);
</del><ins>+    GRefPtr&lt;GtkStyleContext&gt; context = createStyleContext(Scale);
</ins><span class="cx">     gint sliderWidth, sliderLength;
</span><span class="cx">     gtk_style_context_get_style(context.get(), &quot;slider-width&quot;, &amp;sliderWidth, &quot;slider-length&quot;, &amp;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&lt;GtkStyleContext&gt; context = createStyleContext(GTK_TYPE_PROGRESS_BAR);
-#if GTK_CHECK_VERSION(3, 19, 2)
-    GRefPtr&lt;GtkWidgetPath&gt; path = adoptGRef(gtk_widget_path_new());
</del><ins>+    GRefPtr&lt;GtkStyleContext&gt; parentContext = createStyleContext(ProgressBar);
+    GRefPtr&lt;GtkStyleContext&gt; troughContext = createStyleContext(ProgressBarTrough, parentContext.get());
+    GRefPtr&lt;GtkStyleContext&gt; 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, &quot;progressbar&quot;);
</del><ins>+    gtk_render_background(troughContext.get(), paintInfo.context-&gt;platformContext()-&gt;cr(), rect.x(), rect.y(), rect.width(), rect.height());
+    gtk_render_frame(troughContext.get(), paintInfo.context-&gt;platformContext()-&gt;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, &quot;trough&quot;);
-
-    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-&gt;platformContext()-&gt;cr(), rect.x(), rect.y(), rect.width(), rect.height());
-    gtk_render_frame(context.get(), paintInfo.context-&gt;platformContext()-&gt;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, &quot;progressbar&quot;);
-
-    gtk_widget_path_append_type(path.get(), GTK_TYPE_PROGRESS_BAR);
-    gtk_widget_path_iter_set_object_name(path.get(), 1, &quot;trough&quot;);
-
-    gtk_widget_path_append_type(path.get(), GTK_TYPE_PROGRESS_BAR);
-    gtk_widget_path_iter_set_object_name(path.get(), 2, &quot;progress&quot;);
-
-    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&lt;GtkStateFlags&gt;(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&amp;, RenderStyle&amp; style, Element*) const
</span><span class="cx"> {
</span><del>-    GRefPtr&lt;GtkStyleContext&gt; context = createStyleContext(GTK_TYPE_SPIN_BUTTON);
</del><ins>+    GRefPtr&lt;GtkStyleContext&gt; 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()), &amp;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&amp; renderObject, const PaintInfo&amp; paintInfo, const IntRect&amp; rect, GtkArrowType arrowType)
</del><ins>+static void paintSpinArrowButton(RenderTheme* theme, GtkStyleContext* parentContext, const RenderObject&amp; renderObject, const PaintInfo&amp; paintInfo, const IntRect&amp; 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&lt;GtkWidgetPath&gt; 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, &quot;spinbutton&quot;);
-
-    gtk_widget_path_append_type(path.get(), GTK_TYPE_SPIN_BUTTON);
-    gtk_widget_path_iter_set_object_name(path.get(), 1, &quot;button&quot;);
-    gtk_widget_path_iter_add_class(path.get(), 1, arrowType == GTK_ARROW_UP ? &quot;up&quot; : &quot;down&quot;);
-
-    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&lt;guint&gt;(gtk_style_context_get_state(context));
</del><ins>+    GRefPtr&lt;GtkStyleContext&gt; context = createStyleContext(arrowType == GTK_ARROW_UP ? SpinButtonUpButton : SpinButtonDownButton, parentContext);
+    GtkTextDirection direction = gtk_style_context_get_direction(context.get());
+    guint state = static_cast&lt;guint&gt;(gtk_style_context_get_state(context.get()));
</ins><span class="cx">     if (!(state &amp; GTK_STATE_FLAG_INSENSITIVE)) {
</span><span class="cx">         if (theme-&gt;isPressed(renderObject)) {
</span><span class="cx">             if ((arrowType == GTK_ARROW_UP &amp;&amp; theme-&gt;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&lt;GtkStateFlags&gt;(state));
</del><ins>+    gtk_style_context_set_state(context.get(), static_cast&lt;GtkStateFlags&gt;(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&lt;GtkJunctionSides&gt;(junction));
</del><ins>+    gtk_style_context_set_junction_sides(context.get(), static_cast&lt;GtkJunctionSides&gt;(junction));
</ins><span class="cx"> 
</span><del>-    gtk_render_background(context, paintInfo.context-&gt;platformContext()-&gt;cr(), buttonRect.x(), buttonRect.y(), buttonRect.width(), buttonRect.height());
-    gtk_render_frame(context, paintInfo.context-&gt;platformContext()-&gt;cr(), buttonRect.x(), buttonRect.y(), buttonRect.width(), buttonRect.height());
</del><ins>+    gtk_render_background(context.get(), paintInfo.context-&gt;platformContext()-&gt;cr(), buttonRect.x(), buttonRect.y(), buttonRect.width(), buttonRect.height());
+    gtk_render_frame(context.get(), paintInfo.context-&gt;platformContext()-&gt;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-&gt;platformContext()-&gt;cr(), angle, arrowRect.x(), arrowRect.y(), width);
-
-    gtk_style_context_restore(context);
</del><ins>+    gtk_render_arrow(context.get(), paintInfo.context-&gt;platformContext()-&gt;cr(), angle, arrowRect.x(), arrowRect.y(), width);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool RenderThemeGtk::paintInnerSpinButton(const RenderObject&amp; renderObject, const PaintInfo&amp; paintInfo, const IntRect&amp; rect)
</span><span class="cx"> {
</span><del>-    GRefPtr&lt;GtkStyleContext&gt; context = createStyleContext(GTK_TYPE_SPIN_BUTTON);
</del><ins>+    GRefPtr&lt;GtkStyleContext&gt; context = createStyleContext(SpinButton);
+    gtk_style_context_set_direction(context.get(), gtkTextDirection(renderObject.style().direction()));
</ins><span class="cx"> 
</span><del>-    GtkTextDirection direction = static_cast&lt;GtkTextDirection&gt;(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&lt;GtkStateFlags&gt;(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&lt;GtkStyleContext&gt; context = createStyleContext(widgetType);
-#if GTK_CHECK_VERSION(3, 19, 2)
-    if (widgetType == GTK_TYPE_ENTRY) {
-        GRefPtr&lt;GtkWidgetPath&gt; 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, &quot;entry&quot;);
-
-        gtk_widget_path_append_type(path.get(), GTK_TYPE_ENTRY);
-        gtk_widget_path_iter_set_object_name(path.get(), 1, &quot;selection&quot;);
-
-        gtk_style_context_set_path(context.get(), path.get());
</del><ins>+    GRefPtr&lt;GtkStyleContext&gt; parentContext;
+    RenderThemePart part = themePart;
+    if (themePart == Entry &amp;&amp; (state &amp; GTK_STATE_FLAG_SELECTED)) {
+        parentContext = createStyleContext(Entry);
+        part = EntrySelection;
</ins><span class="cx">     }
</span><del>-#endif
</del><span class="cx"> 
</span><ins>+    GRefPtr&lt;GtkStyleContext&gt; 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&lt;GtkStateFlags&gt;(GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED), StyleColorBackground);
</del><ins>+    return styleColor(Entry, static_cast&lt;GtkStateFlags&gt;(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&lt;GtkStateFlags&gt;(GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED), StyleColorForeground);
</del><ins>+    return styleColor(Entry, static_cast&lt;GtkStateFlags&gt;(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&lt;GtkStateFlags&gt;(GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED), StyleColorBackground);
</del><ins>+    return styleColor(ListBox, static_cast&lt;GtkStateFlags&gt;(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&lt;GtkStateFlags&gt;(GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED), StyleColorForeground);
</del><ins>+    return styleColor(ListBox, static_cast&lt;GtkStateFlags&gt;(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&amp; renderObject, GraphicsContext* context, const IntRect&amp; rect, const char* symbolicIconName, const char* fallbackStockIconName)
</del><ins>+bool RenderThemeGtk::paintMediaButton(const RenderObject&amp; renderObject, GraphicsContext&amp; graphicsContext, const IntRect&amp; 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&lt;GdkPixbuf&gt; 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&lt;GtkStyleContext&gt; 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&amp; renderObject, const PaintInfo&amp; paintInfo, const IntRect&amp; rect)
</span><span class="cx"> {
</span><del>-    return paintMediaButton(renderObject, paintInfo.context, rect, &quot;view-fullscreen-symbolic&quot;, GTK_STOCK_FULLSCREEN);
</del><ins>+    return paintMediaButton(renderObject, *paintInfo.context, rect, &quot;view-fullscreen-symbolic&quot;);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool RenderThemeGtk::paintMediaMuteButton(const RenderObject&amp; renderObject, const PaintInfo&amp; paintInfo, const IntRect&amp; 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-&gt;shadowHost();
+    if (!is&lt;HTMLMediaElement&gt;(mediaNode))
+        return false;
</ins><span class="cx"> 
</span><del>-    bool muted = mediaElement-&gt;muted();
-    return paintMediaButton(renderObject, paintInfo.context, rect,
-        muted ? &quot;audio-volume-muted-symbolic&quot; : &quot;audio-volume-high-symbolic&quot;,
-        muted ? &quot;audio-volume-muted&quot; : &quot;audio-volume-high&quot;);
</del><ins>+    HTMLMediaElement* mediaElement = downcast&lt;HTMLMediaElement&gt;(mediaNode);
+    return paintMediaButton(renderObject, *paintInfo.context, rect, mediaElement-&gt;muted() ? &quot;audio-volume-muted-symbolic&quot; : &quot;audio-volume-high-symbolic&quot;);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool RenderThemeGtk::paintMediaPlayButton(const RenderObject&amp; renderObject, const PaintInfo&amp; paintInfo, const IntRect&amp; rect)
</span><span class="lines">@@ -1592,36 +1406,24 @@
</span><span class="cx"> 
</span><span class="cx">     if (!nodeHasPseudo(node, &quot;-webkit-media-controls-play-button&quot;))
</span><span class="cx">         return false;
</span><del>-    bool showPlayButton = nodeHasClass(node, &quot;paused&quot;);
</del><span class="cx"> 
</span><del>-    return paintMediaButton(renderObject, paintInfo.context, rect,
-        showPlayButton ? &quot;media-playback-start-symbolic&quot; : &quot;media-playback-pause-symbolic&quot;,
-        showPlayButton ? GTK_STOCK_MEDIA_PLAY : GTK_STOCK_MEDIA_PAUSE);
</del><ins>+    return paintMediaButton(renderObject, *paintInfo.context, rect, nodeHasClass(node, &quot;paused&quot;) ? &quot;media-playback-start-symbolic&quot; : &quot;media-playback-pause-symbolic&quot;);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool RenderThemeGtk::paintMediaSeekBackButton(const RenderObject&amp; renderObject, const PaintInfo&amp; paintInfo, const IntRect&amp; rect)
</span><span class="cx"> {
</span><del>-    return paintMediaButton(renderObject, paintInfo.context, rect, &quot;media-seek-backward-symbolic&quot;, GTK_STOCK_MEDIA_REWIND);
</del><ins>+    return paintMediaButton(renderObject, *paintInfo.context, rect, &quot;media-seek-backward-symbolic&quot;);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool RenderThemeGtk::paintMediaSeekForwardButton(const RenderObject&amp; renderObject, const PaintInfo&amp; paintInfo, const IntRect&amp; rect)
</span><span class="cx"> {
</span><del>-    return paintMediaButton(renderObject, paintInfo.context, rect, &quot;media-seek-forward-symbolic&quot;, GTK_STOCK_MEDIA_FORWARD);
</del><ins>+    return paintMediaButton(renderObject, *paintInfo.context, rect, &quot;media-seek-forward-symbolic&quot;);
</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&amp; renderObject, const PaintInfo&amp; paintInfo, const IntRect&amp; 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&lt;GdkPixbuf&gt; icon = getStockSymbolicIconForWidgetType(GTK_TYPE_CONTAINER, &quot;media-view-subtitles-symbolic&quot;, nullptr,
-        gtkTextDirection(renderObject.style().direction()), gtkIconState(this, renderObject), iconRect.width());
-    if (!icon) {
-        icon = getStockSymbolicIconForWidgetType(GTK_TYPE_CONTAINER, &quot;user-invisible-symbolic&quot;, 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, &quot;media-view-subtitles-symbolic&quot;);
</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&amp;) 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&amp;, const PaintInfo&amp;, const IntRect&amp;) override;
</span><span class="lines">@@ -153,8 +154,6 @@
</span><span class="cx">     virtual void adjustSliderThumbSize(RenderStyle&amp;, 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&amp;, const PaintInfo&amp;, const IntRect&amp;) override;
</span><span class="cx">     virtual bool paintMediaPlayButton(const RenderObject&amp;, const PaintInfo&amp;, const IntRect&amp;) override;
</span><span class="lines">@@ -177,8 +176,6 @@
</span><span class="cx">     virtual void adjustProgressBarStyle(StyleResolver&amp;, RenderStyle&amp;, Element*) const override;
</span><span class="cx">     virtual bool paintProgressBar(const RenderObject&amp;, const PaintInfo&amp;, const IntRect&amp;) override;
</span><span class="cx"> 
</span><del>-    virtual bool paintCapsLockIndicator(const RenderObject&amp;, const PaintInfo&amp;, const IntRect&amp;) override;
-
</del><span class="cx">     virtual void adjustInnerSpinButtonStyle(StyleResolver&amp;, RenderStyle&amp;, Element*) const override;
</span><span class="cx">     virtual bool paintInnerSpinButton(const RenderObject&amp;, const PaintInfo&amp;, const IntRect&amp;) override;
</span><span class="cx"> 
</span><span class="lines">@@ -187,16 +184,10 @@
</span><span class="cx">     static void setTextInputBorders(RenderStyle&amp;);
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(VIDEO)
</span><del>-    bool paintMediaButton(const RenderObject&amp;, GraphicsContext*, const IntRect&amp;, const char* symbolicIconName, const char* fallbackStockIconName);
</del><ins>+    bool paintMediaButton(const RenderObject&amp;, GraphicsContext&amp;, const IntRect&amp;, const char* iconName);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     static IntRect calculateProgressRect(const RenderObject&amp;, const IntRect&amp;);
</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>