| 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 struct CacheSuccess { | 213 void applyMatchedProperties(StyleResolverState&, const MatchResult&); |
| 214 STACK_ALLOCATED(); | 214 bool applyAnimatedProperties(StyleResolverState&, |
| 215 bool isInheritedCacheHit; | 215 const Element* animatingElement); |
| 216 bool isNonInheritedCacheHit; | 216 void applyCallbackSelectors(StyleResolverState&); |
| 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 }; | |
| 240 | 217 |
| 241 // These flags indicate whether an apply pass for a given CSSPropertyPriority | 218 // These flags indicate whether an apply pass for a given CSSPropertyPriority |
| 242 // and isImportant is required. | 219 // and isImportant is required. |
| 243 class NeedsApplyPass { | 220 class NeedsApplyPass { |
| 244 public: | 221 public: |
| 245 bool get(CSSPropertyPriority priority, bool isImportant) const { | 222 bool get(CSSPropertyPriority priority, bool isImportant) const { |
| 246 return m_flags[getIndex(priority, isImportant)]; | 223 return m_flags[getIndex(priority, isImportant)]; |
| 247 } | 224 } |
| 248 void set(CSSPropertyPriority priority, bool isImportant) { | 225 void set(CSSPropertyPriority priority, bool isImportant) { |
| 249 m_flags[getIndex(priority, isImportant)] = true; | 226 m_flags[getIndex(priority, isImportant)] = true; |
| 250 } | 227 } |
| 251 | 228 |
| 252 private: | 229 private: |
| 253 static size_t getIndex(CSSPropertyPriority priority, bool isImportant) { | 230 static size_t getIndex(CSSPropertyPriority priority, bool isImportant) { |
| 254 DCHECK(priority >= 0 && priority < PropertyPriorityCount); | 231 DCHECK(priority >= 0 && priority < PropertyPriorityCount); |
| 255 return priority * 2 + isImportant; | 232 return priority * 2 + isImportant; |
| 256 } | 233 } |
| 257 bool m_flags[PropertyPriorityCount * 2] = {0}; | 234 bool m_flags[PropertyPriorityCount * 2] = {0}; |
| 258 }; | 235 }; |
| 259 | 236 |
| 260 enum ShouldUpdateNeedsApplyPass { | 237 enum ShouldUpdateNeedsApplyPass { |
| 261 CheckNeedsApplyPass = false, | 238 CheckNeedsApplyPass = false, |
| 262 UpdateNeedsApplyPass = true, | 239 UpdateNeedsApplyPass = true, |
| 263 }; | 240 }; |
| 264 | 241 |
| 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 | |
| 289 template <CSSPropertyPriority priority, ShouldUpdateNeedsApplyPass> | 242 template <CSSPropertyPriority priority, ShouldUpdateNeedsApplyPass> |
| 290 void applyMatchedProperties(StyleResolverState&, | 243 void applyMatchedProperties(StyleResolverState&, |
| 291 const MatchedPropertiesRange&, | 244 const MatchedPropertiesRange&, |
| 292 bool important, | 245 bool important, |
| 293 bool inheritedOnly, | 246 bool inheritedOnly, |
| 294 NeedsApplyPass&); | 247 NeedsApplyPass&); |
| 295 template <CSSPropertyPriority priority, ShouldUpdateNeedsApplyPass> | 248 template <CSSPropertyPriority priority, ShouldUpdateNeedsApplyPass> |
| 296 void applyProperties(StyleResolverState&, | 249 void applyProperties(StyleResolverState&, |
| 297 const StylePropertySet* properties, | 250 const StylePropertySet* properties, |
| 298 bool isImportant, | 251 bool isImportant, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 bool m_printMediaType; | 296 bool m_printMediaType; |
| 344 | 297 |
| 345 unsigned m_styleSharingDepth; | 298 unsigned m_styleSharingDepth; |
| 346 HeapVector<Member<StyleSharingList>, styleSharingMaxDepth> | 299 HeapVector<Member<StyleSharingList>, styleSharingMaxDepth> |
| 347 m_styleSharingLists; | 300 m_styleSharingLists; |
| 348 }; | 301 }; |
| 349 | 302 |
| 350 } // namespace blink | 303 } // namespace blink |
| 351 | 304 |
| 352 #endif // StyleResolver_h | 305 #endif // StyleResolver_h |
| OLD | NEW |