<!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>[194377] trunk/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/194377">194377</a></dd>
<dt>Author</dt> <dd>mcatanzaro@igalia.com</dd>
<dt>Date</dt> <dd>2015-12-22 15:15:25 -0800 (Tue, 22 Dec 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[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="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgtkGRefPtrGtkcpp">trunk/Source/WebCore/platform/gtk/GRefPtrGtk.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgtkGRefPtrGtkh">trunk/Source/WebCore/platform/gtk/GRefPtrGtk.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgtkScrollbarThemeGtkcpp">trunk/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemeGtkcpp">trunk/Source/WebCore/rendering/RenderThemeGtk.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (194376 => 194377)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-12-22 23:12:43 UTC (rev 194376)
+++ trunk/Source/WebCore/ChangeLog        2015-12-22 23:15:25 UTC (rev 194377)
</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-22  Eric Carlson  &lt;eric.carlson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [MediaStream] MediaStreamTrackPrivate.source should be a reference
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgtkGRefPtrGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/gtk/GRefPtrGtk.cpp (194376 => 194377)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/GRefPtrGtk.cpp        2015-12-22 23:12:43 UTC (rev 194376)
+++ trunk/Source/WebCore/platform/gtk/GRefPtrGtk.cpp        2015-12-22 23:15:25 UTC (rev 194377)
</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="trunkSourceWebCoreplatformgtkGRefPtrGtkh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/gtk/GRefPtrGtk.h (194376 => 194377)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/GRefPtrGtk.h        2015-12-22 23:12:43 UTC (rev 194376)
+++ trunk/Source/WebCore/platform/gtk/GRefPtrGtk.h        2015-12-22 23:15:25 UTC (rev 194377)
</span><span class="lines">@@ -23,6 +23,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &lt;wtf/glib/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="trunkSourceWebCoreplatformgtkScrollbarThemeGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp (194376 => 194377)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp        2015-12-22 23:12:43 UTC (rev 194376)
+++ trunk/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp        2015-12-22 23:15:25 UTC (rev 194377)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;ScrollbarThemeGtk.h&quot;
</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">@@ -163,6 +164,12 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #ifndef GTK_API_VERSION_2
</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">@@ -191,6 +198,7 @@
</span><span class="cx">     static NeverDestroyed&lt;ScrollbarStyleContext&gt; styleContext;
</span><span class="cx">     return styleContext.get().context();
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> ScrollbarThemeGtk::ScrollbarThemeGtk()
</span><span class="cx"> {
</span><span class="lines">@@ -199,14 +207,28 @@
</span><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="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">@@ -272,11 +294,19 @@
</span><span class="cx">     return IntRect(trackRect.x() + (trackRect.width() - m_thumbFatness) / 2, trackRect.y() + thumbPos, m_thumbFatness, thumbLength(scrollbar));
</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><del>-    gtk_style_context_add_class(context, orientation == VerticalScrollbar ?  GTK_STYLE_CLASS_VERTICAL : GTK_STYLE_CLASS_HORIZONTAL);
</del><ins>+    gtk_style_context_add_class(context, orientationStyleClass(orientation));
</ins><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">@@ -296,62 +326,129 @@
</span><span class="cx">     if (m_troughUnderSteppers)
</span><span class="cx">         fullScrollbarRect = IntRect(scrollbar.x(), scrollbar.y(), scrollbar.width(), scrollbar.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.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.orientation()));
</ins><span class="cx"> 
</span><del>-    adjustRectAccordingToMargin(styleContext, static_cast&lt;GtkStateFlags&gt;(0), fullScrollbarRect);
-    gtk_render_background(styleContext, context.platformContext()-&gt;cr(), fullScrollbarRect.x(), fullScrollbarRect.y(), fullScrollbarRect.width(), fullScrollbarRect.height());
-    gtk_render_frame(styleContext, context.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.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.platformContext()-&gt;cr(), fullScrollbarRect.x(), fullScrollbarRect.y(), fullScrollbarRect.width(), fullScrollbarRect.height());
+    gtk_render_frame(styleContext.get(), context.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&amp; context, Scrollbar&amp; 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.orientation());
-    gtk_style_context_add_class(styleContext, &quot;scrolled-window&quot;);
-    gtk_render_frame(styleContext, context.platformContext()-&gt;cr(), scrollbar.x(), scrollbar.y(), scrollbar.width(), scrollbar.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.orientation()));
</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.orientation());
+    gtk_style_context_add_class(styleContext.get(), &quot;scrolled-window&quot;);
+#endif
+
+    gtk_render_frame(styleContext.get(), context.platformContext()-&gt;cr(), scrollbar.x(), scrollbar.y(), scrollbar.width(), scrollbar.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::paintThumb(GraphicsContext&amp; context, Scrollbar&amp; 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.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.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.pressedPart() == ThumbPart)
</span><span class="cx">         flags |= GTK_STATE_FLAG_ACTIVE;
</span><span class="cx">     if (scrollbar.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.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.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><del>-    gtk_style_context_restore(styleContext);
</del><ins>+#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::paintButton(GraphicsContext&amp; context, Scrollbar&amp; 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.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.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.currentPos())
</span><span class="lines">@@ -364,14 +461,17 @@
</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.platformContext()-&gt;cr(), rect.x(), rect.y(), rect.width(), rect.height());
-    gtk_render_frame(styleContext, context.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
</ins><span class="cx"> 
</span><ins>+    gtk_render_background(styleContext.get(), context.platformContext()-&gt;cr(), rect.x(), rect.y(), rect.width(), rect.height());
+    gtk_render_frame(styleContext.get(), context.platformContext()-&gt;cr(), rect.x(), rect.y(), rect.width(), rect.height());
+
</ins><span class="cx">     gfloat arrowScaling;
</span><del>-    gtk_style_context_get_style(styleContext, &quot;arrow-scaling&quot;, &amp;arrowScaling, nullptr);
</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(
</span><span class="lines">@@ -380,7 +480,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">@@ -390,9 +490,11 @@
</span><span class="cx">     else
</span><span class="cx">         angle = (part == ForwardButtonEndPart || part == ForwardButtonStartPart) ? G_PI / 2 : 3 * (G_PI / 2);
</span><span class="cx"> 
</span><del>-    gtk_render_arrow(styleContext, context.platformContext()-&gt;cr(), angle, arrowPoint.x(), arrowPoint.y(), arrowSize);
</del><ins>+    gtk_render_arrow(styleContext.get(), context.platformContext()-&gt;cr(), angle, arrowPoint.x(), arrowPoint.y(), arrowSize);
</ins><span class="cx"> 
</span><del>-    gtk_style_context_restore(styleContext);
</del><ins>+#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"> bool ScrollbarThemeGtk::paint(Scrollbar&amp; scrollbar, GraphicsContext&amp; graphicsContext, const IntRect&amp; damageRect)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderThemeGtk.cpp (194376 => 194377)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderThemeGtk.cpp        2015-12-22 23:12:43 UTC (rev 194376)
+++ trunk/Source/WebCore/rendering/RenderThemeGtk.cpp        2015-12-22 23:15:25 UTC (rev 194377)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include &quot;FileList.h&quot;
</span><span class="cx"> #include &quot;FileSystem.h&quot;
</span><span class="cx"> #include &quot;FontDescription.h&quot;
</span><ins>+#include &quot;GRefPtrGtk.h&quot;
</ins><span class="cx"> #include &quot;GUniquePtrGtk.h&quot;
</span><span class="cx"> #include &quot;Gradient.h&quot;
</span><span class="cx"> #include &quot;GraphicsContext.h&quot;
</span><span class="lines">@@ -152,34 +153,62 @@
</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">     } 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">@@ -452,9 +481,7 @@
</span><span class="cx">     if (!style.width().isIntrinsicOrAuto() &amp;&amp; !style.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">@@ -468,7 +495,38 @@
</span><span class="cx"> static void paintToggle(const RenderThemeGtk* theme, GType widgetType, const RenderObject&amp; 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">@@ -487,7 +545,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.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))
</span><span class="lines">@@ -614,7 +677,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.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">@@ -643,8 +708,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.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">@@ -659,7 +736,9 @@
</span><span class="cx"> 
</span><span class="cx">     GtkTextDirection direction = static_cast&lt;GtkTextDirection&gt;(gtkTextDirection(style.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">@@ -721,7 +800,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">@@ -758,8 +839,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">@@ -779,10 +862,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">@@ -831,7 +923,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.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">@@ -1041,7 +1135,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">@@ -1054,10 +1150,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.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))
</span><span class="cx">         gtk_style_context_set_state(context.get(), GTK_STATE_FLAG_INSENSITIVE);
</span><span class="lines">@@ -1082,10 +1191,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.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))
</span><span class="lines">@@ -1127,16 +1250,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().platformContext()-&gt;cr(), rect.x(), rect.y(), rect.width(), rect.height());
</span><span class="cx">     gtk_render_frame(context.get(), paintInfo.context().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">@@ -1188,7 +1337,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">@@ -1289,16 +1452,28 @@
</span><span class="cx"> 
</span><span class="cx"> static Color styleColor(GType widgetType, GtkStateFlags state, StyleColorType colorType)
</span><span class="cx"> {
</span><ins>+    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());
</ins><span class="cx"> 
</span><del>-    GRefPtr&lt;GtkStyleContext&gt; context = createStyleContext(widgetType);
-    // Recent GTK+ versions (&gt; 3.14) require to explicitly set the state before getting the color.
</del><ins>+        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>
</div>

</body>
</html>