Beispiel #1
0
bool SVGLayoutSupport::layoutSizeOfNearestViewportChanged(
    const LayoutObject* start) {
  for (; start; start = start->parent()) {
    if (start->isSVGRoot())
      return toLayoutSVGRoot(start)->isLayoutSizeChanged();
    if (start->isSVGViewportContainer())
      return toLayoutSVGViewportContainer(start)->isLayoutSizeChanged();
  }
  ASSERT_NOT_REACHED();
  return false;
}
bool SVGLayoutSupport::transformToRootChanged(LayoutObject* ancestor)
{
    while (ancestor && !ancestor->isSVGRoot()) {
        if (ancestor->isSVGTransformableContainer())
            return toLayoutSVGContainer(ancestor)->didTransformToRootUpdate();
        if (ancestor->isSVGViewportContainer())
            return toLayoutSVGViewportContainer(ancestor)->didTransformToRootUpdate();
        ancestor = ancestor->parent();
    }

    return false;
}
inline bool SVGLayoutSupport::layoutSizeOfNearestViewportChanged(const LayoutObject* start)
{
    while (start && !start->isSVGRoot() && !start->isSVGViewportContainer())
        start = start->parent();

    ASSERT(start);
    ASSERT(start->isSVGRoot() || start->isSVGViewportContainer());
    if (start->isSVGViewportContainer())
        return toLayoutSVGViewportContainer(start)->isLayoutSizeChanged();

    return toLayoutSVGRoot(start)->isLayoutSizeChanged();
}
FloatSize SVGSVGElement::currentViewportSize() const
{
    if (!layoutObject())
        return FloatSize();

    if (layoutObject()->isSVGRoot()) {
        LayoutRect contentBoxRect = toLayoutSVGRoot(layoutObject())->contentBoxRect();
        return FloatSize(contentBoxRect.width() / layoutObject()->style()->effectiveZoom(), contentBoxRect.height() / layoutObject()->style()->effectiveZoom());
    }

    FloatRect viewportRect = toLayoutSVGViewportContainer(layoutObject())->viewport();
    return FloatSize(viewportRect.width(), viewportRect.height());
}
Beispiel #5
0
bool SVGLayoutSupport::screenScaleFactorChanged(const LayoutObject* ancestor)
{
    for (; ancestor; ancestor = ancestor->parent()) {
        if (ancestor->isSVGRoot())
            return toLayoutSVGRoot(ancestor)->didScreenScaleFactorChange();
        if (ancestor->isSVGTransformableContainer())
            return toLayoutSVGTransformableContainer(ancestor)->didScreenScaleFactorChange();
        if (ancestor->isSVGViewportContainer())
            return toLayoutSVGViewportContainer(ancestor)->didScreenScaleFactorChange();
    }
    ASSERT_NOT_REACHED();
    return false;
}