| 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 21 matching lines...) Expand all Loading... |
| 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 StyleResolver; | 40 class StyleResolver; |
| 41 class StyleSheetContents; | 41 class StyleSheetContents; |
| 42 class RuleFeatureSet; |
| 42 | 43 |
| 43 // This class selects a RenderStyle for a given element based on a collection of
stylesheets. | 44 // This class selects a RenderStyle for a given element based on a collection of
stylesheets. |
| 44 class ScopedStyleResolver final { | 45 class ScopedStyleResolver final { |
| 45 WTF_MAKE_NONCOPYABLE(ScopedStyleResolver); | 46 WTF_MAKE_NONCOPYABLE(ScopedStyleResolver); |
| 46 WTF_MAKE_FAST_ALLOCATED; | 47 WTF_MAKE_FAST_ALLOCATED; |
| 47 public: | 48 public: |
| 48 static PassOwnPtr<ScopedStyleResolver> create(TreeScope& scope) | 49 static PassOwnPtr<ScopedStyleResolver> create(TreeScope& scope) |
| 49 { | 50 { |
| 50 return adoptPtr(new ScopedStyleResolver(scope)); | 51 return adoptPtr(new ScopedStyleResolver(scope)); |
| 51 } | 52 } |
| 52 | 53 |
| 53 const TreeScope& treeScope() const { return *m_scope; } | 54 const TreeScope& treeScope() const { return *m_scope; } |
| 54 | 55 |
| 55 public: | 56 public: |
| 56 const StyleRuleKeyframes* keyframeStylesForAnimation(const StringImpl* anima
tionName); | 57 const StyleRuleKeyframes* keyframeStylesForAnimation(const StringImpl* anima
tionName); |
| 57 void addKeyframeStyle(PassRefPtr<StyleRuleKeyframes>); | 58 void addKeyframeStyle(PassRefPtr<StyleRuleKeyframes>); |
| 58 | 59 |
| 59 void collectMatchingAuthorRules(ElementRuleCollector&, bool includeEmptyRule
s, bool applyAuthorStyles, CascadeScope, CascadeOrder = ignoreCascadeOrder); | 60 void collectMatchingAuthorRules(ElementRuleCollector&, bool includeEmptyRule
s, bool applyAuthorStyles, CascadeScope, CascadeOrder = ignoreCascadeOrder); |
| 60 void addRulesFromSheet(CSSStyleSheet*, StyleResolver*); | 61 void addRulesFromSheet(CSSStyleSheet*, StyleResolver*); |
| 61 void collectFeaturesTo(RuleFeatureSet&, HashSet<const StyleSheetContents*>&
visitedSharedStyleSheetContents) const; | 62 |
| 62 void resetAuthorStyle(); | 63 void resetAuthorStyle(); |
| 63 | 64 |
| 65 const RuleFeatureSet& features() const { return m_features; } |
| 66 |
| 64 private: | 67 private: |
| 65 explicit ScopedStyleResolver(TreeScope&); | 68 explicit ScopedStyleResolver(TreeScope&); |
| 66 | 69 |
| 67 RawPtr<TreeScope> m_scope; | 70 RawPtr<TreeScope> m_scope; |
| 68 Vector<RawPtr<CSSStyleSheet> > m_authorStyleSheets; | 71 Vector<RawPtr<CSSStyleSheet> > m_authorStyleSheets; |
| 69 | 72 |
| 70 typedef HashMap<const StringImpl*, RefPtr<StyleRuleKeyframes> > KeyframesRul
eMap; | 73 typedef HashMap<const StringImpl*, RefPtr<StyleRuleKeyframes> > KeyframesRul
eMap; |
| 71 KeyframesRuleMap m_keyframesRuleMap; | 74 KeyframesRuleMap m_keyframesRuleMap; |
| 75 |
| 76 RuleFeatureSet m_features; |
| 72 }; | 77 }; |
| 73 | 78 |
| 74 } // namespace blink | 79 } // namespace blink |
| 75 | 80 |
| 76 #endif // SKY_ENGINE_CORE_CSS_RESOLVER_SCOPEDSTYLERESOLVER_H_ | 81 #endif // SKY_ENGINE_CORE_CSS_RESOLVER_SCOPEDSTYLERESOLVER_H_ |
| OLD | NEW |