PageScaleConstraintsSet::PageScaleConstraintsSet()
    : m_defaultConstraints(-1, 1, 1)
    , m_finalConstraints(computeConstraintsStack())
    , m_lastContentsWidth(0)
    , m_needsReset(false)
    , m_constraintsDirty(false)
{
}
void PageScaleConstraintsSet::didChangeContentsSize(IntSize contentsSize, float pageScaleFactor)
{
    // If a large fixed-width element expanded the size of the document late in
    // loading and our initial scale is not set (or set to be less than the last
    // minimum scale), reset the page scale factor to the new initial scale.
    if (contentsSize.width() > m_lastContentsWidth
        && pageScaleFactor == finalConstraints().minimumScale
        && computeConstraintsStack().initialScale < finalConstraints().minimumScale)
        setNeedsReset(true);

    m_constraintsDirty = true;
    m_lastContentsWidth = contentsSize.width();
}
void PageScaleConstraintsSet::computeFinalConstraints()
{
    m_finalConstraints = computeConstraintsStack();

    m_constraintsDirty = false;
}
IntSize PageScaleConstraintsSet::layoutSize() const
{
    return flooredIntSize(computeConstraintsStack().layoutSize);
}