Diff
Modified: trunk/Source/WebCore/ChangeLog (159719 => 159720)
--- trunk/Source/WebCore/ChangeLog 2013-11-23 00:07:55 UTC (rev 159719)
+++ trunk/Source/WebCore/ChangeLog 2013-11-23 00:17:11 UTC (rev 159720)
@@ -1,3 +1,22 @@
+2013-11-22 Brent Fulgham <bfulg...@apple.com>
+
+ [Win] Clean up ColorSpace handling in Windows code
+ https://bugs.webkit.org/show_bug.cgi?id=124795
+
+ Reviewed by Tim Horton.
+
+ Functionality covered by existing fast/css/color test suite.
+
+ * platform/graphics/cg/GraphicsContextCG.cpp:
+ (WebCore::safeRGBColorSpaceRef): Handle case of Windows CG implementation not
+ handling sRGB correctly.
+ (WebCore::sRGBColorSpaceRef): Use new helper function.
+ * platform/graphics/win/FontCGWin.cpp:
+ (WebCore::Font::drawGlyphs): Pass correct color space to fill functions.
+ * platform/graphics/win/GraphicsContextCGWin.cpp:
+ (WebCore::GraphicsContext::platformInit): Initialize color space to value passed
+ via the style to the constructor.
+
2013-11-22 Alexey Proskuryakov <a...@apple.com>
WebCrypto algorithms should check that key algorithm matches
Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (159719 => 159720)
--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2013-11-23 00:07:55 UTC (rev 159719)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2013-11-23 00:17:11 UTC (rev 159720)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
* Copyright (C) 2008 Eric Seidel <e...@webkit.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -82,13 +82,15 @@
CGColorSpaceRef sRGBColorSpaceRef()
{
- // FIXME: Windows should be able to use kCGColorSpaceSRGB, this is tracked by http://webkit.org/b/31363.
+ static CGColorSpaceRef sRGBSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
#if PLATFORM(WIN)
- return deviceRGBColorSpaceRef();
-#else
- static CGColorSpaceRef sRGBSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
+ // Out-of-date CG installations will not honor kCGColorSpaceSRGB. This logic avoids
+ // causing a crash under those conditions. Since the default color space in Windows
+ // is sRGB, this all works out nicely.
+ if (!sRGBSpace)
+ sRGBSpace = deviceRGBColorSpaceRef();
+#endif
return sRGBSpace;
-#endif
}
#if PLATFORM(WIN)
Modified: trunk/Source/WebCore/platform/graphics/win/FontCGWin.cpp (159719 => 159720)
--- trunk/Source/WebCore/platform/graphics/win/FontCGWin.cpp 2013-11-23 00:07:55 UTC (rev 159719)
+++ trunk/Source/WebCore/platform/graphics/win/FontCGWin.cpp 2013-11-23 00:17:11 UTC (rev 159720)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -191,8 +191,9 @@
// Paint simple shadows ourselves instead of relying on CG shadows, to avoid losing subpixel antialiasing.
graphicsContext->clearShadow();
Color fillColor = graphicsContext->fillColor();
+ ColorSpace fillColorSpace = graphicsContext->fillColorSpace();
Color shadowFillColor(shadowColor.red(), shadowColor.green(), shadowColor.blue(), shadowColor.alpha() * fillColor.alpha() / 255);
- graphicsContext->setFillColor(shadowFillColor, ColorSpaceDeviceRGB);
+ graphicsContext->setFillColor(shadowFillColor, shadowColorSpace);
float shadowTextX = point.x() + translation.width() + shadowOffset.width();
// If shadows are ignoring transforms, then we haven't applied the Y coordinate flip yet, so down is negative.
float shadowTextY = point.y() + translation.height() + shadowOffset.height() * (graphicsContext->shadowsIgnoreTransforms() ? -1 : 1);
@@ -202,7 +203,7 @@
CGContextSetTextPosition(cgContext, point.x() + translation.width() + shadowOffset.width() + font->syntheticBoldOffset(), point.y() + translation.height() + shadowOffset.height());
CGContextShowGlyphsWithAdvances(cgContext, glyphBuffer.glyphs(from), static_cast<const CGSize*>(glyphBuffer.advances(from)), numGlyphs);
}
- graphicsContext->setFillColor(fillColor, ColorSpaceDeviceRGB);
+ graphicsContext->setFillColor(fillColor, fillColorSpace);
}
CGContextSetTextPosition(cgContext, point.x() + translation.width(), point.y() + translation.height());
@@ -213,7 +214,7 @@
}
if (hasSimpleShadow)
- graphicsContext->setShadow(shadowOffset, shadowBlur, shadowColor, ColorSpaceDeviceRGB);
+ graphicsContext->setShadow(shadowOffset, shadowBlur, shadowColor, shadowColorSpace);
wkRestoreFontSmoothingStyle(cgContext, oldFontSmoothingStyle);
}
Modified: trunk/Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp (159719 => 159720)
--- trunk/Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp 2013-11-23 00:07:55 UTC (rev 159719)
+++ trunk/Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp 2013-11-23 00:17:11 UTC (rev 159720)
@@ -82,8 +82,8 @@
setPaintingDisabled(!m_data->m_cgContext);
if (m_data->m_cgContext) {
// Make sure the context starts in sync with our state.
- setPlatformFillColor(fillColor(), ColorSpaceDeviceRGB);
- setPlatformStrokeColor(strokeColor(), ColorSpaceDeviceRGB);
+ setPlatformFillColor(fillColor(), fillColorSpace());
+ setPlatformStrokeColor(strokeColor(), strokeColorSpace());
}
}