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

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

Issue 2309963002: Apply custom property animation (Closed)
Patch Set: Rebase Created 4 years 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 void matchUARules(ElementRuleCollector&); 203 void matchUARules(ElementRuleCollector&);
204 void matchScopedRules(const Element&, ElementRuleCollector&); 204 void matchScopedRules(const Element&, ElementRuleCollector&);
205 void matchAuthorRules(const Element&, ElementRuleCollector&); 205 void matchAuthorRules(const Element&, ElementRuleCollector&);
206 void matchAuthorRulesV0(const Element&, ElementRuleCollector&); 206 void matchAuthorRulesV0(const Element&, ElementRuleCollector&);
207 void matchAllRules(StyleResolverState&, 207 void matchAllRules(StyleResolverState&,
208 ElementRuleCollector&, 208 ElementRuleCollector&,
209 bool includeSMILProperties); 209 bool includeSMILProperties);
210 void collectTreeBoundaryCrossingRulesV0CascadeOrder(const Element&, 210 void collectTreeBoundaryCrossingRulesV0CascadeOrder(const Element&,
211 ElementRuleCollector&); 211 ElementRuleCollector&);
212 212
213 void applyMatchedProperties(StyleResolverState&, const MatchResult&); 213 struct CacheSuccess {
214 bool applyAnimatedProperties(StyleResolverState&, 214 STACK_ALLOCATED();
215 const Element* animatingElement); 215 bool isInheritedCacheHit;
216 void applyCallbackSelectors(StyleResolverState&); 216 bool isNonInheritedCacheHit;
217 unsigned cacheHash;
218 Member<const CachedMatchedProperties> cachedMatchedProperties;
219
220 CacheSuccess(bool isInheritedCacheHit,
221 bool isNonInheritedCacheHit,
222 unsigned cacheHash,
223 const CachedMatchedProperties* cachedMatchedProperties)
224 : isInheritedCacheHit(isInheritedCacheHit),
225 isNonInheritedCacheHit(isNonInheritedCacheHit),
226 cacheHash(cacheHash),
227 cachedMatchedProperties(cachedMatchedProperties) {}
228
229 bool isFullCacheHit() const {
230 return isInheritedCacheHit && isNonInheritedCacheHit;
231 }
232 bool shouldApplyInheritedOnly() const {
233 return isNonInheritedCacheHit && !isInheritedCacheHit;
234 }
235 void setFailed() {
236 isInheritedCacheHit = false;
237 isNonInheritedCacheHit = false;
238 }
239 };
217 240
218 // These flags indicate whether an apply pass for a given CSSPropertyPriority 241 // These flags indicate whether an apply pass for a given CSSPropertyPriority
219 // and isImportant is required. 242 // and isImportant is required.
220 class NeedsApplyPass { 243 class NeedsApplyPass {
221 public: 244 public:
222 bool get(CSSPropertyPriority priority, bool isImportant) const { 245 bool get(CSSPropertyPriority priority, bool isImportant) const {
223 return m_flags[getIndex(priority, isImportant)]; 246 return m_flags[getIndex(priority, isImportant)];
224 } 247 }
225 void set(CSSPropertyPriority priority, bool isImportant) { 248 void set(CSSPropertyPriority priority, bool isImportant) {
226 m_flags[getIndex(priority, isImportant)] = true; 249 m_flags[getIndex(priority, isImportant)] = true;
227 } 250 }
228 251
229 private: 252 private:
230 static size_t getIndex(CSSPropertyPriority priority, bool isImportant) { 253 static size_t getIndex(CSSPropertyPriority priority, bool isImportant) {
231 DCHECK(priority >= 0 && priority < PropertyPriorityCount); 254 DCHECK(priority >= 0 && priority < PropertyPriorityCount);
232 return priority * 2 + isImportant; 255 return priority * 2 + isImportant;
233 } 256 }
234 bool m_flags[PropertyPriorityCount * 2] = {0}; 257 bool m_flags[PropertyPriorityCount * 2] = {0};
235 }; 258 };
236 259
237 enum ShouldUpdateNeedsApplyPass { 260 enum ShouldUpdateNeedsApplyPass {
238 CheckNeedsApplyPass = false, 261 CheckNeedsApplyPass = false,
239 UpdateNeedsApplyPass = true, 262 UpdateNeedsApplyPass = true,
240 }; 263 };
241 264
265 void applyMatchedPropertiesAndCustomPropertyAnimations(
266 StyleResolverState&,
267 const MatchResult&,
268 const Element* animatingElement);
269 CacheSuccess applyMatchedCache(StyleResolverState&, const MatchResult&);
270 void applyCustomProperties(StyleResolverState&,
271 const MatchResult&,
272 bool applyAnimations,
273 const CacheSuccess&,
274 NeedsApplyPass&);
275 void applyMatchedAnimationProperties(StyleResolverState&,
276 const MatchResult&,
277 const CacheSuccess&,
278 NeedsApplyPass&);
279 void applyMatchedStandardProperties(StyleResolverState&,
280 const MatchResult&,
281 const CacheSuccess&,
282 NeedsApplyPass&);
283 void calculateAnimationUpdate(StyleResolverState&,
284 const Element* animatingElement);
285 bool applyAnimatedStandardProperties(StyleResolverState&, const Element*);
286
287 void applyCallbackSelectors(StyleResolverState&);
288
242 template <CSSPropertyPriority priority, ShouldUpdateNeedsApplyPass> 289 template <CSSPropertyPriority priority, ShouldUpdateNeedsApplyPass>
243 void applyMatchedProperties(StyleResolverState&, 290 void applyMatchedProperties(StyleResolverState&,
244 const MatchedPropertiesRange&, 291 const MatchedPropertiesRange&,
245 bool important, 292 bool important,
246 bool inheritedOnly, 293 bool inheritedOnly,
247 NeedsApplyPass&); 294 NeedsApplyPass&);
248 template <CSSPropertyPriority priority, ShouldUpdateNeedsApplyPass> 295 template <CSSPropertyPriority priority, ShouldUpdateNeedsApplyPass>
249 void applyProperties(StyleResolverState&, 296 void applyProperties(StyleResolverState&,
250 const StylePropertySet* properties, 297 const StylePropertySet* properties,
251 bool isImportant, 298 bool isImportant,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 bool m_printMediaType; 343 bool m_printMediaType;
297 344
298 unsigned m_styleSharingDepth; 345 unsigned m_styleSharingDepth;
299 HeapVector<Member<StyleSharingList>, styleSharingMaxDepth> 346 HeapVector<Member<StyleSharingList>, styleSharingMaxDepth>
300 m_styleSharingLists; 347 m_styleSharingLists;
301 }; 348 };
302 349
303 } // namespace blink 350 } // namespace blink
304 351
305 #endif // StyleResolver_h 352 #endif // StyleResolver_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698