Ejemplo n.º 1
0
AffineTransform SVGLayoutSupport::deprecatedCalculateTransformToLayer(
    const LayoutObject* layoutObject) {
  AffineTransform transform;
  while (layoutObject) {
    transform = layoutObject->localToSVGParentTransform() * transform;
    if (layoutObject->isSVGRoot())
      break;
    layoutObject = layoutObject->parent();
  }

  // Continue walking up the layer tree, accumulating CSS transforms.
  // FIXME: this queries layer compositing state - which is not
  // supported during layout. Hence, the result may not include all CSS
  // transforms.
  PaintLayer* layer = layoutObject ? layoutObject->enclosingLayer() : 0;
  while (layer && layer->isAllowedToQueryCompositingState()) {
    // We can stop at compositing layers, to match the backing resolution.
    // FIXME: should we be computing the transform to the nearest composited
    // layer, or the nearest composited layer that does not paint into its
    // ancestor? I think this is the nearest composited ancestor since we will
    // inherit its transforms in the composited layer tree.
    if (layer->compositingState() != NotComposited)
      break;

    if (TransformationMatrix* layerTransform = layer->transform())
      transform = layerTransform->toAffineTransform() * transform;

    layer = layer->parent();
  }

  return transform;
}
static void paintLayers(PaintLayer& layer, SimDisplayItemList& displayList)
{
    if (layer.isAllowedToQueryCompositingState() && layer.compositingState() == PaintsIntoOwnBacking) {
        CompositedLayerMapping* mapping = layer.compositedLayerMapping();
        GraphicsLayer* graphicsLayer = mapping->mainGraphicsLayer();
        if (graphicsLayer->hasTrackedPaintInvalidations()) {
            ContentLayerDelegate* delegate = graphicsLayer->contentLayerDelegateForTesting();
            delegate->paintContents(&displayList, WebRect(0, 0, layer.size().width(), layer.size().height()));
            graphicsLayer->resetTrackedPaintInvalidations();
        }
    }
    for (PaintLayer* child = layer.firstChild(); child; child = child->nextSibling())
        paintLayers(*child, displayList);
}
bool CompositorAnimations::canAttachCompositedLayers(const Element& element, const Animation& animation)
{
    if (!RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled())
        return false;

    if (!animation.compositorPlayer())
        return false;

    if (!element.layoutObject() || !element.layoutObject()->isBoxModelObject())
        return false;

    PaintLayer* layer = toLayoutBoxModelObject(element.layoutObject())->layer();

    if (!layer || !layer->isAllowedToQueryCompositingState()
        || !layer->compositedLayerMapping()
        || !layer->compositedLayerMapping()->mainGraphicsLayer())
        return false;

    if (!layer->compositedLayerMapping()->mainGraphicsLayer()->platformLayer())
        return false;

    return true;
}