- Revision
- 198719
- Author
- [email protected]
- Date
- 2016-03-26 16:50:38 -0700 (Sat, 26 Mar 2016)
Log Message
Move extended color detection into Open Source
https://bugs.webkit.org/show_bug.cgi?id=155909
<rdar://problem/25369754>
Reviewed by Anders Carlsson.
The code for detecting extended color displays
was hidden while the iPad Pro 9.7" was in development.
Now it is public, move the detection to Open Source.
While doing this, add a new method to PlatformScreen
so that we have a more obvious way to detect such
displays.
Source/WebCore:
* platform/PlatformScreen.h: Add screenSupportsExtendedColor.
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(PlatformCALayerCocoa::commonInit): Set the backing
store format to the RGBA10XR if we're on an extended
display.
* platform/ios/LegacyTileGridTile.mm:
(WebCore::LegacyTileGridTile::LegacyTileGridTile): Ditto.
(WebCore::setBackingStoreFormat): Deleted. Now set directly
in the constructor.
* platform/ios/PlatformScreenIOS.mm:
(WebCore::screenDepthPerComponent): Cleanup.
(WebCore::screenSupportsExtendedColor): Implement the
iOS version of this using MobileGestalt.
* platform/mac/PlatformScreenMac.mm:
(WebCore::displayFromWidget): Whitespace cleanup.
(WebCore::screenForWidget):
(WebCore::screenForWindow):
(WebCore::screenSupportsExtendedColor): Default implementation
returns false for all screens at the moment.
* platform/spi/cocoa/QuartzCoreSPI.h: New constant.
* platform/spi/ios/MobileGestaltSPI.h: Ditto.
Source/WebKit2:
* Shared/mac/RemoteLayerBackingStore.mm:
(WebKit::bufferFormat): No need to use WebKitAdditions any
more.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (198718 => 198719)
--- trunk/Source/WebCore/ChangeLog 2016-03-26 20:07:25 UTC (rev 198718)
+++ trunk/Source/WebCore/ChangeLog 2016-03-26 23:50:38 UTC (rev 198719)
@@ -1,3 +1,45 @@
+2016-03-25 Dean Jackson <[email protected]>
+
+ Move extended color detection into Open Source
+ https://bugs.webkit.org/show_bug.cgi?id=155909
+ <rdar://problem/25369754>
+
+ Reviewed by Anders Carlsson.
+
+ The code for detecting extended color displays
+ was hidden while the iPad Pro 9.7" was in development.
+ Now it is public, move the detection to Open Source.
+
+ While doing this, add a new method to PlatformScreen
+ so that we have a more obvious way to detect such
+ displays.
+
+ * platform/PlatformScreen.h: Add screenSupportsExtendedColor.
+
+ * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
+ (PlatformCALayerCocoa::commonInit): Set the backing
+ store format to the RGBA10XR if we're on an extended
+ display.
+ * platform/ios/LegacyTileGridTile.mm:
+ (WebCore::LegacyTileGridTile::LegacyTileGridTile): Ditto.
+ (WebCore::setBackingStoreFormat): Deleted. Now set directly
+ in the constructor.
+
+ * platform/ios/PlatformScreenIOS.mm:
+ (WebCore::screenDepthPerComponent): Cleanup.
+ (WebCore::screenSupportsExtendedColor): Implement the
+ iOS version of this using MobileGestalt.
+
+ * platform/mac/PlatformScreenMac.mm:
+ (WebCore::displayFromWidget): Whitespace cleanup.
+ (WebCore::screenForWidget):
+ (WebCore::screenForWindow):
+ (WebCore::screenSupportsExtendedColor): Default implementation
+ returns false for all screens at the moment.
+
+ * platform/spi/cocoa/QuartzCoreSPI.h: New constant.
+ * platform/spi/ios/MobileGestaltSPI.h: Ditto.
+
2016-03-26 Myles C. Maxfield <[email protected]>
[OS X] Layout sometimes flakily assumes overlay scrollbars when clicky-scroll-wheel-mouse is attached and system preference detects scrollbar mode
Modified: trunk/Source/WebCore/platform/PlatformScreen.h (198718 => 198719)
--- trunk/Source/WebCore/platform/PlatformScreen.h 2016-03-26 20:07:25 UTC (rev 198718)
+++ trunk/Source/WebCore/platform/PlatformScreen.h 2016-03-26 23:50:38 UTC (rev 198719)
@@ -63,6 +63,8 @@
FloatRect screenRect(Widget*);
FloatRect screenAvailableRect(Widget*);
+ WEBCORE_EXPORT bool screenSupportsExtendedColor();
+
#if PLATFORM(MAC)
NSScreen *screenForWindow(NSWindow *);
NSScreen *screenForDisplayID(PlatformDisplayID);
Modified: trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm (198718 => 198719)
--- trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm 2016-03-26 20:07:25 UTC (rev 198718)
+++ trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm 2016-03-26 23:50:38 UTC (rev 198719)
@@ -33,6 +33,7 @@
#import "LengthFunctions.h"
#import "PlatformCAAnimationCocoa.h"
#import "PlatformCAFilters.h"
+#import "PlatformScreen.h"
#import "QuartzCoreSPI.h"
#import "ScrollbarThemeMac.h"
#import "SoftLinking.h"
@@ -59,16 +60,6 @@
#import "ThemeMac.h"
#endif
-#if USE(APPLE_INTERNAL_SDK)
-#import <WebKitAdditions/LayerBackingStoreAdditions.mm>
-#else
-namespace WebCore {
-static void setBackingStoreFormat(CALayer *)
-{
-}
-} // namespace WebCore
-#endif
-
SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation)
SOFT_LINK_CLASS(AVFoundation, AVPlayerLayer)
@@ -301,8 +292,12 @@
else
[m_layer setDelegate:[WebActionDisablingCALayerDelegate shared]];
- if (m_layerType == LayerTypeWebLayer || m_layerType == LayerTypeTiledBackingTileLayer)
- setBackingStoreFormat(m_layer.get());
+ if (m_layerType == LayerTypeWebLayer || m_layerType == LayerTypeTiledBackingTileLayer) {
+#if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90300
+ if (screenSupportsExtendedColor())
+ [m_layer setContentsFormat:kCAContentsFormatRGBA10XR];
+#endif
+ }
// So that the scrolling thread's performance logging code can find all the tiles, mark this as being a tile.
if (m_layerType == LayerTypeTiledBackingTileLayer)
Modified: trunk/Source/WebCore/platform/ios/LegacyTileGridTile.mm (198718 => 198719)
--- trunk/Source/WebCore/platform/ios/LegacyTileGridTile.mm 2016-03-26 20:07:25 UTC (rev 198718)
+++ trunk/Source/WebCore/platform/ios/LegacyTileGridTile.mm 2016-03-26 23:50:38 UTC (rev 198719)
@@ -33,24 +33,15 @@
#include "LegacyTileGrid.h"
#include "LegacyTileLayer.h"
#include "LegacyTileLayerPool.h"
+#include "PlatformScreen.h"
#include "QuartzCoreSPI.h"
#include "WAKWindow.h"
#include <algorithm>
#include <functional>
#include <wtf/NeverDestroyed.h>
-#if USE(APPLE_INTERNAL_SDK)
-#import <WebKitAdditions/LayerBackingStoreAdditions.mm>
-#else
namespace WebCore {
-static void setBackingStoreFormat(CALayer *)
-{
-}
-} // namespace WebCore
-#endif
-namespace WebCore {
-
#if LOG_TILING
static int totalTileCount;
#endif
@@ -71,7 +62,10 @@
m_tileLayer = adoptNS([[LegacyTileLayer alloc] init]);
}
LegacyTileLayer* layer = m_tileLayer.get();
- setBackingStoreFormat(layer);
+#if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90300
+ if (screenSupportsExtendedColor())
+ layer.contentsFormat = kCAContentsFormatRGBA10XR;
+#endif
[layer setTileGrid:tileGrid];
[layer setOpaque:m_tileGrid->tileCache().tilesOpaque()];
[layer setEdgeAntialiasingMask:0];
Modified: trunk/Source/WebCore/platform/ios/PlatformScreenIOS.mm (198718 => 198719)
--- trunk/Source/WebCore/platform/ios/PlatformScreenIOS.mm 2016-03-26 20:07:25 UTC (rev 198718)
+++ trunk/Source/WebCore/platform/ios/PlatformScreenIOS.mm 2016-03-26 23:50:38 UTC (rev 198719)
@@ -56,7 +56,7 @@
int screenDepthPerComponent(Widget*)
{
// Assume the screen depth is evenly divided into four color components. See <rdar://problem/9378829>.
- return screenDepth(0) / 4;
+ return screenDepth(nullptr) / 4;
}
bool screenIsMonochrome(Widget*)
@@ -69,6 +69,15 @@
return UIAccessibilityIsInvertColorsEnabled();
}
+bool screenSupportsExtendedColor()
+{
+#if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90300
+ return MGGetBoolAnswer(kMGQHasExtendedColorDisplay);
+#else
+ return false;
+#endif
+}
+
// These functions scale between screen and page coordinates because _javascript_/DOM operations
// assume that the screen and the page share the same coordinate system.
FloatRect screenRect(Widget* widget)
Modified: trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm (198718 => 198719)
--- trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm 2016-03-26 20:07:25 UTC (rev 198718)
+++ trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm 2016-03-26 23:50:38 UTC (rev 198719)
@@ -49,7 +49,7 @@
{
if (!widget)
return 0;
-
+
FrameView* view = widget->root();
if (!view)
return 0;
@@ -62,11 +62,11 @@
// Widget is in an NSWindow, use its screen.
if (window)
return screenForWindow(window);
-
+
// Didn't get an NSWindow; probably WebKit2. Try using the Widget's display ID.
if (NSScreen *screen = screenForDisplayID(displayFromWidget(widget)))
return screen;
-
+
// Widget's window is offscreen, or no screens. Fall back to the first screen if available.
return screenForWindow(nil);
}
@@ -118,11 +118,11 @@
NSScreen *screen = [window screen]; // nil if the window is off-screen
if (screen)
return screen;
-
+
NSArray *screens = [NSScreen screens];
if ([screens count] > 0)
return [screens objectAtIndex:0]; // screen containing the menubar
-
+
return nil;
}
@@ -135,6 +135,11 @@
return nil;
}
+bool screenSupportsExtendedColor()
+{
+ return false; // FIXME: Update this to detect extended color screens.
+}
+
FloatRect toUserSpace(const NSRect& rect, NSWindow *destination)
{
FloatRect userRect = rect;
Modified: trunk/Source/WebCore/platform/spi/cocoa/QuartzCoreSPI.h (198718 => 198719)
--- trunk/Source/WebCore/platform/spi/cocoa/QuartzCoreSPI.h 2016-03-26 20:07:25 UTC (rev 198718)
+++ trunk/Source/WebCore/platform/spi/cocoa/QuartzCoreSPI.h 2016-03-26 23:50:38 UTC (rev 198719)
@@ -186,6 +186,10 @@
extern NSString * const kCAContextDisplayId;
extern NSString * const kCAContextIgnoresHitTest;
+#if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90300
+extern NSString * const kCAContentsFormatRGBA10XR;
+#endif
+
#if (PLATFORM(APPLETV) && __TV_OS_VERSION_MIN_REQUIRED < 100000) \
|| (PLATFORM(WATCHOS) && __WATCH_OS_VERSION_MIN_REQUIRED < 30000) \
|| (PLATFORM(IOS) && TARGET_OS_IOS && __IPHONE_OS_VERSION_MIN_REQUIRED < 100000) \
Modified: trunk/Source/WebCore/platform/spi/ios/MobileGestaltSPI.h (198718 => 198719)
--- trunk/Source/WebCore/platform/spi/ios/MobileGestaltSPI.h 2016-03-26 20:07:25 UTC (rev 198718)
+++ trunk/Source/WebCore/platform/spi/ios/MobileGestaltSPI.h 2016-03-26 23:50:38 UTC (rev 198719)
@@ -44,6 +44,7 @@
static const CFStringRef kMGQiPadCapability = CFSTR("ipad");
static const CFStringRef kMGQDeviceName = CFSTR("DeviceName");
static const CFStringRef kMGQDeviceClassNumber = CFSTR("DeviceClassNumber");
+static const CFStringRef kMGQHasExtendedColorDisplay = CFSTR("HasExtendedColorDisplay");
typedef enum {
MGDeviceClassInvalid = -1,
Modified: trunk/Source/WebKit2/ChangeLog (198718 => 198719)
--- trunk/Source/WebKit2/ChangeLog 2016-03-26 20:07:25 UTC (rev 198718)
+++ trunk/Source/WebKit2/ChangeLog 2016-03-26 23:50:38 UTC (rev 198719)
@@ -1,3 +1,23 @@
+2016-03-25 Dean Jackson <[email protected]>
+
+ Move extended color detection into Open Source
+ https://bugs.webkit.org/show_bug.cgi?id=155909
+ <rdar://problem/25369754>
+
+ Reviewed by Anders Carlsson.
+
+ The code for detecting extended color displays
+ was hidden while the iPad Pro 9.7" was in development.
+ Now it is public, move the detection to Open Source.
+
+ While doing this, add a new method to PlatformScreen
+ so that we have a more obvious way to detect such
+ displays.
+
+ * Shared/mac/RemoteLayerBackingStore.mm:
+ (WebKit::bufferFormat): No need to use WebKitAdditions any
+ more.
+
2016-03-26 Dan Bernstein <[email protected]>
Treat SHA-1-signed certificates as insecure by default.
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm (198718 => 198719)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm 2016-03-26 20:07:25 UTC (rev 198718)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm 2016-03-26 23:50:38 UTC (rev 198719)
@@ -38,6 +38,7 @@
#import <WebCore/IOSurface.h>
#import <WebCore/MachSendRight.h>
#import <WebCore/PlatformCALayerClient.h>
+#import <WebCore/PlatformScreen.h>
#import <WebCore/QuartzCoreSPI.h>
#import <WebCore/WebLayer.h>
@@ -45,27 +46,20 @@
#import <mach/mach_port.h>
#endif
-#if USE(APPLE_INTERNAL_SDK)
-#import <WebKitAdditions/RemoteLayerBackingStoreAdditions.mm>
-#else
+using namespace WebCore;
namespace WebKit {
#if USE(IOSURFACE)
-static WebCore::IOSurface::Format bufferFormat(bool)
+static WebCore::IOSurface::Format bufferFormat(bool isOpaque)
{
+ if (screenSupportsExtendedColor())
+ return isOpaque ? WebCore::IOSurface::Format::RGB10 : WebCore::IOSurface::Format::RGB10A8;
+
return WebCore::IOSurface::Format::RGBA;
}
#endif // USE(IOSURFACE)
-} // namespace WebKit
-
-#endif
-
-using namespace WebCore;
-
-namespace WebKit {
-
RemoteLayerBackingStore::RemoteLayerBackingStore(PlatformCALayerRemote* layer)
: m_layer(layer)
, m_isOpaque(false)