Add media query support for wide gamut displays on Mac
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 May 2016 02:07:11 +0000 (02:07 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 May 2016 02:07:11 +0000 (02:07 +0000)
commitbc120c5e3206f2818a9fb65f4e178f54faaf04c6
tree3d6d90b64db5e0301585425f57726f3f3bb117d5
parent30130a81a5f7602a8e8b9e0fe349d5233287c4e8
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.

Source/WebCore:

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.

LayoutTests:

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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201065 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/media/mq-color-gamut-expected.html
LayoutTests/fast/media/mq-color-gamut.html
Source/WebCore/ChangeLog
Source/WebCore/css/MediaQueryEvaluator.cpp
Source/WebCore/platform/PlatformScreen.h
Source/WebCore/platform/efl/PlatformScreenEfl.cpp
Source/WebCore/platform/gtk/PlatformScreenGtk.cpp
Source/WebCore/platform/ios/PlatformScreenIOS.mm
Source/WebCore/platform/mac/PlatformScreenMac.mm
Source/WebCore/platform/spi/cg/CoreGraphicsSPI.h
Source/WebCore/platform/win/PlatformScreenWin.cpp