Exemple #1
0
int RenderSVGRoot::computeReplacedLogicalHeight() const
{
    int replacedHeight = RenderBox::computeReplacedLogicalHeight();

    Frame* frame = node() && node()->document() ? node()->document()->frame() : 0;
    if (!frame)
        return computeIntrinsicHeight(replacedHeight);

    // If our frame has an owner renderer, we're embedded through eg. object/embed.
    RenderPart* ownerRenderer = frame->ownerRenderer();
    if (!ownerRenderer)
        return computeIntrinsicHeight(replacedHeight);

    RenderStyle* ownerRendererStyle = ownerRenderer->style();
    ASSERT(ownerRendererStyle);
    ASSERT(frame->contentRenderer());

    Length ownerHeight = ownerRendererStyle->height();
    if (ownerHeight.isAuto())
        return replacedHeight;

    // Spec: http://dev.w3.org/SVG/profiles/1.1F2/publish/coords.html#ViewportSpace
    // See comment in RenderSVGRoot::computeReplacedLogicalWidth().
    // Similarly, if there are positioning properties specified on the referencing element or on the outermost svg element that
    // are sufficient to establish the height of the viewport, then these positioning properties establish the viewport's height;
    // otherwise, the ‘height’ attribute on the outermost svg element establishes the viewport's height.
    return ownerRenderer->computeReplacedLogicalHeightRespectingMinMaxHeight(ownerRenderer->computeReplacedLogicalHeightUsing(ownerHeight));
}
Exemple #2
0
LayoutUnit RenderSVGRoot::computeReplacedLogicalHeight() const
{
    // When we're embedded through SVGImage (border-image/background-image/<html:img>/...) we're forced to resize to a specific size.
    LayoutUnit replacedHeight = m_containerSize.height();
    if (replacedHeight > 0)
        return replacedHeight;

    replacedHeight = RenderBox::computeReplacedLogicalHeight();
    Frame* frame = node() && node()->document() ? node()->document()->frame() : 0;
    if (!frame)
        return replacedHeight;

    if (!isEmbeddedThroughFrameContainingSVGDocument())
        return replacedHeight;

    RenderPart* ownerRenderer = frame->ownerRenderer();
    ASSERT(ownerRenderer);

    RenderStyle* ownerRendererStyle = ownerRenderer->style();
    ASSERT(ownerRendererStyle);

    Length ownerHeight = ownerRendererStyle->height();
    if (ownerHeight.isAuto())
        return replacedHeight;

    // Spec: http://dev.w3.org/SVG/profiles/1.1F2/publish/coords.html#ViewportSpace
    // See comment in RenderSVGRoot::computeReplacedLogicalWidth().
    // Similarly, if there are positioning properties specified on the referencing element or on the outermost svg element that
    // are sufficient to establish the height of the viewport, then these positioning properties establish the viewport's height;
    // otherwise, the ‘height’ attribute on the outermost svg element establishes the viewport's height.
    return ownerRenderer->computeReplacedLogicalHeightRespectingMinMaxHeight(ownerRenderer->computeReplacedLogicalHeightUsing(ownerHeight));
}