Lines Matching refs:layer
129 // layer creation from the enclosing RenderIFrame.
321 // Host the document layer in the RenderView's root layer.
346 bool RenderLayerCompositor::updateBacking(RenderLayer* layer, CompositingChangeRepaint shouldRepaint)
350 if (needsToBeComposited(layer)) {
354 if (requiresCompositingForTransform(layer->renderer()))
357 // If we are a child of a scrollable layer, ignore the overlap from the
358 // scrollable layer as it can cause child layers to become composited
359 // siblings and will not scroll with the main content layer.
360 if (layer->hasOverflowParent())
364 if (!layer->backing()) {
368 repaintOnCompositingChange(layer);
370 layer->ensureBacking();
374 layer->backing()->graphicsLayer()->setAcceleratesDrawing(true);
375 else if (layer->renderer()->isCanvas()) {
376 HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(layer->renderer()->node());
378 layer->backing()->graphicsLayer()->setAcceleratesDrawing(true);
384 if (layer->backing()) {
388 if (layer->isReflection()) {
389 RenderLayer* sourceLayer = toRenderBoxModelObject(layer->renderer()->parent())->layer();
391 ASSERT(backing->graphicsLayer()->replicaLayer() == layer->backing()->graphicsLayer());
396 layer->clearBacking();
399 // The layer's cached repaints rects are relative to the repaint container, so change when
401 layer->computeRepaintRects();
405 repaintOnCompositingChange(layer);
410 if (layerChanged && layer->renderer()->isVideo()) {
411 // If it's a video, give the media player a chance to hook up to the layer.
412 RenderVideo* video = toRenderVideo(layer->renderer());
417 if (layerChanged && layer->renderer()->isRenderPart()) {
418 RenderLayerCompositor* innerCompositor = frameContentsCompositor(toRenderPart(layer->renderer()));
426 bool RenderLayerCompositor::updateLayerCompositingState(RenderLayer* layer, CompositingChangeRepaint shouldRepaint)
428 bool layerChanged = updateBacking(layer, shouldRepaint);
432 if (layer->backing() && layer->backing()->updateGraphicsLayerConfiguration())
438 void RenderLayerCompositor::repaintOnCompositingChange(RenderLayer* layer)
441 if (layer->renderer() != m_renderView && !layer->renderer()->parent())
444 RenderBoxModelObject* repaintContainer = layer->renderer()->containerForRepaint();
448 layer->repaintIncludingNonCompositingDescendants(repaintContainer);
450 // The contents of this layer may be moving between the window
457 // The bounds of the GraphicsLayer created for a compositing layer is the union of the bounds of all the descendant
459 IntRect RenderLayerCompositor::calculateCompositedBounds(const RenderLayer* layer, const RenderLayer* ancestorLayer)
461 if (!canBeComposited(layer))
464 IntRect boundingBoxRect = layer->localBoundingBox();
465 if (layer->renderer()->isRoot()) {
466 // If the root layer becomes composited (e.g. because some descendant with negative z-index is composited),
480 if (layer->renderer()->hasOverflowClip() || layer->renderer()->hasMask()) {
482 layer->convertToLayerCoords(ancestorLayer, ancestorRelX, ancestorRelY);
487 if (RenderLayer* reflection = layer->reflectionLayer()) {
489 IntRect childUnionBounds = calculateCompositedBounds(reflection, layer);
494 ASSERT(layer->isStackingContext() || (!layer->m_posZOrderList || layer->m_posZOrderList->size() == 0));
496 if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) {
501 IntRect childUnionBounds = calculateCompositedBounds(curLayer, layer);
507 if (Vector<RenderLayer*>* posZOrderList = layer->posZOrderList()) {
512 IntRect childUnionBounds = calculateCompositedBounds(curLayer, layer);
518 if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) {
523 IntRect curAbsBounds = calculateCompositedBounds(curLayer, layer);
529 if (layer->paintsWithTransform(PaintBehaviorNormal)) {
530 TransformationMatrix* affineTrans = layer->transform();
536 layer->convertToLayerCoords(ancestorLayer, ancestorRelX, ancestorRelY);
565 // The contents of this layer may be moving from a GraphicsLayer to the window,
573 RenderLayer* RenderLayerCompositor::enclosingNonStackingClippingLayer(const RenderLayer* layer) const
575 for (RenderLayer* curr = layer->parent(); curr != 0; curr = curr->parent()) {
585 void RenderLayerCompositor::addToOverlapMap(OverlapMap& overlapMap, RenderLayer* layer, IntRect& layerBounds, bool& boundsComputed)
587 if (layer->isRootLayer())
591 layerBounds = layer->renderer()->localToAbsoluteQuad(FloatRect(layer->localBoundingBox())).enclosingBoundingBox();
598 overlapMap.add(layer, layerBounds);
617 // layers following a fixed layer into compositing mode; but if a layer is fully
618 // contained into a previous layer already composited (that is not the fixed
619 // layer), we don't need to composite it. This saves up quite a bit on the
668 // For the z-order children of a compositing layer:
669 // If a child layers has a compositing layer, then all subsequent layers must
670 // be compositing in order to render above that layer.
672 // If a child in the negative z-order list is compositing, then the layer itself
676 void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, OverlapMap* overlapMap, struct CompositingState& compositingState, bool& layersChanged)
678 layer->updateLayerPosition();
679 layer->updateZOrderLists();
680 layer->updateNormalFlowList();
683 layer->setHasCompositingDescendant(false);
691 absBounds = layer->renderer()->localToAbsoluteQuad(FloatRect(layer->localBoundingBox())).enclosingBoundingBox();
701 layer->setMustOverlapCompositedLayers(layer->shouldComposite());
703 layer->setMustOverlapCompositedLayers(mustOverlapCompositedLayers);
705 layer->setMustOverlapCompositedLayers(mustOverlapCompositedLayers);
708 // The children of this layer don't need to composite, unless there is
709 // a compositing layer among them, so start by inheriting the compositing
716 bool willBeComposited = needsToBeComposited(layer);
720 if (layer->hasOverflowScroll())
724 if (layer->isFixed())
730 // This layer now acts as the ancestor for kids.
731 childState.m_compositingAncestor = layer;
733 addToOverlapMap(*overlapMap, layer, absBounds, haveComputedBounds);
737 // Video is special. It's a replaced element with a content layer, but has shadow content
740 if (willBeComposited && layer->renderer()->isVideo())
744 if (layer->isStackingContext()) {
745 ASSERT(!layer->m_zOrderListsDirty);
746 if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) {
757 // If we have to make a layer for this child, make one now so we can have a contents layer
761 // or scrollable elements to their own compositing layer. But in the case that
762 // we have such an element in the negative z-order, we must make it a layer
771 // make layer compositing
772 layer->setMustOverlapCompositedLayers(true);
773 childState.m_compositingAncestor = layer;
775 addToOverlapMap(*overlapMap, layer, absBounds, haveComputedBounds);
782 ASSERT(!layer->m_normalFlowListDirty);
783 if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) {
796 if (layer->isStackingContext()) {
797 if (Vector<RenderLayer*>* posZOrderList = layer->posZOrderList()) {
812 if (layer->isRootLayer()) {
817 ASSERT(willBeComposited == needsToBeComposited(layer));
820 // be composited. Also, if we have opacity < 1, then we need to be a layer so that
821 // the child layers are opaque, then rendered with opacity on this layer.
822 if (!willBeComposited && canBeComposited(layer) && childState.m_subtreeIsCompositing && requiresCompositingWhenDescendantsAreCompositing(layer->renderer())) {
823 layer->setMustOverlapCompositedLayers(true);
825 addToOverlapMap(*overlapMap, layer, absBounds, haveComputedBounds);
829 ASSERT(willBeComposited == needsToBeComposited(layer));
830 if (layer->reflectionLayer())
831 layer->reflectionLayer()->setMustOverlapCompositedLayers(willBeComposited);
847 layer->setHasCompositingDescendant(childState.m_subtreeIsCompositing);
851 if (!willBeComposited && canBeComposited(layer) && clipsCompositingDescendants(layer)) {
853 addToOverlapMap(*overlapMap, layer, absBounds, haveComputedBounds);
857 // If we're back at the root, and no other layers need to be composited, and the root layer itself doesn't need
860 // We also need to check that we don't have a scrollable layer, as this
862 if (layer->isRootLayer() && !childState.m_subtreeIsCompositing && !childState.m_hasScrollableElement && !childState.m_hasFixedElement && !requiresCompositingLayer(layer) && !m_forceCompositingMode) {
864 if (layer->isRootLayer() && !childState.m_subtreeIsCompositing && !requiresCompositingLayer(layer) && !m_forceCompositingMode) {
870 // If the layer is going into compositing mode, repaint its old location.
871 ASSERT(willBeComposited == needsToBeComposited(layer));
872 if (!layer->isComposited() && willBeComposited)
873 repaintOnCompositingChange(layer);
876 if (updateBacking(layer, CompositingChangeRepaintNow))
879 if (layer->reflectionLayer() && updateLayerCompositingState(layer->reflectionLayer(), CompositingChangeRepaintNow))
890 // we'll do a full layer update soon.
903 void RenderLayerCompositor::removeCompositedChildren(RenderLayer* layer)
905 ASSERT(layer->isComposited());
907 GraphicsLayer* hostingLayer = layer->backing()->parentForSublayers();
921 void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer* layer, const CompositingState& compositingState, Vector<GraphicsLayer*>& childLayersOfEnclosingLayer)
923 // Make the layer compositing if necessary, and set up clipping and content layers.
927 RenderLayerBacking* layerBacking = layer->backing();
930 // we can compute and cache the composited bounds for this layer.
933 if (RenderLayer* reflection = layer->reflectionLayer()) {
941 if (!layer->parent())
945 // If this layer has backing, then we are collecting its children, otherwise appending
946 // to the compositing child list of an enclosing layer.
951 if (layer->isComposited())
952 childState.m_compositingAncestor = layer;
959 // a compositing layer among them, so start by assuming false.
962 if (layer->isStackingContext()) {
963 ASSERT(!layer->m_zOrderListsDirty);
965 if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) {
973 // If a negative z-order child is compositing, we get a foreground layer which needs to get parented.
978 ASSERT(!layer->m_normalFlowListDirty);
979 if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) {
987 if (layer->isStackingContext()) {
988 if (Vector<RenderLayer*>* posZOrderList = layer->posZOrderList()) {
999 if (layer->renderer()->isRenderPart())
1000 parented = parentFrameContentLayers(toRenderPart(layer->renderer()));
1002 // If the layer has a clipping layer the overflow controls layers will be siblings of the clipping layer.
1026 // the full screen layer out from under them if they're in the middle of
1028 if (layer->renderer()->isRenderFullScreen() && toRenderFullScreen(layer->renderer())->isAnimating())
1091 RenderLayer* layer = renderer->layer();
1092 if (!layer->isComposited())
1095 RenderLayerBacking* backing = layer->backing();
1105 // This just updates layer geometry without changing the hierarchy.
1106 void RenderLayerCompositor::updateLayerTreeGeometry(RenderLayer* layer)
1108 if (RenderLayerBacking* layerBacking = layer->backing()) {
1110 // we can compute and cache the composited bounds for this layer.
1113 if (RenderLayer* reflection = layer->reflectionLayer()) {
1121 if (!layer->parent())
1125 if (layer->isStackingContext()) {
1126 ASSERT(!layer->m_zOrderListsDirty);
1128 if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) {
1135 ASSERT(!layer->m_normalFlowListDirty);
1136 if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) {
1142 if (layer->isStackingContext()) {
1143 if (Vector<RenderLayer*>* posZOrderList = layer->posZOrderList()) {
1152 void RenderLayerCompositor::updateCompositingDescendantGeometry(RenderLayer* compositingAncestor, RenderLayer* layer, RenderLayerBacking::UpdateDepth updateDepth)
1154 if (layer != compositingAncestor) {
1155 if (RenderLayerBacking* layerBacking = layer->backing()) {
1158 if (RenderLayer* reflection = layer->reflectionLayer()) {
1169 if (layer->reflectionLayer())
1170 updateCompositingDescendantGeometry(compositingAncestor, layer->reflectionLayer(), updateDepth);
1172 if (!layer->hasCompositingDescendant())
1175 if (layer->isStackingContext()) {
1176 if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) {
1183 if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) {
1189 if (layer->isStackingContext()) {
1190 if (Vector<RenderLayer*>* posZOrderList = layer->posZOrderList()) {
1204 void RenderLayerCompositor::recursiveRepaintLayerRect(RenderLayer* layer, const IntRect& rect)
1207 if (layer->isComposited())
1208 layer->setBackingNeedsRepaintInRect(rect);
1210 if (layer->hasCompositingDescendant()) {
1211 if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) {
1217 curLayer->convertToLayerCoords(layer, x, y);
1224 if (Vector<RenderLayer*>* posZOrderList = layer->posZOrderList()) {
1230 curLayer->convertToLayerCoords(layer, x, y);
1237 if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) {
1243 curLayer->convertToLayerCoords(layer, x, y);
1253 return m_renderView->layer();
1363 bool RenderLayerCompositor::needsToBeComposited(const RenderLayer* layer) const
1365 if (!canBeComposited(layer))
1368 // The root layer always has a compositing layer, but it may not have backing.
1369 return requiresCompositingLayer(layer) || layer->mustOverlapCompositedLayers() || (inCompositingMode() && layer->isRootLayer());
1373 bool RenderLayerCompositor::requiresCompositingForAndroidLayers(const RenderLayer* layer) const
1376 if (layer->hasOverflowScroll())
1378 if (layer->isRootLayer() && m_renderView->frameView()->hasOverflowScroll())
1384 if (layer->isFixed())
1391 // Note: this specifies whether the RL needs a compositing layer for intrinsic reasons.
1392 // Use needsToBeComposited() to determine if a RL actually needs a compositing layer.
1394 bool RenderLayerCompositor::requiresCompositingLayer(const RenderLayer* layer) const
1396 RenderObject* renderer = layer->renderer();
1397 // The compositing state of a reflection should match that of its reflected layer.
1398 if (layer->isReflection()) {
1400 layer = toRenderBoxModelObject(renderer)->layer();
1404 || requiresCompositingForAndroidLayers(layer)
1411 || clipsCompositingDescendants(layer)
1416 bool RenderLayerCompositor::canBeComposited(const RenderLayer* layer) const
1418 return m_hasAcceleratedCompositing && layer->isSelfPaintingLayer();
1421 // Return true if the given layer has some ancestor in the RenderLayer hierarchy that clips,
1426 bool RenderLayerCompositor::clippedByAncestor(RenderLayer* layer) const
1428 if (!layer->isComposited() || !layer->parent())
1431 RenderLayer* compositingAncestor = layer->ancestorCompositingLayer();
1437 // and layer.
1439 RenderLayer* curr = layer;
1449 if (!computeClipRoot || computeClipRoot == layer)
1452 IntRect backgroundRect = layer->backgroundClipRect(computeClipRoot, true);
1456 // Return true if the given layer is a stacking context and has compositing child
1458 // into the hierarchy between this layer and its children in the z-order hierarchy.
1459 bool RenderLayerCompositor::clipsCompositingDescendants(const RenderLayer* layer) const
1462 if (layer->hasOverflowScroll())
1465 return layer->hasCompositingDescendant() &&
1466 (layer->renderer()->hasOverflowClip() || layer->renderer()->hasClip());
1535 return pluginRenderer->hasLayer() && pluginRenderer->layer()->isComposited();
1566 return frameRenderer->hasLayer() && frameRenderer->layer()->isComposited();
1606 // layer background, so we need an extra 'contents' layer for the foreground of the layer
1608 bool RenderLayerCompositor::needsContentsCompositingLayer(const RenderLayer* layer) const
1610 return (layer->m_negZOrderList && layer->m_negZOrderList->size() > 0);
1750 // Create a layer to host the clipping layer and the overflow controls layers.
1756 // Create a clipping layer if this is an iframe
1845 // The layer will get hooked up via RenderLayerBacking::updateGraphicsLayerConfiguration()
1863 // The layer will get unhooked up via RenderLayerBacking::updateGraphicsLayerConfiguration()
1898 // The attachment can affect whether the RenderView layer's paintingGoesToWindow() behavior,
1900 RenderLayer* layer = m_renderView->layer();
1901 if (RenderLayerBacking* backing = layer ? layer->backing() : 0)
1938 bool RenderLayerCompositor::layerHas3DContent(const RenderLayer* layer) const
1940 const RenderStyle* style = layer->renderer()->style();
1948 if (layer->isStackingContext()) {
1949 if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) {
1958 if (Vector<RenderLayer*>* posZOrderList = layer->posZOrderList()) {
1968 if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) {
1979 void RenderLayerCompositor::updateContentsScale(float scale, RenderLayer* layer)
1981 if (!layer)
1982 layer = rootRenderLayer();
1984 layer->updateContentsScale(scale);
1986 if (layer->isStackingContext()) {
1987 if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) {
1993 if (Vector<RenderLayer*>* posZOrderList = layer->posZOrderList()) {
2000 if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) {