Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(687)

Unified Diff: Source/core/css/resolver/ElementResolveContext.cpp

Issue 686723002: Improve RAII of StyleResolverState. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix assertions. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/css/resolver/ElementResolveContext.cpp
diff --git a/Source/core/css/resolver/ElementResolveContext.cpp b/Source/core/css/resolver/ElementResolveContext.cpp
index 40008283689d0ecd3035fb2dba264d1b7621c678..51a86a37a10c6aee5e893481eac3771033f877b5 100644
--- a/Source/core/css/resolver/ElementResolveContext.cpp
+++ b/Source/core/css/resolver/ElementResolveContext.cpp
@@ -32,14 +32,16 @@ namespace blink {
ElementResolveContext::ElementResolveContext(const Document& document)
: m_element(nullptr)
, m_parentNode(nullptr)
+ , m_parentStyle(nullptr)
, m_rootElementStyle(document.documentElement() ? document.documentElement()->renderStyle() : document.renderStyle())
, m_elementLinkState(NotInsideLink)
, m_distributedToInsertionPoint(false)
{
}
-ElementResolveContext::ElementResolveContext(Element& element)
+ElementResolveContext::ElementResolveContext(Element& element, RenderStyle* parentStyle)
: m_element(&element)
+ , m_parentStyle(parentStyle)
, m_elementLinkState(element.document().visitedLinkState().determineLinkState(element))
, m_distributedToInsertionPoint(false)
{
@@ -53,6 +55,8 @@ ElementResolveContext::ElementResolveContext(Element& element)
m_rootElementStyle = documentElement && element != documentElement ? documentElement->renderStyle() : documentStyle;
if (!m_rootElementStyle)
m_rootElementStyle = documentStyle;
+ if (!m_parentStyle && m_parentNode)
+ m_parentStyle = m_parentNode->renderStyle();
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698