| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All |
| 7 * rights reserved. | 7 * rights reserved. |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 10 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * along with this library; see the file COPYING.LIB. If not, write to | 24 * along with this library; see the file COPYING.LIB. If not, write to |
| 25 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 25 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 26 * Boston, MA 02110-1301, USA. | 26 * Boston, MA 02110-1301, USA. |
| 27 * | 27 * |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 #ifndef TreeScopeStyleSheetCollection_h | 30 #ifndef TreeScopeStyleSheetCollection_h |
| 31 #define TreeScopeStyleSheetCollection_h | 31 #define TreeScopeStyleSheetCollection_h |
| 32 | 32 |
| 33 #include "core/CoreExport.h" | 33 #include "core/CoreExport.h" |
| 34 #include "core/dom/Document.h" | |
| 35 #include "core/dom/DocumentOrderedList.h" | 34 #include "core/dom/DocumentOrderedList.h" |
| 36 #include "core/dom/StyleSheetCollection.h" | 35 #include "core/dom/StyleSheetCollection.h" |
| 37 #include "core/dom/TreeScope.h" | 36 #include "core/dom/TreeScope.h" |
| 38 #include "wtf/HashMap.h" | |
| 39 #include "wtf/ListHashSet.h" | |
| 40 #include "wtf/Vector.h" | |
| 41 #include "wtf/text/WTFString.h" | |
| 42 | 37 |
| 43 namespace blink { | 38 namespace blink { |
| 44 | 39 |
| 40 class Document; |
| 45 class Node; | 41 class Node; |
| 46 class StyleSheetContents; | |
| 47 class StyleRuleFontFace; | |
| 48 | 42 |
| 49 class CORE_EXPORT TreeScopeStyleSheetCollection : public StyleSheetCollection { | 43 class CORE_EXPORT TreeScopeStyleSheetCollection : public StyleSheetCollection { |
| 50 public: | 44 public: |
| 51 void addStyleSheetCandidateNode(Node&); | 45 void addStyleSheetCandidateNode(Node&); |
| 52 void removeStyleSheetCandidateNode(Node& node) { | 46 void removeStyleSheetCandidateNode(Node& node) { |
| 53 m_styleSheetCandidateNodes.remove(&node); | 47 m_styleSheetCandidateNodes.remove(&node); |
| 54 } | 48 } |
| 55 bool hasStyleSheetCandidateNodes() const { | 49 bool hasStyleSheetCandidateNodes() const { |
| 56 return !m_styleSheetCandidateNodes.isEmpty(); | 50 return !m_styleSheetCandidateNodes.isEmpty(); |
| 57 } | 51 } |
| 58 | 52 |
| 59 void clearMediaQueryRuleSetStyleSheets(); | 53 bool mediaQueryAffectingValueChanged(); |
| 60 | 54 |
| 61 virtual bool isShadowTreeStyleSheetCollection() const { return false; } | 55 virtual bool isShadowTreeStyleSheetCollection() const { return false; } |
| 62 | 56 |
| 63 DECLARE_VIRTUAL_TRACE(); | 57 DECLARE_VIRTUAL_TRACE(); |
| 64 | 58 |
| 65 protected: | 59 protected: |
| 66 explicit TreeScopeStyleSheetCollection(TreeScope&); | 60 explicit TreeScopeStyleSheetCollection(TreeScope&); |
| 67 | 61 |
| 68 Document& document() const { return treeScope().document(); } | 62 Document& document() const { return treeScope().document(); } |
| 69 TreeScope& treeScope() const { return *m_treeScope; } | 63 TreeScope& treeScope() const { return *m_treeScope; } |
| 70 | 64 |
| 71 enum StyleResolverUpdateType { Reconstruct, Reset, Additive }; | 65 void applyActiveStyleSheetChanges(StyleSheetCollection&); |
| 72 | 66 |
| 73 class StyleSheetChange { | 67 Member<TreeScope> m_treeScope; |
| 74 STACK_ALLOCATED(); | 68 DocumentOrderedList m_styleSheetCandidateNodes; |
| 75 | |
| 76 public: | |
| 77 StyleResolverUpdateType styleResolverUpdateType; | |
| 78 bool requiresFullStyleRecalc; | |
| 79 HeapVector<Member<const StyleRuleFontFace>> fontFaceRulesToRemove; | |
| 80 | |
| 81 StyleSheetChange() | |
| 82 : styleResolverUpdateType(Reconstruct), requiresFullStyleRecalc(true) {} | |
| 83 }; | |
| 84 | |
| 85 void analyzeStyleSheetChange(StyleResolverUpdateMode, | |
| 86 const HeapVector<Member<CSSStyleSheet>>&, | |
| 87 StyleSheetChange&); | |
| 88 | 69 |
| 89 private: | 70 private: |
| 90 static StyleResolverUpdateType compareStyleSheets( | |
| 91 const HeapVector<Member<CSSStyleSheet>>& oldStyleSheets, | |
| 92 const HeapVector<Member<CSSStyleSheet>>& newStylesheets, | |
| 93 HeapVector<Member<StyleSheetContents>>& addedSheets); | |
| 94 bool activeLoadingStyleSheetLoaded( | |
| 95 const HeapVector<Member<CSSStyleSheet>>& newStyleSheets); | |
| 96 | |
| 97 friend class TreeScopeStyleSheetCollectionTest; | 71 friend class TreeScopeStyleSheetCollectionTest; |
| 98 | |
| 99 protected: | |
| 100 Member<TreeScope> m_treeScope; | |
| 101 bool m_hadActiveLoadingStylesheet; | |
| 102 | |
| 103 DocumentOrderedList m_styleSheetCandidateNodes; | |
| 104 }; | 72 }; |
| 105 | 73 |
| 106 } // namespace blink | 74 } // namespace blink |
| 107 | 75 |
| 108 #endif | 76 #endif |
| OLD | NEW |