Example #1
0
void RenderReplaced::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio, bool& isPercentageIntrinsicSize) const
{
    // If there's an embeddedContentBox() of a remote, referenced document available, this code-path should never be used.
    ASSERT(!embeddedContentBox());
    isPercentageIntrinsicSize = false;
    intrinsicSize = FloatSize(intrinsicLogicalWidth(), intrinsicLogicalHeight());

    // Figure out if we need to compute an intrinsic ratio.
    if (intrinsicSize.isEmpty() || !hasAspectRatio())
        return;

    intrinsicRatio = intrinsicSize.width() / intrinsicSize.height();
}
Example #2
0
void LayoutReplaced::computeIntrinsicSizingInfo(
    IntrinsicSizingInfo& intrinsicSizingInfo) const {
    // If there's an embeddedReplacedContent() of a remote, referenced document
    // available, this code-path should never be used.
    ASSERT(!embeddedReplacedContent());
    intrinsicSizingInfo.size = FloatSize(intrinsicLogicalWidth().toFloat(),
                                         intrinsicLogicalHeight().toFloat());

    // Figure out if we need to compute an intrinsic ratio.
    if (intrinsicSizingInfo.size.isEmpty() || !layoutObjectHasAspectRatio(this))
        return;

    intrinsicSizingInfo.aspectRatio = intrinsicSizingInfo.size;
}
int RenderReplaced::computeReplacedLogicalHeight() const
{
    int logicalHeight;
    if (lengthIsSpecified(style()->logicalHeight()))
        logicalHeight = computeReplacedLogicalHeightUsing(style()->logicalHeight());
    else if (m_hasIntrinsicSize)
        logicalHeight = calcAspectRatioLogicalHeight();
    else
        logicalHeight = intrinsicLogicalHeight();

    int minLogicalHeight = computeReplacedLogicalHeightUsing(style()->logicalMinHeight());
    int maxLogicalHeight = style()->logicalMaxHeight().isUndefined() ? logicalHeight : computeReplacedLogicalHeightUsing(style()->logicalMaxHeight());

    return max(minLogicalHeight, min(logicalHeight, maxLogicalHeight));
}