Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: third_party/WebKit/Source/core/dom/TreeScopeStyleSheetCollection.h

Issue 1913833002: Current work-in-progress crbug.com/567021 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More assert fixes Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
9 * Copyright (C) 2011 Google Inc. All rights reserved. 9 * Copyright (C) 2011 Google Inc. All rights reserved.
10 * 10 *
(...skipping 11 matching lines...) Expand all
22 * along with this library; see the file COPYING.LIB. If not, write to 22 * along with this library; see the file COPYING.LIB. If not, write to
23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 * Boston, MA 02110-1301, USA. 24 * Boston, MA 02110-1301, USA.
25 * 25 *
26 */ 26 */
27 27
28 #ifndef TreeScopeStyleSheetCollection_h 28 #ifndef TreeScopeStyleSheetCollection_h
29 #define TreeScopeStyleSheetCollection_h 29 #define TreeScopeStyleSheetCollection_h
30 30
31 #include "core/CoreExport.h" 31 #include "core/CoreExport.h"
32 #include "core/dom/Document.h"
33 #include "core/dom/DocumentOrderedList.h" 32 #include "core/dom/DocumentOrderedList.h"
34 #include "core/dom/StyleSheetCollection.h" 33 #include "core/dom/StyleSheetCollection.h"
35 #include "core/dom/TreeScope.h" 34 #include "core/dom/TreeScope.h"
36 #include "wtf/HashMap.h"
37 #include "wtf/ListHashSet.h"
38 #include "wtf/Vector.h"
39 #include "wtf/text/WTFString.h"
40 35
41 namespace blink { 36 namespace blink {
42 37
38 class CSSStyleSheet;
39 class Document;
43 class Node; 40 class Node;
44 class StyleSheetContents;
45 class StyleRuleFontFace;
46 41
47 class CORE_EXPORT TreeScopeStyleSheetCollection : public StyleSheetCollection { 42 class CORE_EXPORT TreeScopeStyleSheetCollection : public StyleSheetCollection {
48 public: 43 public:
49 void addStyleSheetCandidateNode(Node*); 44 void addStyleSheetCandidateNode(Node*);
50 void removeStyleSheetCandidateNode(Node* node) { m_styleSheetCandidateNodes. remove(node); } 45 void removeStyleSheetCandidateNode(Node* node) { m_styleSheetCandidateNodes. remove(node); }
51 bool hasStyleSheetCandidateNodes() const { return !m_styleSheetCandidateNode s.isEmpty(); } 46 bool hasStyleSheetCandidateNodes() const { return !m_styleSheetCandidateNode s.isEmpty(); }
52 47
53 void clearMediaQueryRuleSetStyleSheets(); 48 bool mediaQueryAffectingValueChanged();
54 49
55 virtual bool isShadowTreeStyleSheetCollection() const { return false; } 50 virtual bool isShadowTreeStyleSheetCollection() const { return false; }
56 51
57 DECLARE_VIRTUAL_TRACE(); 52 DECLARE_VIRTUAL_TRACE();
58 53
59 protected: 54 protected:
60 explicit TreeScopeStyleSheetCollection(TreeScope&); 55 explicit TreeScopeStyleSheetCollection(TreeScope&);
61 56
62 Document& document() const { return treeScope().document(); } 57 Document& document() const { return treeScope().document(); }
63 TreeScope& treeScope() const { return *m_treeScope; } 58 TreeScope& treeScope() const { return *m_treeScope; }
64 59
65 enum StyleResolverUpdateType { 60 void applyActiveStyleSheetChanges(StyleSheetCollection&);
66 Reconstruct,
67 Reset,
68 Additive
69 };
70
71 class StyleSheetChange {
72 STACK_ALLOCATED();
73 public:
74 StyleResolverUpdateType styleResolverUpdateType;
75 bool requiresFullStyleRecalc;
76 HeapVector<Member<const StyleRuleFontFace>> fontFaceRulesToRemove;
77
78 StyleSheetChange()
79 : styleResolverUpdateType(Reconstruct)
80 , requiresFullStyleRecalc(true) { }
81 };
82
83 void analyzeStyleSheetChange(StyleResolverUpdateMode, const StyleSheetCollec tion&, StyleSheetChange&);
84
85 private:
86 static StyleResolverUpdateType compareStyleSheets(const HeapVector<Member<CS SStyleSheet>>& oldStyleSheets, const HeapVector<Member<CSSStyleSheet>>& newStyle sheets, HeapVector<Member<StyleSheetContents>>& addedSheets);
87 bool activeLoadingStyleSheetLoaded(const HeapVector<Member<CSSStyleSheet>>& newStyleSheets);
88
89 friend class TreeScopeStyleSheetCollectionTest;
90 61
91 protected: 62 protected:
92 Member<TreeScope> m_treeScope; 63 Member<TreeScope> m_treeScope;
93 bool m_hadActiveLoadingStylesheet; 64 DocumentOrderedList m_styleSheetCandidateNodes;
94 65
95 DocumentOrderedList m_styleSheetCandidateNodes; 66 private:
67 friend class TreeScopeStyleSheetCollectionTest;
96 }; 68 };
97 69
98 } // namespace blink 70 } // namespace blink
99 71
100 #endif 72 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698