Diff
Modified: branches/safari-536.28-branch/Source/WebCore/ChangeLog (135004 => 135005)
--- branches/safari-536.28-branch/Source/WebCore/ChangeLog 2012-11-16 22:46:45 UTC (rev 135004)
+++ branches/safari-536.28-branch/Source/WebCore/ChangeLog 2012-11-16 22:48:30 UTC (rev 135005)
@@ -1,5 +1,29 @@
2012-11-16 Lucas Forschler <lforsch...@apple.com>
+ Merge r130565
+
+ 2012-10-05 Tim Horton <timothy_hor...@apple.com>
+
+ [cg] GraphicsContextCG should ask CG whether the shadow offset workaround is required
+ https://bugs.webkit.org/show_bug.cgi?id=98565
+ <rdar://problem/12436468>
+
+ Reviewed by Simon Fraser.
+
+ On Mountain Lion and above, CG can tell us whether we need to work around incorrect
+ shadow offsets. Prior to Mountain Lion, we should assume we need to apply the workaround.
+
+ No new tests, as this requires an obscure configuration to test.
+
+ * WebCore.exp.in:
+ * platform/graphics/cg/GraphicsContextCG.cpp:
+ (WebCore::applyShadowOffsetWorkaroundIfNeeded):
+ (WebCore::GraphicsContext::setPlatformShadow):
+ * platform/mac/WebCoreSystemInterface.h: Add wkCGContextDrawsWithCorrectShadowOffsets.
+ * platform/mac/WebCoreSystemInterface.mm: Add wkCGContextDrawsWithCorrectShadowOffsets.
+
+2012-11-16 Lucas Forschler <lforsch...@apple.com>
+
Merge r134903
2012-11-15 Jer Noble <jer.no...@apple.com>
Modified: branches/safari-536.28-branch/Source/WebCore/WebCore.exp.in (135004 => 135005)
--- branches/safari-536.28-branch/Source/WebCore/WebCore.exp.in 2012-11-16 22:46:45 UTC (rev 135004)
+++ branches/safari-536.28-branch/Source/WebCore/WebCore.exp.in 2012-11-16 22:48:30 UTC (rev 135005)
@@ -1567,6 +1567,9 @@
#endif
_wkCGContextGetShouldSmoothFonts
_wkCGContextResetClip
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
+_wkCGContextDrawsWithCorrectShadowOffsets
+#endif
#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
_wkCGPathAddRoundedRect
#endif
Modified: branches/safari-536.28-branch/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (135004 => 135005)
--- branches/safari-536.28-branch/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2012-11-16 22:46:45 UTC (rev 135004)
+++ branches/safari-536.28-branch/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2012-11-16 22:48:30 UTC (rev 135005)
@@ -1032,6 +1032,32 @@
return true;
}
+static void applyShadowOffsetWorkaroundIfNeeded(const GraphicsContext& context, CGFloat& xOffset, CGFloat& yOffset)
+{
+#if !PLATFORM(IOS)
+ if (context.isAcceleratedContext())
+ return;
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
+ if (wkCGContextDrawsWithCorrectShadowOffsets(context.platformContext()))
+ return;
+#endif
+
+ // Work around <rdar://problem/5539388> by ensuring that the offsets will get truncated
+ // to the desired integer. Also see: <rdar://problem/10056277>
+ static const CGFloat extraShadowOffset = narrowPrecisionToCGFloat(1.0 / 128);
+ if (xOffset > 0)
+ xOffset += extraShadowOffset;
+ else if (xOffset < 0)
+ xOffset -= extraShadowOffset;
+
+ if (yOffset > 0)
+ yOffset += extraShadowOffset;
+ else if (yOffset < 0)
+ yOffset -= extraShadowOffset;
+#endif
+}
+
void GraphicsContext::setPlatformShadow(const FloatSize& offset, float blur, const Color& color, ColorSpace colorSpace)
{
if (paintingDisabled())
@@ -1066,23 +1092,8 @@
blurRadius = min(blurRadius, narrowPrecisionToCGFloat(1000.0));
-#if defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LION)
- if (!isAcceleratedContext()) {
- // Work around <rdar://problem/5539388> by ensuring that the offsets will get truncated
- // to the desired integer. Also see: <rdar://problem/10056277>
- static const CGFloat extraShadowOffset = narrowPrecisionToCGFloat(1.0 / 128);
- if (xOffset > 0)
- xOffset += extraShadowOffset;
- else if (xOffset < 0)
- xOffset -= extraShadowOffset;
-
- if (yOffset > 0)
- yOffset += extraShadowOffset;
- else if (yOffset < 0)
- yOffset -= extraShadowOffset;
- }
-#endif
-
+ applyShadowOffsetWorkaroundIfNeeded(*this, xOffset, yOffset);
+
// Check for an invalid color, as this means that the color was not set for the shadow
// and we should therefore just use the default shadow color.
if (!color.isValid())
Modified: branches/safari-536.28-branch/Source/WebCore/platform/mac/WebCoreSystemInterface.h (135004 => 135005)
--- branches/safari-536.28-branch/Source/WebCore/platform/mac/WebCoreSystemInterface.h 2012-11-16 22:46:45 UTC (rev 135004)
+++ branches/safari-536.28-branch/Source/WebCore/platform/mac/WebCoreSystemInterface.h 2012-11-16 22:48:30 UTC (rev 135005)
@@ -120,6 +120,9 @@
wkPatternTilingConstantSpacing
} wkPatternTiling;
extern void (*wkCGContextResetClip)(CGContextRef);
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
+extern bool (*wkCGContextDrawsWithCorrectShadowOffsets)(CGContextRef);
+#endif
extern CGPatternRef (*wkCGPatternCreateWithImageAndTransform)(CGImageRef, CGAffineTransform, int);
extern CFReadStreamRef (*wkCreateCustomCFReadStream)(void *(*formCreate)(CFReadStreamRef, void *),
void (*formFinalize)(CFReadStreamRef, void *),
Modified: branches/safari-536.28-branch/Source/WebCore/platform/mac/WebCoreSystemInterface.mm (135004 => 135005)
--- branches/safari-536.28-branch/Source/WebCore/platform/mac/WebCoreSystemInterface.mm 2012-11-16 22:46:45 UTC (rev 135004)
+++ branches/safari-536.28-branch/Source/WebCore/platform/mac/WebCoreSystemInterface.mm 2012-11-16 22:48:30 UTC (rev 135005)
@@ -33,6 +33,9 @@
#endif
BOOL (*wkCGContextGetShouldSmoothFonts)(CGContextRef);
void (*wkCGContextResetClip)(CGContextRef);
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
+bool (*wkCGContextDrawsWithCorrectShadowOffsets)(CGContextRef);
+#endif
CGPatternRef (*wkCGPatternCreateWithImageAndTransform)(CGImageRef, CGAffineTransform, int);
CFStringRef (*wkCopyCFLocalizationPreferredName)(CFStringRef);
NSString* (*wkCopyNSURLResponseStatusLine)(NSURLResponse*);
Modified: branches/safari-536.28-branch/Source/WebKit/mac/ChangeLog (135004 => 135005)
--- branches/safari-536.28-branch/Source/WebKit/mac/ChangeLog 2012-11-16 22:46:45 UTC (rev 135004)
+++ branches/safari-536.28-branch/Source/WebKit/mac/ChangeLog 2012-11-16 22:48:30 UTC (rev 135005)
@@ -1,3 +1,20 @@
+2012-11-16 Lucas Forschler <lforsch...@apple.com>
+
+ Merge r130565
+
+ 2012-10-05 Tim Horton <timothy_hor...@apple.com>
+
+ [cg] GraphicsContextCG should ask CG whether the shadow offset workaround is required
+ https://bugs.webkit.org/show_bug.cgi?id=98565
+ <rdar://problem/12436468>
+
+ Reviewed by Simon Fraser.
+
+ Add wkCGContextDrawsWithCorrectShadowOffsets.
+
+ * WebCoreSupport/WebSystemInterface.mm:
+ (InitWebCoreSystemInterface):
+
2012-11-15 Lucas Forschler <lforsch...@apple.com>
Merge r133977
Modified: branches/safari-536.28-branch/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm (135004 => 135005)
--- branches/safari-536.28-branch/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm 2012-11-16 22:46:45 UTC (rev 135004)
+++ branches/safari-536.28-branch/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm 2012-11-16 22:48:30 UTC (rev 135005)
@@ -49,6 +49,9 @@
INIT(CGContextGetShouldSmoothFonts);
INIT(CGPatternCreateWithImageAndTransform);
INIT(CGContextResetClip);
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
+ INIT(CGContextDrawsWithCorrectShadowOffsets);
+#endif
INIT(CopyCFLocalizationPreferredName);
INIT(CopyCONNECTProxyResponse);
INIT(CopyNSURLResponseStatusLine);
Modified: branches/safari-536.28-branch/Source/WebKit2/ChangeLog (135004 => 135005)
--- branches/safari-536.28-branch/Source/WebKit2/ChangeLog 2012-11-16 22:46:45 UTC (rev 135004)
+++ branches/safari-536.28-branch/Source/WebKit2/ChangeLog 2012-11-16 22:48:30 UTC (rev 135005)
@@ -1,5 +1,22 @@
2012-11-16 Lucas Forschler <lforsch...@apple.com>
+ Merge r130565
+
+ 2012-10-05 Tim Horton <timothy_hor...@apple.com>
+
+ [cg] GraphicsContextCG should ask CG whether the shadow offset workaround is required
+ https://bugs.webkit.org/show_bug.cgi?id=98565
+ <rdar://problem/12436468>
+
+ Reviewed by Simon Fraser.
+
+ Add wkCGContextDrawsWithCorrectShadowOffsets.
+
+ * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
+ (InitWebCoreSystemInterface):
+
+2012-11-16 Lucas Forschler <lforsch...@apple.com>
+
Merge r128088
2012-09-10 Brady Eidson <beid...@apple.com>
Modified: branches/safari-536.28-branch/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm (135004 => 135005)
--- branches/safari-536.28-branch/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm 2012-11-16 22:46:45 UTC (rev 135004)
+++ branches/safari-536.28-branch/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm 2012-11-16 22:48:30 UTC (rev 135005)
@@ -44,6 +44,9 @@
INIT(CGContextGetShouldSmoothFonts);
INIT(CGPatternCreateWithImageAndTransform);
INIT(CGContextResetClip);
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
+ INIT(CGContextDrawsWithCorrectShadowOffsets);
+#endif
INIT(CopyCONNECTProxyResponse);
INIT(CopyNSURLResponseStatusLine);
INIT(CreateCTLineWithUniCharProvider);