Title: [230356] trunk/Source/WebCore
- Revision
- 230356
- Author
- bfulg...@apple.com
- Date
- 2018-04-06 15:54:37 -0700 (Fri, 06 Apr 2018)
Log Message
WebCore::screenSupportsExtendedColor improperly calls NSScreen functions in the WebContent process
https://bugs.webkit.org/show_bug.cgi?id=184364
<rdar://problem/39246314>
Reviewed by Per Arne Vollan.
The WebContent process is interacting directly with NSScreen to determine if the current screen
has extended color support. This should be brokered from the UIProcess.
Tested by fast/media/mq-color-gamut.html.
* platform/ScreenProperties.h:
(WebCore::ScreenProperties::encode const): Add screenSupportsExtendedColor.
(WebCore::ScreenProperties::decode): Ditto.
* platform/mac/PlatformScreenMac.mm:
(WebCore::getScreenProperties): Retrieve extended color support.
(WebCore::screenSupportsExtendedColor): Retrieve cached version when in the WebContent
process. Assert that NSScreen is not accessed in the WebContent process.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (230355 => 230356)
--- trunk/Source/WebCore/ChangeLog 2018-04-06 20:30:15 UTC (rev 230355)
+++ trunk/Source/WebCore/ChangeLog 2018-04-06 22:54:37 UTC (rev 230356)
@@ -1,3 +1,24 @@
+2018-04-06 Brent Fulgham <bfulg...@apple.com>
+
+ WebCore::screenSupportsExtendedColor improperly calls NSScreen functions in the WebContent process
+ https://bugs.webkit.org/show_bug.cgi?id=184364
+ <rdar://problem/39246314>
+
+ Reviewed by Per Arne Vollan.
+
+ The WebContent process is interacting directly with NSScreen to determine if the current screen
+ has extended color support. This should be brokered from the UIProcess.
+
+ Tested by fast/media/mq-color-gamut.html.
+
+ * platform/ScreenProperties.h:
+ (WebCore::ScreenProperties::encode const): Add screenSupportsExtendedColor.
+ (WebCore::ScreenProperties::decode): Ditto.
+ * platform/mac/PlatformScreenMac.mm:
+ (WebCore::getScreenProperties): Retrieve extended color support.
+ (WebCore::screenSupportsExtendedColor): Retrieve cached version when in the WebContent
+ process. Assert that NSScreen is not accessed in the WebContent process.
+
2018-04-06 Fujii Hironori <hironori.fu...@sony.com>
[Win][WebCore] Expose a constant for scrollbar pixels per line (cScrollbarPixelsPerLine)
Modified: trunk/Source/WebCore/platform/ScreenProperties.h (230355 => 230356)
--- trunk/Source/WebCore/platform/ScreenProperties.h 2018-04-06 20:30:15 UTC (rev 230355)
+++ trunk/Source/WebCore/platform/ScreenProperties.h 2018-04-06 22:54:37 UTC (rev 230356)
@@ -41,6 +41,7 @@
RetainPtr<CGColorSpaceRef> colorSpace;
int screenDepth { 0 };
int screenDepthPerComponent { 0 };
+ bool screenSupportsExtendedColor { false };
bool screenHasInvertedColors { false };
bool screenIsMonochrome { false };
@@ -57,7 +58,7 @@
template<class Encoder>
void ScreenProperties::encode(Encoder& encoder) const
{
- encoder << screenAvailableRect << screenRect << screenDepth << screenDepthPerComponent << screenHasInvertedColors << screenIsMonochrome;
+ encoder << screenAvailableRect << screenRect << screenDepth << screenDepthPerComponent << screenSupportsExtendedColor << screenHasInvertedColors << screenIsMonochrome;
if (colorSpace) {
// Try to encode the name.
@@ -106,6 +107,11 @@
if (!screenDepthPerComponent)
return std::nullopt;
+ std::optional<bool> screenSupportsExtendedColor;
+ decoder >> screenSupportsExtendedColor;
+ if (!screenSupportsExtendedColor)
+ return std::nullopt;
+
std::optional<bool> screenHasInvertedColors;
decoder >> screenHasInvertedColors;
if (!screenHasInvertedColors)
@@ -151,7 +157,7 @@
}
}
- return { { WTFMove(*screenAvailableRect), WTFMove(*screenRect), WTFMove(cgColorSpace), WTFMove(*screenDepth), WTFMove(*screenDepthPerComponent), WTFMove(*screenHasInvertedColors), WTFMove(*screenIsMonochrome) } };
+ return { { WTFMove(*screenAvailableRect), WTFMove(*screenRect), WTFMove(cgColorSpace), WTFMove(*screenDepth), WTFMove(*screenDepthPerComponent), WTFMove(*screenSupportsExtendedColor), WTFMove(*screenHasInvertedColors), WTFMove(*screenIsMonochrome) } };
}
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm (230355 => 230356)
--- trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm 2018-04-06 20:30:15 UTC (rev 230355)
+++ trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm 2018-04-06 22:54:37 UTC (rev 230356)
@@ -48,7 +48,7 @@
static PlatformDisplayID displayID(NSScreen *screen)
{
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ // FIXME: <https://webkit.org/b/184344> We should assert here if in WebContent process.
return [[[screen deviceDescription] objectForKey:@"NSScreenNumber"] intValue];
}
@@ -71,7 +71,7 @@
// Screen containing the menubar.
static NSScreen *firstScreen()
{
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ // FIXME: <https://webkit.org/b/184344> We should assert here if in WebContent process.
NSArray *screens = [NSScreen screens];
if (![screens count])
return nil;
@@ -112,10 +112,11 @@
int screenDepth = NSBitsPerPixelFromDepth(screen.depth);
int screenDepthPerComponent = NSBitsPerSampleFromDepth(screen.depth);
+ bool screenSupportsExtendedColor = [screen canRepresentDisplayGamut:NSDisplayGamutP3];
bool screenHasInvertedColors = CGDisplayUsesInvertedPolarity();
bool screenIsMonochrome = CGDisplayUsesForceToGray();
- screenProperties.set(WebCore::displayID(screen), ScreenProperties { screenAvailableRect, screenRect, colorSpace, screenDepth, screenDepthPerComponent, screenHasInvertedColors, screenIsMonochrome });
+ screenProperties.set(WebCore::displayID(screen), ScreenProperties { screenAvailableRect, screenRect, colorSpace, screenDepth, screenDepthPerComponent, screenSupportsExtendedColor, screenHasInvertedColors, screenIsMonochrome });
}
}
@@ -229,7 +230,10 @@
if (!widget)
return false;
- // FIXME: <https://webkit.org/b/184364> We should assert here if in WebContent process.
+ if (!screenProperties().isEmpty())
+ return getScreenProperties(widget).screenSupportsExtendedColor;
+
+ RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
return [screen(widget) canRepresentDisplayGamut:NSDisplayGamutP3];
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes