Diff
Modified: branches/safari-602.1.32-branch/LayoutTests/ChangeLog (201144 => 201145)
--- branches/safari-602.1.32-branch/LayoutTests/ChangeLog 2016-05-19 08:40:36 UTC (rev 201144)
+++ branches/safari-602.1.32-branch/LayoutTests/ChangeLog 2016-05-19 08:40:43 UTC (rev 201145)
@@ -1,3 +1,24 @@
+2016-05-19 Babak Shafiei <[email protected]>
+
+ Merge r201065. rdar://problem/26333137
+
+ 2016-05-17 Dean Jackson <[email protected]>
+
+ Add media query support for wide gamut displays on Mac
+ https://bugs.webkit.org/show_bug.cgi?id=157824
+ <rdar://problem/26333137>
+
+ Reviewed by Simon Fraser.
+
+ Remove the check for sRGB, since it is confusingly false
+ on browsers that don't implement this query, and is likely
+ to be dropped from the specification.
+
+ Also, make the text readable.
+
+ * fast/media/mq-color-gamut-expected.html:
+ * fast/media/mq-color-gamut.html:
+
2016-05-17 Babak Shafiei <[email protected]>
Merge r200976. rdar://problem/26231897
Modified: branches/safari-602.1.32-branch/LayoutTests/fast/media/mq-color-gamut-expected.html (201144 => 201145)
--- branches/safari-602.1.32-branch/LayoutTests/fast/media/mq-color-gamut-expected.html 2016-05-19 08:40:36 UTC (rev 201144)
+++ branches/safari-602.1.32-branch/LayoutTests/fast/media/mq-color-gamut-expected.html 2016-05-19 08:40:43 UTC (rev 201145)
@@ -2,15 +2,13 @@
<head>
<title>CSS4 media query test: color-gamut.</title>
<style type="text/css">
-#a { background-color: green; }
-#b { background-color: blue; }
-#c { background-color: green; }
+#a { background-color: green; color: white; }
+#b { background-color: green; color: white; }
</style>
</head>
<body>
<p id="a">This paragraph should have a green background.</p>
- <p id="b">This paragraph should have a blue background on a device with a display that supports something close to sRGB, which is nearly all displays. Otherwise the background should be green.</p>
- <p id="c">This paragraph should have a blue background on a device with a display that supports something close to P3. Otherwise the background should be green.</p>
+ <p id="b">This paragraph should have a blue background on a device with a display that supports something close to P3. Otherwise the background should be green.</p>
<p>Note that the expected results of this test assume a display that is not significantly wider than sRGB.</p>
</body>
</html>
Modified: branches/safari-602.1.32-branch/LayoutTests/fast/media/mq-color-gamut.html (201144 => 201145)
--- branches/safari-602.1.32-branch/LayoutTests/fast/media/mq-color-gamut.html 2016-05-19 08:40:36 UTC (rev 201144)
+++ branches/safari-602.1.32-branch/LayoutTests/fast/media/mq-color-gamut.html 2016-05-19 08:40:43 UTC (rev 201145)
@@ -2,23 +2,17 @@
<head>
<title>CSS4 media query test: color-gamut.</title>
<style type="text/css">
-#a { background-color: green; }
-#b { background-color: green; }
-#c { background-color: green; }
+#a { background-color: green; color: white; }
+#b { background-color: green; color: white; }
-@media (color-gamut: srgb) {
+@media (color-gamut: p3) {
#b { background-color: blue; }
}
-
-@media (color-gamut: p3) {
-#c { background-color: blue; }
-}
</style>
</head>
<body>
<p id="a">This paragraph should have a green background.</p>
- <p id="b">This paragraph should have a blue background on a device with a display that supports something close to sRGB, which is nearly all displays. Otherwise the background should be green.</p>
- <p id="c">This paragraph should have a blue background on a device with a display that supports something close to P3. Otherwise the background should be green.</p>
+ <p id="b">This paragraph should have a blue background on a device with a display that supports something close to P3. Otherwise the background should be green.</p>
<p>Note that the expected results of this test assume a display that is not significantly wider than sRGB.</p>
</body>
</html>
Modified: branches/safari-602.1.32-branch/Source/WebCore/ChangeLog (201144 => 201145)
--- branches/safari-602.1.32-branch/Source/WebCore/ChangeLog 2016-05-19 08:40:36 UTC (rev 201144)
+++ branches/safari-602.1.32-branch/Source/WebCore/ChangeLog 2016-05-19 08:40:43 UTC (rev 201145)
@@ -1,5 +1,39 @@
2016-05-19 Babak Shafiei <[email protected]>
+ Merge r201065. rdar://problem/26333137
+
+ 2016-05-17 Dean Jackson <[email protected]>
+
+ Add media query support for wide gamut displays on Mac
+ https://bugs.webkit.org/show_bug.cgi?id=157824
+ <rdar://problem/26333137>
+
+ Reviewed by Simon Fraser.
+
+ Implement the Mac version of the color-gamut media query
+ by filling out the screenSupportsExtendedColor function.
+
+ On Yosemite, we always return false. On El Capitan, we
+ can check the ColorProfile via ColorSync to see if the
+ screen is wide gamut.
+
+ There is already a test in fast/media/mq-color-gamut.html
+
+ * css/MediaQueryEvaluator.cpp:
+ (WebCore::color_gamutMediaFeatureEval): Pass the mainFrame's view
+ to screenSupportsExtendedColor, so that it can fetch the NSScreen.
+ * platform/PlatformScreen.h: screenSupportsExtendedColor now takes
+ an optional Widget parameter.
+ * platform/ios/PlatformScreenIOS.mm:
+ (WebCore::screenSupportsExtendedColor): Add empty parameter.
+ * platform/mac/PlatformScreenMac.mm:
+ (WebCore::screenSupportsExtendedColor): Get the NSWindow, then the
+ NSScreen, then the ColorSpace, then the ColorSyncProfile, and
+ check if it is a wide gamut profile.
+ * platform/spi/cg/CoreGraphicsSPI.h: Add the SPI declarations.
+
+2016-05-19 Babak Shafiei <[email protected]>
+
Merge r201043. rdar://problem/25835802
2016-05-16 Simon Fraser <[email protected]>
Modified: branches/safari-602.1.32-branch/Source/WebCore/css/MediaQueryEvaluator.cpp (201144 => 201145)
--- branches/safari-602.1.32-branch/Source/WebCore/css/MediaQueryEvaluator.cpp 2016-05-19 08:40:36 UTC (rev 201144)
+++ branches/safari-602.1.32-branch/Source/WebCore/css/MediaQueryEvaluator.cpp 2016-05-19 08:40:43 UTC (rev 201145)
@@ -246,7 +246,7 @@
return numberValue(value, number) && compareValue(0, static_cast<int>(number), op);
}
-static bool color_gamutMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&, Frame*, MediaFeaturePrefix)
+static bool color_gamutMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&, Frame* frame, MediaFeaturePrefix)
{
if (!value)
return true;
@@ -257,7 +257,7 @@
case CSSValueP3:
// FIXME: For the moment we'll just assume an "extended
// color" display is at least as good as P3.
- return screenSupportsExtendedColor();
+ return screenSupportsExtendedColor(frame->page()->mainFrame().view());
case CSSValueRec2020:
// FIXME: At some point we should start detecting displays that
// support more colors.
Modified: branches/safari-602.1.32-branch/Source/WebCore/platform/PlatformScreen.h (201144 => 201145)
--- branches/safari-602.1.32-branch/Source/WebCore/platform/PlatformScreen.h 2016-05-19 08:40:36 UTC (rev 201144)
+++ branches/safari-602.1.32-branch/Source/WebCore/platform/PlatformScreen.h 2016-05-19 08:40:43 UTC (rev 201145)
@@ -63,7 +63,7 @@
FloatRect screenRect(Widget*);
FloatRect screenAvailableRect(Widget*);
- WEBCORE_EXPORT bool screenSupportsExtendedColor();
+ WEBCORE_EXPORT bool screenSupportsExtendedColor(Widget* widget = nullptr);
#if PLATFORM(MAC)
NSScreen *screenForWindow(NSWindow *);
Modified: branches/safari-602.1.32-branch/Source/WebCore/platform/efl/PlatformScreenEfl.cpp (201144 => 201145)
--- branches/safari-602.1.32-branch/Source/WebCore/platform/efl/PlatformScreenEfl.cpp 2016-05-19 08:40:36 UTC (rev 201144)
+++ branches/safari-602.1.32-branch/Source/WebCore/platform/efl/PlatformScreenEfl.cpp 2016-05-19 08:40:43 UTC (rev 201145)
@@ -118,7 +118,7 @@
return screenRect(widget);
}
-bool screenSupportsExtendedColor()
+bool screenSupportsExtendedColor(Widget*)
{
return false;
}
Modified: branches/safari-602.1.32-branch/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp (201144 => 201145)
--- branches/safari-602.1.32-branch/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp 2016-05-19 08:40:36 UTC (rev 201144)
+++ branches/safari-602.1.32-branch/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp 2016-05-19 08:40:43 UTC (rev 201145)
@@ -130,7 +130,7 @@
}
-bool screenSupportsExtendedColor()
+bool screenSupportsExtendedColor(Widget*)
{
return false;
}
Modified: branches/safari-602.1.32-branch/Source/WebCore/platform/ios/PlatformScreenIOS.mm (201144 => 201145)
--- branches/safari-602.1.32-branch/Source/WebCore/platform/ios/PlatformScreenIOS.mm 2016-05-19 08:40:36 UTC (rev 201144)
+++ branches/safari-602.1.32-branch/Source/WebCore/platform/ios/PlatformScreenIOS.mm 2016-05-19 08:40:43 UTC (rev 201145)
@@ -69,7 +69,7 @@
return UIAccessibilityIsInvertColorsEnabled();
}
-bool screenSupportsExtendedColor()
+bool screenSupportsExtendedColor(Widget*)
{
#if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90300
return MGGetBoolAnswer(kMGQHasExtendedColorDisplay);
Modified: branches/safari-602.1.32-branch/Source/WebCore/platform/mac/PlatformScreenMac.mm (201144 => 201145)
--- branches/safari-602.1.32-branch/Source/WebCore/platform/mac/PlatformScreenMac.mm 2016-05-19 08:40:36 UTC (rev 201144)
+++ branches/safari-602.1.32-branch/Source/WebCore/platform/mac/PlatformScreenMac.mm 2016-05-19 08:40:43 UTC (rev 201145)
@@ -26,10 +26,13 @@
#import "config.h"
#import "PlatformScreen.h"
+#import "CoreGraphicsSPI.h"
#import "FloatRect.h"
#import "FrameView.h"
#import "HostWindow.h"
+#import <ColorSync/ColorSync.h>
+
extern "C" {
bool CGDisplayUsesInvertedPolarity(void);
bool CGDisplayUsesForceToGray(void);
@@ -135,9 +138,30 @@
return nil;
}
-bool screenSupportsExtendedColor()
+bool screenSupportsExtendedColor(Widget* widget)
{
- return false; // FIXME: Update this to detect extended color screens.
+#if __MAC_OS_X_VERSION_MIN_REQUIRED < 101100
+ UNUSED_PARAM(widget);
+ return false;
+#else
+ if (!widget)
+ return false;
+
+ NSWindow *window = [widget->platformWidget() window];
+ NSScreen *screen = screenForWidget(widget, window);
+ CGColorSpaceRef colorSpace = screen.colorSpace.CGColorSpace;
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+ return CGColorSpaceIsWideGamutRGB(colorSpace);
+#else
+ bool isWideGamut = false;
+ RetainPtr<CFDataRef> iccData = adoptCF(CGColorSpaceCopyICCProfile(colorSpace));
+ RetainPtr<ColorSyncProfileRef> profile = "" NULL));
+ if (profile)
+ isWideGamut = ColorSyncProfileIsWideGamut(profile.get());
+ return isWideGamut;
+#endif
+#endif
}
FloatRect toUserSpace(const NSRect& rect, NSWindow *destination)
Modified: branches/safari-602.1.32-branch/Source/WebCore/platform/spi/cg/CoreGraphicsSPI.h (201144 => 201145)
--- branches/safari-602.1.32-branch/Source/WebCore/platform/spi/cg/CoreGraphicsSPI.h 2016-05-19 08:40:36 UTC (rev 201144)
+++ branches/safari-602.1.32-branch/Source/WebCore/platform/spi/cg/CoreGraphicsSPI.h 2016-05-19 08:40:43 UTC (rev 201145)
@@ -33,8 +33,13 @@
#include "IOSurfaceSPI.h"
#endif
+#if PLATFORM(MAC)
+#include <ColorSync/ColorSync.h>
+#endif
+
#if USE(APPLE_INTERNAL_SDK)
+#include <ColorSync/ColorSyncPriv.h>
#include <CoreGraphics/CGFontCache.h>
#include <CoreGraphics/CoreGraphicsPrivate.h>
@@ -195,6 +200,8 @@
CGError CGSSetConnectionProperty(CGSConnectionID, CGSConnectionID ownerCid, CFStringRef key, CFTypeRef value);
CGError CGSCopyConnectionProperty(CGSConnectionID, CGSConnectionID ownerCid, CFStringRef key, CFTypeRef *value);
CGError CGSGetScreenRectForWindow(CGSConnectionID, CGSWindowID, CGRect *);
+
+bool ColorSyncProfileIsWideGamut(ColorSyncProfileRef);
#endif
WTF_EXTERN_C_END
Modified: branches/safari-602.1.32-branch/Source/WebCore/platform/win/PlatformScreenWin.cpp (201144 => 201145)
--- branches/safari-602.1.32-branch/Source/WebCore/platform/win/PlatformScreenWin.cpp 2016-05-19 08:40:36 UTC (rev 201144)
+++ branches/safari-602.1.32-branch/Source/WebCore/platform/win/PlatformScreenWin.cpp 2016-05-19 08:40:43 UTC (rev 201145)
@@ -101,7 +101,7 @@
return monitorInfo.rcWork;
}
-bool screenSupportsExtendedColor()
+bool screenSupportsExtendedColor(Widget*)
{
return false;
}