void PaintLayerCompositor::ensureRootLayer() { RootLayerAttachment expectedAttachment = m_layoutView.frame()->isLocalRoot() ? RootLayerAttachedViaChromeClient : RootLayerAttachedViaEnclosingFrame; if (expectedAttachment == m_rootLayerAttachment) return; Settings* settings = m_layoutView.document().settings(); if (!m_rootContentLayer) { m_rootContentLayer = GraphicsLayer::create(graphicsLayerFactory(), this); IntRect overflowRect = m_layoutView.pixelSnappedLayoutOverflowRect(); m_rootContentLayer->setSize(FloatSize(overflowRect.maxX(), overflowRect.maxY())); m_rootContentLayer->setPosition(FloatPoint()); m_rootContentLayer->setOwnerNodeId(DOMNodeIds::idForNode(m_layoutView.generatingNode())); // FIXME: with rootLayerScrolls, we probably don't even need m_rootContentLayer? if (!(settings && settings->rootLayerScrolls())) { // Need to clip to prevent transformed content showing outside this frame m_rootContentLayer->setMasksToBounds(true); } } if (!m_overflowControlsHostLayer) { ASSERT(!m_scrollLayer); ASSERT(!m_containerLayer); // Create a layer to host the clipping layer and the overflow controls layers. m_overflowControlsHostLayer = GraphicsLayer::create(graphicsLayerFactory(), this); // Clip iframe's overflow controls layer. bool containerMasksToBounds = !m_layoutView.frame()->isLocalRoot(); m_overflowControlsHostLayer->setMasksToBounds(containerMasksToBounds); // Create a clipping layer if this is an iframe or settings require to clip. m_containerLayer = GraphicsLayer::create(graphicsLayerFactory(), this); m_containerLayer->setMasksToBounds(containerMasksToBounds); m_scrollLayer = GraphicsLayer::create(graphicsLayerFactory(), this); if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator()) scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(m_scrollLayer.get(), true); // Hook them up m_overflowControlsHostLayer->addChild(m_containerLayer.get()); m_containerLayer->addChild(m_scrollLayer.get()); m_scrollLayer->addChild(m_rootContentLayer.get()); frameViewDidChangeSize(); } // Check to see if we have to change the attachment if (m_rootLayerAttachment != RootLayerUnattached) { detachRootLayer(); detachCompositorTimeline(); } attachCompositorTimeline(); attachRootLayer(expectedAttachment); }
void Animation::destroyCompositorPlayer() { detachCompositedLayers(); if (m_compositorPlayer) { detachCompositorTimeline(); m_compositorPlayer->setAnimationDelegate(nullptr); } m_compositorPlayer.clear(); }
void PaintLayerCompositor::setIsInWindow(bool isInWindow) { if (!staleInCompositingMode()) return; if (isInWindow) { if (m_rootLayerAttachment != RootLayerUnattached) return; RootLayerAttachment attachment = m_layoutView.frame()->isLocalRoot() ? RootLayerAttachedViaChromeClient : RootLayerAttachedViaEnclosingFrame; attachCompositorTimeline(); attachRootLayer(attachment); } else { if (m_rootLayerAttachment == RootLayerUnattached) return; detachRootLayer(); detachCompositorTimeline(); } }