OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef StyleResolverParentScope_h | 5 #ifndef StyleResolverParentScope_h |
6 #define StyleResolverParentScope_h | 6 #define StyleResolverParentScope_h |
7 | 7 |
8 #include "core/css/resolver/StyleResolver.h" | 8 #include "core/css/resolver/StyleResolver.h" |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/dom/Element.h" | 10 #include "core/dom/Element.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 | 45 |
46 inline StyleResolverParentScope::~StyleResolverParentScope() | 46 inline StyleResolverParentScope::~StyleResolverParentScope() |
47 { | 47 { |
48 s_currentScope = m_previous; | 48 s_currentScope = m_previous; |
49 m_resolver.decreaseStyleSharingDepth(); | 49 m_resolver.decreaseStyleSharingDepth(); |
50 if (!m_pushed) | 50 if (!m_pushed) |
51 return; | 51 return; |
52 if (m_parent.isElementNode()) | 52 if (m_parent.isElementNode()) |
53 m_resolver.popParentElement(toElement(m_parent)); | 53 m_resolver.popParentElement(toElement(m_parent)); |
54 else | |
55 m_resolver.popParentShadowRoot(toShadowRoot(m_parent)); | |
56 } | 54 } |
57 | 55 |
58 inline void StyleResolverParentScope::ensureParentStackIsPushed() | 56 inline void StyleResolverParentScope::ensureParentStackIsPushed() |
59 { | 57 { |
60 if (s_currentScope) | 58 if (s_currentScope) |
61 s_currentScope->pushParentIfNeeded(); | 59 s_currentScope->pushParentIfNeeded(); |
62 } | 60 } |
63 | 61 |
64 inline void StyleResolverParentScope::pushParentIfNeeded() | 62 inline void StyleResolverParentScope::pushParentIfNeeded() |
65 { | 63 { |
66 if (m_pushed) | 64 if (m_pushed) |
67 return; | 65 return; |
68 if (m_previous) | 66 if (m_previous) |
69 m_previous->pushParentIfNeeded(); | 67 m_previous->pushParentIfNeeded(); |
70 if (m_parent.isElementNode()) | 68 if (m_parent.isElementNode()) |
71 m_resolver.pushParentElement(toElement(m_parent)); | 69 m_resolver.pushParentElement(toElement(m_parent)); |
72 else | |
73 m_resolver.pushParentShadowRoot(toShadowRoot(m_parent)); | |
74 m_pushed = true; | 70 m_pushed = true; |
75 } | 71 } |
76 | 72 |
77 } // namespace blink | 73 } // namespace blink |
78 | 74 |
79 #endif // StyleResolverParentScope_h | 75 #endif // StyleResolverParentScope_h |
OLD | NEW |