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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/StyleResolver.h

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
OLDNEW
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 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 DisallowStyleSharing, 65 DisallowStyleSharing,
66 }; 66 };
67 67
68 enum RuleMatchingBehavior { 68 enum RuleMatchingBehavior {
69 MatchAllRules, 69 MatchAllRules,
70 MatchAllRulesExcludingSMIL 70 MatchAllRulesExcludingSMIL
71 }; 71 };
72 72
73 const unsigned styleSharingListSize = 15; 73 const unsigned styleSharingListSize = 15;
74 const unsigned styleSharingMaxDepth = 32; 74 const unsigned styleSharingMaxDepth = 32;
75 using StyleSharingList = WillBeHeapDeque<RawPtrWillBeMember<Element>, styleShari ngListSize>; 75 using StyleSharingList = HeapDeque<Member<Element>, styleSharingListSize>;
76 using ActiveInterpolationsMap = HashMap<PropertyHandle, Vector<RefPtr<Interpolat ion>, 1>>; 76 using ActiveInterpolationsMap = HashMap<PropertyHandle, Vector<RefPtr<Interpolat ion>, 1>>;
77 77
78 // This class selects a ComputedStyle for a given element based on a collection of stylesheets. 78 // This class selects a ComputedStyle for a given element based on a collection of stylesheets.
79 class CORE_EXPORT StyleResolver final : public NoBaseWillBeGarbageCollectedFinal ized<StyleResolver> { 79 class CORE_EXPORT StyleResolver final : public GarbageCollectedFinalized<StyleRe solver> {
80 WTF_MAKE_NONCOPYABLE(StyleResolver); USING_FAST_MALLOC_WILL_BE_REMOVED(Style Resolver); 80 WTF_MAKE_NONCOPYABLE(StyleResolver);
81 public: 81 public:
82 static PassOwnPtrWillBeRawPtr<StyleResolver> create(Document& document) 82 static RawPtr<StyleResolver> create(Document& document)
83 { 83 {
84 return adoptPtrWillBeNoop(new StyleResolver(document)); 84 return new StyleResolver(document);
85 } 85 }
86 ~StyleResolver(); 86 ~StyleResolver();
87 void dispose(); 87 void dispose();
88 88
89 PassRefPtr<ComputedStyle> styleForElement(Element*, const ComputedStyle* par entStyle = 0, StyleSharingBehavior = AllowStyleSharing, 89 PassRefPtr<ComputedStyle> styleForElement(Element*, const ComputedStyle* par entStyle = 0, StyleSharingBehavior = AllowStyleSharing,
90 RuleMatchingBehavior = MatchAllRules); 90 RuleMatchingBehavior = MatchAllRules);
91 91
92 static PassRefPtr<AnimatableValue> createAnimatableValueSnapshot(Element&, c onst ComputedStyle* baseStyle, CSSPropertyID, CSSValue*); 92 static PassRefPtr<AnimatableValue> createAnimatableValueSnapshot(Element&, c onst ComputedStyle* baseStyle, CSSPropertyID, CSSValue*);
93 static PassRefPtr<AnimatableValue> createAnimatableValueSnapshot(StyleResolv erState&, CSSPropertyID, CSSValue*); 93 static PassRefPtr<AnimatableValue> createAnimatableValueSnapshot(StyleResolv erState&, CSSPropertyID, CSSValue*);
94 94
95 PassRefPtr<ComputedStyle> pseudoStyleForElement(Element*, const PseudoStyleR equest&, const ComputedStyle* parentStyle); 95 PassRefPtr<ComputedStyle> pseudoStyleForElement(Element*, const PseudoStyleR equest&, const ComputedStyle* parentStyle);
96 96
97 PassRefPtr<ComputedStyle> styleForPage(int pageIndex); 97 PassRefPtr<ComputedStyle> styleForPage(int pageIndex);
98 PassRefPtr<ComputedStyle> styleForText(Text*); 98 PassRefPtr<ComputedStyle> styleForText(Text*);
99 99
100 static PassRefPtr<ComputedStyle> styleForDocument(Document&); 100 static PassRefPtr<ComputedStyle> styleForDocument(Document&);
101 101
102 // FIXME: It could be better to call appendAuthorStyleSheets() directly afte r we factor StyleResolver further. 102 // FIXME: It could be better to call appendAuthorStyleSheets() directly afte r we factor StyleResolver further.
103 // https://bugs.webkit.org/show_bug.cgi?id=108890 103 // https://bugs.webkit.org/show_bug.cgi?id=108890
104 void appendAuthorStyleSheets(const WillBeHeapVector<RefPtrWillBeMember<CSSSt yleSheet>>&); 104 void appendAuthorStyleSheets(const HeapVector<Member<CSSStyleSheet>>&);
105 void resetAuthorStyle(TreeScope&); 105 void resetAuthorStyle(TreeScope&);
106 void resetRuleFeatures(); 106 void resetRuleFeatures();
107 void finishAppendAuthorStyleSheets(); 107 void finishAppendAuthorStyleSheets();
108 108
109 void lazyAppendAuthorStyleSheets(unsigned firstNew, const WillBeHeapVector<R efPtrWillBeMember<CSSStyleSheet>>&); 109 void lazyAppendAuthorStyleSheets(unsigned firstNew, const HeapVector<Member< CSSStyleSheet>>&);
110 void removePendingAuthorStyleSheets(const WillBeHeapVector<RefPtrWillBeMembe r<CSSStyleSheet>>&); 110 void removePendingAuthorStyleSheets(const HeapVector<Member<CSSStyleSheet>>& );
111 void appendPendingAuthorStyleSheets(); 111 void appendPendingAuthorStyleSheets();
112 bool hasPendingAuthorStyleSheets() const { return m_pendingStyleSheets.size( ) > 0 || m_needCollectFeatures; } 112 bool hasPendingAuthorStyleSheets() const { return m_pendingStyleSheets.size( ) > 0 || m_needCollectFeatures; }
113 113
114 // TODO(esprehn): StyleResolver should probably not contain tree walking 114 // TODO(esprehn): StyleResolver should probably not contain tree walking
115 // state, instead we should pass a context object during recalcStyle. 115 // state, instead we should pass a context object during recalcStyle.
116 SelectorFilter& selectorFilter() { return m_selectorFilter; } 116 SelectorFilter& selectorFilter() { return m_selectorFilter; }
117 117
118 StyleRuleKeyframes* findKeyframesRule(const Element*, const AtomicString& an imationName); 118 StyleRuleKeyframes* findKeyframesRule(const Element*, const AtomicString& an imationName);
119 119
120 // These methods will give back the set of rules that matched for a given el ement (or a pseudo-element). 120 // These methods will give back the set of rules that matched for a given el ement (or a pseudo-element).
121 enum CSSRuleFilter { 121 enum CSSRuleFilter {
122 UAAndUserCSSRules = 1 << 1, 122 UAAndUserCSSRules = 1 << 1,
123 AuthorCSSRules = 1 << 2, 123 AuthorCSSRules = 1 << 2,
124 EmptyCSSRules = 1 << 3, 124 EmptyCSSRules = 1 << 3,
125 CrossOriginCSSRules = 1 << 4, 125 CrossOriginCSSRules = 1 << 4,
126 AllButEmptyCSSRules = UAAndUserCSSRules | AuthorCSSRules | CrossOriginCS SRules, 126 AllButEmptyCSSRules = UAAndUserCSSRules | AuthorCSSRules | CrossOriginCS SRules,
127 AllCSSRules = AllButEmptyCSSRules | EmptyCSSRules, 127 AllCSSRules = AllButEmptyCSSRules | EmptyCSSRules,
128 }; 128 };
129 PassRefPtrWillBeRawPtr<CSSRuleList> cssRulesForElement(Element*, unsigned ru lesToInclude = AllButEmptyCSSRules); 129 RawPtr<CSSRuleList> cssRulesForElement(Element*, unsigned rulesToInclude = A llButEmptyCSSRules);
130 PassRefPtrWillBeRawPtr<CSSRuleList> pseudoCSSRulesForElement(Element*, Pseud oId, unsigned rulesToInclude = AllButEmptyCSSRules); 130 RawPtr<CSSRuleList> pseudoCSSRulesForElement(Element*, PseudoId, unsigned ru lesToInclude = AllButEmptyCSSRules);
131 PassRefPtrWillBeRawPtr<StyleRuleList> styleRulesForElement(Element*, unsigne d rulesToInclude); 131 RawPtr<StyleRuleList> styleRulesForElement(Element*, unsigned rulesToInclude );
132 132
133 void computeFont(ComputedStyle*, const StylePropertySet&); 133 void computeFont(ComputedStyle*, const StylePropertySet&);
134 134
135 ViewportStyleResolver* viewportStyleResolver() { return m_viewportStyleResol ver.get(); } 135 ViewportStyleResolver* viewportStyleResolver() { return m_viewportStyleResol ver.get(); }
136 136
137 void addViewportDependentMediaQueries(const MediaQueryResultList&); 137 void addViewportDependentMediaQueries(const MediaQueryResultList&);
138 bool hasViewportDependentMediaQueries() const { return !m_viewportDependentM ediaQueryResults.isEmpty(); } 138 bool hasViewportDependentMediaQueries() const { return !m_viewportDependentM ediaQueryResults.isEmpty(); }
139 bool mediaQueryAffectedByViewportChange() const; 139 bool mediaQueryAffectedByViewportChange() const;
140 void addDeviceDependentMediaQueries(const MediaQueryResultList&); 140 void addDeviceDependentMediaQueries(const MediaQueryResultList&);
141 bool mediaQueryAffectedByDeviceChange() const; 141 bool mediaQueryAffectedByDeviceChange() const;
(...skipping 22 matching lines...) Expand all
164 164
165 bool hasRulesForId(const AtomicString&) const; 165 bool hasRulesForId(const AtomicString&) const;
166 bool hasFullscreenUAStyle() const { return m_hasFullscreenUAStyle; } 166 bool hasFullscreenUAStyle() const { return m_hasFullscreenUAStyle; }
167 167
168 void addToStyleSharingList(Element&); 168 void addToStyleSharingList(Element&);
169 void clearStyleSharingList(); 169 void clearStyleSharingList();
170 170
171 void increaseStyleSharingDepth() { ++m_styleSharingDepth; } 171 void increaseStyleSharingDepth() { ++m_styleSharingDepth; }
172 void decreaseStyleSharingDepth() { --m_styleSharingDepth; } 172 void decreaseStyleSharingDepth() { --m_styleSharingDepth; }
173 173
174 PassRefPtrWillBeRawPtr<PseudoElement> createPseudoElementIfNeeded(Element& p arent, PseudoId); 174 RawPtr<PseudoElement> createPseudoElementIfNeeded(Element& parent, PseudoId) ;
175 175
176 DECLARE_TRACE(); 176 DECLARE_TRACE();
177 177
178 void addTreeBoundaryCrossingScope(ContainerNode& scope); 178 void addTreeBoundaryCrossingScope(ContainerNode& scope);
179 void initWatchedSelectorRules(); 179 void initWatchedSelectorRules();
180 180
181 private: 181 private:
182 explicit StyleResolver(Document&); 182 explicit StyleResolver(Document&);
183 183
184 PassRefPtr<ComputedStyle> initialStyleForElement(); 184 PassRefPtr<ComputedStyle> initialStyleForElement();
(...skipping 28 matching lines...) Expand all
213 void applyAnimatedProperties(StyleResolverState&, const ActiveInterpolations Map&); 213 void applyAnimatedProperties(StyleResolverState&, const ActiveInterpolations Map&);
214 template <CSSPropertyPriority priority> 214 template <CSSPropertyPriority priority>
215 void applyAllProperty(StyleResolverState&, CSSValue*, bool inheritedOnly, Pr opertyWhitelistType); 215 void applyAllProperty(StyleResolverState&, CSSValue*, bool inheritedOnly, Pr opertyWhitelistType);
216 template <CSSPropertyPriority priority> 216 template <CSSPropertyPriority priority>
217 void applyPropertiesForApplyAtRule(StyleResolverState&, const CSSValue*, boo l isImportant, bool inheritedOnly, PropertyWhitelistType); 217 void applyPropertiesForApplyAtRule(StyleResolverState&, const CSSValue*, boo l isImportant, bool inheritedOnly, PropertyWhitelistType);
218 218
219 bool pseudoStyleForElementInternal(Element&, const PseudoStyleRequest&, cons t ComputedStyle* parentStyle, StyleResolverState&); 219 bool pseudoStyleForElementInternal(Element&, const PseudoStyleRequest&, cons t ComputedStyle* parentStyle, StyleResolverState&);
220 bool hasAuthorBackground(const StyleResolverState&); 220 bool hasAuthorBackground(const StyleResolverState&);
221 bool hasAuthorBorder(const StyleResolverState&); 221 bool hasAuthorBorder(const StyleResolverState&);
222 222
223 PassRefPtrWillBeRawPtr<PseudoElement> createPseudoElement(Element* parent, P seudoId); 223 RawPtr<PseudoElement> createPseudoElement(Element* parent, PseudoId);
224 224
225 Document& document() { return *m_document; } 225 Document& document() { return *m_document; }
226 226
227 static ComputedStyle* s_styleNotYetAvailable; 227 static ComputedStyle* s_styleNotYetAvailable;
228 228
229 MatchedPropertiesCache m_matchedPropertiesCache; 229 MatchedPropertiesCache m_matchedPropertiesCache;
230 230
231 OwnPtrWillBeMember<MediaQueryEvaluator> m_medium; 231 Member<MediaQueryEvaluator> m_medium;
232 MediaQueryResultList m_viewportDependentMediaQueryResults; 232 MediaQueryResultList m_viewportDependentMediaQueryResults;
233 MediaQueryResultList m_deviceDependentMediaQueryResults; 233 MediaQueryResultList m_deviceDependentMediaQueryResults;
234 234
235 RawPtrWillBeMember<Document> m_document; 235 Member<Document> m_document;
236 SelectorFilter m_selectorFilter; 236 SelectorFilter m_selectorFilter;
237 237
238 OwnPtrWillBeMember<ViewportStyleResolver> m_viewportStyleResolver; 238 Member<ViewportStyleResolver> m_viewportStyleResolver;
239 239
240 WillBeHeapListHashSet<RawPtrWillBeMember<CSSStyleSheet>, 16> m_pendingStyleS heets; 240 HeapListHashSet<Member<CSSStyleSheet>, 16> m_pendingStyleSheets;
241 241
242 // FIXME: The entire logic of collecting features on StyleResolver, as well as transferring them 242 // FIXME: The entire logic of collecting features on StyleResolver, as well as transferring them
243 // between various parts of machinery smells wrong. This needs to be better somehow. 243 // between various parts of machinery smells wrong. This needs to be better somehow.
244 RuleFeatureSet m_features; 244 RuleFeatureSet m_features;
245 OwnPtrWillBeMember<RuleSet> m_siblingRuleSet; 245 Member<RuleSet> m_siblingRuleSet;
246 OwnPtrWillBeMember<RuleSet> m_uncommonAttributeRuleSet; 246 Member<RuleSet> m_uncommonAttributeRuleSet;
247 OwnPtrWillBeMember<RuleSet> m_watchedSelectorsRules; 247 Member<RuleSet> m_watchedSelectorsRules;
248 248
249 DocumentOrderedList m_treeBoundaryCrossingScopes; 249 DocumentOrderedList m_treeBoundaryCrossingScopes;
250 250
251 bool m_needCollectFeatures; 251 bool m_needCollectFeatures;
252 bool m_printMediaType; 252 bool m_printMediaType;
253 bool m_hasFullscreenUAStyle = false; 253 bool m_hasFullscreenUAStyle = false;
254 254
255 unsigned m_styleSharingDepth; 255 unsigned m_styleSharingDepth;
256 WillBeHeapVector<OwnPtrWillBeMember<StyleSharingList>, styleSharingMaxDepth> m_styleSharingLists; 256 HeapVector<Member<StyleSharingList>, styleSharingMaxDepth> m_styleSharingLis ts;
257 }; 257 };
258 258
259 } // namespace blink 259 } // namespace blink
260 260
261 #endif // StyleResolver_h 261 #endif // StyleResolver_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698