Title: [150167] trunk/Source/WebCore
- Revision
- 150167
- Author
- [email protected]
- Date
- 2013-05-15 18:35:31 -0700 (Wed, 15 May 2013)
Log Message
makeRGBAFromNSColor throws an exception if given a color in a greyscale colorspace
https://bugs.webkit.org/show_bug.cgi?id=116198
<rdar://problem/13904395>
Reviewed by Simon Fraser.
Block Objective-C exceptions in makeRGBAFromNSColor.
Remove a comment saying that they're impossible.
Convert the incoming color to the DeviceRGB colorspace to match
existing color sources. Some rare cases (attributed strings that come
from PDFKit) can have DeviceGrayscale color spaces, which would
previously throw an exception here.
* platform/graphics/mac/ColorMac.mm:
(WebCore::makeRGBAFromNSColor):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (150166 => 150167)
--- trunk/Source/WebCore/ChangeLog 2013-05-16 01:24:19 UTC (rev 150166)
+++ trunk/Source/WebCore/ChangeLog 2013-05-16 01:35:31 UTC (rev 150167)
@@ -1,3 +1,22 @@
+2013-05-15 Tim Horton <[email protected]>
+
+ makeRGBAFromNSColor throws an exception if given a color in a greyscale colorspace
+ https://bugs.webkit.org/show_bug.cgi?id=116198
+ <rdar://problem/13904395>
+
+ Reviewed by Simon Fraser.
+
+ Block Objective-C exceptions in makeRGBAFromNSColor.
+ Remove a comment saying that they're impossible.
+
+ Convert the incoming color to the DeviceRGB colorspace to match
+ existing color sources. Some rare cases (attributed strings that come
+ from PDFKit) can have DeviceGrayscale color spaces, which would
+ previously throw an exception here.
+
+ * platform/graphics/mac/ColorMac.mm:
+ (WebCore::makeRGBAFromNSColor):
+
2013-05-15 David Kilzer <[email protected]>
BUILD FIX (r150140): Frame::editor() should return a reference for iOS, too
Modified: trunk/Source/WebCore/platform/graphics/mac/ColorMac.mm (150166 => 150167)
--- trunk/Source/WebCore/platform/graphics/mac/ColorMac.mm 2013-05-16 01:24:19 UTC (rev 150166)
+++ trunk/Source/WebCore/platform/graphics/mac/ColorMac.mm 2013-05-16 01:35:31 UTC (rev 150167)
@@ -26,13 +26,12 @@
#import "config.h"
#import "ColorMac.h"
+#import <WebCore/BlockExceptions.h>
#import <wtf/RetainPtr.h>
#import <wtf/StdLibExtras.h>
namespace WebCore {
-// NSColor calls don't throw, so no need to block Cocoa exceptions in this file
-
static bool useOldAquaFocusRingColor;
RGBA32 oldAquaFocusRingColor()
@@ -56,8 +55,15 @@
CGFloat greenComponent;
CGFloat blueComponent;
CGFloat alpha;
- [c getRed:&redComponent green:&greenComponent blue:&blueComponent alpha:&alpha];
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
+ NSColor *rgbColor = [c colorUsingColorSpaceName:NSDeviceRGBColorSpace];
+ if (!rgbColor)
+ return makeRGBA(0, 0, 0, 0);
+
+ [rgbColor getRed:&redComponent green:&greenComponent blue:&blueComponent alpha:&alpha];
+ END_BLOCK_OBJC_EXCEPTIONS;
+
return makeRGBA(255 * redComponent, 255 * greenComponent, 255 * blueComponent, 255 * alpha);
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes