| 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. | 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 void matchUARules(ElementRuleCollector&); | 195 void matchUARules(ElementRuleCollector&); |
| 196 void matchScopedRules(const Element&, ElementRuleCollector&); | 196 void matchScopedRules(const Element&, ElementRuleCollector&); |
| 197 void matchAuthorRules(const Element&, ElementRuleCollector&); | 197 void matchAuthorRules(const Element&, ElementRuleCollector&); |
| 198 void matchAuthorRulesV0(const Element&, ElementRuleCollector&); | 198 void matchAuthorRulesV0(const Element&, ElementRuleCollector&); |
| 199 void matchAllRules(StyleResolverState&, | 199 void matchAllRules(StyleResolverState&, |
| 200 ElementRuleCollector&, | 200 ElementRuleCollector&, |
| 201 bool includeSMILProperties); | 201 bool includeSMILProperties); |
| 202 void collectTreeBoundaryCrossingRulesV0CascadeOrder(const Element&, | 202 void collectTreeBoundaryCrossingRulesV0CascadeOrder(const Element&, |
| 203 ElementRuleCollector&); | 203 ElementRuleCollector&); |
| 204 | 204 |
| 205 void applyMatchedProperties(StyleResolverState&, const MatchResult&); | 205 struct CacheSuccess { |
| 206 bool applyAnimatedProperties(StyleResolverState&, | 206 STACK_ALLOCATED(); |
| 207 const Element* animatingElement); | 207 bool isInheritedCacheHit; |
| 208 void applyCallbackSelectors(StyleResolverState&); | 208 bool isNonInheritedCacheHit; |
| 209 unsigned cacheHash; |
| 210 Member<const CachedMatchedProperties> cachedMatchedProperties; |
| 211 |
| 212 CacheSuccess(bool isInheritedCacheHit, |
| 213 bool isNonInheritedCacheHit, |
| 214 unsigned cacheHash, |
| 215 const CachedMatchedProperties* cachedMatchedProperties) |
| 216 : isInheritedCacheHit(isInheritedCacheHit), |
| 217 isNonInheritedCacheHit(isNonInheritedCacheHit), |
| 218 cacheHash(cacheHash), |
| 219 cachedMatchedProperties(cachedMatchedProperties) {} |
| 220 |
| 221 bool isFullCacheHit() const { |
| 222 return isInheritedCacheHit && isNonInheritedCacheHit; |
| 223 } |
| 224 bool shouldApplyInheritedOnly() const { |
| 225 return isNonInheritedCacheHit && !isInheritedCacheHit; |
| 226 } |
| 227 void setFailed() { |
| 228 isInheritedCacheHit = false; |
| 229 isNonInheritedCacheHit = false; |
| 230 } |
| 231 }; |
| 209 | 232 |
| 210 // These flags indicate whether an apply pass for a given CSSPropertyPriority | 233 // These flags indicate whether an apply pass for a given CSSPropertyPriority |
| 211 // and isImportant is required. | 234 // and isImportant is required. |
| 212 class NeedsApplyPass { | 235 class NeedsApplyPass { |
| 213 public: | 236 public: |
| 214 bool get(CSSPropertyPriority priority, bool isImportant) const { | 237 bool get(CSSPropertyPriority priority, bool isImportant) const { |
| 215 return m_flags[getIndex(priority, isImportant)]; | 238 return m_flags[getIndex(priority, isImportant)]; |
| 216 } | 239 } |
| 217 void set(CSSPropertyPriority priority, bool isImportant) { | 240 void set(CSSPropertyPriority priority, bool isImportant) { |
| 218 m_flags[getIndex(priority, isImportant)] = true; | 241 m_flags[getIndex(priority, isImportant)] = true; |
| 219 } | 242 } |
| 220 | 243 |
| 221 private: | 244 private: |
| 222 static size_t getIndex(CSSPropertyPriority priority, bool isImportant) { | 245 static size_t getIndex(CSSPropertyPriority priority, bool isImportant) { |
| 223 DCHECK(priority >= 0 && priority < PropertyPriorityCount); | 246 DCHECK(priority >= 0 && priority < PropertyPriorityCount); |
| 224 return priority * 2 + isImportant; | 247 return priority * 2 + isImportant; |
| 225 } | 248 } |
| 226 bool m_flags[PropertyPriorityCount * 2] = {0}; | 249 bool m_flags[PropertyPriorityCount * 2] = {0}; |
| 227 }; | 250 }; |
| 228 | 251 |
| 229 enum ShouldUpdateNeedsApplyPass { | 252 enum ShouldUpdateNeedsApplyPass { |
| 230 CheckNeedsApplyPass = false, | 253 CheckNeedsApplyPass = false, |
| 231 UpdateNeedsApplyPass = true, | 254 UpdateNeedsApplyPass = true, |
| 232 }; | 255 }; |
| 233 | 256 |
| 257 void applyMatchedPropertiesAndCustomPropertyAnimations( |
| 258 StyleResolverState&, |
| 259 const MatchResult&, |
| 260 const Element* animatingElement); |
| 261 CacheSuccess applyMatchedCache(StyleResolverState&, const MatchResult&); |
| 262 void applyCustomProperties(StyleResolverState&, |
| 263 const MatchResult&, |
| 264 bool applyAnimations, |
| 265 const CacheSuccess&, |
| 266 NeedsApplyPass&); |
| 267 void applyMatchedAnimationProperties(StyleResolverState&, |
| 268 const MatchResult&, |
| 269 const CacheSuccess&, |
| 270 NeedsApplyPass&); |
| 271 void applyMatchedStandardProperties(StyleResolverState&, |
| 272 const MatchResult&, |
| 273 const CacheSuccess&, |
| 274 NeedsApplyPass&); |
| 275 void calculateAnimationUpdate(StyleResolverState&, |
| 276 const Element* animatingElement); |
| 277 bool applyAnimatedStandardProperties(StyleResolverState&, const Element*); |
| 278 |
| 279 void applyCallbackSelectors(StyleResolverState&); |
| 280 |
| 234 template <CSSPropertyPriority priority, ShouldUpdateNeedsApplyPass> | 281 template <CSSPropertyPriority priority, ShouldUpdateNeedsApplyPass> |
| 235 void applyMatchedProperties(StyleResolverState&, | 282 void applyMatchedProperties(StyleResolverState&, |
| 236 const MatchedPropertiesRange&, | 283 const MatchedPropertiesRange&, |
| 237 bool important, | 284 bool important, |
| 238 bool inheritedOnly, | 285 bool inheritedOnly, |
| 239 NeedsApplyPass&); | 286 NeedsApplyPass&); |
| 240 template <CSSPropertyPriority priority, ShouldUpdateNeedsApplyPass> | 287 template <CSSPropertyPriority priority, ShouldUpdateNeedsApplyPass> |
| 241 void applyProperties(StyleResolverState&, | 288 void applyProperties(StyleResolverState&, |
| 242 const StylePropertySet* properties, | 289 const StylePropertySet* properties, |
| 243 bool isImportant, | 290 bool isImportant, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 bool m_printMediaType = false; | 330 bool m_printMediaType = false; |
| 284 | 331 |
| 285 unsigned m_styleSharingDepth = 0; | 332 unsigned m_styleSharingDepth = 0; |
| 286 HeapVector<Member<StyleSharingList>, styleSharingMaxDepth> | 333 HeapVector<Member<StyleSharingList>, styleSharingMaxDepth> |
| 287 m_styleSharingLists; | 334 m_styleSharingLists; |
| 288 }; | 335 }; |
| 289 | 336 |
| 290 } // namespace blink | 337 } // namespace blink |
| 291 | 338 |
| 292 #endif // StyleResolver_h | 339 #endif // StyleResolver_h |
| OLD | NEW |