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

Side by Side Diff: Source/core/dom/DocumentStyleSheetCollection.h

Issue 14604003: When there are no more stylesheets schedule the recalc async (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Refactor based on review Created 7 years, 7 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 | Annotate | Revision Log
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 10 matching lines...) Expand all
21 * You should have received a copy of the GNU Library General Public License 21 * You should have received a copy of the GNU Library General Public License
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 DocumentStyleSheetCollection_h 28 #ifndef DocumentStyleSheetCollection_h
29 #define DocumentStyleSheetCollection_h 29 #define DocumentStyleSheetCollection_h
30 30
31 #include "Document.h"
31 #include <wtf/FastAllocBase.h> 32 #include <wtf/FastAllocBase.h>
32 #include <wtf/ListHashSet.h> 33 #include <wtf/ListHashSet.h>
33 #include <wtf/RefPtr.h> 34 #include <wtf/RefPtr.h>
34 #include <wtf/Vector.h> 35 #include <wtf/Vector.h>
35 #include <wtf/text/WTFString.h> 36 #include <wtf/text/WTFString.h>
36 37
37 namespace WebCore { 38 namespace WebCore {
38 39
39 class CSSStyleSheet; 40 class CSSStyleSheet;
40 class Document; 41 class Document;
(...skipping 25 matching lines...) Expand all
66 void clearPageUserSheet(); 67 void clearPageUserSheet();
67 void updatePageUserSheet(); 68 void updatePageUserSheet();
68 void invalidateInjectedStyleSheetCache(); 69 void invalidateInjectedStyleSheetCache();
69 void updateInjectedStyleSheetCache() const; 70 void updateInjectedStyleSheetCache() const;
70 71
71 void addAuthorSheet(PassRefPtr<StyleSheetContents> authorSheet); 72 void addAuthorSheet(PassRefPtr<StyleSheetContents> authorSheet);
72 void addUserSheet(PassRefPtr<StyleSheetContents> userSheet); 73 void addUserSheet(PassRefPtr<StyleSheetContents> userSheet);
73 74
74 bool needsUpdateActiveStylesheetsOnStyleRecalc() const { return m_needsUpdat eActiveStylesheetsOnStyleRecalc; } 75 bool needsUpdateActiveStylesheetsOnStyleRecalc() const { return m_needsUpdat eActiveStylesheetsOnStyleRecalc; }
75 76
76 enum UpdateFlag { FullUpdate, OptimizedUpdate }; 77 bool updateActiveStyleSheets(StyleResolverUpdateMode);
77 bool updateActiveStyleSheets(UpdateFlag);
78 78
79 String preferredStylesheetSetName() const { return m_preferredStylesheetSetN ame; } 79 String preferredStylesheetSetName() const { return m_preferredStylesheetSetN ame; }
80 String selectedStylesheetSetName() const { return m_selectedStylesheetSetNam e; } 80 String selectedStylesheetSetName() const { return m_selectedStylesheetSetNam e; }
81 void setPreferredStylesheetSetName(const String& name) { m_preferredStyleshe etSetName = name; } 81 void setPreferredStylesheetSetName(const String& name) { m_preferredStyleshe etSetName = name; }
82 void setSelectedStylesheetSetName(const String& name) { m_selectedStylesheet SetName = name; } 82 void setSelectedStylesheetSetName(const String& name) { m_selectedStylesheet SetName = name; }
83 83
84 void addPendingSheet() { m_pendingStylesheets++; } 84 void addPendingSheet() { m_pendingStylesheets++; }
85 enum RemovePendingSheetNotificationType { 85 enum RemovePendingSheetNotificationType {
86 RemovePendingSheetNotifyImmediately, 86 RemovePendingSheetNotifyImmediately,
87 RemovePendingSheetNotifyLater 87 RemovePendingSheetNotifyLater
(...skipping 14 matching lines...) Expand all
102 102
103 void combineCSSFeatureFlags(); 103 void combineCSSFeatureFlags();
104 void resetCSSFeatureFlags(); 104 void resetCSSFeatureFlags();
105 105
106 void reportMemoryUsage(MemoryObjectInfo*) const; 106 void reportMemoryUsage(MemoryObjectInfo*) const;
107 107
108 private: 108 private:
109 DocumentStyleSheetCollection(Document*); 109 DocumentStyleSheetCollection(Document*);
110 110
111 void collectActiveStyleSheets(Vector<RefPtr<StyleSheet> >&); 111 void collectActiveStyleSheets(Vector<RefPtr<StyleSheet> >&);
112 enum StyleResolverUpdateType { 112
113 Reconstruct, 113 enum UpdateAction { Reconstruct, Reset, Append };
114 Reset, 114 UpdateAction analyzeStyleSheetChange(StyleResolverUpdateMode, const Vector<R efPtr<CSSStyleSheet> >& newStylesheets, bool& requiresFullStyleRecalc);
115 Additive
116 };
117 void analyzeStyleSheetChange(UpdateFlag, const Vector<RefPtr<CSSStyleSheet> >& newStylesheets, StyleResolverUpdateType&, bool& requiresFullStyleRecalc);
118 115
119 Document* m_document; 116 Document* m_document;
120 117
121 Vector<RefPtr<StyleSheet> > m_styleSheetsForStyleSheetList; 118 Vector<RefPtr<StyleSheet> > m_styleSheetsForStyleSheetList;
122 Vector<RefPtr<CSSStyleSheet> > m_activeAuthorStyleSheets; 119 Vector<RefPtr<CSSStyleSheet> > m_activeAuthorStyleSheets;
123 120
124 // Track the number of currently loading top-level stylesheets needed for re ndering. 121 // Track the number of currently loading top-level stylesheets needed for re ndering.
125 // Sheets loaded using the @import directive are not included in this count. 122 // Sheets loaded using the @import directive are not included in this count.
126 // We use this count of pending sheets to detect when we can begin attaching 123 // We use this count of pending sheets to detect when we can begin attaching
127 // elements and when it is safe to execute scripts. 124 // elements and when it is safe to execute scripts.
(...skipping 23 matching lines...) Expand all
151 bool m_usesFirstLetterRules; 148 bool m_usesFirstLetterRules;
152 bool m_usesBeforeAfterRules; 149 bool m_usesBeforeAfterRules;
153 bool m_usesBeforeAfterRulesOverride; 150 bool m_usesBeforeAfterRulesOverride;
154 bool m_usesRemUnits; 151 bool m_usesRemUnits;
155 }; 152 };
156 153
157 } 154 }
158 155
159 #endif 156 #endif
160 157
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698