void LayerTreeHostCA::initialize() { // Create a root layer. m_rootLayer = GraphicsLayer::create(graphicsLayerFactory(), this); #ifndef NDEBUG m_rootLayer->setName("LayerTreeHost root layer"); #endif m_rootLayer->setDrawsContent(false); m_rootLayer->setSize(m_webPage->size()); static_cast<GraphicsLayerCA*>(m_rootLayer.get())->platformCALayer()->setGeometryFlipped(true); m_nonCompositedContentLayer = GraphicsLayer::create(graphicsLayerFactory(), this); static_cast<GraphicsLayerCA*>(m_nonCompositedContentLayer.get())->setAllowTiledLayer(false); #ifndef NDEBUG m_nonCompositedContentLayer->setName("LayerTreeHost non-composited content"); #endif m_nonCompositedContentLayer->setDrawsContent(true); m_nonCompositedContentLayer->setContentsOpaque(m_webPage->drawsBackground() && !m_webPage->drawsTransparentBackground()); m_nonCompositedContentLayer->setSize(m_webPage->size()); if (m_webPage->corePage()->settings()->acceleratedDrawingEnabled()) m_nonCompositedContentLayer->setAcceleratesDrawing(true); m_rootLayer->addChild(m_nonCompositedContentLayer.get()); if (m_webPage->hasPageOverlay()) createPageOverlayLayer(); platformInitialize(); setLayerFlushSchedulingEnabled(!m_webPage->drawingArea() || !m_webPage->drawingArea()->layerTreeStateIsFrozen()); scheduleLayerFlush(); }
void LayerTreeHostCAWin::setRootCompositingLayer(GraphicsLayer* graphicsLayer) { // Don't flush any changes when we don't have a root layer. This will prevent flashes of white // when switching out of compositing mode. setLayerFlushSchedulingEnabled(graphicsLayer); // Resubmit all existing animations. CACF does not remember running animations // When the layer tree is removed and then added back to the hierarchy if (graphicsLayer) static_cast<GraphicsLayerCA*>(graphicsLayer)->platformCALayer()->ensureAnimationsSubmitted(); LayerTreeHostCA::setRootCompositingLayer(graphicsLayer); }