void FontBuilder::checkForGenericFamilyChange(const FontDescription& oldDescription, FontDescription& newDescription)
{
    if (newDescription.isAbsoluteSize())
        return;

    if (newDescription.isMonospace() == oldDescription.isMonospace())
        return;

    // For now, lump all families but monospace together.
    if (newDescription.genericFamily() != FontDescription::MonospaceFamily
        && oldDescription.genericFamily() != FontDescription::MonospaceFamily)
        return;

    // We know the parent is monospace or the child is monospace, and that font
    // size was unspecified. We want to scale our font size as appropriate.
    // If the font uses a keyword size, then we refetch from the table rather than
    // multiplying by our scale factor.
    float size;
    if (newDescription.keywordSize()) {
        size = FontSize::fontSizeForKeyword(&m_document, newDescription.keywordSize(), newDescription.isMonospace());
    } else {
        Settings* settings = m_document.settings();
        float fixedScaleFactor = (settings && settings->defaultFixedFontSize() && settings->defaultFontSize())
            ? static_cast<float>(settings->defaultFixedFontSize()) / settings->defaultFontSize()
            : 1;
        size = oldDescription.isMonospace() ?
            newDescription.specifiedSize() / fixedScaleFactor :
            newDescription.specifiedSize() * fixedScaleFactor;
    }

    newDescription.setSpecifiedSize(size);
}
void FontBuilder::updateSpecifiedSize(FontDescription& fontDescription, const ComputedStyle& style)
{
    float specifiedSize = fontDescription.specifiedSize();

    if (!specifiedSize && fontDescription.keywordSize())
        specifiedSize = FontSize::fontSizeForKeyword(&m_document, fontDescription.keywordSize(), fontDescription.isMonospace());

    fontDescription.setSpecifiedSize(specifiedSize);

    checkForGenericFamilyChange(style.fontDescription(), fontDescription);
}
void FontBuilder::setFontSizeInherit(const FontDescription& parentFontDescription, float effectiveZoom)
{
    FontDescriptionChangeScope scope(this);

    float size = parentFontDescription.specifiedSize();

    if (size < 0)
        return;

    scope.fontDescription().setKeywordSize(parentFontDescription.keywordSize());
    setSize(scope.fontDescription(), effectiveZoom, size);
}