bool SVGRenderSupport::transformToRootChanged(RenderObject* ancestor) { while (ancestor && !ancestor->isSVGRoot()) { if (ancestor->isSVGTransformableContainer()) return toRenderSVGContainer(ancestor)->didTransformToRootUpdate(); if (ancestor->isSVGViewportContainer()) return toRenderSVGViewportContainer(ancestor)->didTransformToRootUpdate(); ancestor = ancestor->parent(); } return false; }
inline bool SVGRenderSupport::layoutSizeOfNearestViewportChanged(const RenderObject* start) { while (start && !start->isSVGRoot() && !start->isSVGViewportContainer()) start = start->parent(); ASSERT(start); ASSERT(start->isSVGRoot() || start->isSVGViewportContainer()); if (start->isSVGViewportContainer()) return toRenderSVGViewportContainer(start)->isLayoutSizeChanged(); return toRenderSVGRoot(start)->isLayoutSizeChanged(); }
static inline bool layoutSizeOfNearestViewportChanged(const RenderElement& renderer) { const RenderElement* start = &renderer; while (start && !start->isSVGRoot() && !start->isSVGViewportContainer()) start = start->parent(); ASSERT(start); ASSERT(start->isSVGRoot() || start->isSVGViewportContainer()); if (start->isSVGViewportContainer()) return toRenderSVGViewportContainer(start)->isLayoutSizeChanged(); return toRenderSVGRoot(start)->isLayoutSizeChanged(); }
FloatSize SVGSVGElement::currentViewportSize() const { Length intrinsicWidth = this->intrinsicWidth(); Length intrinsicHeight = this->intrinsicHeight(); if (intrinsicWidth.isFixed() && intrinsicHeight.isFixed()) return FloatSize(intrinsicWidth.calcFloatValue(0), intrinsicHeight.calcFloatValue(0)); if (!renderer()) return FloatSize(); if (renderer()->isSVGRoot()) { LayoutRect frameRect = toRenderSVGRoot(renderer())->frameRect(); return FloatSize(frameRect.width() / renderer()->style()->effectiveZoom(), frameRect.height() / renderer()->style()->effectiveZoom()); } FloatRect frameRect = toRenderSVGViewportContainer(renderer())->viewport(); return FloatSize(frameRect.width() / renderer()->style()->effectiveZoom(), frameRect.height() / renderer()->style()->effectiveZoom()); }
FloatSize SVGSVGElement::currentViewportSize() const { Length intrinsicWidth = this->intrinsicWidth(); Length intrinsicHeight = this->intrinsicHeight(); if (intrinsicWidth.isFixed() && intrinsicHeight.isFixed()) return FloatSize(floatValueForLength(intrinsicWidth, 0), floatValueForLength(intrinsicHeight, 0)); if (!renderer()) return FloatSize(); if (renderer()->isSVGRoot()) { LayoutRect contentBoxRect = toRenderSVGRoot(renderer())->contentBoxRect(); return FloatSize(contentBoxRect.width() / renderer()->style()->effectiveZoom(), contentBoxRect.height() / renderer()->style()->effectiveZoom()); } FloatRect viewportRect = toRenderSVGViewportContainer(renderer())->viewport(); return FloatSize(viewportRect.width() / renderer()->style()->effectiveZoom(), viewportRect.height() / renderer()->style()->effectiveZoom()); }