Пример #1
0
CString ViewportConfiguration::description() const
{
    TextStream ts;

    ts.startGroup();
    ts << "viewport-configuration " << (void*)this;
    {
        TextStream::GroupScope scope(ts);
        ts << "viewport arguments";
        ts << m_viewportArguments;
    }
    {
        TextStream::GroupScope scope(ts);
        ts << "configuration";
        ts << m_configuration;
    }
    {
        TextStream::GroupScope scope(ts);
        ts << "default configuration";
        ts << m_defaultConfiguration;
    }

    ts.dumpProperty("contentSize", m_contentSize);
    ts.dumpProperty("minimumLayoutSize", m_minimumLayoutSize);
    ts.dumpProperty("computed initial scale", initialScale());
    ts.dumpProperty("computed minimum scale", minimumScale());
    ts.dumpProperty("computed layout size", layoutSize());
    ts.dumpProperty("ignoring horizontal scaling constraints", shouldIgnoreHorizontalScalingConstraints() ? "true" : "false");
    ts.dumpProperty("ignoring vertical scaling constraints", shouldIgnoreVerticalScalingConstraints() ? "true" : "false");
    
    ts.endGroup();

    return ts.release().utf8();
}
Пример #2
0
double ViewportConfiguration::minimumScale() const
{
    // If we scale to fit, then this is our minimum scale as well.
    if (!m_configuration.initialScaleIsSet || shouldIgnoreScalingConstraints())
        return initialScale();

    // If not, we still need to sanity check our value.
    double minimumScale = m_configuration.minimumScale;
    
    if (m_forceAlwaysUserScalable)
        minimumScale = std::min(minimumScale, forceAlwaysUserScalableMinimumScale);

    const FloatSize& minimumLayoutSize = m_minimumLayoutSize;
    double contentWidth = m_contentSize.width();
    if (contentWidth > 0 && contentWidth * minimumScale < minimumLayoutSize.width() && !shouldIgnoreVerticalScalingConstraints())
        minimumScale = minimumLayoutSize.width() / contentWidth;

    double contentHeight = m_contentSize.height();
    if (contentHeight > 0 && contentHeight * minimumScale < minimumLayoutSize.height() && !shouldIgnoreHorizontalScalingConstraints())
        minimumScale = minimumLayoutSize.height() / contentHeight;

    minimumScale = std::min(std::max(minimumScale, m_configuration.minimumScale), m_configuration.maximumScale);

    return minimumScale;
}
Пример #3
0
CString ViewportConfiguration::description() const
{
    TextStream ts;

    ts << "(viewport-configuration " << (void*)this;
    ts << "\n";
    ts.increaseIndent();
    ts.writeIndent();
    ts << "(viewport arguments";
    ts << m_viewportArguments;
    ts << ")";
    ts.decreaseIndent();

    ts << "\n";
    ts.increaseIndent();
    ts.writeIndent();
    ts << "(configuration";
    ts << m_configuration;
    ts << ")";
    ts.decreaseIndent();

    ts << "\n";
    ts.increaseIndent();
    ts.writeIndent();
    ts << "(default configuration";
    ts << m_defaultConfiguration;
    ts << ")";
    ts.decreaseIndent();

    ts.dumpProperty("contentSize", m_contentSize);
    ts.dumpProperty("minimumLayoutSize", m_minimumLayoutSize);

    ts << "\n";
    ts.increaseIndent();
    ts.writeIndent();
    ts << "(computed initial scale " << initialScale() << ")\n";
    ts.writeIndent();
    ts << "(computed minimum scale " << minimumScale() << ")\n";
    ts.writeIndent();
    ts << "(computed layout size " << layoutSize() << ")\n";
    ts.writeIndent();
    ts << "(ignoring horizontal scaling constraints " << (shouldIgnoreHorizontalScalingConstraints() ? "true" : "false") << ")\n";
    ts.writeIndent();
    ts << "(ignoring vertical scaling constraints " << (shouldIgnoreVerticalScalingConstraints() ? "true" : "false") << ")";
    ts.decreaseIndent();

    ts << ")\n";

    return ts.release().utf8();
}