void TextureMapperNode::syncCompositingStateInternal(GraphicsLayerTextureMapper* graphicsLayer, bool recurse, TextureMapper* textureMapper) { syncCompositingStateSelf(graphicsLayer, textureMapper); graphicsLayer->didSynchronize(); if (m_state.maskLayer) { m_state.maskLayer->syncCompositingStateInternal(toGraphicsLayerTextureMapper(graphicsLayer->maskLayer()), false, textureMapper); if (m_state.maskLayer->m_size.isEmpty()) m_state.maskLayer->m_size = m_size; } if (m_state.replicaLayer) m_state.replicaLayer->syncCompositingStateInternal(toGraphicsLayerTextureMapper(graphicsLayer->replicaLayer()), false, textureMapper); if (m_state.dirty) uploadTextureFromContent(textureMapper, m_state.visibleRect, graphicsLayer); m_currentContent.needsDisplayRect = IntRect(); m_currentContent.needsDisplay = false; if (!recurse) return; Vector<GraphicsLayer*> children = graphicsLayer->children(); for (int i = children.size() - 1; i >= 0; --i) { TextureMapperNode* node = toTextureMapperNode(children[i]); if (!node) continue; node->syncCompositingStateInternal(toGraphicsLayerTextureMapper(children[i]), true, textureMapper); } }
void CoordinatedGraphicsScene::createLayer(CoordinatedLayerID id) { OwnPtr<GraphicsLayer> newLayer = GraphicsLayer::create(0 /* factory */, this); toGraphicsLayerTextureMapper(newLayer.get())->setHasOwnBackingStore(false); toGraphicsLayerTextureMapper(newLayer.get())->setID(id); toGraphicsLayerTextureMapper(newLayer.get())->setScrollClient(this); m_layers.add(id, newLayer.release()); }
void CoordinatedGraphicsScene::setLayerRepaintCountIfNeeded(GraphicsLayer* layer, const CoordinatedGraphicsLayerState& state) { if (!layer->isShowingRepaintCounter() || !state.repaintCountChanged) return; toGraphicsLayerTextureMapper(layer)->setRepaintCount(state.repaintCount); }
void CoordinatedGraphicsScene::removeBackingStoreIfNeeded(GraphicsLayer* graphicsLayer) { RefPtr<CoordinatedBackingStore> backingStore = m_backingStores.take(graphicsLayer); if (!backingStore) return; toGraphicsLayerTextureMapper(graphicsLayer)->setBackingStore(0); }
void CoordinatedGraphicsScene::createBackingStoreIfNeeded(GraphicsLayer* graphicsLayer) { if (m_backingStores.contains(graphicsLayer)) return; RefPtr<CoordinatedBackingStore> backingStore(CoordinatedBackingStore::create()); m_backingStores.add(graphicsLayer, backingStore); toGraphicsLayerTextureMapper(graphicsLayer)->setBackingStore(backingStore); }
void TextureMapperLayer::syncCompositingState(GraphicsLayerTextureMapper* graphicsLayer, TextureMapper* textureMapper, int options) { if (!textureMapper) return; if (graphicsLayer && !(options & ComputationsOnly)) { syncCompositingStateSelf(graphicsLayer, textureMapper); graphicsLayer->didSynchronize(); } if (graphicsLayer && m_state.maskLayer) { m_state.maskLayer->syncCompositingState(toGraphicsLayerTextureMapper(graphicsLayer->maskLayer()), textureMapper); // A mask layer has its parent's size by default, in case it's not set specifically. if (m_state.maskLayer->m_size.isEmpty()) m_state.maskLayer->m_size = m_size; } if (m_state.replicaLayer) m_state.replicaLayer->syncCompositingState(toGraphicsLayerTextureMapper(graphicsLayer->replicaLayer()), textureMapper); syncAnimations(); updateBackingStore(textureMapper, graphicsLayer); if (!(options & TraverseDescendants)) options = ComputationsOnly; if (graphicsLayer) { Vector<GraphicsLayer*> children = graphicsLayer->children(); for (int i = children.size() - 1; i >= 0; --i) { TextureMapperLayer* layer = toTextureMapperLayer(children[i]); if (!layer) continue; layer->syncCompositingState(toGraphicsLayerTextureMapper(children[i]), textureMapper, options); } } else { for (int i = m_children.size() - 1; i >= 0; --i) m_children[i]->syncCompositingState(0, textureMapper, options); } }
void CoordinatedGraphicsScene::setLayerAnimationsIfNeeded(GraphicsLayer* graphicsLayer, const CoordinatedGraphicsLayerState& state) { if (!state.animationsChanged) return; GraphicsLayerTextureMapper* layer = toGraphicsLayerTextureMapper(graphicsLayer); #if ENABLE(CSS_SHADERS) for (size_t i = 0; i < state.animations.animations().size(); ++i) { const KeyframeValueList& keyframes = state.animations.animations().at(i).keyframes(); if (keyframes.property() != AnimatedPropertyWebkitFilter) continue; for (size_t j = 0; j < keyframes.size(); ++j) { const FilterAnimationValue* filterValue = static_cast<const FilterAnimationValue*>(keyframes.at(i)); injectCachedCustomFilterPrograms(*filterValue->value()); } } #endif layer->setAnimations(state.animations); }
TextureMapperLayer* toTextureMapperLayer(GraphicsLayer* layer) { return layer ? toGraphicsLayerTextureMapper(layer)->layer() : 0; }
void CoordinatedGraphicsScene::setLayerState(CoordinatedLayerID id, const CoordinatedGraphicsLayerState& layerState) { ASSERT(m_rootLayerID != InvalidCoordinatedLayerID); GraphicsLayer* layer = layerByID(id); if (layerState.positionChanged) layer->setPosition(layerState.pos); if (layerState.anchorPointChanged) layer->setAnchorPoint(layerState.anchorPoint); if (layerState.sizeChanged) layer->setSize(layerState.size); if (layerState.transformChanged) layer->setTransform(layerState.transform); if (layerState.childrenTransformChanged) layer->setChildrenTransform(layerState.childrenTransform); if (layerState.contentsRectChanged) layer->setContentsRect(layerState.contentsRect); if (layerState.opacityChanged) layer->setOpacity(layerState.opacity); if (layerState.solidColorChanged) layer->setContentsToSolidColor(layerState.solidColor); if (layerState.debugBorderColorChanged || layerState.debugBorderWidthChanged) layer->setDebugBorder(layerState.debugBorderColor, layerState.debugBorderWidth); if (layerState.replicaChanged) layer->setReplicatedByLayer(getLayerByIDIfExists(layerState.replica)); if (layerState.maskChanged) layer->setMaskLayer(getLayerByIDIfExists(layerState.mask)); if (layerState.imageChanged) assignImageBackingToLayer(layer, layerState.imageID); if (layerState.flagsChanged) { layer->setContentsOpaque(layerState.contentsOpaque); layer->setDrawsContent(layerState.drawsContent); layer->setContentsVisible(layerState.contentsVisible); layer->setBackfaceVisibility(layerState.backfaceVisible); // Never clip the root layer. layer->setMasksToBounds(id == m_rootLayerID ? false : layerState.masksToBounds); layer->setPreserves3D(layerState.preserves3D); bool fixedToViewportChanged = toGraphicsLayerTextureMapper(layer)->fixedToViewport() != layerState.fixedToViewport; toGraphicsLayerTextureMapper(layer)->setFixedToViewport(layerState.fixedToViewport); if (fixedToViewportChanged) { if (layerState.fixedToViewport) m_fixedLayers.add(id, layer); else m_fixedLayers.remove(id); } layer->setShowDebugBorder(layerState.showDebugBorders); layer->setShowRepaintCounter(layerState.showRepaintCounter); toGraphicsLayerTextureMapper(layer)->setIsScrollable(layerState.isScrollable); } if (layerState.committedScrollOffsetChanged) toGraphicsLayerTextureMapper(layer)->didCommitScrollOffset(layerState.committedScrollOffset); prepareContentBackingStore(layer); // Apply Operations. setLayerChildrenIfNeeded(layer, layerState); createTilesIfNeeded(layer, layerState); removeTilesIfNeeded(layer, layerState); updateTilesIfNeeded(layer, layerState); #if ENABLE(CSS_FILTERS) setLayerFiltersIfNeeded(layer, layerState); #endif setLayerAnimationsIfNeeded(layer, layerState); #if USE(GRAPHICS_SURFACE) syncCanvasIfNeeded(layer, layerState); #endif setLayerRepaintCountIfNeeded(layer, layerState); }