Index: Source/core/css/resolver/StyleResolverState.cpp |
diff --git a/Source/core/css/resolver/StyleResolverState.cpp b/Source/core/css/resolver/StyleResolverState.cpp |
index b71a93d26e0c468e25faaac22a6ba6c964247016..bdad2520f3986bba3977eb318da9d752405b70b2 100644 |
--- a/Source/core/css/resolver/StyleResolverState.cpp |
+++ b/Source/core/css/resolver/StyleResolverState.cpp |
@@ -29,20 +29,36 @@ |
namespace blink { |
-StyleResolverState::StyleResolverState(Document& document, Element* element, RenderStyle* parentStyle) |
- : m_elementContext(element ? ElementResolveContext(*element) : ElementResolveContext(document)) |
+StyleResolverState::StyleResolverState(Document& document, const ElementResolveContext& elementContext, PassRefPtr<RenderStyle> style, PassRefPtr<RenderStyle> parentStyle) |
+ : m_elementContext(elementContext) |
, m_document(document) |
- , m_style(nullptr) |
- , m_cssToLengthConversionData(0, rootElementStyle(), document.renderView()) |
- , m_parentStyle(parentStyle) |
+ , m_style(style) |
+ , m_cssToLengthConversionData(m_style.get(), rootElementStyle(), document.renderView()) |
+ , m_parentStyle(parentStyle ? parentStyle : RenderStyle::clone(m_style.get())) |
, m_applyPropertyToRegularStyle(true) |
, m_applyPropertyToVisitedLinkStyle(false) |
- , m_fontBuilder(document) |
+ , m_fontBuilder(document, m_style.get()) |
, m_styleMap(*this, m_elementStyleResources) |
{ |
- if (!parentStyle && m_elementContext.parentNode()) |
- m_parentStyle = m_elementContext.parentNode()->renderStyle(); |
+ ASSERT(this->style()); |
+ ASSERT(this->parentStyle()); |
+ ASSERT(document.isActive()); |
+ m_elementStyleResources.setDeviceScaleFactor(document.frameHost()->deviceScaleFactor()); |
+} |
+StyleResolverState::StyleResolverState(Document& document, Element* element, PassRefPtr<RenderStyle> style, RenderStyle* parentStyle) |
+ : m_elementContext(element ? ElementResolveContext(*element, parentStyle) : ElementResolveContext(document)) |
+ , m_document(document) |
+ , m_style(style) |
+ , m_cssToLengthConversionData(m_style.get(), rootElementStyle(), document.renderView()) |
+ , m_parentStyle(m_elementContext.parentStyle() ? m_elementContext.parentStyle() : RenderStyle::clone(m_style.get())) |
+ , m_applyPropertyToRegularStyle(true) |
+ , m_applyPropertyToVisitedLinkStyle(false) |
+ , m_fontBuilder(document, m_style.get()) |
+ , m_styleMap(*this, m_elementStyleResources) |
+{ |
+ ASSERT(this->style()); |
+ ASSERT(this->parentStyle()); |
ASSERT(document.isActive()); |
m_elementStyleResources.setDeviceScaleFactor(document.frameHost()->deviceScaleFactor()); |
} |