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

Unified Diff: third_party/WebKit/Source/core/dom/StyleEngine.h

Issue 2451893003: Move Document global rule data to CSSGlobalRuleSet. (Closed)
Patch Set: Rebased. Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/StyleEngine.h
diff --git a/third_party/WebKit/Source/core/dom/StyleEngine.h b/third_party/WebKit/Source/core/dom/StyleEngine.h
index 6e054583f30cfb379435cfed941a399d63a0bc73..175364093d1bc8dafbefd5a9f278d729a2ade94b 100644
--- a/third_party/WebKit/Source/core/dom/StyleEngine.h
+++ b/third_party/WebKit/Source/core/dom/StyleEngine.h
@@ -34,6 +34,7 @@
#include "bindings/core/v8/TraceWrapperMember.h"
#include "core/CoreExport.h"
#include "core/css/CSSFontSelectorClient.h"
+#include "core/css/CSSGlobalRuleSet.h"
#include "core/css/invalidation/StyleInvalidator.h"
#include "core/css/resolver/StyleResolver.h"
#include "core/css/resolver/StyleResolverStats.h"
@@ -108,6 +109,9 @@ class CORE_EXPORT StyleEngine final
void injectAuthorSheet(StyleSheetContents* authorSheet);
CSSStyleSheet& ensureInspectorStyleSheet();
+ RuleSet* watchedSelectorsRuleSet() {
+ return m_globalRuleSet.watchedSelectorsRuleSet();
+ }
void clearMediaQueryRuleSetStyleSheets();
void updateStyleSheetsInImport(DocumentStyleSheetCollector& parentCollector);
@@ -143,28 +147,29 @@ class CORE_EXPORT StyleEngine final
bool ignoringPendingStylesheets() const { return m_ignorePendingStylesheets; }
unsigned maxDirectAdjacentSelectors() const {
- return m_maxDirectAdjacentSelectors;
+ return ruleFeatureSet().maxDirectAdjacentSelectors();
+ }
+ bool usesSiblingRules() const { return ruleFeatureSet().usesSiblingRules(); }
+ bool usesFirstLineRules() const {
+ return ruleFeatureSet().usesFirstLineRules();
}
- bool usesSiblingRules() const { return m_usesSiblingRules; }
- bool usesFirstLineRules() const { return m_usesFirstLineRules; }
bool usesWindowInactiveSelector() const {
- return m_usesWindowInactiveSelector;
+ return ruleFeatureSet().usesWindowInactiveSelector();
}
bool usesRemUnits() const { return m_usesRemUnits; }
- void setUsesRemUnit(bool b) { m_usesRemUnits = b; }
+ void setUsesRemUnit(bool usesRemUnits) { m_usesRemUnits = usesRemUnits; }
void resetCSSFeatureFlags(const RuleFeatureSet&);
void shadowRootRemovedFromDocument(ShadowRoot*);
- void appendActiveAuthorStyleSheets();
void addTreeBoundaryCrossingScope(const TreeScope&);
const DocumentOrderedList& treeBoundaryCrossingScopes() const {
return m_treeBoundaryCrossingScopes;
}
void resetAuthorStyle(TreeScope&);
- StyleResolver* resolver() const { return m_resolver.get(); }
+ StyleResolver* resolver() const { return m_resolver; }
StyleResolver& ensureResolver() {
if (!m_resolver) {
@@ -172,17 +177,20 @@ class CORE_EXPORT StyleEngine final
} else if (m_resolver->hasPendingAuthorStyleSheets()) {
viewportRulesChanged();
m_resolver->appendPendingAuthorStyleSheets();
+ finishAppendAuthorStyleSheets();
+ } else if (m_globalRuleSet.isDirty()) {
+ m_globalRuleSet.update(document());
}
- return *m_resolver.get();
+ return *m_resolver;
}
- bool hasResolver() const { return m_resolver.get(); }
+ bool hasResolver() const { return m_resolver; }
void clearResolver();
void clearMasterResolver();
StyleInvalidator& styleInvalidator() { return m_styleInvalidator; }
- CSSFontSelector* fontSelector() { return m_fontSelector.get(); }
+ CSSFontSelector* fontSelector() { return m_fontSelector; }
void setFontSelector(CSSFontSelector*);
void removeFontFaceRules(const HeapVector<Member<const StyleRuleFontFace>>&);
@@ -200,10 +208,12 @@ class CORE_EXPORT StyleEngine final
StyleEngineContext&);
void collectScopedStyleFeaturesTo(RuleFeatureSet&) const;
- void ensureFullscreenUAStyle();
+ void ensureUAStyleForFullscreen();
+ void ensureUAStyleForElement(const Element&);
void platformColorsChanged();
+ bool hasRulesForId(const AtomicString& id) const;
void classChangedForElement(const SpaceSplitString& changedClasses, Element&);
void classChangedForElement(const SpaceSplitString& oldClasses,
const SpaceSplitString& newClasses,
@@ -231,6 +241,8 @@ class CORE_EXPORT StyleEngine final
StyleResolverStats* stats() { return m_styleResolverStats.get(); }
void setStatsEnabled(bool);
+ PassRefPtr<ComputedStyle> findSharedStyle(const ElementResolveContext&);
+
DECLARE_VIRTUAL_TRACE();
DECLARE_TRACE_WRAPPERS();
@@ -257,8 +269,13 @@ class CORE_EXPORT StyleEngine final
typedef HeapHashSet<Member<TreeScope>> UnorderedTreeScopeSet;
void clearMediaQueryRuleSetOnTreeScopeStyleSheets(UnorderedTreeScopeSet&);
+ const RuleFeatureSet& ruleFeatureSet() const {
+ return m_globalRuleSet.ruleFeatureSet();
+ }
void createResolver();
+ void appendActiveAuthorStyleSheets();
+ void finishAppendAuthorStyleSheets();
CSSStyleSheet* parseSheet(Element&,
const String& text,
@@ -313,12 +330,9 @@ class CORE_EXPORT StyleEngine final
String m_preferredStylesheetSetName;
String m_selectedStylesheetSetName;
- bool m_usesSiblingRules = false;
- bool m_usesFirstLineRules = false;
- bool m_usesWindowInactiveSelector = false;
- bool m_usesRemUnits = false;
- unsigned m_maxDirectAdjacentSelectors = 0;
+ CSSGlobalRuleSet m_globalRuleSet;
+ bool m_usesRemUnits = false;
bool m_ignorePendingStylesheets = false;
bool m_didCalculateResolver = false;
« no previous file with comments | « third_party/WebKit/Source/core/dom/Fullscreen.cpp ('k') | third_party/WebKit/Source/core/dom/StyleEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698