<!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>[197251] releases/WebKitGTK/webkit-2.4/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/197251">197251</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2016-02-27 07:09:36 -0800 (Sat, 27 Feb 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/194377">r194377</a> - [GTK] Everything broken in GTK+ 3.19
https://bugs.webkit.org/show_bug.cgi?id=150550

Reviewed by Carlos Garcia Campos.

Port RenderThemeGtk and ScrollbarThemeGtk to use CSS nodes. This makes it possible to render
stuff with modern GTK+.

No new tests. We already have tons of tests for this functionality, but we're running them
with GTK+ 3.16, so they cannot have detected this breakage. These fixes require unreleased
GTK+, and GTK+ rendering is currently in a state of flux; once things settle down, we can
consider upgrading the GTK+ used for our layout tests.

* platform/gtk/GRefPtrGtk.cpp:
(WTF::refGPtr):
(WTF::derefGPtr):
* platform/gtk/GRefPtrGtk.h:
* platform/gtk/ScrollbarThemeGtk.cpp:
(WebCore::ScrollbarThemeGtk::themeChanged):
(WebCore::ScrollbarThemeGtk::updateThemeProperties):
(WebCore::orientationStyleClass):
(WebCore::applyScrollbarStyleContextClasses):
(WebCore::ScrollbarThemeGtk::paintTrackBackground):
(WebCore::ScrollbarThemeGtk::paintScrollbarBackground):
(WebCore::ScrollbarThemeGtk::paintThumb):
(WebCore::ScrollbarThemeGtk::paintButton):
* rendering/RenderThemeGtk.cpp:
(WebCore::createStyleContext):
(WebCore::setToggleSize):
(WebCore::paintToggle):
(WebCore::RenderThemeGtk::paintButton):
(WebCore::getComboBoxMetrics):
(WebCore::RenderThemeGtk::paintMenuList):
(WebCore::RenderThemeGtk::paintTextField):
(WebCore::applySliderStyleContextClasses):
(WebCore::RenderThemeGtk::paintSliderTrack):
(WebCore::RenderThemeGtk::paintSliderThumb):
(WebCore::RenderThemeGtk::paintProgressBar):
(WebCore::paintSpinArrowButton):
(WebCore::styleColor):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit24SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebCoreplatformgtkGRefPtrGtkcpp">releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/GRefPtrGtk.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebCoreplatformgtkGRefPtrGtkh">releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/GRefPtrGtk.h</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebCoreplatformgtkRenderThemeGtk3cpp">releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebCoreplatformgtkScrollbarThemeGtk3cpp">releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/ScrollbarThemeGtk3.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit24SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog (197250 => 197251)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog        2016-02-27 15:09:16 UTC (rev 197250)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog        2016-02-27 15:09:36 UTC (rev 197251)
</span><span class="lines">@@ -1,3 +1,46 @@
</span><ins>+2015-12-22  Michael Catanzaro  &lt;mcatanzaro@igalia.com&gt;
+
+        [GTK] Everything broken in GTK+ 3.19
+        https://bugs.webkit.org/show_bug.cgi?id=150550
+
+        Reviewed by Carlos Garcia Campos.
+
+        Port RenderThemeGtk and ScrollbarThemeGtk to use CSS nodes. This makes it possible to render
+        stuff with modern GTK+.
+
+        No new tests. We already have tons of tests for this functionality, but we're running them
+        with GTK+ 3.16, so they cannot have detected this breakage. These fixes require unreleased
+        GTK+, and GTK+ rendering is currently in a state of flux; once things settle down, we can
+        consider upgrading the GTK+ used for our layout tests.
+
+        * platform/gtk/GRefPtrGtk.cpp:
+        (WTF::refGPtr):
+        (WTF::derefGPtr):
+        * platform/gtk/GRefPtrGtk.h:
+        * platform/gtk/ScrollbarThemeGtk.cpp:
+        (WebCore::ScrollbarThemeGtk::themeChanged):
+        (WebCore::ScrollbarThemeGtk::updateThemeProperties):
+        (WebCore::orientationStyleClass):
+        (WebCore::applyScrollbarStyleContextClasses):
+        (WebCore::ScrollbarThemeGtk::paintTrackBackground):
+        (WebCore::ScrollbarThemeGtk::paintScrollbarBackground):
+        (WebCore::ScrollbarThemeGtk::paintThumb):
+        (WebCore::ScrollbarThemeGtk::paintButton):
+        * rendering/RenderThemeGtk.cpp:
+        (WebCore::createStyleContext):
+        (WebCore::setToggleSize):
+        (WebCore::paintToggle):
+        (WebCore::RenderThemeGtk::paintButton):
+        (WebCore::getComboBoxMetrics):
+        (WebCore::RenderThemeGtk::paintMenuList):
+        (WebCore::RenderThemeGtk::paintTextField):
+        (WebCore::applySliderStyleContextClasses):
+        (WebCore::RenderThemeGtk::paintSliderTrack):
+        (WebCore::RenderThemeGtk::paintSliderThumb):
+        (WebCore::RenderThemeGtk::paintProgressBar):
+        (WebCore::paintSpinArrowButton):
+        (WebCore::styleColor):
+
</ins><span class="cx"> 2015-12-10  Michael Catanzaro  &lt;mcatanzaro@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] RenderThemeGtk::platformActiveSelectionBackgroundColor, et. al. should not clobber state of cached GtkStyleContexts
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebCoreplatformgtkGRefPtrGtkcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/GRefPtrGtk.cpp (197250 => 197251)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/GRefPtrGtk.cpp        2016-02-27 15:09:16 UTC (rev 197250)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/GRefPtrGtk.cpp        2016-02-27 15:09:36 UTC (rev 197251)
</span><span class="lines">@@ -72,6 +72,22 @@
</span><span class="cx">     if (ptr)
</span><span class="cx">         gdk_cursor_unref(ptr);
</span><span class="cx"> }
</span><ins>+
+#else
+
+template &lt;&gt; GtkWidgetPath* refGPtr(GtkWidgetPath* ptr)
+{
+    if (ptr)
+        gtk_widget_path_ref(ptr);
+    return ptr;
+}
+
+template &lt;&gt; void derefGPtr(GtkWidgetPath* ptr)
+{
+    if (ptr)
+        gtk_widget_path_unref(ptr);
+}
+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebCoreplatformgtkGRefPtrGtkh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/GRefPtrGtk.h (197250 => 197251)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/GRefPtrGtk.h        2016-02-27 15:09:16 UTC (rev 197250)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/GRefPtrGtk.h        2016-02-27 15:09:36 UTC (rev 197251)
</span><span class="lines">@@ -23,6 +23,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &lt;wtf/gobject/GRefPtr.h&gt;
</span><span class="cx"> 
</span><ins>+typedef struct _GtkWidgetPath GtkWidgetPath;
</ins><span class="cx"> typedef struct _SecretValue SecretValue;
</span><span class="cx"> 
</span><span class="cx"> namespace WTF {
</span><span class="lines">@@ -38,6 +39,9 @@
</span><span class="cx"> #ifdef GTK_API_VERSION_2
</span><span class="cx"> template &lt;&gt; GdkCursor* refGPtr(GdkCursor* ptr);
</span><span class="cx"> template &lt;&gt; void derefGPtr(GdkCursor* ptr);
</span><ins>+#else
+template &lt;&gt; GtkWidgetPath* refGPtr(GtkWidgetPath* ptr);
+template &lt;&gt; void derefGPtr(GtkWidgetPath* ptr);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebCoreplatformgtkRenderThemeGtk3cpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp (197250 => 197251)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp        2016-02-27 15:09:16 UTC (rev 197250)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp        2016-02-27 15:09:36 UTC (rev 197251)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include &quot;CSSValueKeywords.h&quot;
</span><span class="cx"> #include &quot;GraphicsContext.h&quot;
</span><span class="cx"> #include &quot;GtkVersioning.h&quot;
</span><ins>+#include &quot;GRefPtrGtk.h&quot;
</ins><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="cx"> #include &quot;MediaControlElements.h&quot;
</span><span class="cx"> #include &quot;Page.h&quot;
</span><span class="lines">@@ -66,35 +67,64 @@
</span><span class="cx">         initialized = true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    GtkWidgetPath* path = gtk_widget_path_new();
-    gtk_widget_path_append_type(path, widgetType);
</del><ins>+    GRefPtr&lt;GtkWidgetPath&gt; path = adoptGRef(gtk_widget_path_new());
+    gtk_widget_path_append_type(path.get(), widgetType);
</ins><span class="cx"> 
</span><ins>+#if GTK_CHECK_VERSION(3, 19, 2)
+    // 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.
</ins><span class="cx">     if (widgetType == GTK_TYPE_ENTRY)
</span><del>-        gtk_widget_path_iter_add_class(path, 0, GTK_STYLE_CLASS_ENTRY);
</del><ins>+        gtk_widget_path_iter_set_object_name(path.get(), 0, &quot;entry&quot;);
</ins><span class="cx">     else if (widgetType == GTK_TYPE_ARROW)
</span><del>-        gtk_widget_path_iter_add_class(path, 0, &quot;arrow&quot;);
</del><ins>+        gtk_widget_path_iter_set_object_name(path.get(), 0, &quot;button&quot;); // Note: not a typo.
</ins><span class="cx">     else if (widgetType == GTK_TYPE_BUTTON) {
</span><del>-        gtk_widget_path_iter_add_class(path, 0, GTK_STYLE_CLASS_BUTTON);
-        gtk_widget_path_iter_add_class(path, 0, &quot;text-button&quot;);
</del><ins>+        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;);
</ins><span class="cx">     }
</span><span class="cx">     else if (widgetType == GTK_TYPE_SCALE)
</span><del>-        gtk_widget_path_iter_add_class(path, 0, GTK_STYLE_CLASS_SCALE);
</del><ins>+        gtk_widget_path_iter_set_object_name(path.get(), 0, &quot;scale&quot;);
</ins><span class="cx">     else if (widgetType == GTK_TYPE_SEPARATOR)
</span><del>-        gtk_widget_path_iter_add_class(path, 0, GTK_STYLE_CLASS_SEPARATOR);
</del><ins>+        gtk_widget_path_iter_set_object_name(path.get(), 0, &quot;separator&quot;);
</ins><span class="cx">     else if (widgetType == GTK_TYPE_PROGRESS_BAR)
</span><del>-        gtk_widget_path_iter_add_class(path, 0, GTK_STYLE_CLASS_PROGRESSBAR);
</del><ins>+        gtk_widget_path_iter_set_object_name(path.get(), 0, &quot;progressbar&quot;);
</ins><span class="cx">     else if (widgetType == GTK_TYPE_SPIN_BUTTON)
</span><del>-        gtk_widget_path_iter_add_class(path, 0, GTK_STYLE_CLASS_SPINBUTTON);
</del><ins>+        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;);
+#else
+    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);
</ins><span class="cx">     else if (widgetType == GTK_TYPE_TREE_VIEW)
</span><del>-        gtk_widget_path_iter_add_class(path, 0, GTK_STYLE_CLASS_VIEW);
</del><ins>+        gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_VIEW);
</ins><span class="cx">     else if (widgetType == GTK_TYPE_CHECK_BUTTON)
</span><del>-        gtk_widget_path_iter_add_class(path, 0, GTK_STYLE_CLASS_CHECK);
</del><ins>+        gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_CHECK);
</ins><span class="cx">     else if (widgetType == GTK_TYPE_RADIO_BUTTON)
</span><del>-        gtk_widget_path_iter_add_class(path, 0, GTK_STYLE_CLASS_RADIO);
</del><ins>+        gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_RADIO);
+#endif
</ins><span class="cx"> 
</span><span class="cx">     GRefPtr&lt;GtkStyleContext&gt; context = adoptGRef(gtk_style_context_new());
</span><del>-    gtk_style_context_set_path(context.get(), path);
-    gtk_widget_path_free(path);
</del><ins>+    gtk_style_context_set_path(context.get(), path.get());
</ins><span class="cx"> 
</span><span class="cx">     return context;
</span><span class="cx"> }
</span><span class="lines">@@ -181,7 +211,7 @@
</span><span class="cx">     adjustRectForFocus(context.get(), rect);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void setToggleSize(GType widgetType, RenderStyle&amp; style)
</del><ins>+static void setToggleSize(GType widgetType, RenderStyle* style)
</ins><span class="cx"> {
</span><span class="cx">     GRefPtr&lt;GtkStyleContext&gt; context = createStyleContext(widgetType);
</span><span class="cx"> 
</span><span class="lines">@@ -189,9 +219,7 @@
</span><span class="cx">     if (!style-&gt;width().isIntrinsicOrAuto() &amp;&amp; !style-&gt;height().isAuto())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    // Other ports hard-code this to 13 which is also the default value defined by GTK+.
-    // GTK+ users tend to demand the native look.
-    // It could be made a configuration option values other than 13 actually break site compatibility.
</del><ins>+    // Other ports hard-code this to 13. GTK+ users tend to demand the native look.
</ins><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="cx"> 
</span><span class="lines">@@ -205,7 +233,38 @@
</span><span class="cx"> static void paintToggle(const RenderThemeGtk* theme, GType widgetType, RenderObject* renderObject, const PaintInfo&amp; paintInfo, const IntRect&amp; fullRect)
</span><span class="cx"> {
</span><span class="cx">     GRefPtr&lt;GtkStyleContext&gt; context = createStyleContext(widgetType);
</span><ins>+#if GTK_CHECK_VERSION(3, 19, 2)
+    GRefPtr&lt;GtkWidgetPath&gt; path = adoptGRef(gtk_widget_path_new());
</ins><span class="cx"> 
</span><ins>+    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());
+#endif
+
</ins><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="cx">     // in the full toggle button region. The reason for not simply forcing toggle
</span><span class="lines">@@ -224,7 +283,12 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     gtk_style_context_set_direction(context.get(), static_cast&lt;GtkTextDirection&gt;(gtkTextDirection(renderObject-&gt;style().direction())));
</span><ins>+
+#if GTK_CHECK_VERSION(3, 19, 2)
+    gtk_style_context_add_class(context.get(), &quot;toggle&quot;);
+#else
</ins><span class="cx">     gtk_style_context_add_class(context.get(), widgetType == GTK_TYPE_CHECK_BUTTON ? GTK_STYLE_CLASS_CHECK : GTK_STYLE_CLASS_RADIO);
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">     guint flags = 0;
</span><span class="cx">     if (!theme-&gt;isEnabled(renderObject) || theme-&gt;isReadOnlyControl(renderObject))
</span><span class="lines">@@ -351,7 +415,9 @@
</span><span class="cx">     GRefPtr&lt;GtkStyleContext&gt; context = createStyleContext(GTK_TYPE_BUTTON);
</span><span class="cx"> 
</span><span class="cx">     gtk_style_context_set_direction(context.get(), static_cast&lt;GtkTextDirection&gt;(gtkTextDirection(renderObject-&gt;style().direction())));
</span><ins>+#if !GTK_CHECK_VERSION(3, 19, 2)
</ins><span class="cx">     gtk_style_context_add_class(context.get(), GTK_STYLE_CLASS_BUTTON);
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">     renderButton(this, context.get(), renderObject, paintInfo, rect);
</span><span class="cx"> 
</span><span class="lines">@@ -366,8 +432,20 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     GRefPtr&lt;GtkStyleContext&gt; context = createStyleContext(GTK_TYPE_COMBO_BOX);
</span><ins>+#if GTK_CHECK_VERSION(3, 19, 2)
+    GRefPtr&lt;GtkWidgetPath&gt; path = adoptGRef(gtk_widget_path_new());
</ins><span class="cx"> 
</span><ins>+    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
</ins><span class="cx">     gtk_style_context_add_class(context.get(), GTK_STYLE_CLASS_BUTTON);
</span><ins>+#endif
</ins><span class="cx">     gtk_style_context_set_direction(context.get(), static_cast&lt;GtkTextDirection&gt;(gtkTextDirection(style-&gt;direction())));
</span><span class="cx"> 
</span><span class="cx">     gtk_style_context_set_state(context.get(), static_cast&lt;GtkStateFlags&gt;(0));
</span><span class="lines">@@ -382,7 +460,9 @@
</span><span class="cx"> 
</span><span class="cx">     GtkTextDirection direction = static_cast&lt;GtkTextDirection&gt;(gtkTextDirection(style-&gt;direction()));
</span><span class="cx">     gtk_style_context_set_direction(context.get(), direction);
</span><ins>+#if !GTK_CHECK_VERSION(3, 19, 2)
</ins><span class="cx">     gtk_style_context_add_class(context.get(), &quot;separator&quot;);
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">     gboolean wideSeparators;
</span><span class="cx">     gint separatorWidth;
</span><span class="lines">@@ -441,7 +521,9 @@
</span><span class="cx">     // Paint the button.
</span><span class="cx">     GRefPtr&lt;GtkStyleContext&gt; buttonStyleContext = createStyleContext(GTK_TYPE_BUTTON);
</span><span class="cx">     gtk_style_context_set_direction(buttonStyleContext.get(), direction);
</span><ins>+#if !GTK_CHECK_VERSION(3, 19, 2)
</ins><span class="cx">     gtk_style_context_add_class(buttonStyleContext.get(), GTK_STYLE_CLASS_BUTTON);
</span><ins>+#endif
</ins><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">@@ -477,8 +559,10 @@
</span><span class="cx">     GRefPtr&lt;GtkStyleContext&gt; arrowStyleContext = createStyleContext(GTK_TYPE_ARROW);
</span><span class="cx"> 
</span><span class="cx">     gtk_style_context_set_direction(arrowStyleContext.get(), direction);
</span><ins>+#if !GTK_CHECK_VERSION(3, 19, 2)
</ins><span class="cx">     gtk_style_context_add_class(arrowStyleContext.get(), &quot;arrow&quot;);
</span><span class="cx">     gtk_style_context_add_class(arrowStyleContext.get(), GTK_STYLE_CLASS_BUTTON);
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">     gfloat arrowScaling;
</span><span class="cx">     gtk_style_context_get_style(arrowStyleContext.get(), &quot;arrow-scaling&quot;, &amp;arrowScaling, nullptr);
</span><span class="lines">@@ -498,10 +582,19 @@
</span><span class="cx"> 
</span><span class="cx">     // Paint the separator if needed.
</span><span class="cx">     GRefPtr&lt;GtkStyleContext&gt; separatorStyleContext = createStyleContext(GTK_TYPE_COMBO_BOX);
</span><ins>+#if GTK_CHECK_VERSION(3, 19, 2)
+    GRefPtr&lt;GtkWidgetPath&gt; path = adoptGRef(gtk_widget_path_new());
</ins><span class="cx"> 
</span><del>-    gtk_style_context_set_direction(separatorStyleContext.get(), direction);
</del><ins>+    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
</ins><span class="cx">     gtk_style_context_add_class(separatorStyleContext.get(), &quot;separator&quot;);
</span><ins>+#endif
</ins><span class="cx"> 
</span><ins>+    gtk_style_context_set_direction(separatorStyleContext.get(), direction);
+
</ins><span class="cx">     gboolean wideSeparators;
</span><span class="cx">     gint separatorWidth;
</span><span class="cx">     gtk_style_context_get_style(separatorStyleContext.get(), &quot;wide-separators&quot;, &amp;wideSeparators, &quot;separator-width&quot;, &amp;separatorWidth, nullptr);
</span><span class="lines">@@ -545,7 +638,9 @@
</span><span class="cx">     GRefPtr&lt;GtkStyleContext&gt; context = createStyleContext(GTK_TYPE_ENTRY);
</span><span class="cx"> 
</span><span class="cx">     gtk_style_context_set_direction(context.get(), static_cast&lt;GtkTextDirection&gt;(gtkTextDirection(renderObject-&gt;style().direction())));
</span><ins>+#if !GTK_CHECK_VERSION(3, 19, 2)
</ins><span class="cx">     gtk_style_context_add_class(context.get(), GTK_STYLE_CLASS_ENTRY);
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">     guint flags = 0;
</span><span class="cx">     if (!isEnabled(renderObject) || isReadOnlyControl(renderObject))
</span><span class="lines">@@ -573,7 +668,9 @@
</span><span class="cx"> 
</span><span class="cx"> static void applySliderStyleContextClasses(GtkStyleContext* context, ControlPart part)
</span><span class="cx"> {
</span><ins>+#if !GTK_CHECK_VERSION(3, 19, 2)
</ins><span class="cx">     gtk_style_context_add_class(context, GTK_STYLE_CLASS_SCALE);
</span><ins>+#endif
</ins><span class="cx">     if (part == SliderHorizontalPart || part == SliderThumbHorizontalPart)
</span><span class="cx">         gtk_style_context_add_class(context, GTK_STYLE_CLASS_HORIZONTAL);
</span><span class="cx">     else if (part == SliderVerticalPart || part == SliderThumbVerticalPart)
</span><span class="lines">@@ -586,10 +683,23 @@
</span><span class="cx">     ASSERT_UNUSED(part, part == SliderHorizontalPart || part == SliderVerticalPart || part == MediaVolumeSliderPart);
</span><span class="cx"> 
</span><span class="cx">     GRefPtr&lt;GtkStyleContext&gt; context = createStyleContext(GTK_TYPE_SCALE);
</span><ins>+#if GTK_CHECK_VERSION(3, 19, 2)
+    GRefPtr&lt;GtkWidgetPath&gt; path = adoptGRef(gtk_widget_path_new());
</ins><span class="cx"> 
</span><ins>+    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
+
</ins><span class="cx">     gtk_style_context_set_direction(context.get(), gtkTextDirection(renderObject-&gt;style().direction()));
</span><span class="cx">     applySliderStyleContextClasses(context.get(), part);
</span><ins>+#if !GTK_CHECK_VERSION(3, 19, 2)
</ins><span class="cx">     gtk_style_context_add_class(context.get(), GTK_STYLE_CLASS_TROUGH);
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">     if (!isEnabled(renderObject) || isReadOnlyControl(renderObject))
</span><span class="cx">         gtk_style_context_set_state(context.get(), GTK_STATE_FLAG_INSENSITIVE);
</span><span class="lines">@@ -614,10 +724,24 @@
</span><span class="cx">     ASSERT(part == SliderThumbHorizontalPart || part == SliderThumbVerticalPart || part == MediaVolumeSliderThumbPart);
</span><span class="cx"> 
</span><span class="cx">     GRefPtr&lt;GtkStyleContext&gt; context = createStyleContext(GTK_TYPE_SCALE);
</span><ins>+#if GTK_CHECK_VERSION(3, 19, 2)
+    // FIXME: The entire slider is too wide, stretching the thumb into an oval rather than a circle.
+    GRefPtr&lt;GtkWidgetPath&gt; path = adoptGRef(gtk_widget_path_new());
</ins><span class="cx"> 
</span><ins>+    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
+
</ins><span class="cx">     gtk_style_context_set_direction(context.get(), gtkTextDirection(renderObject-&gt;style().direction()));
</span><span class="cx">     applySliderStyleContextClasses(context.get(), part);
</span><del>-    gtk_style_context_add_class(context.get(), GTK_STYLE_CLASS_SLIDER);
</del><span class="cx"> 
</span><span class="cx">     guint flags = 0;
</span><span class="cx">     if (!isEnabled(renderObject) || isReadOnlyControl(renderObject))
</span><span class="lines">@@ -660,16 +784,42 @@
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="cx">     GRefPtr&lt;GtkStyleContext&gt; context = createStyleContext(GTK_TYPE_PROGRESS_BAR);
</span><ins>+#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_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_style_context_set_path(context.get(), path.get());
+#else
</ins><span class="cx">     gtk_style_context_save(context.get());
</span><del>-
</del><span class="cx">     gtk_style_context_add_class(context.get(), GTK_STYLE_CLASS_TROUGH);
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">     gtk_render_background(context.get(), paintInfo.context-&gt;platformContext()-&gt;cr(), rect.x(), rect.y(), rect.width(), rect.height());
</span><span class="cx">     gtk_render_frame(context.get(), paintInfo.context-&gt;platformContext()-&gt;cr(), rect.x(), rect.y(), rect.width(), rect.height());
</span><span class="cx"> 
</span><ins>+#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
</ins><span class="cx">     gtk_style_context_restore(context.get());
</span><ins>+    gtk_style_context_add_class(context.get(), GTK_STYLE_CLASS_PROGRESSBAR);
+#endif
</ins><span class="cx"> 
</span><del>-    gtk_style_context_add_class(context.get(), GTK_STYLE_CLASS_PROGRESSBAR);
</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">@@ -720,7 +870,21 @@
</span><span class="cx">     ASSERT(arrowType == GTK_ARROW_UP || arrowType == GTK_ARROW_DOWN);
</span><span class="cx"> 
</span><span class="cx">     gtk_style_context_save(context);
</span><ins>+
+#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
</ins><span class="cx">     gtk_style_context_add_class(context, GTK_STYLE_CLASS_BUTTON);
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">     GtkTextDirection direction = gtk_style_context_get_direction(context);
</span><span class="cx">     guint state = static_cast&lt;guint&gt;(gtk_style_context_get_state(context));
</span><span class="lines">@@ -851,14 +1015,27 @@
</span><span class="cx"> static Color styleColor(GType widgetType, GtkStateFlags state, StyleColorType colorType)
</span><span class="cx"> {
</span><span class="cx">     GRefPtr&lt;GtkStyleContext&gt; context = createStyleContext(widgetType);
</span><del>-    // Recent GTK+ versions (&gt; 3.14) require to explicitly set the state before getting the color.
</del><ins>+#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());
+    }
+#endif
+
</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="cx">     if (colorType == StyleColorBackground)
</span><del>-        gtk_style_context_get_background_color(context.get(), gtk_style_context_get_state(context.get()), &amp;gdkRGBAColor);
</del><ins>+        gtk_style_context_get_background_color(context.get(), state, &amp;gdkRGBAColor);
</ins><span class="cx">     else
</span><del>-        gtk_style_context_get_color(context.get(), gtk_style_context_get_state(context.get()), &amp;gdkRGBAColor);
</del><ins>+        gtk_style_context_get_color(context.get(), state, &amp;gdkRGBAColor);
</ins><span class="cx">     return gdkRGBAColor;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebCoreplatformgtkScrollbarThemeGtk3cpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/ScrollbarThemeGtk3.cpp (197250 => 197251)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/ScrollbarThemeGtk3.cpp        2016-02-27 15:09:16 UTC (rev 197250)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/ScrollbarThemeGtk3.cpp        2016-02-27 15:09:36 UTC (rev 197251)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #ifndef GTK_API_VERSION_2
</span><span class="cx"> 
</span><ins>+#include &quot;GRefPtrGtk.h&quot;
</ins><span class="cx"> #include &quot;PlatformContextCairo.h&quot;
</span><span class="cx"> #include &quot;PlatformMouseEvent.h&quot;
</span><span class="cx"> #include &quot;ScrollView.h&quot;
</span><span class="lines">@@ -37,6 +38,11 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+#if !GTK_CHECK_VERSION(3, 19, 2)
+// Currently we use a static GtkStyleContext for GTK+ &lt; 3.19, and a bunch of unique
+// GtkStyleContexts for GTK+ &gt;= 3.19. This is crazy and definitely should not be necessary, but I
+// couldn't find any other way to not break one version or the other. Ideally one of the two
+// people on the planet who really understand GTK+ styles would fix this.
</ins><span class="cx"> class ScrollbarStyleContext {
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(ScrollbarStyleContext); WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="lines">@@ -65,10 +71,13 @@
</span><span class="cx">     DEFINE_STATIC_LOCAL(ScrollbarStyleContext, styleContext, ());
</span><span class="cx">     return styleContext.context();
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> void ScrollbarThemeGtk::themeChanged()
</span><span class="cx"> {
</span><ins>+#if !GTK_CHECK_VERSION(3, 19, 2)
</ins><span class="cx">     gtk_style_context_invalidate(gtkScrollbarStyleContext());
</span><ins>+#endif
</ins><span class="cx">     updateThemeProperties();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -79,8 +88,19 @@
</span><span class="cx"> 
</span><span class="cx"> void ScrollbarThemeGtk::updateThemeProperties()
</span><span class="cx"> {
</span><ins>+#if GTK_CHECK_VERSION(3, 19, 2)
+    GRefPtr&lt;GtkStyleContext&gt; styleContext = adoptGRef(gtk_style_context_new());
+    GRefPtr&lt;GtkWidgetPath&gt; path = adoptGRef(gtk_widget_path_new());
+
+    gtk_widget_path_append_type(path.get(), GTK_TYPE_SCROLLBAR);
+    gtk_widget_path_iter_set_object_name(path.get(), 0, &quot;scrollbar&quot;);
+
+    gtk_style_context_set_path(styleContext.get(), path.get());
+#else
+    GRefPtr&lt;GtkStyleContext&gt; styleContext = gtkScrollbarStyleContext();
+#endif
</ins><span class="cx">     gtk_style_context_get_style(
</span><del>-        gtkScrollbarStyleContext(),
</del><ins>+        styleContext.get(),
</ins><span class="cx">         &quot;min-slider-length&quot;, &amp;m_minThumbLength,
</span><span class="cx">         &quot;slider-width&quot;, &amp;m_thumbFatness,
</span><span class="cx">         &quot;trough-border&quot;, &amp;m_troughBorderWidth,
</span><span class="lines">@@ -95,11 +115,18 @@
</span><span class="cx">     updateScrollbarsFrameThickness();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static const char* orientationStyleClass(ScrollbarOrientation orientation)
+{
+    return orientation == VerticalScrollbar ? &quot;vertical&quot; : &quot;horizontal&quot;;
+}
+
+#if !GTK_CHECK_VERSION(3, 19, 2)
</ins><span class="cx"> static void applyScrollbarStyleContextClasses(GtkStyleContext* context, ScrollbarOrientation orientation)
</span><span class="cx"> {
</span><span class="cx">     gtk_style_context_add_class(context, GTK_STYLE_CLASS_SCROLLBAR);
</span><span class="cx">     gtk_style_context_add_class(context, orientation == VerticalScrollbar ?  GTK_STYLE_CLASS_VERTICAL : GTK_STYLE_CLASS_HORIZONTAL);
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> static void adjustRectAccordingToMargin(GtkStyleContext* context, GtkStateFlags state, IntRect&amp; rect)
</span><span class="cx"> {
</span><span class="lines">@@ -119,62 +146,129 @@
</span><span class="cx">     if (m_troughUnderSteppers)
</span><span class="cx">         fullScrollbarRect = IntRect(scrollbar-&gt;x(), scrollbar-&gt;y(), scrollbar-&gt;width(), scrollbar-&gt;height());
</span><span class="cx"> 
</span><del>-    GtkStyleContext* styleContext = gtkScrollbarStyleContext();
-    gtk_style_context_save(styleContext);
</del><ins>+#if GTK_CHECK_VERSION(3, 19, 2)
+    GRefPtr&lt;GtkStyleContext&gt; styleContext = adoptGRef(gtk_style_context_new());
+    GRefPtr&lt;GtkWidgetPath&gt; path = adoptGRef(gtk_widget_path_new());
</ins><span class="cx"> 
</span><del>-    applyScrollbarStyleContextClasses(styleContext, scrollbar-&gt;orientation());
-    gtk_style_context_add_class(styleContext, GTK_STYLE_CLASS_TROUGH);
</del><ins>+    gtk_widget_path_append_type(path.get(), GTK_TYPE_SCROLLBAR);
+    gtk_widget_path_iter_set_object_name(path.get(), 0, &quot;scrollbar&quot;);
+    gtk_widget_path_iter_add_class(path.get(), 0, orientationStyleClass(scrollbar-&gt;orientation()));
</ins><span class="cx"> 
</span><del>-    adjustRectAccordingToMargin(styleContext, static_cast&lt;GtkStateFlags&gt;(0), fullScrollbarRect);
-    gtk_render_background(styleContext, context-&gt;platformContext()-&gt;cr(), fullScrollbarRect.x(), fullScrollbarRect.y(), fullScrollbarRect.width(), fullScrollbarRect.height());
-    gtk_render_frame(styleContext, context-&gt;platformContext()-&gt;cr(), fullScrollbarRect.x(), fullScrollbarRect.y(), fullScrollbarRect.width(), fullScrollbarRect.height());
</del><ins>+    gtk_widget_path_append_type(path.get(), GTK_TYPE_SCROLLBAR);
+    gtk_widget_path_iter_set_object_name(path.get(), 1, &quot;trough&quot;);
</ins><span class="cx"> 
</span><del>-    gtk_style_context_restore(styleContext);
</del><ins>+    gtk_style_context_set_path(styleContext.get(), path.get());
+#else
+    GRefPtr&lt;GtkStyleContext&gt; styleContext = gtkScrollbarStyleContext();
+    gtk_style_context_save(styleContext.get());
+
+    applyScrollbarStyleContextClasses(styleContext.get(), scrollbar-&gt;orientation());
+    gtk_style_context_add_class(styleContext.get(), GTK_STYLE_CLASS_TROUGH);
+#endif
+
+    adjustRectAccordingToMargin(styleContext.get(), static_cast&lt;GtkStateFlags&gt;(0), fullScrollbarRect);
+    gtk_render_background(styleContext.get(), context-&gt;platformContext()-&gt;cr(), fullScrollbarRect.x(), fullScrollbarRect.y(), fullScrollbarRect.width(), fullScrollbarRect.height());
+    gtk_render_frame(styleContext.get(), context-&gt;platformContext()-&gt;cr(), fullScrollbarRect.x(), fullScrollbarRect.y(), fullScrollbarRect.width(), fullScrollbarRect.height());
+
+#if !GTK_CHECK_VERSION(3, 19, 2)
+    gtk_style_context_restore(styleContext.get());
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ScrollbarThemeGtk::paintScrollbarBackground(GraphicsContext* context, ScrollbarThemeClient* scrollbar)
</span><span class="cx"> {
</span><del>-    GtkStyleContext* styleContext = gtkScrollbarStyleContext();
-    gtk_style_context_save(styleContext);
</del><ins>+#if GTK_CHECK_VERSION(3, 19, 2)
+    GRefPtr&lt;GtkStyleContext&gt; styleContext = adoptGRef(gtk_style_context_new());
+    GRefPtr&lt;GtkWidgetPath&gt; path = adoptGRef(gtk_widget_path_new());
</ins><span class="cx"> 
</span><del>-    applyScrollbarStyleContextClasses(styleContext, scrollbar-&gt;orientation());
-    gtk_style_context_add_class(styleContext, &quot;scrolled-window&quot;);
-    gtk_render_frame(styleContext, context-&gt;platformContext()-&gt;cr(), scrollbar-&gt;x(), scrollbar-&gt;y(), scrollbar-&gt;width(), scrollbar-&gt;height());
</del><ins>+    gtk_widget_path_append_type(path.get(), GTK_TYPE_SCROLLBAR);
+    gtk_widget_path_iter_set_object_name(path.get(), 0, &quot;scrollbar&quot;);
+    gtk_widget_path_iter_add_class(path.get(), 0, orientationStyleClass(scrollbar-&gt;orientation()));
</ins><span class="cx"> 
</span><ins>+    gtk_style_context_set_path(styleContext.get(), path.get());
+#else
+    GRefPtr&lt;GtkStyleContext&gt; styleContext = gtkScrollbarStyleContext();
+    gtk_style_context_save(styleContext.get());
+
+    applyScrollbarStyleContextClasses(styleContext.get(), scrollbar-&gt;orientation());
+    gtk_style_context_add_class(styleContext.get(), &quot;scrolled-window&quot;);
+#endif
+
+    gtk_render_frame(styleContext.get(), context-&gt;platformContext()-&gt;cr(), scrollbar-&gt;x(), scrollbar-&gt;y(), scrollbar-&gt;width(), scrollbar-&gt;height());
+
+#if !GTK_CHECK_VERSION(3, 19, 2)
</ins><span class="cx">     gtk_style_context_restore(styleContext);
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ScrollbarThemeGtk::paintThumb(GraphicsContext* context, ScrollbarThemeClient* scrollbar, const IntRect&amp; rect)
</span><span class="cx"> {
</span><del>-    GtkStyleContext* styleContext = gtkScrollbarStyleContext();
-    gtk_style_context_save(styleContext);
</del><ins>+#if GTK_CHECK_VERSION(3, 19, 2)
+    GRefPtr&lt;GtkStyleContext&gt; styleContext = adoptGRef(gtk_style_context_new());
+    GRefPtr&lt;GtkWidgetPath&gt; path = adoptGRef(gtk_widget_path_new());
</ins><span class="cx"> 
</span><ins>+    gtk_widget_path_append_type(path.get(), GTK_TYPE_SCROLLBAR);
+    gtk_widget_path_iter_set_object_name(path.get(), 0, &quot;scrollbar&quot;);
+    gtk_widget_path_iter_add_class(path.get(), 0, orientationStyleClass(scrollbar-&gt;orientation()));
+
+    gtk_widget_path_append_type(path.get(), GTK_TYPE_SCROLLBAR);
+    gtk_widget_path_iter_set_object_name(path.get(), 1, &quot;trough&quot;);
+
+    gtk_widget_path_append_type(path.get(), GTK_TYPE_SCROLLBAR);
+    gtk_widget_path_iter_set_object_name(path.get(), 2, &quot;slider&quot;);
+
+    gtk_style_context_set_path(styleContext.get(), path.get());
+#else
+    GRefPtr&lt;GtkStyleContext&gt; styleContext = gtkScrollbarStyleContext();
+    gtk_style_context_save(styleContext.get());
+#endif
+
</ins><span class="cx">     ScrollbarOrientation orientation = scrollbar-&gt;orientation();
</span><del>-    applyScrollbarStyleContextClasses(styleContext, orientation);
-    gtk_style_context_add_class(styleContext, GTK_STYLE_CLASS_SLIDER);
</del><ins>+#if !GTK_CHECK_VERSION(3, 19, 2)
+    applyScrollbarStyleContextClasses(styleContext.get(), orientation);
+    gtk_style_context_add_class(styleContext.get(), GTK_STYLE_CLASS_SLIDER);
+#endif
</ins><span class="cx"> 
</span><span class="cx">     guint flags = 0;
</span><span class="cx">     if (scrollbar-&gt;pressedPart() == ThumbPart)
</span><span class="cx">         flags |= GTK_STATE_FLAG_ACTIVE;
</span><span class="cx">     if (scrollbar-&gt;hoveredPart() == ThumbPart)
</span><span class="cx">         flags |= GTK_STATE_FLAG_PRELIGHT;
</span><del>-    gtk_style_context_set_state(styleContext, static_cast&lt;GtkStateFlags&gt;(flags));
</del><ins>+    gtk_style_context_set_state(styleContext.get(), static_cast&lt;GtkStateFlags&gt;(flags));
</ins><span class="cx"> 
</span><span class="cx">     IntRect thumbRect(rect);
</span><del>-    adjustRectAccordingToMargin(styleContext, static_cast&lt;GtkStateFlags&gt;(flags), thumbRect);
-    gtk_render_slider(styleContext, context-&gt;platformContext()-&gt;cr(), thumbRect.x(), thumbRect.y(), thumbRect.width(), thumbRect.height(),
</del><ins>+    adjustRectAccordingToMargin(styleContext.get(), static_cast&lt;GtkStateFlags&gt;(flags), thumbRect);
+    gtk_render_slider(styleContext.get(), context-&gt;platformContext()-&gt;cr(), thumbRect.x(), thumbRect.y(), thumbRect.width(), thumbRect.height(),
</ins><span class="cx">         orientation == VerticalScrollbar ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL);
</span><span class="cx"> 
</span><ins>+#if !GTK_CHECK_VERSION(3, 19, 2)
</ins><span class="cx">     gtk_style_context_restore(styleContext);
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ScrollbarThemeGtk::paintButton(GraphicsContext* context, ScrollbarThemeClient* scrollbar, const IntRect&amp; rect, ScrollbarPart part)
</span><span class="cx"> {
</span><del>-    GtkStyleContext* styleContext = gtkScrollbarStyleContext();
-    gtk_style_context_save(styleContext);
</del><ins>+#if GTK_CHECK_VERSION(3, 19, 2)
+    GRefPtr&lt;GtkStyleContext&gt; styleContext = adoptGRef(gtk_style_context_new());
+    GRefPtr&lt;GtkWidgetPath&gt; path = adoptGRef(gtk_widget_path_new());
</ins><span class="cx"> 
</span><ins>+    gtk_widget_path_append_type(path.get(), GTK_TYPE_SCROLLBAR);
+    gtk_widget_path_iter_set_object_name(path.get(), 0, &quot;scrollbar&quot;);
+    gtk_widget_path_iter_add_class(path.get(), 0, orientationStyleClass(scrollbar-&gt;orientation()));
+
+    gtk_widget_path_append_type(path.get(), GTK_TYPE_SCROLLBAR);
+    gtk_widget_path_iter_set_object_name(path.get(), 1, &quot;button&quot;);
+
+    gtk_style_context_set_path(styleContext.get(), path.get());
+#else
+    GRefPtr&lt;GtkStyleContext&gt; styleContext = gtkScrollbarStyleContext();
+    gtk_style_context_save(styleContext.get());
+#endif
+
</ins><span class="cx">     ScrollbarOrientation orientation = scrollbar-&gt;orientation();
</span><del>-    applyScrollbarStyleContextClasses(styleContext, orientation);
</del><ins>+#if !GTK_CHECK_VERSION(3, 19, 2)
+    applyScrollbarStyleContextClasses(styleContext.get(), orientation);
+#endif
</ins><span class="cx"> 
</span><span class="cx">     guint flags = 0;
</span><span class="cx">     if ((BackButtonStartPart == part &amp;&amp; scrollbar-&gt;currentPos())
</span><span class="lines">@@ -187,14 +281,16 @@
</span><span class="cx">             flags |= GTK_STATE_FLAG_PRELIGHT;
</span><span class="cx">     } else
</span><span class="cx">         flags |= GTK_STATE_FLAG_INSENSITIVE;
</span><del>-    gtk_style_context_set_state(styleContext, static_cast&lt;GtkStateFlags&gt;(flags));
</del><ins>+    gtk_style_context_set_state(styleContext.get(), static_cast&lt;GtkStateFlags&gt;(flags));
</ins><span class="cx"> 
</span><del>-    gtk_style_context_add_class(styleContext, GTK_STYLE_CLASS_BUTTON);
-    gtk_render_background(styleContext, context-&gt;platformContext()-&gt;cr(), rect.x(), rect.y(), rect.width(), rect.height());
-    gtk_render_frame(styleContext, context-&gt;platformContext()-&gt;cr(), rect.x(), rect.y(), rect.width(), rect.height());
</del><ins>+#if !GTK_CHECK_VERSION(3, 19, 2)
+    gtk_style_context_add_class(styleContext.get(), GTK_STYLE_CLASS_BUTTON);
+#endif
+    gtk_render_background(styleContext.get(), context-&gt;platformContext()-&gt;cr(), rect.x(), rect.y(), rect.width(), rect.height());
+    gtk_render_frame(styleContext.get(), context-&gt;platformContext()-&gt;cr(), rect.x(), rect.y(), rect.width(), rect.height());
</ins><span class="cx"> 
</span><span class="cx">     gfloat arrowScaling;
</span><del>-    gtk_style_context_get_style(styleContext, &quot;arrow-scaling&quot;, &amp;arrowScaling, NULL);
</del><ins>+    gtk_style_context_get_style(styleContext.get(), &quot;arrow-scaling&quot;, &amp;arrowScaling, nullptr);
</ins><span class="cx"> 
</span><span class="cx">     double arrowSize = std::min(rect.width(), rect.height()) * arrowScaling;
</span><span class="cx">     FloatPoint arrowPoint(rect.x() + (rect.width() - arrowSize) / 2,
</span><span class="lines">@@ -202,7 +298,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (flags &amp; GTK_STATE_FLAG_ACTIVE) {
</span><span class="cx">         gint arrowDisplacementX, arrowDisplacementY;
</span><del>-        gtk_style_context_get_style(styleContext, &quot;arrow-displacement-x&quot;, &amp;arrowDisplacementX, &quot;arrow-displacement-y&quot;, &amp;arrowDisplacementY, nullptr);
</del><ins>+        gtk_style_context_get_style(styleContext.get(), &quot;arrow-displacement-x&quot;, &amp;arrowDisplacementX, &quot;arrow-displacement-y&quot;, &amp;arrowDisplacementY, nullptr);
</ins><span class="cx">         arrowPoint.move(arrowDisplacementX, arrowDisplacementY);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -213,9 +309,11 @@
</span><span class="cx">         angle = (part == ForwardButtonEndPart || part == ForwardButtonStartPart) ? G_PI / 2 : 3 * (G_PI / 2);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    gtk_render_arrow(styleContext, context-&gt;platformContext()-&gt;cr(), angle, arrowPoint.x(), arrowPoint.y(), arrowSize);
</del><ins>+    gtk_render_arrow(styleContext.get(), context-&gt;platformContext()-&gt;cr(), angle, arrowPoint.x(), arrowPoint.y(), arrowSize);
</ins><span class="cx"> 
</span><ins>+#if !GTK_CHECK_VERSION(3, 19, 2)
</ins><span class="cx">     gtk_style_context_restore(styleContext);
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre>
</div>
</div>

</body>
</html>