void MediaPlayerPrivateFullscreenWindow::setRootChildLayer(PassRefPtr<WKCACFLayer> rootChild) { if (m_rootChild == rootChild) return; if (m_rootChild) m_rootChild->removeFromSuperlayer(); m_rootChild = rootChild; if (!m_rootChild) return; m_layerRenderer->setRootChildLayer(m_rootChild.get()); WKCACFLayer* rootLayer = m_rootChild->rootLayer(); CGRect rootBounds = m_rootChild->rootLayer()->bounds(); m_rootChild->setFrame(rootBounds); m_layerRenderer->setScrollFrame(IntPoint(rootBounds.origin), IntSize(rootBounds.size)); m_rootChild->setBackgroundColor(CGColorGetConstantColor(kCGColorBlack)); #ifndef NDEBUG RetainPtr<CGColorRef> redColor(AdoptCF, CGColorCreateGenericRGB(1, 0, 0, 1)); rootLayer->setBackgroundColor(redColor.get()); #else rootLayer->setBackgroundColor(CGColorGetConstantColor(kCGColorBlack)); #endif }
void MediaPlayerPrivateFullscreenWindow::setRootChildLayer(PassRefPtr<PlatformCALayer> rootChild) { if (m_rootChild == rootChild) return; if (m_rootChild) m_rootChild->removeFromSuperlayer(); m_rootChild = rootChild; if (!m_rootChild) { m_layerTreeHost = nullptr; return; } if (!m_layerTreeHost) { m_layerTreeHost = CACFLayerTreeHost::create(); if (m_hwnd) m_layerTreeHost->setWindow(m_hwnd); } m_layerTreeHost->setRootChildLayer(m_rootChild.get()); PlatformCALayer* rootLayer = m_rootChild->rootLayer(); CGRect rootBounds = m_rootChild->rootLayer()->bounds(); m_rootChild->setFrame(rootBounds); m_rootChild->setBackgroundColor(CGColorGetConstantColor(kCGColorBlack)); #ifndef NDEBUG RetainPtr<CGColorRef> redColor = adoptCF(CGColorCreateGenericRGB(1, 0, 0, 1)); rootLayer->setBackgroundColor(redColor.get()); #else rootLayer->setBackgroundColor(CGColorGetConstantColor(kCGColorBlack)); #endif }