Title: [197253] releases/WebKitGTK/webkit-2.4/Source/WebCore
Revision
197253
Author
[email protected]
Date
2016-02-27 07:10:10 -0800 (Sat, 27 Feb 2016)

Log Message

Merge r196364 - [GTK] Toggle buttons are blurry with GTK+ 3.19
https://bugs.webkit.org/show_bug.cgi?id=154007

Reviewed by Michael Catanzaro.

Use min-width/min-height style properties when GTK+ >= 3.19.7 to
get the size of toggle buttons.

* rendering/RenderThemeGtk.cpp:
(WebCore::setToggleSize):
(WebCore::paintToggle):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog (197252 => 197253)


--- releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog	2016-02-27 15:09:57 UTC (rev 197252)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog	2016-02-27 15:10:10 UTC (rev 197253)
@@ -1,3 +1,17 @@
+2016-02-09  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Toggle buttons are blurry with GTK+ 3.19
+        https://bugs.webkit.org/show_bug.cgi?id=154007
+
+        Reviewed by Michael Catanzaro.
+
+        Use min-width/min-height style properties when GTK+ >= 3.19.7 to
+        get the size of toggle buttons.
+
+        * rendering/RenderThemeGtk.cpp:
+        (WebCore::setToggleSize):
+        (WebCore::paintToggle):
+
 2016-01-11  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Cleanup RenderThemeGtk

Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp (197252 => 197253)


--- releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp	2016-02-27 15:09:57 UTC (rev 197252)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp	2016-02-27 15:10:10 UTC (rev 197253)
@@ -371,12 +371,23 @@
     // Other ports hard-code this to 13. GTK+ users tend to demand the native look.
     gint indicatorSize;
     gtk_style_context_get_style(context.get(), "indicator-size", &indicatorSize, nullptr);
+    IntSize minSize(indicatorSize, indicatorSize);
 
+#if GTK_CHECK_VERSION(3, 19, 7)
+    GRefPtr<GtkStyleContext> childContext = createStyleContext(themePart == CheckButton ? CheckButtonCheck : RadioButtonRadio, context.get());
+    gint minWidth, minHeight;
+    gtk_style_context_get(childContext.get(), gtk_style_context_get_state(childContext.get()), "min-width", &minWidth, "min-height", &minHeight, nullptr);
+    if (minWidth)
+        minSize.setWidth(minWidth);
+    if (minHeight)
+        minSize.setHeight(minHeight);
+#endif
+
     if (style->width().isIntrinsicOrAuto())
-        style->setWidth(Length(indicatorSize, Fixed));
+        style->setWidth(Length(minSize.width(), Fixed));
 
     if (style->height().isAuto())
-        style->setHeight(Length(indicatorSize, Fixed));
+        style->setHeight(Length(minSize.height(), Fixed));
 }
 
 static void paintToggle(const RenderThemeGtk* theme, RenderThemePart themePart, RenderObject* renderObject, const PaintInfo& paintInfo, const IntRect& fullRect)
@@ -408,15 +419,26 @@
     // buttons to be a smaller size is that we don't want to break site layouts.
     gint indicatorSize;
     gtk_style_context_get_style(context.get(), "indicator-size", &indicatorSize, nullptr);
+    IntSize minSize(indicatorSize, indicatorSize);
+
+#if GTK_CHECK_VERSION(3, 19, 7)
+    gint minWidth, minHeight;
+    gtk_style_context_get(context.get(), gtk_style_context_get_state(context.get()), "min-width", &minWidth, "min-height", &minHeight, nullptr);
+    if (minWidth)
+        minSize.setWidth(minWidth);
+    if (minHeight)
+        minSize.setHeight(minHeight);
+#endif
+
     IntRect rect(fullRect);
-    if (rect.width() > indicatorSize) {
-        rect.inflateX(-(rect.width() - indicatorSize) / 2);
-        rect.setWidth(indicatorSize); // In case rect.width() was equal to indicatorSize + 1.
+    if (rect.width() > minSize.width()) {
+        rect.inflateX(-(rect.width() - minSize.width()) / 2);
+        rect.setWidth(minSize.width()); // In case rect.width() was equal to minSize.width() + 1.
     }
 
-    if (rect.height() > indicatorSize) {
-        rect.inflateY(-(rect.height() - indicatorSize) / 2);
-        rect.setHeight(indicatorSize); // In case rect.height() was equal to indicatorSize + 1.
+    if (rect.height() > minSize.height()) {
+        rect.inflateY(-(rect.height() - minSize.height()) / 2);
+        rect.setHeight(minSize.height()); // In case rect.height() was equal to minSize.height() + 1.
     }
 
     gtk_render_background(context.get(), paintInfo.context->platformContext()->cr(), rect.x(), rect.y(), rect.width(), rect.height());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to