| 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 23 matching lines...) Expand all Loading... |
| 34 #include "sky/engine/core/dom/TreeScope.h" | 34 #include "sky/engine/core/dom/TreeScope.h" |
| 35 #include "sky/engine/wtf/HashMap.h" | 35 #include "sky/engine/wtf/HashMap.h" |
| 36 #include "sky/engine/wtf/HashSet.h" | 36 #include "sky/engine/wtf/HashSet.h" |
| 37 #include "sky/engine/wtf/OwnPtr.h" | 37 #include "sky/engine/wtf/OwnPtr.h" |
| 38 #include "sky/engine/wtf/PassOwnPtr.h" | 38 #include "sky/engine/wtf/PassOwnPtr.h" |
| 39 | 39 |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 class CSSStyleSheet; | 42 class CSSStyleSheet; |
| 43 class ContainerNode; | 43 class ContainerNode; |
| 44 class HTMLStyleElement; | |
| 45 class StyleSheetContents; | 44 class StyleSheetContents; |
| 46 | 45 |
| 47 // This class selects a RenderStyle for a given element based on a collection of
stylesheets. | 46 // This class selects a RenderStyle for a given element based on a collection of
stylesheets. |
| 48 class ScopedStyleResolver final { | 47 class ScopedStyleResolver final { |
| 49 WTF_MAKE_NONCOPYABLE(ScopedStyleResolver); | 48 WTF_MAKE_NONCOPYABLE(ScopedStyleResolver); |
| 50 WTF_MAKE_FAST_ALLOCATED; | 49 WTF_MAKE_FAST_ALLOCATED; |
| 51 public: | 50 public: |
| 52 static PassOwnPtr<ScopedStyleResolver> create(TreeScope& scope) | 51 static PassOwnPtr<ScopedStyleResolver> create(TreeScope& scope) |
| 53 { | 52 { |
| 54 return adoptPtr(new ScopedStyleResolver(scope)); | 53 return adoptPtr(new ScopedStyleResolver(scope)); |
| 55 } | 54 } |
| 56 | 55 |
| 57 const TreeScope& treeScope() const { return m_scope; } | 56 const TreeScope& treeScope() const { return m_scope; } |
| 58 | 57 |
| 59 void collectMatchingAuthorRules(ElementRuleCollector&, CascadeOrder = ignore
CascadeOrder); | 58 void collectMatchingAuthorRules(ElementRuleCollector&, CascadeOrder = ignore
CascadeOrder); |
| 60 void collectMatchingHostRules(ElementRuleCollector&, CascadeOrder = ignoreCa
scadeOrder); | 59 void collectMatchingHostRules(ElementRuleCollector&, CascadeOrder = ignoreCa
scadeOrder); |
| 61 | 60 |
| 62 bool hasSelectorForId(const AtomicString& id) const; | 61 bool hasSelectorForId(const AtomicString& id) const; |
| 63 bool hasSelectorForClass(const AtomicString& className) const; | 62 bool hasSelectorForClass(const AtomicString& className) const; |
| 64 bool hasSelectorForAttribute(const AtomicString& attributeName) const; | 63 bool hasSelectorForAttribute(const AtomicString& attributeName) const; |
| 65 | 64 |
| 66 void updateActiveStyleSheets(); | 65 void updateActiveStyleSheets(); |
| 67 | 66 |
| 68 const Vector<RefPtr<CSSStyleSheet>>& authorStyleSheets() const { return m_au
thorStyleSheets; } | 67 const Vector<RefPtr<CSSStyleSheet>>& authorStyleSheets() const { return m_au
thorStyleSheets; } |
| 69 | 68 |
| 70 void addStyleSheetCandidateNode(HTMLStyleElement&); | |
| 71 void removeStyleSheetCandidateNode(HTMLStyleElement&); | |
| 72 | |
| 73 private: | 69 private: |
| 74 explicit ScopedStyleResolver(TreeScope&); | 70 explicit ScopedStyleResolver(TreeScope&); |
| 75 | 71 |
| 76 void collectStyleSheets(Vector<RefPtr<CSSStyleSheet>>& candidateSheets); | 72 void collectStyleSheets(Vector<RefPtr<CSSStyleSheet>>& candidateSheets); |
| 77 | 73 |
| 78 TreeScope& m_scope; | 74 TreeScope& m_scope; |
| 79 DocumentOrderedList m_styleSheetCandidateNodes; | |
| 80 Vector<RefPtr<CSSStyleSheet>> m_authorStyleSheets; | 75 Vector<RefPtr<CSSStyleSheet>> m_authorStyleSheets; |
| 81 }; | 76 }; |
| 82 | 77 |
| 83 } // namespace blink | 78 } // namespace blink |
| 84 | 79 |
| 85 #endif // SKY_ENGINE_CORE_CSS_RESOLVER_SCOPEDSTYLERESOLVER_H_ | 80 #endif // SKY_ENGINE_CORE_CSS_RESOLVER_SCOPEDSTYLERESOLVER_H_ |
| OLD | NEW |