| 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.
All rights reserved. | 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
| 4 * Copyright (C) 2012 Google Inc. All rights reserved. | 4 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "sky/engine/core/css/ElementRuleCollector.h" | 30 #include "sky/engine/core/css/ElementRuleCollector.h" |
| 31 #include "sky/engine/core/css/RuleSet.h" | 31 #include "sky/engine/core/css/RuleSet.h" |
| 32 #include "sky/engine/core/dom/TreeScope.h" | 32 #include "sky/engine/core/dom/TreeScope.h" |
| 33 #include "sky/engine/wtf/HashMap.h" | 33 #include "sky/engine/wtf/HashMap.h" |
| 34 #include "sky/engine/wtf/HashSet.h" | 34 #include "sky/engine/wtf/HashSet.h" |
| 35 #include "sky/engine/wtf/OwnPtr.h" | 35 #include "sky/engine/wtf/OwnPtr.h" |
| 36 #include "sky/engine/wtf/PassOwnPtr.h" | 36 #include "sky/engine/wtf/PassOwnPtr.h" |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 class MediaQueryEvaluator; | |
| 41 class StyleResolver; | 40 class StyleResolver; |
| 42 class StyleSheetContents; | 41 class StyleSheetContents; |
| 43 | 42 |
| 44 // This class selects a RenderStyle for a given element based on a collection of
stylesheets. | 43 // This class selects a RenderStyle for a given element based on a collection of
stylesheets. |
| 45 class ScopedStyleResolver final { | 44 class ScopedStyleResolver final { |
| 46 WTF_MAKE_NONCOPYABLE(ScopedStyleResolver); | 45 WTF_MAKE_NONCOPYABLE(ScopedStyleResolver); |
| 47 WTF_MAKE_FAST_ALLOCATED; | 46 WTF_MAKE_FAST_ALLOCATED; |
| 48 public: | 47 public: |
| 49 static PassOwnPtr<ScopedStyleResolver> create(TreeScope& scope) | 48 static PassOwnPtr<ScopedStyleResolver> create(TreeScope& scope) |
| 50 { | 49 { |
| 51 return adoptPtr(new ScopedStyleResolver(scope)); | 50 return adoptPtr(new ScopedStyleResolver(scope)); |
| 52 } | 51 } |
| 53 | 52 |
| 54 const TreeScope& treeScope() const { return *m_scope; } | 53 const TreeScope& treeScope() const { return *m_scope; } |
| 55 | 54 |
| 56 public: | 55 public: |
| 57 const StyleRuleKeyframes* keyframeStylesForAnimation(const StringImpl* anima
tionName); | 56 const StyleRuleKeyframes* keyframeStylesForAnimation(const StringImpl* anima
tionName); |
| 58 void addKeyframeStyle(PassRefPtr<StyleRuleKeyframes>); | 57 void addKeyframeStyle(PassRefPtr<StyleRuleKeyframes>); |
| 59 | 58 |
| 60 void collectMatchingAuthorRules(ElementRuleCollector&, bool includeEmptyRule
s, bool applyAuthorStyles, CascadeScope, CascadeOrder = ignoreCascadeOrder); | 59 void collectMatchingAuthorRules(ElementRuleCollector&, bool includeEmptyRule
s, bool applyAuthorStyles, CascadeScope, CascadeOrder = ignoreCascadeOrder); |
| 61 void addRulesFromSheet(CSSStyleSheet*, const MediaQueryEvaluator&, StyleReso
lver*); | 60 void addRulesFromSheet(CSSStyleSheet*, StyleResolver*); |
| 62 void collectFeaturesTo(RuleFeatureSet&, HashSet<const StyleSheetContents*>&
visitedSharedStyleSheetContents) const; | 61 void collectFeaturesTo(RuleFeatureSet&, HashSet<const StyleSheetContents*>&
visitedSharedStyleSheetContents) const; |
| 63 void resetAuthorStyle(); | 62 void resetAuthorStyle(); |
| 64 | 63 |
| 65 private: | 64 private: |
| 66 explicit ScopedStyleResolver(TreeScope& scope) | 65 explicit ScopedStyleResolver(TreeScope& scope) |
| 67 : m_scope(scope) | 66 : m_scope(scope) |
| 68 { | 67 { |
| 69 } | 68 } |
| 70 | 69 |
| 71 RawPtr<TreeScope> m_scope; | 70 RawPtr<TreeScope> m_scope; |
| 72 | 71 |
| 73 Vector<RawPtr<CSSStyleSheet> > m_authorStyleSheets; | 72 Vector<RawPtr<CSSStyleSheet> > m_authorStyleSheets; |
| 74 | 73 |
| 75 typedef HashMap<const StringImpl*, RefPtr<StyleRuleKeyframes> > KeyframesRul
eMap; | 74 typedef HashMap<const StringImpl*, RefPtr<StyleRuleKeyframes> > KeyframesRul
eMap; |
| 76 KeyframesRuleMap m_keyframesRuleMap; | 75 KeyframesRuleMap m_keyframesRuleMap; |
| 77 }; | 76 }; |
| 78 | 77 |
| 79 } // namespace blink | 78 } // namespace blink |
| 80 | 79 |
| 81 #endif // SKY_ENGINE_CORE_CSS_RESOLVER_SCOPEDSTYLERESOLVER_H_ | 80 #endif // SKY_ENGINE_CORE_CSS_RESOLVER_SCOPEDSTYLERESOLVER_H_ |
| OLD | NEW |