<!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>[195120] releases/WebKitGTK/webkit-2.10/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/195120">195120</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2016-01-15 04:37:09 -0800 (Fri, 15 Jan 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="#releasesWebKitGTKwebkit210SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebCoreplatformgtkGRefPtrGtkcpp">releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/gtk/GRefPtrGtk.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebCoreplatformgtkGRefPtrGtkh">releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/gtk/GRefPtrGtk.h</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebCoreplatformgtkScrollbarThemeGtkcpp">releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebCorerenderingRenderThemeGtkcpp">releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderThemeGtk.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit210SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog (195119 => 195120)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog        2016-01-15 12:36:46 UTC (rev 195119)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog        2016-01-15 12:37:09 UTC (rev 195120)
</span><span class="lines">@@ -1,3 +1,46 @@
</span><ins>+2015-12-22 Michael Catanzaro <mcatanzaro@igalia.com>
+
+ [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 <mcatanzaro@igalia.com>
</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="releasesWebKitGTKwebkit210SourceWebCoreplatformgtkGRefPtrGtkcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/gtk/GRefPtrGtk.cpp (195119 => 195120)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/gtk/GRefPtrGtk.cpp        2016-01-15 12:36:46 UTC (rev 195119)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/gtk/GRefPtrGtk.cpp        2016-01-15 12:37:09 UTC (rev 195120)
</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 <> GtkWidgetPath* refGPtr(GtkWidgetPath* ptr)
+{
+ if (ptr)
+ gtk_widget_path_ref(ptr);
+ return ptr;
+}
+
+template <> 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="releasesWebKitGTKwebkit210SourceWebCoreplatformgtkGRefPtrGtkh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/gtk/GRefPtrGtk.h (195119 => 195120)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/gtk/GRefPtrGtk.h        2016-01-15 12:36:46 UTC (rev 195119)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/gtk/GRefPtrGtk.h        2016-01-15 12:37:09 UTC (rev 195120)
</span><span class="lines">@@ -23,6 +23,7 @@
</span><span class="cx">
</span><span class="cx"> #include <wtf/glib/GRefPtr.h>
</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 <> GdkCursor* refGPtr(GdkCursor* ptr);
</span><span class="cx"> template <> void derefGPtr(GdkCursor* ptr);
</span><ins>+#else
+template <> GtkWidgetPath* refGPtr(GtkWidgetPath* ptr);
+template <> void derefGPtr(GtkWidgetPath* ptr);
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceWebCoreplatformgtkScrollbarThemeGtkcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp (195119 => 195120)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp        2016-01-15 12:36:46 UTC (rev 195119)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp        2016-01-15 12:37:09 UTC (rev 195120)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "ScrollbarThemeGtk.h"
</span><span class="cx">
</span><ins>+#include "GRefPtrGtk.h"
</ins><span class="cx"> #include "PlatformContextCairo.h"
</span><span class="cx"> #include "PlatformMouseEvent.h"
</span><span class="cx"> #include "ScrollView.h"
</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+ < 3.19, and a bunch of unique
+// GtkStyleContexts for GTK+ >= 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<ScrollbarStyleContext> 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<GtkStyleContext> styleContext = adoptGRef(gtk_style_context_new());
+ GRefPtr<GtkWidgetPath> 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, "scrollbar");
+
+ gtk_style_context_set_path(styleContext.get(), path.get());
+#else
+ GRefPtr<GtkStyleContext> styleContext = gtkScrollbarStyleContext();
+#endif
+
</ins><span class="cx"> gtk_style_context_get_style(
</span><del>- gtkScrollbarStyleContext(),
</del><ins>+ styleContext.get(),
</ins><span class="cx"> "min-slider-length", &m_minThumbLength,
</span><span class="cx"> "slider-width", &m_thumbFatness,
</span><span class="cx"> "trough-border", &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 ? "vertical" : "horizontal";
+}
+
+#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& 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<GtkStyleContext> styleContext = adoptGRef(gtk_style_context_new());
+ GRefPtr<GtkWidgetPath> 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, "scrollbar");
+ gtk_widget_path_iter_add_class(path.get(), 0, orientationStyleClass(scrollbar.orientation()));
</ins><span class="cx">
</span><del>- adjustRectAccordingToMargin(styleContext, static_cast<GtkStateFlags>(0), fullScrollbarRect);
- gtk_render_background(styleContext, context.platformContext()->cr(), fullScrollbarRect.x(), fullScrollbarRect.y(), fullScrollbarRect.width(), fullScrollbarRect.height());
- gtk_render_frame(styleContext, context.platformContext()->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, "trough");
</ins><span class="cx">
</span><del>- gtk_style_context_restore(styleContext);
</del><ins>+ gtk_style_context_set_path(styleContext.get(), path.get());
+#else
+ GRefPtr<GtkStyleContext> 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<GtkStateFlags>(0), fullScrollbarRect);
+ gtk_render_background(styleContext.get(), context.platformContext()->cr(), fullScrollbarRect.x(), fullScrollbarRect.y(), fullScrollbarRect.width(), fullScrollbarRect.height());
+ gtk_render_frame(styleContext.get(), context.platformContext()->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, Scrollbar& 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<GtkStyleContext> styleContext = adoptGRef(gtk_style_context_new());
+ GRefPtr<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new());
</ins><span class="cx">
</span><del>- applyScrollbarStyleContextClasses(styleContext, scrollbar.orientation());
- gtk_style_context_add_class(styleContext, "scrolled-window");
- gtk_render_frame(styleContext, context.platformContext()->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, "scrollbar");
+ 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<GtkStyleContext> styleContext = gtkScrollbarStyleContext();
+ gtk_style_context_save(styleContext.get());
+
+ applyScrollbarStyleContextClasses(styleContext.get(), scrollbar.orientation());
+ gtk_style_context_add_class(styleContext.get(), "scrolled-window");
+#endif
+
+ gtk_render_frame(styleContext.get(), context.platformContext()->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& context, Scrollbar& scrollbar, const IntRect& 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<GtkStyleContext> styleContext = adoptGRef(gtk_style_context_new());
+ GRefPtr<GtkWidgetPath> 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, "scrollbar");
+ 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, "trough");
+
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SCROLLBAR);
+ gtk_widget_path_iter_set_object_name(path.get(), 2, "slider");
+
+ gtk_style_context_set_path(styleContext.get(), path.get());
+#else
+ GRefPtr<GtkStyleContext> 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<GtkStateFlags>(flags));
</del><ins>+ gtk_style_context_set_state(styleContext.get(), static_cast<GtkStateFlags>(flags));
</ins><span class="cx">
</span><span class="cx"> IntRect thumbRect(rect);
</span><del>- adjustRectAccordingToMargin(styleContext, static_cast<GtkStateFlags>(flags), thumbRect);
- gtk_render_slider(styleContext, context.platformContext()->cr(), thumbRect.x(), thumbRect.y(), thumbRect.width(), thumbRect.height(),
</del><ins>+ adjustRectAccordingToMargin(styleContext.get(), static_cast<GtkStateFlags>(flags), thumbRect);
+ gtk_render_slider(styleContext.get(), context.platformContext()->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& context, Scrollbar& scrollbar, const IntRect& 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<GtkStyleContext> styleContext = adoptGRef(gtk_style_context_new());
+ GRefPtr<GtkWidgetPath> 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, "scrollbar");
+ 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, "button");
+
+ gtk_style_context_set_path(styleContext.get(), path.get());
+#else
+ GRefPtr<GtkStyleContext> 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 && 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<GtkStateFlags>(flags));
</del><ins>+ gtk_style_context_set_state(styleContext.get(), static_cast<GtkStateFlags>(flags));
</ins><span class="cx">
</span><del>- gtk_style_context_add_class(styleContext, GTK_STYLE_CLASS_BUTTON);
- gtk_render_background(styleContext, context.platformContext()->cr(), rect.x(), rect.y(), rect.width(), rect.height());
- gtk_render_frame(styleContext, context.platformContext()->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()->cr(), rect.x(), rect.y(), rect.width(), rect.height());
+ gtk_render_frame(styleContext.get(), context.platformContext()->cr(), rect.x(), rect.y(), rect.width(), rect.height());
+
</ins><span class="cx"> gfloat arrowScaling;
</span><del>- gtk_style_context_get_style(styleContext, "arrow-scaling", &arrowScaling, nullptr);
</del><ins>+ gtk_style_context_get_style(styleContext.get(), "arrow-scaling", &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 & GTK_STATE_FLAG_ACTIVE) {
</span><span class="cx"> gint arrowDisplacementX, arrowDisplacementY;
</span><del>- gtk_style_context_get_style(styleContext, "arrow-displacement-x", &arrowDisplacementX, "arrow-displacement-y", &arrowDisplacementY, nullptr);
</del><ins>+ gtk_style_context_get_style(styleContext.get(), "arrow-displacement-x", &arrowDisplacementX, "arrow-displacement-y", &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()->cr(), angle, arrowPoint.x(), arrowPoint.y(), arrowSize);
</del><ins>+ gtk_render_arrow(styleContext.get(), context.platformContext()->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& scrollbar, GraphicsContext& graphicsContext, const IntRect& damageRect)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceWebCorerenderingRenderThemeGtkcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderThemeGtk.cpp (195119 => 195120)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderThemeGtk.cpp        2016-01-15 12:36:46 UTC (rev 195119)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderThemeGtk.cpp        2016-01-15 12:37:09 UTC (rev 195120)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include "FileList.h"
</span><span class="cx"> #include "FileSystem.h"
</span><span class="cx"> #include "FontDescription.h"
</span><ins>+#include "GRefPtrGtk.h"
</ins><span class="cx"> #include "GUniquePtrGtk.h"
</span><span class="cx"> #include "Gradient.h"
</span><span class="cx"> #include "GraphicsContext.h"
</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<GtkWidgetPath> 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, "entry");
</ins><span class="cx"> else if (widgetType == GTK_TYPE_ARROW)
</span><del>- gtk_widget_path_iter_add_class(path, 0, "arrow");
</del><ins>+ gtk_widget_path_iter_set_object_name(path.get(), 0, "button"); // 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, "text-button");
</del><ins>+ gtk_widget_path_iter_set_object_name(path.get(), 0, "button");
+ gtk_widget_path_iter_add_class(path.get(), 0, "text-button");
</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, "scale");
</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, "separator");
</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, "progressbar");
</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, "spinbutton");
+ else if (widgetType == GTK_TYPE_TREE_VIEW) {
+ gtk_widget_path_iter_set_object_name(path.get(), 0, "treeview");
+ gtk_widget_path_iter_add_class(path.get(), 0, "view");
+ } else if (widgetType == GTK_TYPE_CHECK_BUTTON)
+ gtk_widget_path_iter_set_object_name(path.get(), 0, "checkbutton");
+ else if (widgetType == GTK_TYPE_RADIO_BUTTON)
+ gtk_widget_path_iter_set_object_name(path.get(), 0, "radiobutton");
+ else if (widgetType == GTK_TYPE_COMBO_BOX)
+ gtk_widget_path_iter_set_object_name(path.get(), 0, "combobox");
+#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, "arrow");
+ else if (widgetType == GTK_TYPE_BUTTON) {
+ gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_BUTTON);
+ gtk_widget_path_iter_add_class(path.get(), 0, "text-button");
+ } else if (widgetType == GTK_TYPE_SCALE)
+ gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_SCALE);
+ else if (widgetType == GTK_TYPE_SEPARATOR)
+ gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_SEPARATOR);
+ else if (widgetType == GTK_TYPE_PROGRESS_BAR)
+ gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_PROGRESSBAR);
+ else if (widgetType == GTK_TYPE_SPIN_BUTTON)
+ gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_SPINBUTTON);
</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<GtkStyleContext> 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() && !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(), "indicator-size", &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& renderObject, const PaintInfo& paintInfo, const IntRect& fullRect)
</span><span class="cx"> {
</span><span class="cx"> GRefPtr<GtkStyleContext> context = createStyleContext(widgetType);
</span><ins>+#if GTK_CHECK_VERSION(3, 19, 2)
+ GRefPtr<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new());
</ins><span class="cx">
</span><ins>+ if (widgetType == GTK_TYPE_CHECK_BUTTON) {
+ if (theme->isChecked(renderObject) || theme->isIndeterminate(renderObject)) {
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_CHECK_BUTTON);
+ gtk_widget_path_iter_set_object_name(path.get(), 0, "checkbutton");
+ } else {
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_CHECK_BUTTON);
+ gtk_widget_path_iter_set_object_name(path.get(), 0, "button");
+ gtk_widget_path_iter_add_class(path.get(), 0, "check");
+ }
+
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_CHECK_BUTTON);
+ gtk_widget_path_iter_set_object_name(path.get(), 1, "check");
+ } else if (widgetType == GTK_TYPE_RADIO_BUTTON) {
+ if (theme->isChecked(renderObject) || theme->isIndeterminate(renderObject)) {
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_RADIO_BUTTON);
+ gtk_widget_path_iter_set_object_name(path.get(), 0, "radiobutton");
+ } else {
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_RADIO_BUTTON);
+ gtk_widget_path_iter_set_object_name(path.get(), 0, "button");
+ gtk_widget_path_iter_add_class(path.get(), 0, "radio");
+ }
+
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_RADIO_BUTTON);
+ gtk_widget_path_iter_set_object_name(path.get(), 1, "radio");
+ }
+
+ gtk_style_context_set_path(context.get(), path.get());
+#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<GtkTextDirection>(gtkTextDirection(renderObject.style().direction())));
</span><ins>+
+#if GTK_CHECK_VERSION(3, 19, 2)
+ gtk_style_context_add_class(context.get(), "toggle");
+#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->isEnabled(renderObject))
</span><span class="lines">@@ -614,7 +677,9 @@
</span><span class="cx"> GRefPtr<GtkStyleContext> context = createStyleContext(GTK_TYPE_BUTTON);
</span><span class="cx">
</span><span class="cx"> gtk_style_context_set_direction(context.get(), static_cast<GtkTextDirection>(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<GtkStyleContext> context = createStyleContext(GTK_TYPE_COMBO_BOX);
</span><ins>+#if GTK_CHECK_VERSION(3, 19, 2)
+ GRefPtr<GtkWidgetPath> 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, "combobox");
+
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_COMBO_BOX);
+ gtk_widget_path_iter_set_object_name(path.get(), 1, "button");
+ gtk_widget_path_iter_add_class(path.get(), 1, "combo");
+
+ gtk_style_context_set_path(context.get(), path.get());
+#else
</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<GtkTextDirection>(gtkTextDirection(style.direction())));
</span><span class="cx">
</span><span class="cx"> gtk_style_context_set_state(context.get(), static_cast<GtkStateFlags>(0));
</span><span class="lines">@@ -659,7 +736,9 @@
</span><span class="cx">
</span><span class="cx"> GtkTextDirection direction = static_cast<GtkTextDirection>(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(), "separator");
</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<GtkStyleContext> 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<GtkStyleContext> 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(), "arrow");
</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(), "arrow-scaling", &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<GtkStyleContext> separatorStyleContext = createStyleContext(GTK_TYPE_COMBO_BOX);
</span><ins>+#if GTK_CHECK_VERSION(3, 19, 2)
+ GRefPtr<GtkWidgetPath> 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, "separator");
+
+ gtk_style_context_set_path(separatorStyleContext.get(), path.get());
+#else
</ins><span class="cx"> gtk_style_context_add_class(separatorStyleContext.get(), "separator");
</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(), "wide-separators", &wideSeparators, "separator-width", &separatorWidth, nullptr);
</span><span class="lines">@@ -831,7 +923,9 @@
</span><span class="cx"> GRefPtr<GtkStyleContext> context = createStyleContext(GTK_TYPE_ENTRY);
</span><span class="cx">
</span><span class="cx"> gtk_style_context_set_direction(context.get(), static_cast<GtkTextDirection>(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<GtkStyleContext> context = createStyleContext(GTK_TYPE_SCALE);
</span><ins>+#if GTK_CHECK_VERSION(3, 19, 2)
+ GRefPtr<GtkWidgetPath> 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, "scale");
+
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SCALE);
+ gtk_widget_path_iter_set_object_name(path.get(), 1, "trough");
+
+ gtk_style_context_set_path(context.get(), path.get());
+#endif
+
</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<GtkStyleContext> 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<GtkWidgetPath> 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, "scale");
+
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SCALE);
+ gtk_widget_path_iter_set_object_name(path.get(), 1, "trough");
+
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SCALE);
+ gtk_widget_path_iter_set_object_name(path.get(), 2, "slider");
+
+ gtk_style_context_set_path(context.get(), path.get());
+#endif
+
</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<GtkStyleContext> context = createStyleContext(GTK_TYPE_PROGRESS_BAR);
</span><ins>+#if GTK_CHECK_VERSION(3, 19, 2)
+ GRefPtr<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new());
+
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_PROGRESS_BAR);
+ gtk_widget_path_iter_set_object_name(path.get(), 0, "progressbar");
+
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_PROGRESS_BAR);
+ gtk_widget_path_iter_set_object_name(path.get(), 1, "trough");
+
+ gtk_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()->cr(), rect.x(), rect.y(), rect.width(), rect.height());
</span><span class="cx"> gtk_render_frame(context.get(), paintInfo.context->platformContext()->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, "progressbar");
+
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_PROGRESS_BAR);
+ gtk_widget_path_iter_set_object_name(path.get(), 1, "trough");
+
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_PROGRESS_BAR);
+ gtk_widget_path_iter_set_object_name(path.get(), 2, "progress");
+
+ gtk_style_context_set_path(context.get(), path.get());
+#else
</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<GtkStateFlags>(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<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new());
+
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SPIN_BUTTON);
+ gtk_widget_path_iter_set_object_name(path.get(), 0, "spinbutton");
+
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SPIN_BUTTON);
+ gtk_widget_path_iter_set_object_name(path.get(), 1, "button");
+ gtk_widget_path_iter_add_class(path.get(), 1, arrowType == GTK_ARROW_UP ? "up" : "down");
+
+ gtk_style_context_set_path(context, path.get());
+#else
</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<guint>(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<GtkStyleContext> context = createStyleContext(widgetType);
+#if GTK_CHECK_VERSION(3, 19, 2)
+ if (widgetType == GTK_TYPE_ENTRY) {
+ GRefPtr<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new());
</ins><span class="cx">
</span><del>- GRefPtr<GtkStyleContext> context = createStyleContext(widgetType);
- // Recent GTK+ versions (> 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, "entry");
+
+ gtk_widget_path_append_type(path.get(), GTK_TYPE_ENTRY);
+ gtk_widget_path_iter_set_object_name(path.get(), 1, "selection");
+
+ gtk_style_context_set_path(context.get(), path.get());
+ }
+#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()), &gdkRGBAColor);
</del><ins>+ gtk_style_context_get_background_color(context.get(), state, &gdkRGBAColor);
</ins><span class="cx"> else
</span><del>- gtk_style_context_get_color(context.get(), gtk_style_context_get_state(context.get()), &gdkRGBAColor);
</del><ins>+ gtk_style_context_get_color(context.get(), state, &gdkRGBAColor);
</ins><span class="cx"> return gdkRGBAColor;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>