<!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>[195122] 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/195122">195122</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2016-01-15 04:37:54 -0800 (Fri, 15 Jan 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/194844">r194844</a> - [GTK] Cleanup ScrollbarThemeGtk
https://bugs.webkit.org/show_bug.cgi?id=152830

Reviewed by Michael Catanzaro.

Use a common path for GTK+ 3.19 and previous versions, simplifying
the code and removing a lot of ifdefs. Use always a new
GtkStyleContext, but when painting cache the newly created one so
all paint methods use that one. We were also caching some theme
properties assuming they don't change unless the theme changes,
but some of them can have different values depending on the state,
for example, when hovered or pressed. Those properties are now
only cached when we create a new GtkStyleContext.
The method updateScrollbarsFrameThickness() has also been removed,
since the Scrollbar constructor already initializes the frame rect
using the scrollbarThickness(). This method was not doing anything
anyway, since that was called on the constructor of the theme,
when there were no scrollbars registered. This also means we no
longer need to track registered/unregistered scrollbars.

* platform/gtk/ScrollbarThemeGtk.cpp:
(WebCore::ScrollbarThemeGtk::backButtonRect): Use the cached
GtkStyleContext and properties or create a new.
(WebCore::ScrollbarThemeGtk::forwardButtonRect): Ditto.
(WebCore::ScrollbarThemeGtk::trackRect): Ditto.
(WebCore::orientationStyleClass):
(WebCore::ScrollbarThemeGtk::getOrCreateStyleContext): Create a
new GtkStyleContext for the scrollbar if there isn't a cached
one. Also initialize the properties that depend on the state.
(WebCore::createChildStyleContext): Create a new GtkStyleContext
from a parent one.
(WebCore::ScrollbarThemeGtk::updateThemeProperties): Get the
properties that can only change when the theme changes.
(WebCore::ScrollbarThemeGtk::thumbRect): Use the cached
GtkStyleContext and properties or create a new.
(WebCore::adjustRectAccordingToMargin): Use always the
GtkStyleContext state instead of receiving it and setting it again.
(WebCore::ScrollbarThemeGtk::paintTrackBackground): Get or create
a GtkStyleContext for the scrollbar and create a child one for the trough.
(WebCore::ScrollbarThemeGtk::paintScrollbarBackground): Use the
cached GtkStyleContext or create a new one.
(WebCore::ScrollbarThemeGtk::paintThumb): Get or create a
GtkStyleContext for the scrollbar and create a child ones for
trough and slider.
(WebCore::ScrollbarThemeGtk::paintButton): Get or create a
GtkStyleContext for the scrollbar and create a child one for the button.
(WebCore::ScrollbarThemeGtk::paint): Create a GtkStyleContext and
cache it temporarily using TemporaryChange until the method finishes.
(WebCore::ScrollbarThemeGtk::scrollbarThickness): Use the cached
GtkStyleContext and properties or create a new.
(WebCore::ScrollbarThemeGtk::buttonSize): Ditto.
* platform/gtk/ScrollbarThemeGtk.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit210SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebCoreplatformgtkScrollbarThemeGtkcpp">releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebCoreplatformgtkScrollbarThemeGtkh">releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/gtk/ScrollbarThemeGtk.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit210SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog (195121 => 195122)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog        2016-01-15 12:37:36 UTC (rev 195121)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog        2016-01-15 12:37:54 UTC (rev 195122)
</span><span class="lines">@@ -1,3 +1,58 @@
</span><ins>+2016-01-11  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Cleanup ScrollbarThemeGtk
+        https://bugs.webkit.org/show_bug.cgi?id=152830
+
+        Reviewed by Michael Catanzaro.
+
+        Use a common path for GTK+ 3.19 and previous versions, simplifying
+        the code and removing a lot of ifdefs. Use always a new
+        GtkStyleContext, but when painting cache the newly created one so
+        all paint methods use that one. We were also caching some theme
+        properties assuming they don't change unless the theme changes,
+        but some of them can have different values depending on the state,
+        for example, when hovered or pressed. Those properties are now
+        only cached when we create a new GtkStyleContext.
+        The method updateScrollbarsFrameThickness() has also been removed,
+        since the Scrollbar constructor already initializes the frame rect
+        using the scrollbarThickness(). This method was not doing anything
+        anyway, since that was called on the constructor of the theme,
+        when there were no scrollbars registered. This also means we no
+        longer need to track registered/unregistered scrollbars.
+
+        * platform/gtk/ScrollbarThemeGtk.cpp:
+        (WebCore::ScrollbarThemeGtk::backButtonRect): Use the cached
+        GtkStyleContext and properties or create a new.
+        (WebCore::ScrollbarThemeGtk::forwardButtonRect): Ditto.
+        (WebCore::ScrollbarThemeGtk::trackRect): Ditto.
+        (WebCore::orientationStyleClass):
+        (WebCore::ScrollbarThemeGtk::getOrCreateStyleContext): Create a
+        new GtkStyleContext for the scrollbar if there isn't a cached
+        one. Also initialize the properties that depend on the state.
+        (WebCore::createChildStyleContext): Create a new GtkStyleContext
+        from a parent one.
+        (WebCore::ScrollbarThemeGtk::updateThemeProperties): Get the
+        properties that can only change when the theme changes.
+        (WebCore::ScrollbarThemeGtk::thumbRect): Use the cached
+        GtkStyleContext and properties or create a new.
+        (WebCore::adjustRectAccordingToMargin): Use always the
+        GtkStyleContext state instead of receiving it and setting it again.
+        (WebCore::ScrollbarThemeGtk::paintTrackBackground): Get or create
+        a GtkStyleContext for the scrollbar and create a child one for the trough.
+        (WebCore::ScrollbarThemeGtk::paintScrollbarBackground): Use the
+        cached GtkStyleContext or create a new one.
+        (WebCore::ScrollbarThemeGtk::paintThumb): Get or create a
+        GtkStyleContext for the scrollbar and create a child ones for
+        trough and slider.
+        (WebCore::ScrollbarThemeGtk::paintButton): Get or create a
+        GtkStyleContext for the scrollbar and create a child one for the button.
+        (WebCore::ScrollbarThemeGtk::paint): Create a GtkStyleContext and
+        cache it temporarily using TemporaryChange until the method finishes.
+        (WebCore::ScrollbarThemeGtk::scrollbarThickness): Use the cached
+        GtkStyleContext and properties or create a new.
+        (WebCore::ScrollbarThemeGtk::buttonSize): Ditto.
+        * platform/gtk/ScrollbarThemeGtk.h:
+
</ins><span class="cx"> 2016-01-08  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Absolute positioning -webkit-search-cancel-button crashes Safari.
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceWebCoreplatformgtkScrollbarThemeGtkcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp (195121 => 195122)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp        2016-01-15 12:37:36 UTC (rev 195121)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp        2016-01-15 12:37:54 UTC (rev 195122)
</span><span class="lines">@@ -33,7 +33,7 @@
</span><span class="cx"> #include &quot;Scrollbar.h&quot;
</span><span class="cx"> #include &lt;gtk/gtk.h&gt;
</span><span class="cx"> #include &lt;wtf/NeverDestroyed.h&gt;
</span><del>-#include &lt;wtf/glib/GRefPtr.h&gt;
</del><ins>+#include &lt;wtf/TemporaryChange.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -67,18 +67,19 @@
</span><span class="cx">     if (part == BackButtonStartPart &amp;&amp; !m_hasBackButtonStartPart)
</span><span class="cx">         return IntRect();
</span><span class="cx"> 
</span><del>-    int x = scrollbar.x() + m_troughBorderWidth;
-    int y = scrollbar.y() + m_troughBorderWidth;
</del><ins>+    GRefPtr&lt;GtkStyleContext&gt; styleContext = getOrCreateStyleContext();
+    int x = scrollbar.x() + m_cachedProperties.troughBorderWidth;
+    int y = scrollbar.y() + m_cachedProperties.troughBorderWidth;
</ins><span class="cx">     IntSize size = buttonSize(scrollbar);
</span><span class="cx">     if (part == BackButtonStartPart)
</span><span class="cx">         return IntRect(x, y, size.width(), size.height());
</span><span class="cx"> 
</span><span class="cx">     // BackButtonEndPart (alternate button)
</span><span class="cx">     if (scrollbar.orientation() == HorizontalScrollbar)
</span><del>-        return IntRect(scrollbar.x() + scrollbar.width() - m_troughBorderWidth - (2 * size.width()), y, size.width(), size.height());
</del><ins>+        return IntRect(scrollbar.x() + scrollbar.width() - m_cachedProperties.troughBorderWidth - (2 * size.width()), y, size.width(), size.height());
</ins><span class="cx"> 
</span><span class="cx">     // VerticalScrollbar alternate button
</span><del>-    return IntRect(x, scrollbar.y() + scrollbar.height() - m_troughBorderWidth - (2 * size.height()), size.width(), size.height());
</del><ins>+    return IntRect(x, scrollbar.y() + scrollbar.height() - m_cachedProperties.troughBorderWidth - (2 * size.height()), size.width(), size.height());
</ins><span class="cx"> #else
</span><span class="cx">     UNUSED_PARAM(scrollbar);
</span><span class="cx">     UNUSED_PARAM(part);
</span><span class="lines">@@ -94,23 +95,24 @@
</span><span class="cx">     if (part == ForwardButtonEndPart &amp;&amp; !m_hasForwardButtonEndPart)
</span><span class="cx">         return IntRect();
</span><span class="cx"> 
</span><ins>+    GRefPtr&lt;GtkStyleContext&gt; styleContext = getOrCreateStyleContext();
</ins><span class="cx">     IntSize size = buttonSize(scrollbar);
</span><span class="cx">     if (scrollbar.orientation() == HorizontalScrollbar) {
</span><del>-        int y = scrollbar.y() + m_troughBorderWidth;
</del><ins>+        int y = scrollbar.y() + m_cachedProperties.troughBorderWidth;
</ins><span class="cx">         if (part == ForwardButtonEndPart)
</span><del>-            return IntRect(scrollbar.x() + scrollbar.width() - size.width() - m_troughBorderWidth, y, size.width(), size.height());
</del><ins>+            return IntRect(scrollbar.x() + scrollbar.width() - size.width() - m_cachedProperties.troughBorderWidth, y, size.width(), size.height());
</ins><span class="cx"> 
</span><span class="cx">         // ForwardButtonStartPart (alternate button)
</span><del>-        return IntRect(scrollbar.x() + m_troughBorderWidth + size.width(), y, size.width(), size.height());
</del><ins>+        return IntRect(scrollbar.x() + m_cachedProperties.troughBorderWidth + size.width(), y, size.width(), size.height());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // VerticalScrollbar
</span><del>-    int x = scrollbar.x() + m_troughBorderWidth;
</del><ins>+    int x = scrollbar.x() + m_cachedProperties.troughBorderWidth;
</ins><span class="cx">     if (part == ForwardButtonEndPart)
</span><del>-        return IntRect(x, scrollbar.y() + scrollbar.height() - size.height() - m_troughBorderWidth, size.width(), size.height());
</del><ins>+        return IntRect(x, scrollbar.y() + scrollbar.height() - size.height() - m_cachedProperties.troughBorderWidth, size.width(), size.height());
</ins><span class="cx"> 
</span><span class="cx">     // ForwardButtonStartPart (alternate button)
</span><del>-    return IntRect(x, scrollbar.y() + m_troughBorderWidth + size.height(), size.width(), size.height());
</del><ins>+    return IntRect(x, scrollbar.y() + m_cachedProperties.troughBorderWidth + size.height(), size.width(), size.height());
</ins><span class="cx"> #else
</span><span class="cx">     UNUSED_PARAM(scrollbar);
</span><span class="cx">     UNUSED_PARAM(part);
</span><span class="lines">@@ -121,10 +123,11 @@
</span><span class="cx"> IntRect ScrollbarThemeGtk::trackRect(Scrollbar&amp; scrollbar, bool)
</span><span class="cx"> {
</span><span class="cx"> #ifndef GTK_API_VERSION_2
</span><ins>+    GRefPtr&lt;GtkStyleContext&gt; styleContext = getOrCreateStyleContext();
</ins><span class="cx">     // The padding along the thumb movement axis includes the trough border
</span><span class="cx">     // plus the size of stepper spacing (the space between the stepper and
</span><span class="cx">     // the place where the thumb stops). There is often no stepper spacing.
</span><del>-    int movementAxisPadding = m_troughBorderWidth + m_stepperSpacing;
</del><ins>+    int movementAxisPadding = m_cachedProperties.troughBorderWidth + m_cachedProperties.stepperSpacing;
</ins><span class="cx"> 
</span><span class="cx">     // The fatness of the scrollbar on the non-movement axis.
</span><span class="cx">     int thickness = scrollbarThickness(scrollbar.controlSize());
</span><span class="lines">@@ -132,17 +135,17 @@
</span><span class="cx">     int startButtonsOffset = 0;
</span><span class="cx">     int buttonsWidth = 0;
</span><span class="cx">     if (m_hasForwardButtonStartPart) {
</span><del>-        startButtonsOffset += m_stepperSize;
-        buttonsWidth += m_stepperSize;
</del><ins>+        startButtonsOffset += m_cachedProperties.stepperSize;
+        buttonsWidth += m_cachedProperties.stepperSize;
</ins><span class="cx">     }
</span><span class="cx">     if (m_hasBackButtonStartPart) {
</span><del>-        startButtonsOffset += m_stepperSize;
-        buttonsWidth += m_stepperSize;
</del><ins>+        startButtonsOffset += m_cachedProperties.stepperSize;
+        buttonsWidth += m_cachedProperties.stepperSize;
</ins><span class="cx">     }
</span><span class="cx">     if (m_hasBackButtonEndPart)
</span><del>-        buttonsWidth += m_stepperSize;
</del><ins>+        buttonsWidth += m_cachedProperties.stepperSize;
</ins><span class="cx">     if (m_hasForwardButtonEndPart)
</span><del>-        buttonsWidth += m_stepperSize;
</del><ins>+        buttonsWidth += m_cachedProperties.stepperSize;
</ins><span class="cx"> 
</span><span class="cx">     if (scrollbar.orientation() == HorizontalScrollbar) {
</span><span class="cx">         // Once the scrollbar becomes smaller than the natural size of the
</span><span class="lines">@@ -164,42 +167,56 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #ifndef GTK_API_VERSION_2
</span><ins>+static inline const char* orientationStyleClass(ScrollbarOrientation orientation)
+{
+    return orientation == VerticalScrollbar ? &quot;vertical&quot; : &quot;horizontal&quot;;
+}
</ins><span class="cx"> 
</span><del>-#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.
-class ScrollbarStyleContext {
-    WTF_MAKE_NONCOPYABLE(ScrollbarStyleContext); WTF_MAKE_FAST_ALLOCATED;
-public:
-    ScrollbarStyleContext()
-        : m_context(adoptGRef(gtk_style_context_new()))
-    {
-        GtkWidgetPath* path = gtk_widget_path_new();
-        gtk_widget_path_append_type(path, GTK_TYPE_SCROLLBAR);
-        gtk_widget_path_iter_add_class(path, 0, GTK_STYLE_CLASS_SCROLLBAR);
-        gtk_style_context_set_path(m_context.get(), path);
-        gtk_widget_path_free(path);
-    }
</del><ins>+GRefPtr&lt;GtkStyleContext&gt; ScrollbarThemeGtk::getOrCreateStyleContext(ScrollbarOrientation orientation)
+{
+    if (m_cachedStyleContext)
+        return m_cachedStyleContext;
</ins><span class="cx"> 
</span><del>-    ~ScrollbarStyleContext()
-    {
-    }
</del><ins>+    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);
+#if GTK_CHECK_VERSION(3, 19, 2)
+    gtk_widget_path_iter_set_object_name(path.get(), -1, &quot;scrollbar&quot;);
+#else
+    gtk_widget_path_iter_add_class(path.get(), -1, &quot;scrollbar&quot;);
+#endif
+    gtk_widget_path_iter_add_class(path.get(), -1, orientationStyleClass(orientation));
+    gtk_style_context_set_path(styleContext.get(), path.get());
</ins><span class="cx"> 
</span><del>-    GtkStyleContext* context() const { return m_context.get(); }
</del><ins>+    gtk_style_context_get_style(
+        styleContext.get(),
+        &quot;slider-width&quot;, &amp;m_cachedProperties.thumbFatness,
+        &quot;trough-border&quot;, &amp;m_cachedProperties.troughBorderWidth,
+        &quot;stepper-size&quot;, &amp;m_cachedProperties.stepperSize,
+        &quot;stepper-spacing&quot;, &amp;m_cachedProperties.stepperSpacing,
+        &quot;trough-under-steppers&quot;, &amp;m_cachedProperties.troughUnderSteppers,
+        nullptr);
</ins><span class="cx"> 
</span><del>-private:
-    GRefPtr&lt;GtkStyleContext&gt; m_context;
-};
</del><ins>+    return styleContext;
+}
</ins><span class="cx"> 
</span><del>-static GtkStyleContext* gtkScrollbarStyleContext()
</del><ins>+static GRefPtr&lt;GtkStyleContext&gt; createChildStyleContext(GtkStyleContext* parent, const char* name)
</ins><span class="cx"> {
</span><del>-    static NeverDestroyed&lt;ScrollbarStyleContext&gt; styleContext;
-    return styleContext.get().context();
-}
</del><ins>+    ASSERT(parent);
+    GRefPtr&lt;GtkWidgetPath&gt; path = adoptGRef(gtk_widget_path_copy(gtk_style_context_get_path(parent)));
+    gtk_widget_path_append_type(path.get(), GTK_TYPE_SCROLLBAR);
+#if GTK_CHECK_VERSION(3, 19, 2)
+    gtk_widget_path_iter_set_object_name(path.get(), -1, name);
+#else
+    gtk_widget_path_iter_add_class(path.get(), -1, name);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    GRefPtr&lt;GtkStyleContext&gt; styleContext = adoptGRef(gtk_style_context_new());
+    gtk_style_context_set_path(styleContext.get(), path.get());
+    gtk_style_context_set_parent(styleContext.get(), parent);
+    return styleContext;
+}
+
</ins><span class="cx"> ScrollbarThemeGtk::ScrollbarThemeGtk()
</span><span class="cx"> {
</span><span class="cx">     updateThemeProperties();
</span><span class="lines">@@ -207,111 +224,37 @@
</span><span class="cx"> 
</span><span class="cx"> void ScrollbarThemeGtk::themeChanged()
</span><span class="cx"> {
</span><del>-#if !GTK_CHECK_VERSION(3, 19, 2)
-    gtk_style_context_invalidate(gtkScrollbarStyleContext());
-#endif
</del><span class="cx">     updateThemeProperties();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ScrollbarThemeGtk::updateThemeProperties()
</span><span class="cx"> {
</span><del>-#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
-
</del><ins>+    GRefPtr&lt;GtkStyleContext&gt; styleContext = getOrCreateStyleContext();
</ins><span class="cx">     gtk_style_context_get_style(
</span><span class="cx">         styleContext.get(),
</span><span class="cx">         &quot;min-slider-length&quot;, &amp;m_minThumbLength,
</span><del>-        &quot;slider-width&quot;, &amp;m_thumbFatness,
-        &quot;trough-border&quot;, &amp;m_troughBorderWidth,
-        &quot;stepper-size&quot;, &amp;m_stepperSize,
-        &quot;stepper-spacing&quot;, &amp;m_stepperSpacing,
-        &quot;trough-under-steppers&quot;, &amp;m_troughUnderSteppers,
</del><span class="cx">         &quot;has-backward-stepper&quot;, &amp;m_hasBackButtonStartPart,
</span><span class="cx">         &quot;has-forward-stepper&quot;, &amp;m_hasForwardButtonEndPart,
</span><span class="cx">         &quot;has-secondary-backward-stepper&quot;, &amp;m_hasBackButtonEndPart,
</span><span class="cx">         &quot;has-secondary-forward-stepper&quot;, &amp;m_hasForwardButtonStartPart,
</span><span class="cx">         nullptr);
</span><del>-    updateScrollbarsFrameThickness();
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-typedef HashSet&lt;Scrollbar*&gt; ScrollbarMap;
-
-static ScrollbarMap&amp; scrollbarMap()
-{
-    static NeverDestroyed&lt;ScrollbarMap&gt; map;
-    return map;
-}
-
-void ScrollbarThemeGtk::registerScrollbar(Scrollbar&amp; scrollbar)
-{
-    scrollbarMap().add(&amp;scrollbar);
-}
-
-void ScrollbarThemeGtk::unregisterScrollbar(Scrollbar&amp; scrollbar)
-{
-    scrollbarMap().remove(&amp;scrollbar);
-}
-
-void ScrollbarThemeGtk::updateScrollbarsFrameThickness()
-{
-    if (scrollbarMap().isEmpty())
-        return;
-
-    // Update the thickness of every interior frame scrollbar widget. The
-    // platform-independent scrollbar them code isn't yet smart enough to get
-    // this information when it paints.
-    for (const auto&amp; scrollbar : scrollbarMap()) {
-        // Top-level scrollbar i.e. scrollbars who have a parent ScrollView
-        // with no parent are native, and thus do not need to be resized.
-        if (!scrollbar-&gt;parent() || !scrollbar-&gt;parent()-&gt;parent())
-            return;
-
-        int thickness = scrollbarThickness(scrollbar-&gt;controlSize());
-        if (scrollbar-&gt;orientation() == HorizontalScrollbar)
-            scrollbar-&gt;setFrameRect(IntRect(0, scrollbar-&gt;parent()-&gt;height() - thickness, scrollbar-&gt;width(), thickness));
-        else
-            scrollbar-&gt;setFrameRect(IntRect(scrollbar-&gt;parent()-&gt;width() - thickness, 0, thickness, scrollbar-&gt;height()));
-    }
-}
-
</del><span class="cx"> IntRect ScrollbarThemeGtk::thumbRect(Scrollbar&amp; scrollbar, const IntRect&amp; unconstrainedTrackRect)
</span><span class="cx"> {
</span><ins>+    GRefPtr&lt;GtkStyleContext&gt; styleContext = getOrCreateStyleContext(scrollbar.orientation());
</ins><span class="cx">     IntRect trackRect = constrainTrackRectToTrackPieces(scrollbar, unconstrainedTrackRect);
</span><span class="cx">     int thumbPos = thumbPosition(scrollbar);
</span><span class="cx">     if (scrollbar.orientation() == HorizontalScrollbar)
</span><del>-        return IntRect(trackRect.x() + thumbPos, trackRect.y() + (trackRect.height() - m_thumbFatness) / 2, thumbLength(scrollbar), m_thumbFatness); 
</del><ins>+        return IntRect(trackRect.x() + thumbPos, trackRect.y() + (trackRect.height() - m_cachedProperties.thumbFatness) / 2, thumbLength(scrollbar), m_cachedProperties.thumbFatness);
</ins><span class="cx"> 
</span><span class="cx">     // VerticalScrollbar
</span><del>-    return IntRect(trackRect.x() + (trackRect.width() - m_thumbFatness) / 2, trackRect.y() + thumbPos, m_thumbFatness, thumbLength(scrollbar));
</del><ins>+    return IntRect(trackRect.x() + (trackRect.width() - m_cachedProperties.thumbFatness) / 2, trackRect.y() + thumbPos, m_cachedProperties.thumbFatness, thumbLength(scrollbar));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-
-static const char* orientationStyleClass(ScrollbarOrientation orientation)
</del><ins>+static void adjustRectAccordingToMargin(GtkStyleContext* context, IntRect&amp; rect)
</ins><span class="cx"> {
</span><del>-    return orientation == VerticalScrollbar ? &quot;vertical&quot; : &quot;horizontal&quot;;
-}
-
-#if !GTK_CHECK_VERSION(3, 19, 2)
-static void applyScrollbarStyleContextClasses(GtkStyleContext* context, ScrollbarOrientation orientation)
-{
-    gtk_style_context_add_class(context, GTK_STYLE_CLASS_SCROLLBAR);
-    gtk_style_context_add_class(context, orientationStyleClass(orientation));
-}
-#endif
-
-static void adjustRectAccordingToMargin(GtkStyleContext* context, GtkStateFlags state, IntRect&amp; rect)
-{
</del><span class="cx">     GtkBorder margin;
</span><del>-    gtk_style_context_set_state(context, state);
</del><span class="cx">     gtk_style_context_get_margin(context, gtk_style_context_get_state(context), &amp;margin);
</span><span class="cx">     rect.move(margin.left, margin.right);
</span><span class="cx">     rect.contract(margin.left + margin.right, margin.top + margin.bottom);
</span><span class="lines">@@ -319,97 +262,34 @@
</span><span class="cx"> 
</span><span class="cx"> void ScrollbarThemeGtk::paintTrackBackground(GraphicsContext&amp; context, Scrollbar&amp; scrollbar, const IntRect&amp; rect)
</span><span class="cx"> {
</span><ins>+    GRefPtr&lt;GtkStyleContext&gt; parentStyleContext = getOrCreateStyleContext(scrollbar.orientation());
</ins><span class="cx">     // Paint the track background. If the trough-under-steppers property is true, this
</span><span class="cx">     // should be the full size of the scrollbar, but if is false, it should only be the
</span><span class="cx">     // track rect.
</span><span class="cx">     IntRect fullScrollbarRect(rect);
</span><del>-    if (m_troughUnderSteppers)
</del><ins>+    if (m_cachedProperties.troughUnderSteppers)
</ins><span class="cx">         fullScrollbarRect = IntRect(scrollbar.x(), scrollbar.y(), scrollbar.width(), scrollbar.height());
</span><span class="cx"> 
</span><del>-#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_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_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);
</del><ins>+    GRefPtr&lt;GtkStyleContext&gt; styleContext = createChildStyleContext(parentStyleContext.get(), &quot;trough&quot;);
+    adjustRectAccordingToMargin(styleContext.get(), fullScrollbarRect);
</ins><span class="cx">     gtk_render_background(styleContext.get(), context.platformContext()-&gt;cr(), fullScrollbarRect.x(), fullScrollbarRect.y(), fullScrollbarRect.width(), fullScrollbarRect.height());
</span><span class="cx">     gtk_render_frame(styleContext.get(), context.platformContext()-&gt;cr(), fullScrollbarRect.x(), fullScrollbarRect.y(), fullScrollbarRect.width(), fullScrollbarRect.height());
</span><del>-
-#if !GTK_CHECK_VERSION(3, 19, 2)
-    gtk_style_context_restore(styleContext.get());
-#endif
</del><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>-#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_widget_path_iter_add_class(path.get(), 0, orientationStyleClass(scrollbar.orientation()));
-
-    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
-
</del><ins>+    GRefPtr&lt;GtkStyleContext&gt; styleContext = getOrCreateStyleContext(scrollbar.orientation());
</ins><span class="cx">     gtk_render_frame(styleContext.get(), context.platformContext()-&gt;cr(), scrollbar.x(), scrollbar.y(), scrollbar.width(), scrollbar.height());
</span><del>-
-#if !GTK_CHECK_VERSION(3, 19, 2)
-    gtk_style_context_restore(styleContext.get());
-#endif
</del><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>-#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_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
-
</del><span class="cx">     ScrollbarOrientation orientation = scrollbar.orientation();
</span><del>-#if !GTK_CHECK_VERSION(3, 19, 2)
-    applyScrollbarStyleContextClasses(styleContext.get(), orientation);
-    gtk_style_context_add_class(styleContext.get(), GTK_STYLE_CLASS_SLIDER);
-#endif
</del><ins>+    GRefPtr&lt;GtkStyleContext&gt; parentStyleContext = getOrCreateStyleContext(orientation);
+    GRefPtr&lt;GtkStyleContext&gt; troughStyleContext = createChildStyleContext(parentStyleContext.get(), &quot;trough&quot;);
+    GRefPtr&lt;GtkStyleContext&gt; styleContext = createChildStyleContext(troughStyleContext.get(), &quot;slider&quot;);
</ins><span class="cx"> 
</span><del>-    guint flags = 0;
</del><ins>+    unsigned flags = 0;
</ins><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="lines">@@ -417,40 +297,18 @@
</span><span class="cx">     gtk_style_context_set_state(styleContext.get(), static_cast&lt;GtkStateFlags&gt;(flags));
</span><span class="cx"> 
</span><span class="cx">     IntRect thumbRect(rect);
</span><del>-    adjustRectAccordingToMargin(styleContext.get(), static_cast&lt;GtkStateFlags&gt;(flags), thumbRect);
</del><ins>+    adjustRectAccordingToMargin(styleContext.get(), thumbRect);
</ins><span class="cx">     gtk_render_slider(styleContext.get(), context.platformContext()-&gt;cr(), thumbRect.x(), thumbRect.y(), thumbRect.width(), thumbRect.height(),
</span><span class="cx">         orientation == VerticalScrollbar ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL);
</span><del>-
-#if !GTK_CHECK_VERSION(3, 19, 2)
-    gtk_style_context_restore(styleContext.get());
-#endif
</del><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>-#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_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
-
</del><span class="cx">     ScrollbarOrientation orientation = scrollbar.orientation();
</span><del>-#if !GTK_CHECK_VERSION(3, 19, 2)
-    applyScrollbarStyleContextClasses(styleContext.get(), orientation);
-#endif
</del><ins>+    GRefPtr&lt;GtkStyleContext&gt; parentStyleContext = getOrCreateStyleContext(orientation);
+    GRefPtr&lt;GtkStyleContext&gt; styleContext = createChildStyleContext(parentStyleContext.get(), &quot;button&quot;);
</ins><span class="cx"> 
</span><del>-    guint flags = 0;
</del><ins>+    unsigned flags = 0;
</ins><span class="cx">     if ((BackButtonStartPart == part &amp;&amp; scrollbar.currentPos())
</span><span class="cx">         || (BackButtonEndPart == part &amp;&amp; scrollbar.currentPos())
</span><span class="cx">         || (ForwardButtonEndPart == part &amp;&amp; scrollbar.currentPos() != scrollbar.maximum())
</span><span class="lines">@@ -463,10 +321,6 @@
</span><span class="cx">         flags |= GTK_STATE_FLAG_INSENSITIVE;
</span><span class="cx">     gtk_style_context_set_state(styleContext.get(), static_cast&lt;GtkStateFlags&gt;(flags));
</span><span class="cx"> 
</span><del>-#if !GTK_CHECK_VERSION(3, 19, 2)
-    gtk_style_context_add_class(styleContext.get(), GTK_STYLE_CLASS_BUTTON);
-#endif
-
</del><span class="cx">     gtk_render_background(styleContext.get(), context.platformContext()-&gt;cr(), rect.x(), rect.y(), rect.width(), rect.height());
</span><span class="cx">     gtk_render_frame(styleContext.get(), context.platformContext()-&gt;cr(), rect.x(), rect.y(), rect.width(), rect.height());
</span><span class="cx"> 
</span><span class="lines">@@ -491,10 +345,6 @@
</span><span class="cx">         angle = (part == ForwardButtonEndPart || part == ForwardButtonStartPart) ? G_PI / 2 : 3 * (G_PI / 2);
</span><span class="cx"> 
</span><span class="cx">     gtk_render_arrow(styleContext.get(), context.platformContext()-&gt;cr(), angle, arrowPoint.x(), arrowPoint.y(), arrowSize);
</span><del>-
-#if !GTK_CHECK_VERSION(3, 19, 2)
-    gtk_style_context_restore(styleContext.get());
-#endif
</del><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 class="lines">@@ -502,6 +352,8 @@
</span><span class="cx">     if (graphicsContext.paintingDisabled())
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><ins>+    TemporaryChange&lt;GRefPtr&lt;GtkStyleContext&gt;&gt; tempStyleContext(m_cachedStyleContext, getOrCreateStyleContext(scrollbar.orientation()));
+
</ins><span class="cx">     // Create the ScrollbarControlPartMask based on the damageRect
</span><span class="cx">     ScrollbarControlPartMask scrollMask = NoPart;
</span><span class="cx"> 
</span><span class="lines">@@ -528,7 +380,7 @@
</span><span class="cx">     if (damageRect.intersects(trackPaintRect))
</span><span class="cx">         scrollMask |= TrackBGPart;
</span><span class="cx"> 
</span><del>-    if (m_troughUnderSteppers &amp;&amp; (scrollMask &amp; BackButtonStartPart
</del><ins>+    if (m_cachedProperties.troughUnderSteppers &amp;&amp; (scrollMask &amp; BackButtonStartPart
</ins><span class="cx">             || scrollMask &amp; BackButtonEndPart
</span><span class="cx">             || scrollMask &amp; ForwardButtonStartPart
</span><span class="cx">             || scrollMask &amp; ForwardButtonEndPart))
</span><span class="lines">@@ -572,16 +424,18 @@
</span><span class="cx"> 
</span><span class="cx"> int ScrollbarThemeGtk::scrollbarThickness(ScrollbarControlSize)
</span><span class="cx"> {
</span><del>-    return m_thumbFatness + (m_troughBorderWidth * 2);
</del><ins>+    GRefPtr&lt;GtkStyleContext&gt; styleContext = getOrCreateStyleContext();
+    return m_cachedProperties.thumbFatness + (m_cachedProperties.troughBorderWidth * 2);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> IntSize ScrollbarThemeGtk::buttonSize(Scrollbar&amp; scrollbar)
</span><span class="cx"> {
</span><ins>+    GRefPtr&lt;GtkStyleContext&gt; styleContext = getOrCreateStyleContext(scrollbar.orientation());
</ins><span class="cx">     if (scrollbar.orientation() == VerticalScrollbar)
</span><del>-        return IntSize(m_thumbFatness, m_stepperSize);
</del><ins>+        return IntSize(m_cachedProperties.thumbFatness, m_cachedProperties.stepperSize);
</ins><span class="cx"> 
</span><span class="cx">     // HorizontalScrollbar
</span><del>-    return IntSize(m_stepperSize, m_thumbFatness);
</del><ins>+    return IntSize(m_cachedProperties.stepperSize, m_cachedProperties.thumbFatness);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> int ScrollbarThemeGtk::minimumThumbLength(Scrollbar&amp;)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceWebCoreplatformgtkScrollbarThemeGtkh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/gtk/ScrollbarThemeGtk.h (195121 => 195122)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/gtk/ScrollbarThemeGtk.h        2016-01-15 12:37:36 UTC (rev 195121)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/gtk/ScrollbarThemeGtk.h        2016-01-15 12:37:54 UTC (rev 195122)
</span><span class="lines">@@ -27,53 +27,58 @@
</span><span class="cx"> #define ScrollbarThemeGtk_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;ScrollbarThemeComposite.h&quot;
</span><ins>+#include &lt;wtf/glib/GRefPtr.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class Scrollbar;
</span><span class="cx"> 
</span><del>-class ScrollbarThemeGtk : public ScrollbarThemeComposite {
</del><ins>+class ScrollbarThemeGtk final : public ScrollbarThemeComposite {
</ins><span class="cx"> public:
</span><span class="cx">     virtual ~ScrollbarThemeGtk();
</span><span class="cx"> 
</span><del>-    virtual bool hasButtons(Scrollbar&amp;) { return true; }
-    virtual bool hasThumb(Scrollbar&amp;);
-    virtual IntRect backButtonRect(Scrollbar&amp;, ScrollbarPart, bool);
-    virtual IntRect forwardButtonRect(Scrollbar&amp;, ScrollbarPart, bool);
-    virtual IntRect trackRect(Scrollbar&amp;, bool);
</del><ins>+    virtual bool hasButtons(Scrollbar&amp;) override { return true; }
+    virtual bool hasThumb(Scrollbar&amp;) override;
+    virtual IntRect backButtonRect(Scrollbar&amp;, ScrollbarPart, bool) override;
+    virtual IntRect forwardButtonRect(Scrollbar&amp;, ScrollbarPart, bool) override;
+    virtual IntRect trackRect(Scrollbar&amp;, bool) override;
</ins><span class="cx"> 
</span><span class="cx"> #ifndef GTK_API_VERSION_2
</span><span class="cx">     ScrollbarThemeGtk();
</span><span class="cx"> 
</span><span class="cx">     using ScrollbarThemeComposite::thumbRect;
</span><span class="cx">     IntRect thumbRect(Scrollbar&amp;, const IntRect&amp; unconstrainedTrackRect);
</span><del>-    bool paint(Scrollbar&amp;, GraphicsContext&amp;, const IntRect&amp; damageRect);
-    void paintScrollbarBackground(GraphicsContext&amp;, Scrollbar&amp;);
-    void paintTrackBackground(GraphicsContext&amp;, Scrollbar&amp;, const IntRect&amp;);
-    void paintThumb(GraphicsContext&amp;, Scrollbar&amp;, const IntRect&amp;);
-    virtual void paintButton(GraphicsContext&amp;, Scrollbar&amp;, const IntRect&amp;, ScrollbarPart);
-    virtual bool shouldCenterOnThumb(Scrollbar&amp;, const PlatformMouseEvent&amp;);
-    virtual int scrollbarThickness(ScrollbarControlSize);
-    virtual IntSize buttonSize(Scrollbar&amp;);
-    virtual int minimumThumbLength(Scrollbar&amp;);
</del><ins>+    bool paint(Scrollbar&amp;, GraphicsContext&amp;, const IntRect&amp; damageRect) override;
+    void paintScrollbarBackground(GraphicsContext&amp;, Scrollbar&amp;) override;
+    void paintTrackBackground(GraphicsContext&amp;, Scrollbar&amp;, const IntRect&amp;) override;
+    void paintThumb(GraphicsContext&amp;, Scrollbar&amp;, const IntRect&amp;) override;
+    virtual void paintButton(GraphicsContext&amp;, Scrollbar&amp;, const IntRect&amp;, ScrollbarPart) override;
+    virtual bool shouldCenterOnThumb(Scrollbar&amp;, const PlatformMouseEvent&amp;) override;
+    virtual int scrollbarThickness(ScrollbarControlSize) override;
+    virtual int minimumThumbLength(Scrollbar&amp;) override;
</ins><span class="cx"> 
</span><span class="cx">     // TODO: These are the default GTK+ values. At some point we should pull these from the theme itself.
</span><del>-    virtual double initialAutoscrollTimerDelay() { return 0.20; }
-    virtual double autoscrollTimerDelay() { return 0.02; }
</del><ins>+    virtual double initialAutoscrollTimerDelay() override { return 0.20; }
+    virtual double autoscrollTimerDelay() override { return 0.02; }
</ins><span class="cx">     void themeChanged();
</span><del>-    void updateScrollbarsFrameThickness();
-    void registerScrollbar(Scrollbar&amp;);
-    void unregisterScrollbar(Scrollbar&amp;);
</del><span class="cx"> 
</span><del>-protected:
</del><ins>+private:
</ins><span class="cx">     void updateThemeProperties();
</span><ins>+    GRefPtr&lt;GtkStyleContext&gt; getOrCreateStyleContext(ScrollbarOrientation = VerticalScrollbar);
</ins><span class="cx"> 
</span><del>-    int m_thumbFatness;
-    int m_troughBorderWidth;
-    int m_stepperSize;
-    int m_stepperSpacing;
</del><ins>+    IntSize buttonSize(Scrollbar&amp;);
+
+    struct Properties {
+        int thumbFatness;
+        int troughBorderWidth;
+        int stepperSize;
+        int stepperSpacing;
+        gboolean troughUnderSteppers;
+    };
+
+    GRefPtr&lt;GtkStyleContext&gt; m_cachedStyleContext;
+    Properties m_cachedProperties;
</ins><span class="cx">     int m_minThumbLength;
</span><del>-    gboolean m_troughUnderSteppers;
</del><span class="cx">     gboolean m_hasForwardButtonStartPart;
</span><span class="cx">     gboolean m_hasForwardButtonEndPart;
</span><span class="cx">     gboolean m_hasBackButtonStartPart;
</span></span></pre>
</div>
</div>

</body>
</html>