StyleResolverState::StyleResolverState(Document& document, Element* element, RenderStyle* parentStyle)
    : m_elementContext(element ? ElementResolveContext(*element) : ElementResolveContext(document))
    , m_document(document)
    , m_style(nullptr)
    , m_cssToLengthConversionData(0, document.renderView())
    , m_parentStyle(parentStyle)
    , m_lineHeightValue(nullptr)
    , m_styleMap(*this, m_elementStyleResources)
{
    if (!parentStyle && m_elementContext.parentNode())
        m_parentStyle = m_elementContext.parentNode()->renderStyle();

    ASSERT(document.isActive());
    m_elementStyleResources.setDeviceScaleFactor(document.frameHost()->deviceScaleFactor());
}
StyleResolverState::StyleResolverState(Document& document, Element* element, RenderStyle* parentStyle)
    : m_elementContext(element ? ElementResolveContext(*element) : ElementResolveContext(document))
    , m_document(document)
    , m_style(nullptr)
    , m_cssToLengthConversionData(0, rootElementStyle(), document.renderView())
    , m_parentStyle(parentStyle)
    , m_applyPropertyToRegularStyle(true)
    , m_applyPropertyToVisitedLinkStyle(false)
    , m_lineHeightValue(nullptr)
    , m_styleMap(*this, m_elementStyleResources)
{
    if (!parentStyle && m_elementContext.parentNode())
        m_parentStyle = m_elementContext.parentNode()->renderStyle();

    // FIXME: Animation unitests will start animations on non-active documents!
    // http://crbug.com/330095
    // ASSERT(document.isActive());
    if (!document.isActive())
        return;
    m_elementStyleResources.setDeviceScaleFactor(document.frameHost()->deviceScaleFactor());
}
StyleResolverState::StyleResolverState(Document& document, Element* element, const ComputedStyle* parentStyle)
    : StyleResolverState(document, element ? ElementResolveContext(*element) : ElementResolveContext(document), parentStyle)
{
}