| Index: Source/core/css/resolver/StyleResolverParentScope.h
|
| diff --git a/Source/core/css/resolver/StyleResolverParentScope.h b/Source/core/css/resolver/StyleResolverParentScope.h
|
| index 58624fa2b83269747e2cdc72de92f9a1b22832ed..8972b42088bfcce55f34b329c772e4037348155a 100644
|
| --- a/Source/core/css/resolver/StyleResolverParentScope.h
|
| +++ b/Source/core/css/resolver/StyleResolverParentScope.h
|
| @@ -7,13 +7,14 @@
|
|
|
| #include "core/css/resolver/StyleResolver.h"
|
| #include "core/dom/Element.h"
|
| +#include "core/dom/shadow/ShadowRoot.h"
|
|
|
| namespace WebCore {
|
|
|
| // Maintains the parent element stack (and bloom filter) inside recalcStyle.
|
| class StyleResolverParentScope FINAL {
|
| public:
|
| - explicit StyleResolverParentScope(Element& parent);
|
| + explicit StyleResolverParentScope(Node& parent);
|
| ~StyleResolverParentScope();
|
|
|
| static void ensureParentStackIsPushed();
|
| @@ -21,27 +22,34 @@ public:
|
| private:
|
| void pushParentIfNeeded();
|
|
|
| - Element& m_parent;
|
| + Node& m_parent;
|
| bool m_pushed;
|
| StyleResolverParentScope* m_previous;
|
| + StyleResolver& m_resolver;
|
|
|
| static StyleResolverParentScope* s_currentScope;
|
| };
|
|
|
| -inline StyleResolverParentScope::StyleResolverParentScope(Element& parent)
|
| +inline StyleResolverParentScope::StyleResolverParentScope(Node& parent)
|
| : m_parent(parent)
|
| , m_pushed(false)
|
| , m_previous(s_currentScope)
|
| + , m_resolver(*m_parent.document().styleResolver())
|
| {
|
| ASSERT(m_parent.document().inStyleRecalc());
|
| + ASSERT(parent.isElementNode() || parent.isShadowRoot());
|
| s_currentScope = this;
|
| }
|
|
|
| inline StyleResolverParentScope::~StyleResolverParentScope()
|
| {
|
| - if (m_pushed)
|
| - m_parent.document().styleResolver()->popParentElement(m_parent);
|
| s_currentScope = m_previous;
|
| + if (!m_pushed)
|
| + return;
|
| + if (m_parent.isElementNode())
|
| + m_resolver.popParentElement(toElement(m_parent));
|
| + else
|
| + m_resolver.popParentShadowRoot(toShadowRoot(m_parent));
|
| }
|
|
|
| inline void StyleResolverParentScope::ensureParentStackIsPushed()
|
| @@ -56,7 +64,10 @@ inline void StyleResolverParentScope::pushParentIfNeeded()
|
| return;
|
| if (m_previous)
|
| m_previous->pushParentIfNeeded();
|
| - m_parent.document().styleResolver()->pushParentElement(m_parent);
|
| + if (m_parent.isElementNode())
|
| + m_resolver.pushParentElement(toElement(m_parent));
|
| + else
|
| + m_resolver.pushParentShadowRoot(toShadowRoot(m_parent));
|
| m_pushed = true;
|
| }
|
|
|
|
|