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

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

Issue 2808673004: WIP Support var() references in registered custom property keyframes (Closed)
Patch Set: Created 3 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. 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 enum StyleSharingBehavior { 56 enum StyleSharingBehavior {
57 kAllowStyleSharing, 57 kAllowStyleSharing,
58 kDisallowStyleSharing, 58 kDisallowStyleSharing,
59 }; 59 };
60 60
61 enum RuleMatchingBehavior { kMatchAllRules, kMatchAllRulesExcludingSMIL }; 61 enum RuleMatchingBehavior { kMatchAllRules, kMatchAllRulesExcludingSMIL };
62 62
63 const unsigned kStyleSharingListSize = 15; 63 const unsigned kStyleSharingListSize = 15;
64 const unsigned kStyleSharingMaxDepth = 32; 64 const unsigned kStyleSharingMaxDepth = 32;
65 using StyleSharingList = HeapDeque<Member<Element>, kStyleSharingListSize>; 65 using StyleSharingList = HeapDeque<Member<Element>, kStyleSharingListSize>;
66 using ActiveInterpolationsMap = 66 using ActiveInterpolations = Vector<RefPtr<Interpolation>, 1>;
67 HashMap<PropertyHandle, Vector<RefPtr<Interpolation>, 1>>; 67 using ActiveInterpolationsMap = HashMap<PropertyHandle, ActiveInterpolations>;
68 68
69 // This class selects a ComputedStyle for a given element based on a collection 69 // This class selects a ComputedStyle for a given element based on a collection
70 // of stylesheets. 70 // of stylesheets.
71 class CORE_EXPORT StyleResolver final 71 class CORE_EXPORT StyleResolver final
72 : public GarbageCollectedFinalized<StyleResolver> { 72 : public GarbageCollectedFinalized<StyleResolver> {
73 WTF_MAKE_NONCOPYABLE(StyleResolver); 73 WTF_MAKE_NONCOPYABLE(StyleResolver);
74 74
75 public: 75 public:
76 static StyleResolver* Create(Document& document) { 76 static StyleResolver* Create(Document& document) {
77 return new StyleResolver(document); 77 return new StyleResolver(document);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 void SetFailed() { 212 void SetFailed() {
213 is_inherited_cache_hit = false; 213 is_inherited_cache_hit = false;
214 is_non_inherited_cache_hit = false; 214 is_non_inherited_cache_hit = false;
215 } 215 }
216 }; 216 };
217 217
218 // These flags indicate whether an apply pass for a given CSSPropertyPriority 218 // These flags indicate whether an apply pass for a given CSSPropertyPriority
219 // and isImportant is required. 219 // and isImportant is required.
220 class NeedsApplyPass { 220 class NeedsApplyPass {
221 public: 221 public:
222 bool Get(CSSPropertyPriority priority, bool is_important) const { 222 bool Get(CSSPropertyPriority priority, bool isImportant) const {
223 return flags_[GetIndex(priority, is_important)]; 223 return flags_[GetIndex(priority, isImportant)];
224 } 224 }
225 void Set(CSSPropertyPriority priority, bool is_important) { 225 void Set(CSSPropertyPriority priority, bool is_important) {
226 flags_[GetIndex(priority, is_important)] = true; 226 flags_[GetIndex(priority, is_important)] = true;
227 } 227 }
228 228
229 private: 229 private:
230 static size_t GetIndex(CSSPropertyPriority priority, bool is_important) { 230 static size_t GetIndex(CSSPropertyPriority priority, bool is_important) {
231 DCHECK(priority >= 0 && priority < kPropertyPriorityCount); 231 DCHECK(priority >= 0 && priority < kPropertyPriorityCount);
232 return priority * 2 + is_important; 232 return priority * 2 + is_important;
233 } 233 }
(...skipping 19 matching lines...) Expand all
253 void ApplyMatchedAnimationProperties(StyleResolverState&, 253 void ApplyMatchedAnimationProperties(StyleResolverState&,
254 const MatchResult&, 254 const MatchResult&,
255 const CacheSuccess&, 255 const CacheSuccess&,
256 NeedsApplyPass&); 256 NeedsApplyPass&);
257 void ApplyMatchedStandardProperties(StyleResolverState&, 257 void ApplyMatchedStandardProperties(StyleResolverState&,
258 const MatchResult&, 258 const MatchResult&,
259 const CacheSuccess&, 259 const CacheSuccess&,
260 NeedsApplyPass&); 260 NeedsApplyPass&);
261 void CalculateAnimationUpdate(StyleResolverState&, 261 void CalculateAnimationUpdate(StyleResolverState&,
262 const Element* animating_element); 262 const Element* animating_element);
263 void ApplyAnimatedCustomProperties(StyleResolverState&);
264 void ApplyAnimatedCustomProperty(StyleResolverState&, const PropertyHandle&);
263 bool ApplyAnimatedStandardProperties(StyleResolverState&, const Element*); 265 bool ApplyAnimatedStandardProperties(StyleResolverState&, const Element*);
264 266
265 void ApplyCallbackSelectors(StyleResolverState&); 267 void ApplyCallbackSelectors(StyleResolverState&);
266 268
267 template <CSSPropertyPriority priority, ShouldUpdateNeedsApplyPass> 269 template <CSSPropertyPriority priority, ShouldUpdateNeedsApplyPass>
268 void ApplyMatchedProperties(StyleResolverState&, 270 void ApplyMatchedProperties(StyleResolverState&,
269 const MatchedPropertiesRange&, 271 const MatchedPropertiesRange&,
270 bool important, 272 bool important,
271 bool inherited_only, 273 bool inherited_only,
272 NeedsApplyPass&); 274 NeedsApplyPass&);
273 template <CSSPropertyPriority priority, ShouldUpdateNeedsApplyPass> 275 template <CSSPropertyPriority priority, ShouldUpdateNeedsApplyPass>
274 void ApplyProperties(StyleResolverState&, 276 void ApplyProperties(StyleResolverState&,
275 const StylePropertySet* properties, 277 const StylePropertySet* properties,
276 bool is_important, 278 bool is_important,
277 bool inherited_only, 279 bool inherited_only,
278 NeedsApplyPass&, 280 NeedsApplyPass&,
279 PropertyWhitelistType = kPropertyWhitelistNone); 281 PropertyWhitelistType = kPropertyWhitelistNone);
280 template <CSSPropertyPriority priority> 282 template <CSSPropertyPriority priority>
281 void ApplyAnimatedProperties(StyleResolverState&, 283 void ApplyAnimatedStandardProperties(StyleResolverState&,
282 const ActiveInterpolationsMap&); 284 const ActiveInterpolationsMap&);
283 template <CSSPropertyPriority priority> 285 template <CSSPropertyPriority priority>
284 void ApplyAllProperty(StyleResolverState&, 286 void ApplyAllProperty(StyleResolverState&,
285 const CSSValue&, 287 const CSSValue&,
286 bool inherited_only, 288 bool inherited_only,
287 PropertyWhitelistType); 289 PropertyWhitelistType);
288 template <CSSPropertyPriority priority, ShouldUpdateNeedsApplyPass> 290 template <CSSPropertyPriority priority, ShouldUpdateNeedsApplyPass>
289 void ApplyPropertiesForApplyAtRule(StyleResolverState&, 291 void ApplyPropertiesForApplyAtRule(StyleResolverState&,
290 const CSSValue&, 292 const CSSValue&,
291 bool is_important, 293 bool is_important,
292 NeedsApplyPass&, 294 NeedsApplyPass&,
293 PropertyWhitelistType); 295 PropertyWhitelistType);
294 296
295 bool PseudoStyleForElementInternal(Element&, 297 bool PseudoStyleForElementInternal(Element&,
296 const PseudoStyleRequest&, 298 const PseudoStyleRequest&,
297 const ComputedStyle* parent_style, 299 const ComputedStyle* parentStyle,
298 StyleResolverState&); 300 StyleResolverState&);
299 bool HasAuthorBackground(const StyleResolverState&); 301 bool HasAuthorBackground(const StyleResolverState&);
300 bool HasAuthorBorder(const StyleResolverState&); 302 bool HasAuthorBorder(const StyleResolverState&);
301 303
302 PseudoElement* CreatePseudoElement(Element* parent, PseudoId); 304 PseudoElement* CreatePseudoElement(Element* parent, PseudoId);
303 305
304 Document& GetDocument() const { return *document_; } 306 Document& GetDocument() const { return *document_; }
305 307
306 bool WasViewportResized() const { return was_viewport_resized_; } 308 bool WasViewportResized() const { return was_viewport_resized_; }
307 309
308 static ComputedStyle* style_not_yet_available_; 310 static ComputedStyle* style_not_yet_available_;
309 311
310 MatchedPropertiesCache matched_properties_cache_; 312 MatchedPropertiesCache matched_properties_cache_;
311 Member<Document> document_; 313 Member<Document> document_;
312 SelectorFilter selector_filter_; 314 SelectorFilter selector_filter_;
313 315
314 Member<StyleRuleUsageTracker> tracker_; 316 Member<StyleRuleUsageTracker> tracker_;
315 317
316 bool print_media_type_ = false; 318 bool print_media_type_ = false;
317 bool was_viewport_resized_ = false; 319 bool was_viewport_resized_ = false;
318 320
319 unsigned style_sharing_depth_ = 0; 321 unsigned style_sharing_depth_ = 0;
320 HeapVector<Member<StyleSharingList>, kStyleSharingMaxDepth> 322 HeapVector<Member<StyleSharingList>, kStyleSharingMaxDepth>
321 style_sharing_lists_; 323 style_sharing_lists_;
322 }; 324 };
323 325
324 } // namespace blink 326 } // namespace blink
325 327
326 #endif // StyleResolver_h 328 #endif // StyleResolver_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698