<!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>[197609] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/197609">197609</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2016-03-04 22:25:30 -0800 (Fri, 04 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GTK] Scrollbars are broken again with GTK+ &gt;= 3.19.11
https://bugs.webkit.org/show_bug.cgi?id=154890

Reviewed by Michael Catanzaro.

Scrollbar style properties have been deprecated in GTK+, and it
seems that now deprecating means keeping the properties but
ignoring them. So, this reworks the whole scrollbars theme code
again to not cache style properties anymore, but retrieve them
from the GtkStyleContext. Previous GTK+ versions still need to
query the style properties, so I've added helper functions to get
all the style properties with the ifdefs, trying to keep the
common render code free of GTK+ versions ifdefs.

* platform/gtk/ScrollbarThemeGtk.cpp:
(WebCore::ScrollbarThemeGtk::backButtonRect):
(WebCore::ScrollbarThemeGtk::forwardButtonRect):
(WebCore::ScrollbarThemeGtk::trackRect):
(WebCore::ScrollbarThemeGtk::thumbRect):
(WebCore::ScrollbarThemeGtk::paintTrackBackground):
(WebCore::ScrollbarThemeGtk::paintThumb):
(WebCore::ScrollbarThemeGtk::paint):
(WebCore::ScrollbarThemeGtk::scrollbarThickness):
(WebCore::ScrollbarThemeGtk::buttonSize):
(WebCore::ScrollbarThemeGtk::stepperSize):
(WebCore::ScrollbarThemeGtk::getStepperSpacing):
(WebCore::ScrollbarThemeGtk::troughUnderSteppers):
(WebCore::ScrollbarThemeGtk::minimumThumbLength):
(WebCore::ScrollbarThemeGtk::thumbFatness):
(WebCore::ScrollbarThemeGtk::getTroughBorder):
(WebCore::ScrollbarThemeGtk::getOrCreateStyleContext):
(WebCore::ScrollbarThemeGtk::updateThemeProperties):
(WebCore::ScrollbarThemeGtk::handleMousePressEvent):
* platform/gtk/ScrollbarThemeGtk.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgtkScrollbarThemeGtkcpp">trunk/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgtkScrollbarThemeGtkh">trunk/Source/WebCore/platform/gtk/ScrollbarThemeGtk.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (197608 => 197609)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-03-05 05:24:51 UTC (rev 197608)
+++ trunk/Source/WebCore/ChangeLog        2016-03-05 06:25:30 UTC (rev 197609)
</span><span class="lines">@@ -1,3 +1,40 @@
</span><ins>+2016-03-04  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Scrollbars are broken again with GTK+ &gt;= 3.19.11
+        https://bugs.webkit.org/show_bug.cgi?id=154890
+
+        Reviewed by Michael Catanzaro.
+
+        Scrollbar style properties have been deprecated in GTK+, and it
+        seems that now deprecating means keeping the properties but
+        ignoring them. So, this reworks the whole scrollbars theme code
+        again to not cache style properties anymore, but retrieve them
+        from the GtkStyleContext. Previous GTK+ versions still need to
+        query the style properties, so I've added helper functions to get
+        all the style properties with the ifdefs, trying to keep the
+        common render code free of GTK+ versions ifdefs.
+
+        * platform/gtk/ScrollbarThemeGtk.cpp:
+        (WebCore::ScrollbarThemeGtk::backButtonRect):
+        (WebCore::ScrollbarThemeGtk::forwardButtonRect):
+        (WebCore::ScrollbarThemeGtk::trackRect):
+        (WebCore::ScrollbarThemeGtk::thumbRect):
+        (WebCore::ScrollbarThemeGtk::paintTrackBackground):
+        (WebCore::ScrollbarThemeGtk::paintThumb):
+        (WebCore::ScrollbarThemeGtk::paint):
+        (WebCore::ScrollbarThemeGtk::scrollbarThickness):
+        (WebCore::ScrollbarThemeGtk::buttonSize):
+        (WebCore::ScrollbarThemeGtk::stepperSize):
+        (WebCore::ScrollbarThemeGtk::getStepperSpacing):
+        (WebCore::ScrollbarThemeGtk::troughUnderSteppers):
+        (WebCore::ScrollbarThemeGtk::minimumThumbLength):
+        (WebCore::ScrollbarThemeGtk::thumbFatness):
+        (WebCore::ScrollbarThemeGtk::getTroughBorder):
+        (WebCore::ScrollbarThemeGtk::getOrCreateStyleContext):
+        (WebCore::ScrollbarThemeGtk::updateThemeProperties):
+        (WebCore::ScrollbarThemeGtk::handleMousePressEvent):
+        * platform/gtk/ScrollbarThemeGtk.h:
+
</ins><span class="cx"> 2016-03-04  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Resource load statistics are not honoring private browsing
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgtkScrollbarThemeGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp (197608 => 197609)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp        2016-03-05 05:24:51 UTC (rev 197608)
+++ trunk/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp        2016-03-05 06:25:30 UTC (rev 197609)
</span><span class="lines">@@ -68,18 +68,20 @@
</span><span class="cx">         return IntRect();
</span><span class="cx"> 
</span><span class="cx">     GRefPtr&lt;GtkStyleContext&gt; styleContext = getOrCreateStyleContext(&amp;scrollbar, painting ? StyleContextMode::Paint : StyleContextMode::Layout);
</span><del>-    int x = scrollbar.x() + m_cachedProperties.troughBorderWidth;
-    int y = scrollbar.y() + m_cachedProperties.troughBorderWidth;
-    IntSize size = buttonSize(scrollbar);
</del><ins>+    GtkBorder troughBorder;
+    getTroughBorder(scrollbar, &amp;troughBorder);
+    int x = scrollbar.x() + troughBorder.left;
+    int y = scrollbar.y() + troughBorder.top;
+    IntSize size = buttonSize(scrollbar, part);
</ins><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_cachedProperties.troughBorderWidth - (2 * size.width()), y, size.width(), size.height());
</del><ins>+        return IntRect(scrollbar.x() + scrollbar.width() - troughBorder.left - (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_cachedProperties.troughBorderWidth - (2 * size.height()), size.width(), size.height());
</del><ins>+    return IntRect(x, scrollbar.y() + scrollbar.height() - troughBorder.top - (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">@@ -97,23 +99,25 @@
</span><span class="cx">         return IntRect();
</span><span class="cx"> 
</span><span class="cx">     GRefPtr&lt;GtkStyleContext&gt; styleContext = getOrCreateStyleContext(&amp;scrollbar, painting ? StyleContextMode::Paint : StyleContextMode::Layout);
</span><del>-    IntSize size = buttonSize(scrollbar);
</del><ins>+    GtkBorder troughBorder;
+    getTroughBorder(scrollbar, &amp;troughBorder);
+    IntSize size = buttonSize(scrollbar, part);
</ins><span class="cx">     if (scrollbar.orientation() == HorizontalScrollbar) {
</span><del>-        int y = scrollbar.y() + m_cachedProperties.troughBorderWidth;
</del><ins>+        int y = scrollbar.y() + troughBorder.top;
</ins><span class="cx">         if (part == ForwardButtonEndPart)
</span><del>-            return IntRect(scrollbar.x() + scrollbar.width() - size.width() - m_cachedProperties.troughBorderWidth, y, size.width(), size.height());
</del><ins>+            return IntRect(scrollbar.x() + scrollbar.width() - size.width() - troughBorder.left, y, size.width(), size.height());
</ins><span class="cx"> 
</span><span class="cx">         // ForwardButtonStartPart (alternate button)
</span><del>-        return IntRect(scrollbar.x() + m_cachedProperties.troughBorderWidth + size.width(), y, size.width(), size.height());
</del><ins>+        return IntRect(scrollbar.x() + troughBorder.left + 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_cachedProperties.troughBorderWidth;
</del><ins>+    int x = scrollbar.x() + troughBorder.left;
</ins><span class="cx">     if (part == ForwardButtonEndPart)
</span><del>-        return IntRect(x, scrollbar.y() + scrollbar.height() - size.height() - m_cachedProperties.troughBorderWidth, size.width(), size.height());
</del><ins>+        return IntRect(x, scrollbar.y() + scrollbar.height() - size.height() - troughBorder.top, size.width(), size.height());
</ins><span class="cx"> 
</span><span class="cx">     // ForwardButtonStartPart (alternate button)
</span><del>-    return IntRect(x, scrollbar.y() + m_cachedProperties.troughBorderWidth + size.height(), size.width(), size.height());
</del><ins>+    return IntRect(x, scrollbar.y() + troughBorder.top + 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">@@ -129,39 +133,55 @@
</span><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_cachedProperties.troughBorderWidth + m_cachedProperties.stepperSpacing;
</del><ins>+    GtkBorder troughBorder;
+    getTroughBorder(scrollbar, &amp;troughBorder);
+    GtkBorder stepperSpacing = { 0, 0, 0, 0 };
</ins><span class="cx"> 
</span><span class="cx">     // The fatness of the scrollbar on the non-movement axis.
</span><del>-    int thickness = scrollbarThickness(scrollbar.controlSize());
</del><ins>+    int thickness = scrollbarThickness(styleContext.get(), scrollbar.orientation());
</ins><span class="cx"> 
</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_cachedProperties.stepperSize;
-        buttonsWidth += m_cachedProperties.stepperSize;
</del><ins>+        int buttonSize = stepperSize(scrollbar, ForwardButtonStartPart);
+        startButtonsOffset += buttonSize;
+        buttonsWidth += buttonSize;
</ins><span class="cx">     }
</span><span class="cx">     if (m_hasBackButtonStartPart) {
</span><del>-        startButtonsOffset += m_cachedProperties.stepperSize;
-        buttonsWidth += m_cachedProperties.stepperSize;
</del><ins>+        int buttonSize = stepperSize(scrollbar, BackButtonStartPart);
+        startButtonsOffset += buttonSize;
+        buttonsWidth += buttonSize;
+        GtkBorder margin;
+        getStepperSpacing(scrollbar, BackButtonStartPart, &amp;margin);
+        stepperSpacing.left += margin.left;
+        stepperSpacing.right += margin.right;
+        stepperSpacing.top += margin.top;
+        stepperSpacing.bottom += margin.bottom;
</ins><span class="cx">     }
</span><span class="cx">     if (m_hasBackButtonEndPart)
</span><del>-        buttonsWidth += m_cachedProperties.stepperSize;
-    if (m_hasForwardButtonEndPart)
-        buttonsWidth += m_cachedProperties.stepperSize;
</del><ins>+        buttonsWidth += stepperSize(scrollbar, BackButtonEndPart);
+    if (m_hasForwardButtonEndPart) {
+        buttonsWidth += stepperSize(scrollbar, ForwardButtonEndPart);
+        GtkBorder margin;
+        getStepperSpacing(scrollbar, BackButtonStartPart, &amp;margin);
+        stepperSpacing.left += margin.left;
+        stepperSpacing.right += margin.right;
+        stepperSpacing.top += margin.top;
+        stepperSpacing.bottom += margin.bottom;
+    }
</ins><span class="cx"> 
</span><span class="cx">     if (scrollbar.orientation() == HorizontalScrollbar) {
</span><del>-        // Once the scrollbar becomes smaller than the natural size of the
-        // two buttons, the track disappears.
-        if (scrollbar.width() &lt; 2 * thickness)
</del><ins>+        // Once the scrollbar becomes smaller than the natural size of the two buttons and the thumb, the track disappears.
+        if (scrollbar.width() &lt; buttonsWidth + minimumThumbLength(scrollbar))
</ins><span class="cx">             return IntRect();
</span><del>-        return IntRect(scrollbar.x() + movementAxisPadding + startButtonsOffset, scrollbar.y(),
-                       scrollbar.width() - (2 * movementAxisPadding) - buttonsWidth, thickness);
</del><ins>+        return IntRect(scrollbar.x() + troughBorder.left + stepperSpacing.left + startButtonsOffset, scrollbar.y(),
+            scrollbar.width() - (troughBorder.left + troughBorder.right) - (stepperSpacing.left + stepperSpacing.right) - buttonsWidth, thickness);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (scrollbar.height() &lt; 2 * thickness)
</del><ins>+    if (scrollbar.height() &lt; buttonsWidth + minimumThumbLength(scrollbar))
</ins><span class="cx">         return IntRect();
</span><del>-    return IntRect(scrollbar.x(), scrollbar.y() + movementAxisPadding + startButtonsOffset,
-                   thickness, scrollbar.height() - (2 * movementAxisPadding) - buttonsWidth);
</del><ins>+    return IntRect(scrollbar.x(), scrollbar.y() + troughBorder.top + stepperSpacing.top + startButtonsOffset,
+        thickness, scrollbar.height() - (troughBorder.top + troughBorder.bottom) - (stepperSpacing.top + stepperSpacing.bottom) - buttonsWidth);
</ins><span class="cx"> #else
</span><span class="cx">     UNUSED_PARAM(scrollbar);
</span><span class="cx">     UNUSED_PARAM(painting);
</span><span class="lines">@@ -200,15 +220,6 @@
</span><span class="cx">     gtk_widget_path_iter_add_class(path.get(), -1, orientationStyleClass(scrollbar ? scrollbar-&gt;orientation() : VerticalScrollbar));
</span><span class="cx">     gtk_style_context_set_path(styleContext.get(), path.get());
</span><span class="cx"> 
</span><del>-    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);
-
</del><span class="cx">     return styleContext;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -263,7 +274,6 @@
</span><span class="cx">     GRefPtr&lt;GtkStyleContext&gt; styleContext = getOrCreateStyleContext();
</span><span class="cx">     gtk_style_context_get_style(
</span><span class="cx">         styleContext.get(),
</span><del>-        &quot;min-slider-length&quot;, &amp;m_minThumbLength,
</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="lines">@@ -276,11 +286,17 @@
</span><span class="cx">     GRefPtr&lt;GtkStyleContext&gt; styleContext = getOrCreateStyleContext(&amp;scrollbar);
</span><span class="cx">     IntRect trackRect = constrainTrackRectToTrackPieces(scrollbar, unconstrainedTrackRect);
</span><span class="cx">     int thumbPos = thumbPosition(scrollbar);
</span><ins>+    int thumbFat = thumbFatness(scrollbar);
+    GtkBorder troughBorder = { 0, 0, 0, 0 };
+#if GTK_CHECK_VERSION(3, 19, 11)
+    getTroughBorder(scrollbar, &amp;troughBorder);
+#endif
+
</ins><span class="cx">     if (scrollbar.orientation() == HorizontalScrollbar)
</span><del>-        return IntRect(trackRect.x() + thumbPos, trackRect.y() + (trackRect.height() - m_cachedProperties.thumbFatness) / 2, thumbLength(scrollbar), m_cachedProperties.thumbFatness);
</del><ins>+        return IntRect(trackRect.x() + thumbPos, trackRect.y() + troughBorder.top + (trackRect.height() - thumbFat) / 2, thumbLength(scrollbar), thumbFat);
</ins><span class="cx"> 
</span><span class="cx">     // VerticalScrollbar
</span><del>-    return IntRect(trackRect.x() + (trackRect.width() - m_cachedProperties.thumbFatness) / 2, trackRect.y() + thumbPos, m_cachedProperties.thumbFatness, thumbLength(scrollbar));
</del><ins>+    return IntRect(trackRect.x() + troughBorder.left + (trackRect.width() - thumbFat) / 2, trackRect.y() + thumbPos, thumbFat, thumbLength(scrollbar));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void adjustRectAccordingToMargin(GtkStyleContext* context, IntRect&amp; rect)
</span><span class="lines">@@ -298,7 +314,7 @@
</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_cachedProperties.troughUnderSteppers)
</del><ins>+    if (troughUnderSteppers(scrollbar))
</ins><span class="cx">         fullScrollbarRect = IntRect(scrollbar.x(), scrollbar.y(), scrollbar.width(), scrollbar.height());
</span><span class="cx"> 
</span><span class="cx">     GRefPtr&lt;GtkStyleContext&gt; styleContext = createChildStyleContext(parentStyleContext.get(), &quot;trough&quot;);
</span><span class="lines">@@ -331,10 +347,15 @@
</span><span class="cx">     if (m_usesOverlayScrollbars &amp;&amp; scrollbar.hoveredPart() == NoPart) {
</span><span class="cx">         // When using overlay scrollbars we always claim the size of the scrollbar when hovered, so when
</span><span class="cx">         // drawing the indicator we need to adjust the rectangle to its actual size in indicator mode.
</span><ins>+#if GTK_CHECK_VERSION(3, 19, 11)
+        int thumbFat = thumbFatness(styleContext.get(), orientation);
+#else
+        int thumbFat = thumbFatness(parentStyleContext.get(), orientation);
+#endif
</ins><span class="cx">         if (orientation == VerticalScrollbar)
</span><del>-            thumbRect.move(scrollbar.width() - m_cachedProperties.thumbFatness, 0);
</del><ins>+            thumbRect.move(scrollbar.width() - thumbFat, 0);
</ins><span class="cx">         else
</span><del>-            thumbRect.move(0, scrollbar.height() - m_cachedProperties.thumbFatness);
</del><ins>+            thumbRect.move(0, scrollbar.height() - thumbFat);
</ins><span class="cx">     }
</span><span class="cx">     adjustRectAccordingToMargin(styleContext.get(), thumbRect);
</span><span class="cx">     gtk_render_slider(styleContext.get(), context.platformContext()-&gt;cr(), thumbRect.x(), thumbRect.y(), thumbRect.width(), thumbRect.height(),
</span><span class="lines">@@ -424,15 +445,14 @@
</span><span class="cx">     if (damageRect.intersects(trackPaintRect))
</span><span class="cx">         scrollMask |= TrackBGPart;
</span><span class="cx"> 
</span><del>-    if (m_cachedProperties.troughUnderSteppers &amp;&amp; (scrollMask &amp; BackButtonStartPart
</del><ins>+    if (troughUnderSteppers(scrollbar) &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="cx">         scrollMask |= TrackBGPart;
</span><span class="cx"> 
</span><del>-    bool thumbPresent = hasThumb(scrollbar);
</del><span class="cx">     IntRect currentThumbRect;
</span><del>-    if (thumbPresent) {
</del><ins>+    if (hasThumb(scrollbar)) {
</ins><span class="cx">         IntRect track = trackRect(scrollbar, false);
</span><span class="cx">         currentThumbRect = thumbRect(scrollbar, track);
</span><span class="cx">         if (damageRect.intersects(currentThumbRect))
</span><span class="lines">@@ -455,7 +475,7 @@
</span><span class="cx">         opacity *= scrollbar.hoveredPart() == NoPart ? 0.4 : 0.7;
</span><span class="cx"> #endif
</span><span class="cx">     }
</span><del>-    if (!opacity)
</del><ins>+    if (!opacity || scrollMask == NoPart)
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="cx">     if (opacity != 1) {
</span><span class="lines">@@ -465,9 +485,10 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     ScrollbarControlPartMask allButtons = BackButtonStartPart | BackButtonEndPart | ForwardButtonStartPart | ForwardButtonEndPart;
</span><del>-    if (scrollMask &amp; TrackBGPart || scrollMask &amp; ThumbPart || scrollMask &amp; allButtons)
</del><ins>+    if (scrollMask &amp; TrackBGPart || scrollMask &amp; ThumbPart || scrollMask &amp; allButtons) {
</ins><span class="cx">         paintScrollbarBackground(graphicsContext, scrollbar);
</span><span class="cx">         paintTrackBackground(graphicsContext, scrollbar, trackPaintRect);
</span><ins>+    }
</ins><span class="cx"> 
</span><span class="cx">     // Paint the back and forward buttons.
</span><span class="cx">     if (scrollMask &amp; BackButtonStartPart)
</span><span class="lines">@@ -512,26 +533,177 @@
</span><span class="cx">     return ScrollbarButtonPressAction::None;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+int ScrollbarThemeGtk::scrollbarThickness(GtkStyleContext* styleContext, ScrollbarOrientation orientation)
+{
+    GtkBorder troughBorder;
+#if GTK_CHECK_VERSION(3, 19, 11)
+    GRefPtr&lt;GtkStyleContext&gt; troughStyleContext = createChildStyleContext(styleContext, &quot;trough&quot;);
+    GRefPtr&lt;GtkStyleContext&gt; sliderStyleContext = createChildStyleContext(troughStyleContext.get(), &quot;slider&quot;);
+    int thumbFat = thumbFatness(sliderStyleContext.get(), orientation);
+    getTroughBorder(troughStyleContext.get(), &amp;troughBorder);
+#else
+    int thumbFat = thumbFatness(styleContext, orientation);
+    getTroughBorder(styleContext, &amp;troughBorder);
+#endif
+    if (orientation == VerticalScrollbar)
+        return thumbFat + troughBorder.left + troughBorder.right;
+    return thumbFat + troughBorder.top + troughBorder.bottom;
+}
+
</ins><span class="cx"> int ScrollbarThemeGtk::scrollbarThickness(ScrollbarControlSize)
</span><span class="cx"> {
</span><span class="cx">     GRefPtr&lt;GtkStyleContext&gt; styleContext = getOrCreateStyleContext();
</span><del>-    return m_cachedProperties.thumbFatness + (m_cachedProperties.troughBorderWidth * 2);
</del><ins>+    return scrollbarThickness(styleContext.get());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-IntSize ScrollbarThemeGtk::buttonSize(Scrollbar&amp; scrollbar)
</del><ins>+IntSize ScrollbarThemeGtk::buttonSize(Scrollbar&amp; scrollbar, ScrollbarPart buttonPart)
</ins><span class="cx"> {
</span><span class="cx">     GRefPtr&lt;GtkStyleContext&gt; styleContext = getOrCreateStyleContext(&amp;scrollbar);
</span><ins>+#if GTK_CHECK_VERSION(3, 19, 11)
+    GRefPtr&lt;GtkStyleContext&gt; buttonStyleContext = createChildStyleContext(styleContext.get(), &quot;button&quot;);
+    switch (buttonPart) {
+    case BackButtonStartPart:
+    case ForwardButtonStartPart:
+        gtk_style_context_add_class(buttonStyleContext.get(), &quot;up&quot;);
+        break;
+    case BackButtonEndPart:
+    case ForwardButtonEndPart:
+        gtk_style_context_add_class(buttonStyleContext.get(), &quot;down&quot;);
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+    }
+    int minWidth = 0, minHeight = 0;
+    gtk_style_context_get(buttonStyleContext.get(), gtk_style_context_get_state(buttonStyleContext.get()),
+        &quot;min-width&quot;, &amp;minWidth, &quot;min-height&quot;, &amp;minHeight, nullptr);
+    return IntSize(minWidth, minHeight);
+#else
+    UNUSED_PARAM(buttonPart);
+    int stepperSize;
+    gtk_style_context_get_style(styleContext.get(), &quot;stepper-size&quot;, &amp;stepperSize, nullptr);
</ins><span class="cx">     if (scrollbar.orientation() == VerticalScrollbar)
</span><del>-        return IntSize(m_cachedProperties.thumbFatness, m_cachedProperties.stepperSize);
</del><ins>+        return IntSize(thumbFatness(scrollbar), stepperSize);
</ins><span class="cx"> 
</span><span class="cx">     // HorizontalScrollbar
</span><del>-    return IntSize(m_cachedProperties.stepperSize, m_cachedProperties.thumbFatness);
</del><ins>+    return IntSize(stepperSize, thumbFatness(scrollbar));
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-int ScrollbarThemeGtk::minimumThumbLength(Scrollbar&amp;)
</del><ins>+int ScrollbarThemeGtk::stepperSize(Scrollbar&amp; scrollbar, ScrollbarPart buttonPart)
</ins><span class="cx"> {
</span><del>-    return m_minThumbLength;
</del><ins>+    IntSize size = buttonSize(scrollbar, buttonPart);
+    return scrollbar.orientation() == VerticalScrollbar ? size.height() : size.width();
</ins><span class="cx"> }
</span><ins>+
+void ScrollbarThemeGtk::getStepperSpacing(Scrollbar&amp; scrollbar, ScrollbarPart buttonPart, GtkBorder* margin)
+{
+    GRefPtr&lt;GtkStyleContext&gt; styleContext = getOrCreateStyleContext(&amp;scrollbar);
+#if GTK_CHECK_VERSION(3, 19, 11)
+    GRefPtr&lt;GtkStyleContext&gt; buttonStyleContext = createChildStyleContext(styleContext.get(), &quot;button&quot;);
+    switch (buttonPart) {
+    case BackButtonStartPart:
+    case ForwardButtonStartPart:
+        gtk_style_context_add_class(buttonStyleContext.get(), &quot;up&quot;);
+        break;
+    case BackButtonEndPart:
+    case ForwardButtonEndPart:
+        gtk_style_context_add_class(buttonStyleContext.get(), &quot;down&quot;);
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+    }
+    gtk_style_context_get_margin(buttonStyleContext.get(), gtk_style_context_get_state(buttonStyleContext.get()), margin);
+#else
+    UNUSED_PARAM(buttonPart);
+    int stepperSpacing = 0;
+    gtk_style_context_get_style(styleContext.get(), &quot;stepper-spacing&quot;, &amp;stepperSpacing, nullptr);
+    margin-&gt;left = margin-&gt;right = margin-&gt;top = margin-&gt;bottom = stepperSpacing;
+#endif
+}
+
+bool ScrollbarThemeGtk::troughUnderSteppers(Scrollbar&amp; scrollbar)
+{
+#if !GTK_CHECK_VERSION(3, 19, 11)
+    GRefPtr&lt;GtkStyleContext&gt; styleContext = getOrCreateStyleContext(&amp;scrollbar);
+    gboolean underSteppers;
+    gtk_style_context_get_style(styleContext.get(), &quot;trough-under-steppers&quot;, &amp;underSteppers, nullptr);
+    return underSteppers;
+#else
+    UNUSED_PARAM(scrollbar);
+    // This is now ignored by GTK+ and considered always true.
+    return true;
+#endif
+}
+int ScrollbarThemeGtk::minimumThumbLength(Scrollbar&amp; scrollbar)
+{
+    GRefPtr&lt;GtkStyleContext&gt; styleContext = getOrCreateStyleContext(&amp;scrollbar);
+    int minThumbLength = 0;
+#if GTK_CHECK_VERSION(3, 19, 11)
+    GRefPtr&lt;GtkStyleContext&gt; troughStyleContext = createChildStyleContext(styleContext.get(), &quot;trough&quot;);
+    GRefPtr&lt;GtkStyleContext&gt; sliderStyleContext = createChildStyleContext(troughStyleContext.get(), &quot;slider&quot;);
+    gtk_style_context_get(sliderStyleContext.get(), gtk_style_context_get_state(sliderStyleContext.get()),
+        scrollbar.orientation() == VerticalScrollbar ? &quot;min-height&quot; : &quot;min-width&quot;, &amp;minThumbLength, nullptr);
+#else
+    gtk_style_context_get_style(styleContext.get(), &quot;min-slider-length&quot;, &amp;minThumbLength, nullptr);
+#endif
+    return minThumbLength;
+}
+
+int ScrollbarThemeGtk::thumbFatness(GtkStyleContext* styleContext, ScrollbarOrientation orientation)
+{
+    int thumbFat = 0;
+#if GTK_CHECK_VERSION(3, 19, 11)
+    gtk_style_context_get(styleContext, gtk_style_context_get_state(styleContext),
+        orientation == VerticalScrollbar ? &quot;min-width&quot; : &quot;min-height&quot;, &amp;thumbFat, nullptr);
+    GtkBorder margin;
+    gtk_style_context_get_margin(styleContext, gtk_style_context_get_state(styleContext), &amp;margin);
+    GtkBorder border;
+    gtk_style_context_get_border(styleContext, gtk_style_context_get_state(styleContext), &amp;border);
+    if (orientation == VerticalScrollbar)
+        thumbFat += margin.left + margin.right + border.left + border.right;
+    else
+        thumbFat += margin.top + margin.bottom + border.top + border.bottom;
+#else
+    UNUSED_PARAM(orientation);
+    gtk_style_context_get_style(styleContext, &quot;slider-width&quot;, &amp;thumbFat, nullptr);
+#endif
+    return thumbFat;
+}
+
+int ScrollbarThemeGtk::thumbFatness(Scrollbar&amp; scrollbar)
+{
+    GRefPtr&lt;GtkStyleContext&gt; styleContext = getOrCreateStyleContext(&amp;scrollbar);
+#if GTK_CHECK_VERSION(3, 19, 11)
+    GRefPtr&lt;GtkStyleContext&gt; troughStyleContext = createChildStyleContext(styleContext.get(), &quot;trough&quot;);
+    GRefPtr&lt;GtkStyleContext&gt; sliderStyleContext = createChildStyleContext(troughStyleContext.get(), &quot;slider&quot;);
+    return thumbFatness(sliderStyleContext.get(), scrollbar.orientation());
+#else
+    return thumbFatness(styleContext.get(), scrollbar.orientation());
+#endif
+}
+
+void ScrollbarThemeGtk::getTroughBorder(GtkStyleContext* styleContext, GtkBorder* border)
+{
+#if GTK_CHECK_VERSION(3, 19, 11)
+    gtk_style_context_get_border(styleContext, gtk_style_context_get_state(styleContext), border);
+#else
+    int troughBorderWidth = 0;
+    gtk_style_context_get_style(styleContext, &quot;trough-border&quot;, &amp;troughBorderWidth, nullptr);
+    border-&gt;top = border-&gt;bottom = border-&gt;left = border-&gt;right = troughBorderWidth;
+#endif
+}
+
+void ScrollbarThemeGtk::getTroughBorder(Scrollbar&amp; scrollbar, GtkBorder* border)
+{
+    GRefPtr&lt;GtkStyleContext&gt; styleContext = getOrCreateStyleContext(&amp;scrollbar);
+#if GTK_CHECK_VERSION(3, 19, 11)
+    GRefPtr&lt;GtkStyleContext&gt; troughStyleContext = createChildStyleContext(styleContext.get(), &quot;trough&quot;);
+    getTroughBorder(troughStyleContext.get(), border);
+#else
+    getTroughBorder(styleContext.get(), border);
+#endif
+}
+
</ins><span class="cx"> #endif // GTK_API_VERSION_2
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgtkScrollbarThemeGtkh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/gtk/ScrollbarThemeGtk.h (197608 => 197609)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/ScrollbarThemeGtk.h        2016-03-05 05:24:51 UTC (rev 197608)
+++ trunk/Source/WebCore/platform/gtk/ScrollbarThemeGtk.h        2016-03-05 06:25:30 UTC (rev 197609)
</span><span class="lines">@@ -70,19 +70,17 @@
</span><span class="cx">     enum class StyleContextMode { Layout, Paint };
</span><span class="cx">     GRefPtr&lt;GtkStyleContext&gt; getOrCreateStyleContext(Scrollbar* = nullptr, StyleContextMode = StyleContextMode::Layout);
</span><span class="cx"> 
</span><del>-    IntSize buttonSize(Scrollbar&amp;);
</del><ins>+    IntSize buttonSize(Scrollbar&amp;, ScrollbarPart);
+    int stepperSize(Scrollbar&amp;, ScrollbarPart);
+    int thumbFatness(Scrollbar&amp;);
+    int thumbFatness(GtkStyleContext*, ScrollbarOrientation = VerticalScrollbar);
+    void getTroughBorder(Scrollbar&amp;, GtkBorder*);
+    void getTroughBorder(GtkStyleContext*, GtkBorder*);
+    int scrollbarThickness(GtkStyleContext*, ScrollbarOrientation = VerticalScrollbar);
+    void getStepperSpacing(Scrollbar&amp;, ScrollbarPart, GtkBorder*);
+    bool troughUnderSteppers(Scrollbar&amp;);
</ins><span class="cx"> 
</span><del>-    struct Properties {
-        int thumbFatness;
-        int troughBorderWidth;
-        int stepperSize;
-        int stepperSpacing;
-        gboolean troughUnderSteppers;
-    };
-
</del><span class="cx">     GRefPtr&lt;GtkStyleContext&gt; m_cachedStyleContext;
</span><del>-    Properties m_cachedProperties;
-    int m_minThumbLength;
</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>