Changeset 230356 in webkit
- Timestamp:
- Apr 6, 2018 3:54:37 PM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r230355 r230356 1 2018-04-06 Brent Fulgham <bfulgham@apple.com> 2 3 WebCore::screenSupportsExtendedColor improperly calls NSScreen functions in the WebContent process 4 https://bugs.webkit.org/show_bug.cgi?id=184364 5 <rdar://problem/39246314> 6 7 Reviewed by Per Arne Vollan. 8 9 The WebContent process is interacting directly with NSScreen to determine if the current screen 10 has extended color support. This should be brokered from the UIProcess. 11 12 Tested by fast/media/mq-color-gamut.html. 13 14 * platform/ScreenProperties.h: 15 (WebCore::ScreenProperties::encode const): Add screenSupportsExtendedColor. 16 (WebCore::ScreenProperties::decode): Ditto. 17 * platform/mac/PlatformScreenMac.mm: 18 (WebCore::getScreenProperties): Retrieve extended color support. 19 (WebCore::screenSupportsExtendedColor): Retrieve cached version when in the WebContent 20 process. Assert that NSScreen is not accessed in the WebContent process. 21 1 22 2018-04-06 Fujii Hironori <Hironori.Fujii@sony.com> 2 23 -
trunk/Source/WebCore/platform/ScreenProperties.h
r230351 r230356 42 42 int screenDepth { 0 }; 43 43 int screenDepthPerComponent { 0 }; 44 bool screenSupportsExtendedColor { false }; 44 45 bool screenHasInvertedColors { false }; 45 46 bool screenIsMonochrome { false }; … … 58 59 void ScreenProperties::encode(Encoder& encoder) const 59 60 { 60 encoder << screenAvailableRect << screenRect << screenDepth << screenDepthPerComponent << screen HasInvertedColors << screenIsMonochrome;61 encoder << screenAvailableRect << screenRect << screenDepth << screenDepthPerComponent << screenSupportsExtendedColor << screenHasInvertedColors << screenIsMonochrome; 61 62 62 63 if (colorSpace) { … … 107 108 return std::nullopt; 108 109 110 std::optional<bool> screenSupportsExtendedColor; 111 decoder >> screenSupportsExtendedColor; 112 if (!screenSupportsExtendedColor) 113 return std::nullopt; 114 109 115 std::optional<bool> screenHasInvertedColors; 110 116 decoder >> screenHasInvertedColors; … … 152 158 } 153 159 154 return { { WTFMove(*screenAvailableRect), WTFMove(*screenRect), WTFMove(cgColorSpace), WTFMove(*screenDepth), WTFMove(*screenDepthPerComponent), WTFMove(*screen HasInvertedColors), WTFMove(*screenIsMonochrome) } };160 return { { WTFMove(*screenAvailableRect), WTFMove(*screenRect), WTFMove(cgColorSpace), WTFMove(*screenDepth), WTFMove(*screenDepthPerComponent), WTFMove(*screenSupportsExtendedColor), WTFMove(*screenHasInvertedColors), WTFMove(*screenIsMonochrome) } }; 155 161 } 156 162 -
trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm
r230352 r230356 49 49 static PlatformDisplayID displayID(NSScreen *screen) 50 50 { 51 RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));51 // FIXME: <https://webkit.org/b/184344> We should assert here if in WebContent process. 52 52 return [[[screen deviceDescription] objectForKey:@"NSScreenNumber"] intValue]; 53 53 } … … 72 72 static NSScreen *firstScreen() 73 73 { 74 RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));74 // FIXME: <https://webkit.org/b/184344> We should assert here if in WebContent process. 75 75 NSArray *screens = [NSScreen screens]; 76 76 if (![screens count]) … … 113 113 int screenDepth = NSBitsPerPixelFromDepth(screen.depth); 114 114 int screenDepthPerComponent = NSBitsPerSampleFromDepth(screen.depth); 115 bool screenSupportsExtendedColor = [screen canRepresentDisplayGamut:NSDisplayGamutP3]; 115 116 bool screenHasInvertedColors = CGDisplayUsesInvertedPolarity(); 116 117 bool screenIsMonochrome = CGDisplayUsesForceToGray(); 117 118 118 screenProperties.set(WebCore::displayID(screen), ScreenProperties { screenAvailableRect, screenRect, colorSpace, screenDepth, screenDepthPerComponent, screen HasInvertedColors, screenIsMonochrome });119 screenProperties.set(WebCore::displayID(screen), ScreenProperties { screenAvailableRect, screenRect, colorSpace, screenDepth, screenDepthPerComponent, screenSupportsExtendedColor, screenHasInvertedColors, screenIsMonochrome }); 119 120 } 120 121 } … … 230 231 return false; 231 232 232 // FIXME: <https://webkit.org/b/184364> We should assert here if in WebContent process. 233 if (!screenProperties().isEmpty()) 234 return getScreenProperties(widget).screenSupportsExtendedColor; 235 236 RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer)); 233 237 return [screen(widget) canRepresentDisplayGamut:NSDisplayGamutP3]; 234 238 }
Note: See TracChangeset
for help on using the changeset viewer.