OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
4 * Copyright (C) 2012 Google Inc. All rights reserved. | 4 * Copyright (C) 2012 Google Inc. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 typedef HashMap<const StringImpl*, RefPtr<StyleRuleKeyframes> > KeyframesRul
eMap; | 93 typedef HashMap<const StringImpl*, RefPtr<StyleRuleKeyframes> > KeyframesRul
eMap; |
94 KeyframesRuleMap m_keyframesRuleMap; | 94 KeyframesRuleMap m_keyframesRuleMap; |
95 }; | 95 }; |
96 | 96 |
97 class ScopedStyleTree { | 97 class ScopedStyleTree { |
98 WTF_MAKE_NONCOPYABLE(ScopedStyleTree); WTF_MAKE_FAST_ALLOCATED; | 98 WTF_MAKE_NONCOPYABLE(ScopedStyleTree); WTF_MAKE_FAST_ALLOCATED; |
99 public: | 99 public: |
100 ScopedStyleTree() : m_scopedResolverForDocument(0), m_buildInDocumentOrder(t
rue) { } | 100 ScopedStyleTree() : m_scopedResolverForDocument(0), m_buildInDocumentOrder(t
rue) { } |
101 | 101 |
102 ScopedStyleResolver* ensureScopedStyleResolver(const ContainerNode& scopingN
ode); | 102 ScopedStyleResolver* ensureScopedStyleResolver(const ContainerNode& scopingN
ode); |
| 103 ScopedStyleResolver* lookupScopedStyleResolverFor(const ContainerNode* scopi
ngNode) |
| 104 { |
| 105 HashMap<const ContainerNode*, OwnPtr<ScopedStyleResolver> >::iterator it
= m_authorStyles.find(scopingNode); |
| 106 return it != m_authorStyles.end() ? it->value.get() : 0; |
| 107 } |
| 108 |
103 ScopedStyleResolver* scopedStyleResolverFor(const ContainerNode& scopingNode
); | 109 ScopedStyleResolver* scopedStyleResolverFor(const ContainerNode& scopingNode
); |
104 ScopedStyleResolver* addScopedStyleResolver(const ContainerNode& scopingNode
, bool& isNewEntry); | 110 ScopedStyleResolver* addScopedStyleResolver(const ContainerNode& scopingNode
, bool& isNewEntry); |
105 void clear(); | 111 void clear(); |
106 | 112 |
107 // for fast-path. | 113 // for fast-path. |
108 bool hasOnlyScopedResolverForDocument() const { return m_scopedResolverForDo
cument && m_authorStyles.size() == 1; } | 114 bool hasOnlyScopedResolverForDocument() const { return m_scopedResolverForDo
cument && m_authorStyles.size() == 1; } |
109 ScopedStyleResolver* scopedStyleResolverForDocument() { return m_scopedResol
verForDocument; } | 115 ScopedStyleResolver* scopedStyleResolverForDocument() { return m_scopedResol
verForDocument; } |
110 | 116 |
111 void resolveScopedStyles(const Element*, Vector<ScopedStyleResolver*, 8>&); | 117 void resolveScopedStyles(const Element*, Vector<ScopedStyleResolver*, 8>&); |
112 void collectScopedResolversForHostedShadowTrees(const Element*, Vector<Scope
dStyleResolver*, 8>&); | 118 void collectScopedResolversForHostedShadowTrees(const Element*, Vector<Scope
dStyleResolver*, 8>&); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 { | 159 { |
154 if (!cacheIsValid(element)) | 160 if (!cacheIsValid(element)) |
155 resolveStyleCache(element); | 161 resolveStyleCache(element); |
156 | 162 |
157 return m_cache.scopedResolver; | 163 return m_cache.scopedResolver; |
158 } | 164 } |
159 | 165 |
160 } // namespace WebCore | 166 } // namespace WebCore |
161 | 167 |
162 #endif // ScopedStyleResolver_h | 168 #endif // ScopedStyleResolver_h |
OLD | NEW |