Index: Source/core/css/resolver/StyleResolverState.cpp |
diff --git a/Source/core/css/resolver/StyleResolverState.cpp b/Source/core/css/resolver/StyleResolverState.cpp |
index caefee7f02b5c2591f28120c6f49ba400abefb28..b98a30c462b6c895bc825bfdc876da8421f1ac68 100644 |
--- a/Source/core/css/resolver/StyleResolverState.cpp |
+++ b/Source/core/css/resolver/StyleResolverState.cpp |
@@ -29,21 +29,15 @@ |
namespace WebCore { |
-StyleResolverState::StyleResolverState(Document* document, Element* element, RenderStyle* parentStyle, RenderRegion* regionForStyling) |
- : m_regionForStyling(0) |
+StyleResolverState::StyleResolverState(Document& document, Element* element, RenderStyle* parentStyle, RenderRegion* regionForStyling) |
+ : m_elementContext(element ? ElementResolveContext(element) : ElementResolveContext()) |
+ , m_document(element ? m_elementContext.document() : document) |
+ , m_regionForStyling(0) |
, m_applyPropertyToRegularStyle(true) |
, m_applyPropertyToVisitedLinkStyle(false) |
, m_lineHeightValue(0) |
, m_styleMap(*this, m_elementStyleResources) |
{ |
- if (element) { |
- m_elementContext = ElementResolveContext(element); |
- m_document = &m_elementContext.document(); |
- } else { |
- m_elementContext = ElementResolveContext(); |
- m_document = document; |
- } |
- |
m_regionForStyling = regionForStyling; |
if (m_elementContext.resetStyleInheritance()) |
@@ -62,7 +56,7 @@ StyleResolverState::StyleResolverState(Document* document, Element* element, Ren |
// FIXME: StyleResolverState is never passed between documents |
// so we should be able to do this initialization at StyleResolverState |
// createion time instead of now, correct? |
- if (Page* page = document->page()) |
+ if (Page* page = document.page()) |
m_elementStyleResources.setDeviceScaleFactor(page->deviceScaleFactor()); |
} |