Title: [216567] branches/safari-603-branch/Source/WebCore
Revision
216567
Author
jmarc...@apple.com
Date
2017-05-10 00:40:11 -0700 (Wed, 10 May 2017)

Log Message

Cherry-pick r213727. rdar://problem/32086123

Modified Paths

Diff

Modified: branches/safari-603-branch/Source/WebCore/ChangeLog (216566 => 216567)


--- branches/safari-603-branch/Source/WebCore/ChangeLog	2017-05-10 07:22:57 UTC (rev 216566)
+++ branches/safari-603-branch/Source/WebCore/ChangeLog	2017-05-10 07:40:11 UTC (rev 216567)
@@ -1,3 +1,20 @@
+2017-05-09  Jason Marcell  <jmarc...@apple.com>
+
+        Cherry-pick r213727. rdar://problem/32086123
+
+    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-05-09  Matthew Hanson  <matthew_han...@apple.com>
 
         Cherry-pick r216431. rdar://problem/31971208

Modified: branches/safari-603-branch/Source/WebCore/platform/win/ScrollbarThemeWin.cpp (216566 => 216567)


--- branches/safari-603-branch/Source/WebCore/platform/win/ScrollbarThemeWin.cpp	2017-05-10 07:22:57 UTC (rev 216566)
+++ branches/safari-603-branch/Source/WebCore/platform/win/ScrollbarThemeWin.cpp	2017-05-10 07:40:11 UTC (rev 216567)
@@ -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