Index: third_party/WebKit/Source/core/css/resolver/StyleResolverState.h |
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleResolverState.h b/third_party/WebKit/Source/core/css/resolver/StyleResolverState.h |
index 912098578eab311099bae194f3156b6e491747f2..6e0304667d769afbbc740d973709620b5f354937 100644 |
--- a/third_party/WebKit/Source/core/css/resolver/StyleResolverState.h |
+++ b/third_party/WebKit/Source/core/css/resolver/StyleResolverState.h |
@@ -47,12 +47,14 @@ class CORE_EXPORT StyleResolverState { |
STACK_ALLOCATED(); |
WTF_MAKE_NONCOPYABLE(StyleResolverState); |
public: |
+ StyleResolverState(const ComputedStyle* parentStyle); |
StyleResolverState(Document&, const ElementResolveContext&, const ComputedStyle* parentStyle); |
StyleResolverState(Document&, Element*, const ComputedStyle* parentStyle = 0); |
~StyleResolverState(); |
// In FontFaceSet and CanvasRenderingContext2D, we don't have an element to grab the document from. |
// This is why we have to store the document separately. |
+ bool hasDocument() const { return m_document; } |
Document& document() const { return *m_document; } |
// These are all just pass-through methods to ElementResolveContext. |
Element* element() const { return m_elementContext.element(); } |
@@ -67,7 +69,11 @@ public: |
{ |
// FIXME: Improve RAII of StyleResolverState to remove this function. |
m_style = style; |
- m_cssToLengthConversionData = CSSToLengthConversionData(m_style.get(), rootElementStyle(), document().layoutViewItem(), m_style->effectiveZoom()); |
+ if (m_document) { |
+ m_cssToLengthConversionData = CSSToLengthConversionData(m_style.get(), rootElementStyle(), document().layoutViewItem(), m_style->effectiveZoom()); |
+ } else { |
+ m_cssToLengthConversionData = CSSToLengthConversionData(m_style.get(), m_style->effectiveZoom()); |
+ } |
} |
const ComputedStyle* style() const { return m_style.get(); } |
ComputedStyle* style() { return m_style.get(); } |