Commit 1744e523 authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

Remove master references from style code.

The remaining references to master is from dom code apis and branch
names in documentation.

Change-Id: I7a1524ba2bcef3ecac612df6e513a701573e2a11
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2263533Reviewed-by: default avatarAnders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#781808}
parent aaf6089b
...@@ -48,7 +48,7 @@ DocumentStyleSheetCollection::DocumentStyleSheetCollection( ...@@ -48,7 +48,7 @@ DocumentStyleSheetCollection::DocumentStyleSheetCollection(
} }
void DocumentStyleSheetCollection::CollectStyleSheetsFromCandidates( void DocumentStyleSheetCollection::CollectStyleSheetsFromCandidates(
StyleEngine& master_engine, StyleEngine& engine,
DocumentStyleSheetCollector& collector) { DocumentStyleSheetCollector& collector) {
CHECK(ThreadState::Current()->IsOnThreadHeap(this)); CHECK(ThreadState::Current()->IsOnThreadHeap(this));
for (Node* n : style_sheet_candidate_nodes_) { for (Node* n : style_sheet_candidate_nodes_) {
...@@ -64,7 +64,7 @@ void DocumentStyleSheetCollection::CollectStyleSheetsFromCandidates( ...@@ -64,7 +64,7 @@ void DocumentStyleSheetCollection::CollectStyleSheetsFromCandidates(
continue; continue;
collector.WillVisit(document); collector.WillVisit(document);
document->GetStyleEngine().UpdateActiveStyleSheetsInImport(master_engine, document->GetStyleEngine().UpdateActiveStyleSheetsInImport(engine,
collector); collector);
continue; continue;
} }
...@@ -83,7 +83,7 @@ void DocumentStyleSheetCollection::CollectStyleSheetsFromCandidates( ...@@ -83,7 +83,7 @@ void DocumentStyleSheetCollection::CollectStyleSheetsFromCandidates(
CSSStyleSheet* css_sheet = To<CSSStyleSheet>(sheet); CSSStyleSheet* css_sheet = To<CSSStyleSheet>(sheet);
collector.AppendActiveStyleSheet( collector.AppendActiveStyleSheet(
std::make_pair(css_sheet, master_engine.RuleSetForSheet(*css_sheet))); std::make_pair(css_sheet, engine.RuleSetForSheet(*css_sheet)));
} }
if (!GetTreeScope().HasAdoptedStyleSheets()) if (!GetTreeScope().HasAdoptedStyleSheets())
return; return;
...@@ -96,12 +96,12 @@ void DocumentStyleSheetCollection::CollectStyleSheetsFromCandidates( ...@@ -96,12 +96,12 @@ void DocumentStyleSheetCollection::CollectStyleSheetsFromCandidates(
DCHECK_EQ(GetDocument(), sheet->AssociatedDocument()); DCHECK_EQ(GetDocument(), sheet->AssociatedDocument());
collector.AppendSheetForList(sheet); collector.AppendSheetForList(sheet);
collector.AppendActiveStyleSheet( collector.AppendActiveStyleSheet(
std::make_pair(sheet, master_engine.RuleSetForSheet(*sheet))); std::make_pair(sheet, engine.RuleSetForSheet(*sheet)));
} }
} }
void DocumentStyleSheetCollection::CollectStyleSheets( void DocumentStyleSheetCollection::CollectStyleSheets(
StyleEngine& master_engine, StyleEngine& engine,
DocumentStyleSheetCollector& collector) { DocumentStyleSheetCollector& collector) {
for (auto& sheet : for (auto& sheet :
GetDocument().GetStyleEngine().InjectedAuthorStyleSheets()) { GetDocument().GetStyleEngine().InjectedAuthorStyleSheets()) {
...@@ -109,7 +109,7 @@ void DocumentStyleSheetCollection::CollectStyleSheets( ...@@ -109,7 +109,7 @@ void DocumentStyleSheetCollection::CollectStyleSheets(
sheet.second, sheet.second,
GetDocument().GetStyleEngine().RuleSetForSheet(*sheet.second))); GetDocument().GetStyleEngine().RuleSetForSheet(*sheet.second)));
} }
CollectStyleSheetsFromCandidates(master_engine, collector); CollectStyleSheetsFromCandidates(engine, collector);
if (CSSStyleSheet* inspector_sheet = if (CSSStyleSheet* inspector_sheet =
GetDocument().GetStyleEngine().InspectorStyleSheet()) { GetDocument().GetStyleEngine().InspectorStyleSheet()) {
collector.AppendActiveStyleSheet(std::make_pair( collector.AppendActiveStyleSheet(std::make_pair(
...@@ -119,11 +119,11 @@ void DocumentStyleSheetCollection::CollectStyleSheets( ...@@ -119,11 +119,11 @@ void DocumentStyleSheetCollection::CollectStyleSheets(
} }
void DocumentStyleSheetCollection::UpdateActiveStyleSheets( void DocumentStyleSheetCollection::UpdateActiveStyleSheets(
StyleEngine& master_engine) { StyleEngine& engine) {
// StyleSheetCollection is GarbageCollected<>, allocate it on the heap. // StyleSheetCollection is GarbageCollected<>, allocate it on the heap.
auto* collection = MakeGarbageCollected<StyleSheetCollection>(); auto* collection = MakeGarbageCollected<StyleSheetCollection>();
ActiveDocumentStyleSheetCollector collector(*collection); ActiveDocumentStyleSheetCollector collector(*collection);
CollectStyleSheets(master_engine, collector); CollectStyleSheets(engine, collector);
ApplyActiveStyleSheetChanges(*collection); ApplyActiveStyleSheetChanges(*collection);
} }
......
...@@ -45,9 +45,8 @@ class DocumentStyleSheetCollection final ...@@ -45,9 +45,8 @@ class DocumentStyleSheetCollection final
public: public:
explicit DocumentStyleSheetCollection(TreeScope&); explicit DocumentStyleSheetCollection(TreeScope&);
void UpdateActiveStyleSheets(StyleEngine& master_engine); void UpdateActiveStyleSheets(StyleEngine&);
void CollectStyleSheets(StyleEngine& master_engine, void CollectStyleSheets(StyleEngine&, DocumentStyleSheetCollector&);
DocumentStyleSheetCollector&);
void CollectViewportRules(ViewportStyleResolver&); void CollectViewportRules(ViewportStyleResolver&);
void Trace(Visitor* visitor) const override { void Trace(Visitor* visitor) const override {
...@@ -55,7 +54,7 @@ class DocumentStyleSheetCollection final ...@@ -55,7 +54,7 @@ class DocumentStyleSheetCollection final
} }
private: private:
void CollectStyleSheetsFromCandidates(StyleEngine& master_engine, void CollectStyleSheetsFromCandidates(StyleEngine&,
DocumentStyleSheetCollector&); DocumentStyleSheetCollector&);
DISALLOW_COPY_AND_ASSIGN(DocumentStyleSheetCollection); DISALLOW_COPY_AND_ASSIGN(DocumentStyleSheetCollection);
}; };
......
...@@ -45,7 +45,7 @@ ShadowTreeStyleSheetCollection::ShadowTreeStyleSheetCollection( ...@@ -45,7 +45,7 @@ ShadowTreeStyleSheetCollection::ShadowTreeStyleSheetCollection(
: TreeScopeStyleSheetCollection(shadow_root) {} : TreeScopeStyleSheetCollection(shadow_root) {}
void ShadowTreeStyleSheetCollection::CollectStyleSheets( void ShadowTreeStyleSheetCollection::CollectStyleSheets(
StyleEngine& master_engine, StyleEngine& engine,
StyleSheetCollection& collection) { StyleSheetCollection& collection) {
for (Node* n : style_sheet_candidate_nodes_) { for (Node* n : style_sheet_candidate_nodes_) {
StyleSheetCandidate candidate(*n); StyleSheetCandidate candidate(*n);
...@@ -59,7 +59,7 @@ void ShadowTreeStyleSheetCollection::CollectStyleSheets( ...@@ -59,7 +59,7 @@ void ShadowTreeStyleSheetCollection::CollectStyleSheets(
if (candidate.CanBeActivated(g_null_atom)) { if (candidate.CanBeActivated(g_null_atom)) {
CSSStyleSheet* css_sheet = To<CSSStyleSheet>(sheet); CSSStyleSheet* css_sheet = To<CSSStyleSheet>(sheet);
collection.AppendActiveStyleSheet( collection.AppendActiveStyleSheet(
std::make_pair(css_sheet, master_engine.RuleSetForSheet(*css_sheet))); std::make_pair(css_sheet, engine.RuleSetForSheet(*css_sheet)));
} }
} }
if (!GetTreeScope().HasAdoptedStyleSheets()) if (!GetTreeScope().HasAdoptedStyleSheets())
...@@ -70,15 +70,15 @@ void ShadowTreeStyleSheetCollection::CollectStyleSheets( ...@@ -70,15 +70,15 @@ void ShadowTreeStyleSheetCollection::CollectStyleSheets(
continue; continue;
DCHECK_EQ(GetTreeScope().GetDocument(), sheet->AssociatedDocument()); DCHECK_EQ(GetTreeScope().GetDocument(), sheet->AssociatedDocument());
collection.AppendActiveStyleSheet( collection.AppendActiveStyleSheet(
std::make_pair(sheet, master_engine.RuleSetForSheet(*sheet))); std::make_pair(sheet, engine.RuleSetForSheet(*sheet)));
} }
} }
void ShadowTreeStyleSheetCollection::UpdateActiveStyleSheets( void ShadowTreeStyleSheetCollection::UpdateActiveStyleSheets(
StyleEngine& master_engine) { StyleEngine& engine) {
// StyleSheetCollection is GarbageCollected<>, allocate it on the heap. // StyleSheetCollection is GarbageCollected<>, allocate it on the heap.
auto* collection = MakeGarbageCollected<StyleSheetCollection>(); auto* collection = MakeGarbageCollected<StyleSheetCollection>();
CollectStyleSheets(master_engine, *collection); CollectStyleSheets(engine, *collection);
ApplyActiveStyleSheetChanges(*collection); ApplyActiveStyleSheetChanges(*collection);
} }
......
...@@ -44,7 +44,7 @@ class ShadowTreeStyleSheetCollection final ...@@ -44,7 +44,7 @@ class ShadowTreeStyleSheetCollection final
: public TreeScopeStyleSheetCollection { : public TreeScopeStyleSheetCollection {
public: public:
explicit ShadowTreeStyleSheetCollection(ShadowRoot&); explicit ShadowTreeStyleSheetCollection(ShadowRoot&);
void UpdateActiveStyleSheets(StyleEngine& master_engine); void UpdateActiveStyleSheets(StyleEngine&);
bool IsShadowTreeStyleSheetCollection() const final { return true; } bool IsShadowTreeStyleSheetCollection() const final { return true; }
void Trace(Visitor* visitor) const override { void Trace(Visitor* visitor) const override {
...@@ -52,7 +52,7 @@ class ShadowTreeStyleSheetCollection final ...@@ -52,7 +52,7 @@ class ShadowTreeStyleSheetCollection final
} }
private: private:
void CollectStyleSheets(StyleEngine& master_engine, StyleSheetCollection&); void CollectStyleSheets(StyleEngine&, StyleSheetCollection&);
DISALLOW_COPY_AND_ASSIGN(ShadowTreeStyleSheetCollection); DISALLOW_COPY_AND_ASSIGN(ShadowTreeStyleSheetCollection);
}; };
......
...@@ -109,7 +109,7 @@ CSSFontSelector* CreateCSSFontSelectorFor(Document& document) { ...@@ -109,7 +109,7 @@ CSSFontSelector* CreateCSSFontSelectorFor(Document& document) {
StyleEngine::StyleEngine(Document& document) StyleEngine::StyleEngine(Document& document)
: document_(&document), : document_(&document),
is_master_(!document.IsHTMLImport()), is_html_import_(document.IsHTMLImport()),
document_style_sheet_collection_( document_style_sheet_collection_(
MakeGarbageCollected<DocumentStyleSheetCollection>(document)) { MakeGarbageCollected<DocumentStyleSheetCollection>(document)) {
if (document.GetFrame()) { if (document.GetFrame()) {
...@@ -120,7 +120,7 @@ StyleEngine::StyleEngine(Document& document) ...@@ -120,7 +120,7 @@ StyleEngine::StyleEngine(Document& document)
} }
if (document.IsInMainFrame()) if (document.IsInMainFrame())
viewport_resolver_ = MakeGarbageCollected<ViewportStyleResolver>(document); viewport_resolver_ = MakeGarbageCollected<ViewportStyleResolver>(document);
if (IsMaster()) if (!IsHTMLImport())
global_rule_set_ = MakeGarbageCollected<CSSGlobalRuleSet>(); global_rule_set_ = MakeGarbageCollected<CSSGlobalRuleSet>();
if (auto* settings = GetDocument().GetSettings()) { if (auto* settings = GetDocument().GetSettings()) {
if (!settings->GetForceDarkModeEnabled()) if (!settings->GetForceDarkModeEnabled())
...@@ -133,8 +133,8 @@ StyleEngine::StyleEngine(Document& document) ...@@ -133,8 +133,8 @@ StyleEngine::StyleEngine(Document& document)
StyleEngine::~StyleEngine() = default; StyleEngine::~StyleEngine() = default;
inline Document* StyleEngine::Master() { inline Document* StyleEngine::HTMLImportRootDocument() {
if (IsMaster()) if (!IsHTMLImport())
return document_; return document_;
HTMLImportsController* import = GetDocument().ImportsController(); HTMLImportsController* import = GetDocument().ImportsController();
// Document::ImportsController() can return null while executing its // Document::ImportsController() can return null while executing its
...@@ -173,10 +173,10 @@ TreeScopeStyleSheetCollection* StyleEngine::StyleSheetCollectionFor( ...@@ -173,10 +173,10 @@ TreeScopeStyleSheetCollection* StyleEngine::StyleSheetCollectionFor(
const HeapVector<Member<StyleSheet>>& StyleEngine::StyleSheetsForStyleSheetList( const HeapVector<Member<StyleSheet>>& StyleEngine::StyleSheetsForStyleSheetList(
TreeScope& tree_scope) { TreeScope& tree_scope) {
DCHECK(Master()); DCHECK(HTMLImportRootDocument());
TreeScopeStyleSheetCollection& collection = TreeScopeStyleSheetCollection& collection =
EnsureStyleSheetCollectionFor(tree_scope); EnsureStyleSheetCollectionFor(tree_scope);
if (Master()->IsActive()) if (HTMLImportRootDocument()->IsActive())
collection.UpdateStyleSheetList(); collection.UpdateStyleSheetList();
return collection.StyleSheetsForStyleSheetList(); return collection.StyleSheetsForStyleSheetList();
} }
...@@ -277,7 +277,7 @@ void StyleEngine::RemovePendingSheet(Node& style_sheet_candidate_node, ...@@ -277,7 +277,7 @@ void StyleEngine::RemovePendingSheet(Node& style_sheet_candidate_node,
void StyleEngine::SetNeedsActiveStyleUpdate(TreeScope& tree_scope) { void StyleEngine::SetNeedsActiveStyleUpdate(TreeScope& tree_scope) {
DCHECK(tree_scope.RootNode().isConnected()); DCHECK(tree_scope.RootNode().isConnected());
if (GetDocument().IsActive() || !IsMaster()) if (GetDocument().IsActive() || IsHTMLImport())
MarkTreeScopeDirty(tree_scope); MarkTreeScopeDirty(tree_scope);
} }
...@@ -432,7 +432,7 @@ void StyleEngine::MediaQueriesChangedInScope(TreeScope& tree_scope) { ...@@ -432,7 +432,7 @@ void StyleEngine::MediaQueriesChangedInScope(TreeScope& tree_scope) {
} }
void StyleEngine::WatchedSelectorsChanged() { void StyleEngine::WatchedSelectorsChanged() {
DCHECK(IsMaster()); DCHECK(!IsHTMLImport());
DCHECK(global_rule_set_); DCHECK(global_rule_set_);
global_rule_set_->InitWatchedSelectorsRuleSet(GetDocument()); global_rule_set_->InitWatchedSelectorsRuleSet(GetDocument());
// TODO(futhark@chromium.org): Should be able to use RuleSetInvalidation here. // TODO(futhark@chromium.org): Should be able to use RuleSetInvalidation here.
...@@ -504,15 +504,15 @@ void StyleEngine::MediaQueryAffectingValueChanged(MediaValueChange change) { ...@@ -504,15 +504,15 @@ void StyleEngine::MediaQueryAffectingValueChanged(MediaValueChange change) {
} }
void StyleEngine::UpdateActiveStyleSheetsInImport( void StyleEngine::UpdateActiveStyleSheetsInImport(
StyleEngine& master_engine, StyleEngine& root_engine,
DocumentStyleSheetCollector& parent_collector) { DocumentStyleSheetCollector& parent_collector) {
DCHECK(RuntimeEnabledFeatures::HTMLImportsEnabled( DCHECK(RuntimeEnabledFeatures::HTMLImportsEnabled(
GetDocument().GetExecutionContext())); GetDocument().GetExecutionContext()));
DCHECK(!IsMaster()); DCHECK(IsHTMLImport());
HeapVector<Member<StyleSheet>> sheets_for_list; HeapVector<Member<StyleSheet>> sheets_for_list;
ImportedDocumentStyleSheetCollector subcollector(parent_collector, ImportedDocumentStyleSheetCollector subcollector(parent_collector,
sheets_for_list); sheets_for_list);
GetDocumentStyleSheetCollection().CollectStyleSheets(master_engine, GetDocumentStyleSheetCollection().CollectStyleSheets(root_engine,
subcollector); subcollector);
GetDocumentStyleSheetCollection().SwapSheetsForSheetList(sheets_for_list); GetDocumentStyleSheetCollection().SwapSheetsForSheetList(sheets_for_list);
...@@ -554,7 +554,7 @@ void StyleEngine::UpdateActiveStyleSheets() { ...@@ -554,7 +554,7 @@ void StyleEngine::UpdateActiveStyleSheets() {
if (!NeedsActiveStyleSheetUpdate()) if (!NeedsActiveStyleSheetUpdate())
return; return;
DCHECK(IsMaster()); DCHECK(!IsHTMLImport());
DCHECK(!GetDocument().InStyleRecalc()); DCHECK(!GetDocument().InStyleRecalc());
DCHECK(GetDocument().IsActive()); DCHECK(GetDocument().IsActive());
...@@ -686,7 +686,7 @@ void StyleEngine::CreateResolver() { ...@@ -686,7 +686,7 @@ void StyleEngine::CreateResolver() {
void StyleEngine::ClearResolvers() { void StyleEngine::ClearResolvers() {
DCHECK(!GetDocument().InStyleRecalc()); DCHECK(!GetDocument().InStyleRecalc());
DCHECK(IsMaster() || !resolver_); DCHECK(!IsHTMLImport() || !resolver_);
GetDocument().ClearScopedStyleResolver(); GetDocument().ClearScopedStyleResolver();
for (TreeScope* tree_scope : active_tree_scopes_) for (TreeScope* tree_scope : active_tree_scopes_)
...@@ -1381,7 +1381,7 @@ void StyleEngine::SetHttpDefaultStyle(const String& content) { ...@@ -1381,7 +1381,7 @@ void StyleEngine::SetHttpDefaultStyle(const String& content) {
} }
void StyleEngine::EnsureUAStyleForXrOverlay() { void StyleEngine::EnsureUAStyleForXrOverlay() {
DCHECK(IsMaster()); DCHECK(!IsHTMLImport());
DCHECK(global_rule_set_); DCHECK(global_rule_set_);
if (CSSDefaultStyleSheets::Instance().EnsureDefaultStyleSheetForXrOverlay()) { if (CSSDefaultStyleSheets::Instance().EnsureDefaultStyleSheetForXrOverlay()) {
global_rule_set_->MarkDirty(); global_rule_set_->MarkDirty();
...@@ -1390,7 +1390,7 @@ void StyleEngine::EnsureUAStyleForXrOverlay() { ...@@ -1390,7 +1390,7 @@ void StyleEngine::EnsureUAStyleForXrOverlay() {
} }
void StyleEngine::EnsureUAStyleForFullscreen() { void StyleEngine::EnsureUAStyleForFullscreen() {
DCHECK(IsMaster()); DCHECK(!IsHTMLImport());
DCHECK(global_rule_set_); DCHECK(global_rule_set_);
if (global_rule_set_->HasFullscreenUAStyle()) if (global_rule_set_->HasFullscreenUAStyle())
return; return;
...@@ -1400,7 +1400,7 @@ void StyleEngine::EnsureUAStyleForFullscreen() { ...@@ -1400,7 +1400,7 @@ void StyleEngine::EnsureUAStyleForFullscreen() {
} }
void StyleEngine::EnsureUAStyleForElement(const Element& element) { void StyleEngine::EnsureUAStyleForElement(const Element& element) {
DCHECK(IsMaster()); DCHECK(!IsHTMLImport());
DCHECK(global_rule_set_); DCHECK(global_rule_set_);
if (CSSDefaultStyleSheets::Instance().EnsureDefaultStyleSheetsForElement( if (CSSDefaultStyleSheets::Instance().EnsureDefaultStyleSheetsForElement(
element)) { element)) {
...@@ -1410,7 +1410,7 @@ void StyleEngine::EnsureUAStyleForElement(const Element& element) { ...@@ -1410,7 +1410,7 @@ void StyleEngine::EnsureUAStyleForElement(const Element& element) {
} }
void StyleEngine::EnsureUAStyleForPseudoElement(PseudoId pseudo_id) { void StyleEngine::EnsureUAStyleForPseudoElement(PseudoId pseudo_id) {
DCHECK(IsMaster()); DCHECK(!IsHTMLImport());
DCHECK(global_rule_set_); DCHECK(global_rule_set_);
if (CSSDefaultStyleSheets::Instance() if (CSSDefaultStyleSheets::Instance()
.EnsureDefaultStyleSheetsForPseudoElement(pseudo_id)) { .EnsureDefaultStyleSheetsForPseudoElement(pseudo_id)) {
...@@ -1420,7 +1420,7 @@ void StyleEngine::EnsureUAStyleForPseudoElement(PseudoId pseudo_id) { ...@@ -1420,7 +1420,7 @@ void StyleEngine::EnsureUAStyleForPseudoElement(PseudoId pseudo_id) {
} }
bool StyleEngine::HasRulesForId(const AtomicString& id) const { bool StyleEngine::HasRulesForId(const AtomicString& id) const {
DCHECK(IsMaster()); DCHECK(!IsHTMLImport());
DCHECK(global_rule_set_); DCHECK(global_rule_set_);
return global_rule_set_->GetRuleFeatureSet().HasSelectorForId(id); return global_rule_set_->GetRuleFeatureSet().HasSelectorForId(id);
} }
...@@ -1546,7 +1546,7 @@ void StyleEngine::InvalidateInitialData() { ...@@ -1546,7 +1546,7 @@ void StyleEngine::InvalidateInitialData() {
void StyleEngine::ApplyUserRuleSetChanges( void StyleEngine::ApplyUserRuleSetChanges(
const ActiveStyleSheetVector& old_style_sheets, const ActiveStyleSheetVector& old_style_sheets,
const ActiveStyleSheetVector& new_style_sheets) { const ActiveStyleSheetVector& new_style_sheets) {
DCHECK(IsMaster()); DCHECK(!IsHTMLImport());
DCHECK(global_rule_set_); DCHECK(global_rule_set_);
HeapHashSet<Member<RuleSet>> changed_rule_sets; HeapHashSet<Member<RuleSet>> changed_rule_sets;
...@@ -1613,7 +1613,7 @@ void StyleEngine::ApplyRuleSetChanges( ...@@ -1613,7 +1613,7 @@ void StyleEngine::ApplyRuleSetChanges(
TreeScope& tree_scope, TreeScope& tree_scope,
const ActiveStyleSheetVector& old_style_sheets, const ActiveStyleSheetVector& old_style_sheets,
const ActiveStyleSheetVector& new_style_sheets) { const ActiveStyleSheetVector& new_style_sheets) {
DCHECK(IsMaster()); DCHECK(!IsHTMLImport());
DCHECK(global_rule_set_); DCHECK(global_rule_set_);
HeapHashSet<Member<RuleSet>> changed_rule_sets; HeapHashSet<Member<RuleSet>> changed_rule_sets;
...@@ -1736,7 +1736,7 @@ const MediaQueryEvaluator& StyleEngine::EnsureMediaQueryEvaluator() { ...@@ -1736,7 +1736,7 @@ const MediaQueryEvaluator& StyleEngine::EnsureMediaQueryEvaluator() {
} }
bool StyleEngine::MediaQueryAffectedByViewportChange() { bool StyleEngine::MediaQueryAffectedByViewportChange() {
DCHECK(IsMaster()); DCHECK(!IsHTMLImport());
DCHECK(global_rule_set_); DCHECK(global_rule_set_);
return EnsureMediaQueryEvaluator().DidResultsChange( return EnsureMediaQueryEvaluator().DidResultsChange(
global_rule_set_->GetRuleFeatureSet() global_rule_set_->GetRuleFeatureSet()
...@@ -1744,7 +1744,7 @@ bool StyleEngine::MediaQueryAffectedByViewportChange() { ...@@ -1744,7 +1744,7 @@ bool StyleEngine::MediaQueryAffectedByViewportChange() {
} }
bool StyleEngine::MediaQueryAffectedByDeviceChange() { bool StyleEngine::MediaQueryAffectedByDeviceChange() {
DCHECK(IsMaster()); DCHECK(!IsHTMLImport());
DCHECK(global_rule_set_); DCHECK(global_rule_set_);
return EnsureMediaQueryEvaluator().DidResultsChange( return EnsureMediaQueryEvaluator().DidResultsChange(
global_rule_set_->GetRuleFeatureSet().DeviceDependentMediaQueryResults()); global_rule_set_->GetRuleFeatureSet().DeviceDependentMediaQueryResults());
...@@ -2054,7 +2054,7 @@ void StyleEngine::ViewportDefiningElementDidChange() { ...@@ -2054,7 +2054,7 @@ void StyleEngine::ViewportDefiningElementDidChange() {
void StyleEngine::UpdateStyleInvalidationRoot(ContainerNode* ancestor, void StyleEngine::UpdateStyleInvalidationRoot(ContainerNode* ancestor,
Node* dirty_node) { Node* dirty_node) {
DCHECK(IsMaster()); DCHECK(!IsHTMLImport());
if (GetDocument().IsActive()) { if (GetDocument().IsActive()) {
if (in_dom_removal_) { if (in_dom_removal_) {
ancestor = nullptr; ancestor = nullptr;
......
...@@ -147,7 +147,7 @@ class CORE_EXPORT StyleEngine final : public GarbageCollected<StyleEngine>, ...@@ -147,7 +147,7 @@ class CORE_EXPORT StyleEngine final : public GarbageCollected<StyleEngine>,
WebDocument::kAuthorOrigin); WebDocument::kAuthorOrigin);
CSSStyleSheet& EnsureInspectorStyleSheet(); CSSStyleSheet& EnsureInspectorStyleSheet();
RuleSet* WatchedSelectorsRuleSet() { RuleSet* WatchedSelectorsRuleSet() {
DCHECK(IsMaster()); DCHECK(!IsHTMLImport());
DCHECK(global_rule_set_); DCHECK(global_rule_set_);
return global_rule_set_->WatchedSelectorsRuleSet(); return global_rule_set_->WatchedSelectorsRuleSet();
} }
...@@ -158,7 +158,7 @@ class CORE_EXPORT StyleEngine final : public GarbageCollected<StyleEngine>, ...@@ -158,7 +158,7 @@ class CORE_EXPORT StyleEngine final : public GarbageCollected<StyleEngine>,
RuleSet* RuleSetForSheet(CSSStyleSheet&); RuleSet* RuleSetForSheet(CSSStyleSheet&);
void MediaQueryAffectingValueChanged(MediaValueChange change); void MediaQueryAffectingValueChanged(MediaValueChange change);
void UpdateActiveStyleSheetsInImport( void UpdateActiveStyleSheetsInImport(
StyleEngine& master_engine, StyleEngine& root_engine,
DocumentStyleSheetCollector& parent_collector); DocumentStyleSheetCollector& parent_collector);
void UpdateActiveStyle(); void UpdateActiveStyle();
...@@ -231,7 +231,7 @@ class CORE_EXPORT StyleEngine final : public GarbageCollected<StyleEngine>, ...@@ -231,7 +231,7 @@ class CORE_EXPORT StyleEngine final : public GarbageCollected<StyleEngine>,
bool MediaQueryAffectedByViewportChange(); bool MediaQueryAffectedByViewportChange();
bool MediaQueryAffectedByDeviceChange(); bool MediaQueryAffectedByDeviceChange();
bool HasViewportDependentMediaQueries() { bool HasViewportDependentMediaQueries() {
DCHECK(IsMaster()); DCHECK(!IsHTMLImport());
DCHECK(global_rule_set_); DCHECK(global_rule_set_);
UpdateActiveStyle(); UpdateActiveStyle();
return !global_rule_set_->GetRuleFeatureSet() return !global_rule_set_->GetRuleFeatureSet()
...@@ -410,8 +410,8 @@ class CORE_EXPORT StyleEngine final : public GarbageCollected<StyleEngine>, ...@@ -410,8 +410,8 @@ class CORE_EXPORT StyleEngine final : public GarbageCollected<StyleEngine>,
void MarkTreeScopeDirty(TreeScope&); void MarkTreeScopeDirty(TreeScope&);
void MarkUserStyleDirty(); void MarkUserStyleDirty();
bool IsMaster() const { return is_master_; } bool IsHTMLImport() const { return is_html_import_; }
Document* Master(); Document* HTMLImportRootDocument();
Document& GetDocument() const { return *document_; } Document& GetDocument() const { return *document_; }
typedef HeapHashSet<Member<TreeScope>> UnorderedTreeScopeSet; typedef HeapHashSet<Member<TreeScope>> UnorderedTreeScopeSet;
...@@ -425,7 +425,7 @@ class CORE_EXPORT StyleEngine final : public GarbageCollected<StyleEngine>, ...@@ -425,7 +425,7 @@ class CORE_EXPORT StyleEngine final : public GarbageCollected<StyleEngine>,
MediaValueChange); MediaValueChange);
const RuleFeatureSet& GetRuleFeatureSet() const { const RuleFeatureSet& GetRuleFeatureSet() const {
DCHECK(IsMaster()); DCHECK(!IsHTMLImport());
DCHECK(global_rule_set_); DCHECK(global_rule_set_);
return global_rule_set_->GetRuleFeatureSet(); return global_rule_set_->GetRuleFeatureSet();
} }
...@@ -501,7 +501,9 @@ class CORE_EXPORT StyleEngine final : public GarbageCollected<StyleEngine>, ...@@ -501,7 +501,9 @@ class CORE_EXPORT StyleEngine final : public GarbageCollected<StyleEngine>,
void PropagateWritingModeAndDirectionToHTMLRoot(); void PropagateWritingModeAndDirectionToHTMLRoot();
Member<Document> document_; Member<Document> document_;
bool is_master_;
// True if this StyleEngine is for an HTML Import document.
bool is_html_import_ = false;
// Tracks the number of currently loading top-level stylesheets. Sheets loaded // Tracks the number of currently loading top-level stylesheets. Sheets loaded
// using the @import directive are not included in this count. We use this // using the @import directive are not included in this count. We use this
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment