Title: [213727] trunk/Source/WebCore
Revision
213727
Author
pvol...@apple.com
Date
2017-03-10 12:25:40 -0800 (Fri, 10 Mar 2017)

Log Message

[Win] Scrollbars buttons have incorrect size in HiDPI.
https://bugs.webkit.org/show_bug.cgi?id=169463

Reviewed by Alex Christensen.

There seems to be a bug in DrawThemeBackground when the device context is scaled.
We can work around this by scaling the drawing rectangle instead.

* platform/win/ScrollbarThemeWin.cpp:
(WebCore::ScrollbarThemeWin::paintButton):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (213726 => 213727)


--- trunk/Source/WebCore/ChangeLog	2017-03-10 20:17:59 UTC (rev 213726)
+++ trunk/Source/WebCore/ChangeLog	2017-03-10 20:25:40 UTC (rev 213727)
@@ -1,3 +1,16 @@
+2017-03-10  Per Arne Vollan  <pvol...@apple.com>
+
+        [Win] Scrollbars buttons have incorrect size in HiDPI.
+        https://bugs.webkit.org/show_bug.cgi?id=169463
+
+        Reviewed by Alex Christensen.
+
+        There seems to be a bug in DrawThemeBackground when the device context is scaled.
+        We can work around this by scaling the drawing rectangle instead.
+ 
+        * platform/win/ScrollbarThemeWin.cpp:
+        (WebCore::ScrollbarThemeWin::paintButton):
+
 2017-03-10  Zalan Bujtas  <za...@apple.com>
 
         Simple line layout: Oprhan lines with visual overflow does not work properly.

Modified: trunk/Source/WebCore/platform/win/ScrollbarThemeWin.cpp (213726 => 213727)


--- trunk/Source/WebCore/platform/win/ScrollbarThemeWin.cpp	2017-03-10 20:17:59 UTC (rev 213726)
+++ trunk/Source/WebCore/platform/win/ScrollbarThemeWin.cpp	2017-03-10 20:25:40 UTC (rev 213727)
@@ -331,15 +331,26 @@
     if (scrollbarTheme)
         alphaBlend = IsThemeBackgroundPartiallyTransparent(scrollbarTheme, SP_BUTTON, xpState);
 
-    LocalWindowsContext windowsContext(context, rect, alphaBlend);
-    RECT themeRect(rect);
-    if (scrollbarTheme)
-        DrawThemeBackground(scrollbarTheme, windowsContext.hdc(), SP_BUTTON, xpState, &themeRect, 0);
-    else
-        ::DrawFrameControl(windowsContext.hdc(), &themeRect, DFC_SCROLL, classicState);
+    // There seems to be a bug in DrawThemeBackground when the device context is scaled.
+    // We can work around this by scaling the drawing rectangle instead.
+    auto scaleFactor = context.scaleFactor().width();
+    auto scaledRect = rect;
+    scaledRect.scale(scaleFactor);
+    context.save();
+    context.scale(FloatSize(1.0f / scaleFactor, 1.0f / scaleFactor));
 
-    if (!alphaBlend && !context.isInTransparencyLayer())
-        DIBPixelData::setRGBABitmapAlpha(windowsContext.hdc(), rect, 255);
+    {
+        LocalWindowsContext windowsContext(context, scaledRect, alphaBlend);
+        RECT themeRect(scaledRect);
+        if (scrollbarTheme)
+            DrawThemeBackground(scrollbarTheme, windowsContext.hdc(), SP_BUTTON, xpState, &themeRect, 0);
+        else
+            ::DrawFrameControl(windowsContext.hdc(), &themeRect, DFC_SCROLL, classicState);
+
+        if (!alphaBlend && !context.isInTransparencyLayer())
+            DIBPixelData::setRGBABitmapAlpha(windowsContext.hdc(), scaledRect, 255);
+    }
+    context.restore();
 }
 
 static IntRect gripperRect(int thickness, const IntRect& thumbRect)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to