bool CompositingCoordinator::flushPendingLayerChanges() { TemporaryChange<bool> protector(m_isFlushingLayerChanges, true); initializeRootCompositingLayerIfNeeded(); m_rootLayer->flushCompositingStateForThisLayerOnly(); m_client->didFlushRootLayer(); bool didSync = m_page->mainFrame().view()->flushCompositingStateIncludingSubframes(); toCoordinatedGraphicsLayer(m_rootLayer.get())->updateContentBuffersIncludingSubLayers(); toCoordinatedGraphicsLayer(m_rootLayer.get())->syncPendingStateChangesIncludingSubLayers(); flushPendingImageBackingChanges(); if (m_shouldSyncFrame) { didSync = true; if (m_rootCompositingLayer) { m_state.contentsSize = roundedIntSize(m_rootCompositingLayer->size()); if (CoordinatedGraphicsLayer* contentsLayer = mainContentsLayer()) m_state.coveredRect = contentsLayer->coverRect(); } m_state.scrollPosition = m_visibleContentsRect.location(); m_client->commitSceneState(m_state); clearPendingStateChanges(); m_shouldSyncFrame = false; } return didSync; }
void CompositingCoordinator::setVisibleContentsRect(const FloatRect& rect, const FloatPoint& trajectoryVector) { // A zero trajectoryVector indicates that tiles all around the viewport are requested. if (CoordinatedGraphicsLayer* contentsLayer = mainContentsLayer()) contentsLayer->setVisibleContentRectTrajectoryVector(trajectoryVector); bool contentsRectDidChange = rect != m_visibleContentsRect; if (contentsRectDidChange) { m_visibleContentsRect = rect; for (auto& registeredLayer : m_registeredLayers.values()) registeredLayer->setNeedsVisibleRectAdjustment(); } FrameView* view = m_page->mainFrame().view(); if (view->useFixedLayout() && contentsRectDidChange) { // Round the rect instead of enclosing it to make sure that its size stays // the same while panning. This can have nasty effects on layout. view->setFixedVisibleContentRect(roundedIntRect(rect)); } }