Title: [113415] trunk/Source/WebCore
Revision
113415
Author
[email protected]
Date
2012-04-05 22:23:25 -0700 (Thu, 05 Apr 2012)

Log Message

<rdar://problem/11133179> and https://bugs.webkit.org/show_bug.cgi?id=74129
REGRESSION (SnowLeopard, 5.1.4): All WK2 horizontal scrollbars look broken

Patch by Dan Bernstein, Reviewed by Beth Dakin.

This code assumed that the current CTM wouldn't have extraneous operations built into it, 
but this bug is evidence that that assumption was wrong. We should just get the base CTM instead 
and apply the device scale factor to it.

No tests added since the SnowLeopard-style scrollbars aren't testable in our regression tests right now.

* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::platformApplyDeviceScaleFactor):
(WebCore::GraphicsContext::applyDeviceScaleFactor):
* platform/graphics/GraphicsContext.h: (GraphicsContext):
* platform/graphics/cg/GraphicsContextCG.cpp: (WebCore::GraphicsContext::platformApplyDeviceScaleFactor):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (113414 => 113415)


--- trunk/Source/WebCore/ChangeLog	2012-04-06 05:16:05 UTC (rev 113414)
+++ trunk/Source/WebCore/ChangeLog	2012-04-06 05:23:25 UTC (rev 113415)
@@ -1,3 +1,22 @@
+2012-04-05  Adele Peterson  <[email protected]>
+
+        <rdar://problem/11133179> and https://bugs.webkit.org/show_bug.cgi?id=74129
+        REGRESSION (SnowLeopard, 5.1.4): All WK2 horizontal scrollbars look broken
+
+        Patch by Dan Bernstein, Reviewed by Beth Dakin.
+
+        This code assumed that the current CTM wouldn't have extraneous operations built into it, 
+        but this bug is evidence that that assumption was wrong. We should just get the base CTM instead 
+        and apply the device scale factor to it.
+
+        No tests added since the SnowLeopard-style scrollbars aren't testable in our regression tests right now.
+
+        * platform/graphics/GraphicsContext.cpp:
+        (WebCore::GraphicsContext::platformApplyDeviceScaleFactor):
+        (WebCore::GraphicsContext::applyDeviceScaleFactor):
+        * platform/graphics/GraphicsContext.h: (GraphicsContext):
+        * platform/graphics/cg/GraphicsContextCG.cpp: (WebCore::GraphicsContext::platformApplyDeviceScaleFactor):
+
 2012-04-05  Yuta Kitamura  <[email protected]>
 
         Leak in WebSocketChannel with workers/worker-reload.html

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (113414 => 113415)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2012-04-06 05:16:05 UTC (rev 113414)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2012-04-06 05:23:25 UTC (rev 113415)
@@ -765,7 +765,7 @@
 }
 
 #if !USE(CG)
-void GraphicsContext::platformApplyDeviceScaleFactor()
+void GraphicsContext::platformApplyDeviceScaleFactor(float)
 {
 }
 #endif
@@ -773,7 +773,7 @@
 void GraphicsContext::applyDeviceScaleFactor(float deviceScaleFactor)
 {
     scale(FloatSize(deviceScaleFactor, deviceScaleFactor));
-    platformApplyDeviceScaleFactor();
+    platformApplyDeviceScaleFactor(deviceScaleFactor);
 }
 
 void GraphicsContext::fillEllipse(const FloatRect& ellipse)

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (113414 => 113415)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2012-04-06 05:16:05 UTC (rev 113414)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2012-04-06 05:23:25 UTC (rev 113415)
@@ -427,7 +427,7 @@
         // This function applies the device scale factor to the context, making the context capable of
         // acting as a base-level context for a HiDPI environment.
         void applyDeviceScaleFactor(float);
-        void platformApplyDeviceScaleFactor();
+        void platformApplyDeviceScaleFactor(float);
 
 #if OS(WINCE) && !PLATFORM(QT)
         void setBitmap(PassRefPtr<SharedBitmap>);

Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (113414 => 113415)


--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2012-04-06 05:16:05 UTC (rev 113414)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2012-04-06 05:23:25 UTC (rev 113415)
@@ -65,9 +65,9 @@
 
 #endif
 
-// Undocumented CGContextSetCTM function, available at least since 10.4.
 extern "C" {
     CG_EXTERN void CGContextSetCTM(CGContextRef, CGAffineTransform);
+    CG_EXTERN CGAffineTransform CGContextGetBaseCTM(CGContextRef);
 };
 
 using namespace std;
@@ -1628,12 +1628,12 @@
     CGContextSetBlendMode(platformContext(), target);
 }
 
-void GraphicsContext::platformApplyDeviceScaleFactor()
+void GraphicsContext::platformApplyDeviceScaleFactor(float deviceScaleFactor)
 {
     // CoreGraphics expects the base CTM of a HiDPI context to have the scale factor applied to it.
     // Failing to change the base level CTM will cause certain CG features, such as focus rings,
     // to draw with a scale factor of 1 rather than the actual scale factor.
-    wkSetBaseCTM(platformContext(), getCTM());
+    wkSetBaseCTM(platformContext(), CGAffineTransformScale(CGContextGetBaseCTM(platformContext()), deviceScaleFactor, deviceScaleFactor));
 }
 
 void GraphicsContext::platformFillEllipse(const FloatRect& ellipse)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to