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