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

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, 10 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 finishAppendAuthorStyleSheets(); 106 void finishAppendAuthorStyleSheets();
107 107
108 void lazyAppendAuthorStyleSheets(unsigned firstNew, const WillBeHeapVector<R efPtrWillBeMember<CSSStyleSheet>>&); 108 void lazyAppendAuthorStyleSheets(unsigned firstNew, const HeapVector<Member< CSSStyleSheet>>&);
109 void removePendingAuthorStyleSheets(const WillBeHeapVector<RefPtrWillBeMembe r<CSSStyleSheet>>&); 109 void removePendingAuthorStyleSheets(const HeapVector<Member<CSSStyleSheet>>& );
110 void appendPendingAuthorStyleSheets(); 110 void appendPendingAuthorStyleSheets();
111 bool hasPendingAuthorStyleSheets() const { return m_pendingStyleSheets.size( ) > 0 || m_needCollectFeatures; } 111 bool hasPendingAuthorStyleSheets() const { return m_pendingStyleSheets.size( ) > 0 || m_needCollectFeatures; }
112 112
113 // TODO(esprehn): StyleResolver should probably not contain tree walking 113 // TODO(esprehn): StyleResolver should probably not contain tree walking
114 // state, instead we should pass a context object during recalcStyle. 114 // state, instead we should pass a context object during recalcStyle.
115 SelectorFilter& selectorFilter() { return m_selectorFilter; } 115 SelectorFilter& selectorFilter() { return m_selectorFilter; }
116 116
117 StyleRuleKeyframes* findKeyframesRule(const Element*, const AtomicString& an imationName); 117 StyleRuleKeyframes* findKeyframesRule(const Element*, const AtomicString& an imationName);
118 118
119 // These methods will give back the set of rules that matched for a given el ement (or a pseudo-element). 119 // These methods will give back the set of rules that matched for a given el ement (or a pseudo-element).
120 enum CSSRuleFilter { 120 enum CSSRuleFilter {
121 UAAndUserCSSRules = 1 << 1, 121 UAAndUserCSSRules = 1 << 1,
122 AuthorCSSRules = 1 << 2, 122 AuthorCSSRules = 1 << 2,
123 EmptyCSSRules = 1 << 3, 123 EmptyCSSRules = 1 << 3,
124 CrossOriginCSSRules = 1 << 4, 124 CrossOriginCSSRules = 1 << 4,
125 AllButEmptyCSSRules = UAAndUserCSSRules | AuthorCSSRules | CrossOriginCS SRules, 125 AllButEmptyCSSRules = UAAndUserCSSRules | AuthorCSSRules | CrossOriginCS SRules,
126 AllCSSRules = AllButEmptyCSSRules | EmptyCSSRules, 126 AllCSSRules = AllButEmptyCSSRules | EmptyCSSRules,
127 }; 127 };
128 PassRefPtrWillBeRawPtr<CSSRuleList> cssRulesForElement(Element*, unsigned ru lesToInclude = AllButEmptyCSSRules); 128 RawPtr<CSSRuleList> cssRulesForElement(Element*, unsigned rulesToInclude = A llButEmptyCSSRules);
129 PassRefPtrWillBeRawPtr<CSSRuleList> pseudoCSSRulesForElement(Element*, Pseud oId, unsigned rulesToInclude = AllButEmptyCSSRules); 129 RawPtr<CSSRuleList> pseudoCSSRulesForElement(Element*, PseudoId, unsigned ru lesToInclude = AllButEmptyCSSRules);
130 PassRefPtrWillBeRawPtr<StyleRuleList> styleRulesForElement(Element*, unsigne d rulesToInclude); 130 RawPtr<StyleRuleList> styleRulesForElement(Element*, unsigned rulesToInclude );
131 131
132 void computeFont(ComputedStyle*, const StylePropertySet&); 132 void computeFont(ComputedStyle*, const StylePropertySet&);
133 133
134 ViewportStyleResolver* viewportStyleResolver() { return m_viewportStyleResol ver.get(); } 134 ViewportStyleResolver* viewportStyleResolver() { return m_viewportStyleResol ver.get(); }
135 135
136 void addViewportDependentMediaQueries(const MediaQueryResultList&); 136 void addViewportDependentMediaQueries(const MediaQueryResultList&);
137 bool hasViewportDependentMediaQueries() const { return !m_viewportDependentM ediaQueryResults.isEmpty(); } 137 bool hasViewportDependentMediaQueries() const { return !m_viewportDependentM ediaQueryResults.isEmpty(); }
138 bool mediaQueryAffectedByViewportChange() const; 138 bool mediaQueryAffectedByViewportChange() const;
139 void addDeviceDependentMediaQueries(const MediaQueryResultList&); 139 void addDeviceDependentMediaQueries(const MediaQueryResultList&);
140 bool mediaQueryAffectedByDeviceChange() const; 140 bool mediaQueryAffectedByDeviceChange() const;
(...skipping 21 matching lines...) Expand all
162 StyleSharingList& styleSharingList(); 162 StyleSharingList& styleSharingList();
163 163
164 bool hasRulesForId(const AtomicString&) const; 164 bool hasRulesForId(const AtomicString&) const;
165 165
166 void addToStyleSharingList(Element&); 166 void addToStyleSharingList(Element&);
167 void clearStyleSharingList(); 167 void clearStyleSharingList();
168 168
169 void increaseStyleSharingDepth() { ++m_styleSharingDepth; } 169 void increaseStyleSharingDepth() { ++m_styleSharingDepth; }
170 void decreaseStyleSharingDepth() { --m_styleSharingDepth; } 170 void decreaseStyleSharingDepth() { --m_styleSharingDepth; }
171 171
172 PassRefPtrWillBeRawPtr<PseudoElement> createPseudoElementIfNeeded(Element& p arent, PseudoId); 172 RawPtr<PseudoElement> createPseudoElementIfNeeded(Element& parent, PseudoId) ;
173 173
174 DECLARE_TRACE(); 174 DECLARE_TRACE();
175 175
176 void addTreeBoundaryCrossingScope(ContainerNode& scope); 176 void addTreeBoundaryCrossingScope(ContainerNode& scope);
177 177
178 private: 178 private:
179 explicit StyleResolver(Document&); 179 explicit StyleResolver(Document&);
180 180
181 PassRefPtr<ComputedStyle> initialStyleForElement(); 181 PassRefPtr<ComputedStyle> initialStyleForElement();
182 182
(...skipping 26 matching lines...) Expand all
209 void applyProperties(StyleResolverState&, const StylePropertySet* properties , bool isImportant, bool inheritedOnly, PropertyWhitelistType = PropertyWhitelis tNone); 209 void applyProperties(StyleResolverState&, const StylePropertySet* properties , bool isImportant, bool inheritedOnly, PropertyWhitelistType = PropertyWhitelis tNone);
210 template <CSSPropertyPriority priority> 210 template <CSSPropertyPriority priority>
211 void applyAnimatedProperties(StyleResolverState&, const ActiveInterpolations Map&); 211 void applyAnimatedProperties(StyleResolverState&, const ActiveInterpolations Map&);
212 template <CSSPropertyPriority priority> 212 template <CSSPropertyPriority priority>
213 void applyAllProperty(StyleResolverState&, CSSValue*, bool inheritedOnly, Pr opertyWhitelistType); 213 void applyAllProperty(StyleResolverState&, CSSValue*, bool inheritedOnly, Pr opertyWhitelistType);
214 214
215 bool pseudoStyleForElementInternal(Element&, const PseudoStyleRequest&, cons t ComputedStyle* parentStyle, StyleResolverState&); 215 bool pseudoStyleForElementInternal(Element&, const PseudoStyleRequest&, cons t ComputedStyle* parentStyle, StyleResolverState&);
216 bool hasAuthorBackground(const StyleResolverState&); 216 bool hasAuthorBackground(const StyleResolverState&);
217 bool hasAuthorBorder(const StyleResolverState&); 217 bool hasAuthorBorder(const StyleResolverState&);
218 218
219 PassRefPtrWillBeRawPtr<PseudoElement> createPseudoElement(Element* parent, P seudoId); 219 RawPtr<PseudoElement> createPseudoElement(Element* parent, PseudoId);
220 220
221 Document& document() { return *m_document; } 221 Document& document() { return *m_document; }
222 222
223 static ComputedStyle* s_styleNotYetAvailable; 223 static ComputedStyle* s_styleNotYetAvailable;
224 224
225 MatchedPropertiesCache m_matchedPropertiesCache; 225 MatchedPropertiesCache m_matchedPropertiesCache;
226 226
227 OwnPtrWillBeMember<MediaQueryEvaluator> m_medium; 227 Member<MediaQueryEvaluator> m_medium;
228 MediaQueryResultList m_viewportDependentMediaQueryResults; 228 MediaQueryResultList m_viewportDependentMediaQueryResults;
229 MediaQueryResultList m_deviceDependentMediaQueryResults; 229 MediaQueryResultList m_deviceDependentMediaQueryResults;
230 230
231 RawPtrWillBeMember<Document> m_document; 231 Member<Document> m_document;
232 SelectorFilter m_selectorFilter; 232 SelectorFilter m_selectorFilter;
233 233
234 OwnPtrWillBeMember<ViewportStyleResolver> m_viewportStyleResolver; 234 Member<ViewportStyleResolver> m_viewportStyleResolver;
235 235
236 WillBeHeapListHashSet<RawPtrWillBeMember<CSSStyleSheet>, 16> m_pendingStyleS heets; 236 HeapListHashSet<Member<CSSStyleSheet>, 16> m_pendingStyleSheets;
237 237
238 // FIXME: The entire logic of collecting features on StyleResolver, as well as transferring them 238 // FIXME: The entire logic of collecting features on StyleResolver, as well as transferring them
239 // between various parts of machinery smells wrong. This needs to be better somehow. 239 // between various parts of machinery smells wrong. This needs to be better somehow.
240 RuleFeatureSet m_features; 240 RuleFeatureSet m_features;
241 OwnPtrWillBeMember<RuleSet> m_siblingRuleSet; 241 Member<RuleSet> m_siblingRuleSet;
242 OwnPtrWillBeMember<RuleSet> m_uncommonAttributeRuleSet; 242 Member<RuleSet> m_uncommonAttributeRuleSet;
243 OwnPtrWillBeMember<RuleSet> m_watchedSelectorsRules; 243 Member<RuleSet> m_watchedSelectorsRules;
244 244
245 DocumentOrderedList m_treeBoundaryCrossingScopes; 245 DocumentOrderedList m_treeBoundaryCrossingScopes;
246 246
247 bool m_needCollectFeatures; 247 bool m_needCollectFeatures;
248 bool m_printMediaType; 248 bool m_printMediaType;
249 249
250 unsigned m_styleSharingDepth; 250 unsigned m_styleSharingDepth;
251 WillBeHeapVector<OwnPtrWillBeMember<StyleSharingList>, styleSharingMaxDepth> m_styleSharingLists; 251 HeapVector<Member<StyleSharingList>, styleSharingMaxDepth> m_styleSharingLis ts;
252 }; 252 };
253 253
254 } // namespace blink 254 } // namespace blink
255 255
256 #endif // StyleResolver_h 256 #endif // StyleResolver_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698