Example #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;
}