Changeset 173702 in webkit
- Timestamp:
- Sep 17, 2014 2:18:04 PM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r173696 r173702 1 2014-09-17 Simon Fraser <simon.fraser@apple.com> 2 3 Fix an issue that caused video playback to not always use high resolution streams 4 https://bugs.webkit.org/show_bug.cgi?id=136879 5 rdar://problem/18316542 6 7 Reviewed by Eric Carlson. 8 9 The underlying video framework expects to be able to use -[CALayer convertRect:toLayer:nil] on 10 the video layer to obtain information about the display resolution of the video, 11 including the device scale factor. This doesn't work for layers in the web process, 12 which are remotely hosted into the UI process. 13 14 For now, use a workaround which involves putting a scale transform equivalent to 15 the device scale factor on the web process layer, and the inverse scale on the 16 hosting layer in the UI process. 17 18 We have to do this in two places, for in-page video, and for fullscreen video. 19 20 * Shared/mac/RemoteLayerTreeTransaction.h: Add hostingDeviceScaleFactor to the LayerCreation 21 properties. 22 * Shared/mac/RemoteLayerTreeTransaction.mm: 23 (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::LayerCreationProperties): 24 (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::encode): 25 (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::decode): 26 * UIProcess/ios/RemoteLayerTreeHostIOS.mm: 27 (-[WKRemoteView initWithFrame:contextID:hostingDeviceScaleFactor:]): Set the inverse scale 28 transform on the layer. 29 (WebKit::RemoteLayerTreeHost::createLayer): 30 (-[WKRemoteView initWithFrame:contextID:]): Deleted. 31 * UIProcess/ios/WebVideoFullscreenManagerProxy.h: 32 * UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in: 33 * UIProcess/ios/WebVideoFullscreenManagerProxy.mm: 34 (WebKit::WebVideoFullscreenManagerProxy::setupFullscreenWithID): 35 * WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm: 36 (WebKit::PlatformCALayerRemoteCustom::PlatformCALayerRemoteCustom): 37 * WebProcess/WebPage/mac/RemoteLayerTreeContext.h: 38 (WebKit::RemoteLayerTreeContext::deviceScaleFactor): 39 * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm: 40 (WebKit::RemoteLayerTreeContext::layerWasCreated): 41 * WebProcess/ios/WebVideoFullscreenManager.mm: 42 (WebKit::WebVideoFullscreenManager::enterFullscreenForNode): 43 (WebKit::WebVideoFullscreenManager::didSetupFullscreen): 44 1 45 2014-09-17 Gavin Barraclough <baraclough@apple.com> 2 46 -
trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h
r170774 r173702 96 96 97 97 uint32_t hostingContextID; 98 float hostingDeviceScaleFactor; 98 99 }; 99 100 -
trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm
r170864 r173702 48 48 , type(PlatformCALayer::LayerTypeLayer) 49 49 , hostingContextID(0) 50 , hostingDeviceScaleFactor(1) 50 51 { 51 52 } … … 56 57 encoder.encodeEnum(type); 57 58 encoder << hostingContextID; 59 encoder << hostingDeviceScaleFactor; 58 60 } 59 61 … … 67 69 68 70 if (!decoder.decode(result.hostingContextID)) 71 return false; 72 73 if (!decoder.decode(result.hostingDeviceScaleFactor)) 69 74 return false; 70 75 -
trunk/Source/WebKit2/UIProcess/ios/RemoteLayerTreeHostIOS.mm
r170864 r173702 109 109 110 110 @implementation WKRemoteView 111 - (instancetype)initWithFrame:(CGRect)frame contextID:(uint32_t)contextID 111 - (instancetype)initWithFrame:(CGRect)frame contextID:(uint32_t)contextID hostingDeviceScaleFactor:(float)scaleFactor 112 112 { 113 113 if ((self = [super initWithFrame:frame])) { 114 114 [[self layer] setContextId:contextID]; 115 // Invert the scale transform added in the WebProcess to fix <rdar://problem/18316542>. 116 float inverseScale = 1 / scaleFactor; 117 [[self layer] setTransform:CATransform3DMakeScale(inverseScale, inverseScale, 1)]; 115 118 } 116 119 … … 156 159 case PlatformCALayer::LayerTypeWebGLLayer: 157 160 if (!m_isDebugLayerTreeHost) 158 view = adoptNS([[WKRemoteView alloc] initWithFrame:CGRectZero contextID:properties.hostingContextID ]);161 view = adoptNS([[WKRemoteView alloc] initWithFrame:CGRectZero contextID:properties.hostingContextID hostingDeviceScaleFactor:properties.hostingDeviceScaleFactor]); 159 162 else 160 163 view = adoptNS([[WKCompositingView alloc] init]); -
trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h
r170083 r173702 56 56 57 57 // Translate to FullscreenInterface 58 void setupFullscreenWithID(uint32_t, WebCore::IntRect initialRect );58 void setupFullscreenWithID(uint32_t, WebCore::IntRect initialRect, float hostingDeviceScaleFactor); 59 59 void setSeekableRangesVector(Vector<std::pair<double, double>>&); 60 60 void setExternalPlaybackProperties(bool enabled, uint32_t targetType, String localizedDeviceName); -
trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in
r171288 r173702 32 32 SetDuration(double duration) 33 33 SetRate(bool isPlaying, double rate) 34 SetupFullscreenWithID(uint32_t videoLayerID, WebCore::IntRect initialRect )34 SetupFullscreenWithID(uint32_t videoLayerID, WebCore::IntRect initialRect, float hostingScaleFactor) 35 35 EnterFullscreen() 36 36 ExitFullscreen(WebCore::IntRect finalRect) -
trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm
r171973 r173702 73 73 } 74 74 75 void WebVideoFullscreenManagerProxy::setupFullscreenWithID(uint32_t videoLayerID, WebCore::IntRect initialRect )75 void WebVideoFullscreenManagerProxy::setupFullscreenWithID(uint32_t videoLayerID, WebCore::IntRect initialRect, float hostingDeviceScaleFactor) 76 76 { 77 77 ASSERT(videoLayerID); 78 78 m_layerHost = WKMakeRenderLayer(videoLayerID); 79 if (hostingDeviceScaleFactor != 1) { 80 // Invert the scale transform added in the WebProcess to fix <rdar://problem/18316542>. 81 float inverseScale = 1 / hostingDeviceScaleFactor; 82 [m_layerHost setTransform:CATransform3DMakeScale(inverseScale, inverseScale, 1)]; 83 } 84 79 85 UIView *parentView = toRemoteLayerTreeDrawingAreaProxy(m_page->drawingArea())->remoteLayerTreeHost().rootLayer(); 80 86 setupFullscreen(*m_layerHost.get(), initialRect, parentView); -
trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm
r172681 r173702 65 65 case LayerHostingMode::OutOfProcess: 66 66 m_layerHostingContext = LayerHostingContext::createForExternalHostingProcess(); 67 #if PLATFORM(IOS) 68 float scaleFactor = context.deviceScaleFactor(); 69 // Set a scale factor here to make convertRect:toLayer:nil take scale factor into account. <rdar://problem/18316542>. 70 // This scale factor is inverted in the hosting process. 71 [customLayer setTransform:CATransform3DMakeScale(scaleFactor, scaleFactor, 1)]; 72 #endif 67 73 break; 68 74 #endif -
trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h
r172836 r173702 56 56 WebCore::LayerPool& layerPool() { return m_layerPool; } 57 57 58 float deviceScaleFactor() const { return m_webPage.deviceScaleFactor(); } 59 58 60 LayerHostingMode layerHostingMode() const { return m_webPage.layerHostingMode(); } 59 61 -
trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm
r172836 r173702 62 62 creationProperties.type = type; 63 63 64 if (layer.isPlatformCALayerRemoteCustom()) 64 if (layer.isPlatformCALayerRemoteCustom()) { 65 65 creationProperties.hostingContextID = layer.hostingContextID(); 66 creationProperties.hostingDeviceScaleFactor = deviceScaleFactor(); 67 } 66 68 67 69 m_createdLayers.append(creationProperties); -
trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm
r173230 r173702 98 98 m_layerHostingContext = LayerHostingContext::createForExternalHostingProcess(); 99 99 100 m_page->send(Messages::WebVideoFullscreenManagerProxy::SetupFullscreenWithID(m_layerHostingContext->contextID(), clientRectForElement(videoElement) ), m_page->pageID());100 m_page->send(Messages::WebVideoFullscreenManagerProxy::SetupFullscreenWithID(m_layerHostingContext->contextID(), clientRectForElement(videoElement), m_page->deviceScaleFactor()), m_page->pageID()); 101 101 } 102 102 … … 176 176 [CATransaction begin]; 177 177 [CATransaction setDisableActions:YES]; 178 178 179 [videoLayer setBackgroundColor:cachedCGColor(WebCore::Color::transparent, WebCore::ColorSpaceDeviceRGB)]; 180 181 // Set a scale factor here to make convertRect:toLayer:nil take scale factor into account. <rdar://problem/18316542>. 182 // This scale factor is inverted in the hosting process. 183 float hostingScaleFactor = m_page->deviceScaleFactor(); 184 [videoLayer setTransform:CATransform3DMakeScale(hostingScaleFactor, hostingScaleFactor, 1)]; 179 185 m_layerHostingContext->setRootLayer(videoLayer); 186 180 187 setVideoFullscreenLayer(videoLayer); 181 188 [CATransaction commit]; 189 182 190 m_page->send(Messages::WebVideoFullscreenManagerProxy::EnterFullscreen(), m_page->pageID()); 183 191 }
Note: See TracChangeset
for help on using the changeset viewer.