Changeset 201065 in webkit
- Timestamp:
- May 17, 2016 7:07:11 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r201053 r201065 1 2016-05-17 Dean Jackson <dino@apple.com> 2 3 Add media query support for wide gamut displays on Mac 4 https://bugs.webkit.org/show_bug.cgi?id=157824 5 <rdar://problem/26333137> 6 7 Reviewed by Simon Fraser. 8 9 Remove the check for sRGB, since it is confusingly false 10 on browsers that don't implement this query, and is likely 11 to be dropped from the specification. 12 13 Also, make the text readable. 14 15 * fast/media/mq-color-gamut-expected.html: 16 * fast/media/mq-color-gamut.html: 17 1 18 2016-05-17 Joseph Pecoraro <pecoraro@apple.com> 2 19 -
trunk/LayoutTests/fast/media/mq-color-gamut-expected.html
r199024 r201065 3 3 <title>CSS4 media query test: color-gamut.</title> 4 4 <style type="text/css"> 5 #a { background-color: green; } 6 #b { background-color: blue; } 7 #c { background-color: green; } 5 #a { background-color: green; color: white; } 6 #b { background-color: green; color: white; } 8 7 </style> 9 8 </head> 10 9 <body> 11 10 <p id="a">This paragraph should have a green background.</p> 12 <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> 13 <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> 11 <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> 14 12 <p>Note that the expected results of this test assume a display that is not significantly wider than sRGB.</p> 15 13 </body> -
trunk/LayoutTests/fast/media/mq-color-gamut.html
r199024 r201065 3 3 <title>CSS4 media query test: color-gamut.</title> 4 4 <style type="text/css"> 5 #a { background-color: green; } 6 #b { background-color: green; } 7 #c { background-color: green; } 8 9 @media (color-gamut: srgb) { 10 #b { background-color: blue; } 11 } 5 #a { background-color: green; color: white; } 6 #b { background-color: green; color: white; } 12 7 13 8 @media (color-gamut: p3) { 14 # c{ background-color: blue; }9 #b { background-color: blue; } 15 10 } 16 11 </style> … … 18 13 <body> 19 14 <p id="a">This paragraph should have a green background.</p> 20 <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> 21 <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> 15 <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> 22 16 <p>Note that the expected results of this test assume a display that is not significantly wider than sRGB.</p> 23 17 </body> -
trunk/Source/WebCore/ChangeLog
r201064 r201065 1 2016-05-17 Dean Jackson <dino@apple.com> 2 3 Add media query support for wide gamut displays on Mac 4 https://bugs.webkit.org/show_bug.cgi?id=157824 5 <rdar://problem/26333137> 6 7 Reviewed by Simon Fraser. 8 9 Implement the Mac version of the color-gamut media query 10 by filling out the screenSupportsExtendedColor function. 11 12 On Yosemite, we always return false. On El Capitan, we 13 can check the ColorProfile via ColorSync to see if the 14 screen is wide gamut. 15 16 There is already a test in fast/media/mq-color-gamut.html 17 18 * css/MediaQueryEvaluator.cpp: 19 (WebCore::color_gamutMediaFeatureEval): Pass the mainFrame's view 20 to screenSupportsExtendedColor, so that it can fetch the NSScreen. 21 * platform/PlatformScreen.h: screenSupportsExtendedColor now takes 22 an optional Widget parameter. 23 * platform/ios/PlatformScreenIOS.mm: 24 (WebCore::screenSupportsExtendedColor): Add empty parameter. 25 * platform/mac/PlatformScreenMac.mm: 26 (WebCore::screenSupportsExtendedColor): Get the NSWindow, then the 27 NSScreen, then the ColorSpace, then the ColorSyncProfile, and 28 check if it is a wide gamut profile. 29 * platform/spi/cg/CoreGraphicsSPI.h: Add the SPI declarations. 30 1 31 2016-05-17 Chris Dumez <cdumez@apple.com> 2 32 -
trunk/Source/WebCore/css/MediaQueryEvaluator.cpp
r200336 r201065 247 247 } 248 248 249 static bool color_gamutMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&, Frame* , MediaFeaturePrefix)249 static bool color_gamutMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&, Frame* frame, MediaFeaturePrefix) 250 250 { 251 251 if (!value) … … 258 258 // FIXME: For the moment we'll just assume an "extended 259 259 // color" display is at least as good as P3. 260 return screenSupportsExtendedColor( );260 return screenSupportsExtendedColor(frame->page()->mainFrame().view()); 261 261 case CSSValueRec2020: 262 262 // FIXME: At some point we should start detecting displays that -
trunk/Source/WebCore/platform/PlatformScreen.h
r198719 r201065 64 64 FloatRect screenAvailableRect(Widget*); 65 65 66 WEBCORE_EXPORT bool screenSupportsExtendedColor( );66 WEBCORE_EXPORT bool screenSupportsExtendedColor(Widget* widget = nullptr); 67 67 68 68 #if PLATFORM(MAC) -
trunk/Source/WebCore/platform/efl/PlatformScreenEfl.cpp
r199024 r201065 119 119 } 120 120 121 bool screenSupportsExtendedColor( )121 bool screenSupportsExtendedColor(Widget*) 122 122 { 123 123 return false; -
trunk/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp
r199024 r201065 131 131 } 132 132 133 bool screenSupportsExtendedColor( )133 bool screenSupportsExtendedColor(Widget*) 134 134 { 135 135 return false; -
trunk/Source/WebCore/platform/ios/PlatformScreenIOS.mm
r198719 r201065 70 70 } 71 71 72 bool screenSupportsExtendedColor( )72 bool screenSupportsExtendedColor(Widget*) 73 73 { 74 74 #if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90300 -
trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm
r198719 r201065 27 27 #import "PlatformScreen.h" 28 28 29 #import "CoreGraphicsSPI.h" 29 30 #import "FloatRect.h" 30 31 #import "FrameView.h" 31 32 #import "HostWindow.h" 33 34 #import <ColorSync/ColorSync.h> 32 35 33 36 extern "C" { … … 136 139 } 137 140 138 bool screenSupportsExtendedColor( )141 bool screenSupportsExtendedColor(Widget* widget) 139 142 { 140 return false; // FIXME: Update this to detect extended color screens. 143 #if __MAC_OS_X_VERSION_MIN_REQUIRED < 101100 144 UNUSED_PARAM(widget); 145 return false; 146 #else 147 if (!widget) 148 return false; 149 150 NSWindow *window = [widget->platformWidget() window]; 151 NSScreen *screen = screenForWidget(widget, window); 152 CGColorSpaceRef colorSpace = screen.colorSpace.CGColorSpace; 153 154 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 155 return CGColorSpaceIsWideGamutRGB(colorSpace); 156 #else 157 bool isWideGamut = false; 158 RetainPtr<CFDataRef> iccData = adoptCF(CGColorSpaceCopyICCProfile(colorSpace)); 159 RetainPtr<ColorSyncProfileRef> profile = adoptCF(ColorSyncProfileCreate(iccData.get(), NULL)); 160 if (profile) 161 isWideGamut = ColorSyncProfileIsWideGamut(profile.get()); 162 return isWideGamut; 163 #endif 164 #endif 141 165 } 142 166 -
trunk/Source/WebCore/platform/spi/cg/CoreGraphicsSPI.h
r199071 r201065 34 34 #endif 35 35 36 #if PLATFORM(MAC) 37 #include <ColorSync/ColorSync.h> 38 #endif 39 36 40 #if USE(APPLE_INTERNAL_SDK) 37 41 42 #include <ColorSync/ColorSyncPriv.h> 38 43 #include <CoreGraphics/CGFontCache.h> 39 44 #include <CoreGraphics/CoreGraphicsPrivate.h> … … 196 201 CGError CGSCopyConnectionProperty(CGSConnectionID, CGSConnectionID ownerCid, CFStringRef key, CFTypeRef *value); 197 202 CGError CGSGetScreenRectForWindow(CGSConnectionID, CGSWindowID, CGRect *); 203 204 bool ColorSyncProfileIsWideGamut(ColorSyncProfileRef); 198 205 #endif 199 206 -
trunk/Source/WebCore/platform/win/PlatformScreenWin.cpp
r199024 r201065 102 102 } 103 103 104 bool screenSupportsExtendedColor( )104 bool screenSupportsExtendedColor(Widget*) 105 105 { 106 106 return false;
Note: See TracChangeset
for help on using the changeset viewer.