Commit 71a01c52 authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

Remove MarkAllTreeScopesDirty() flag.

This code path is unused. This flag was previously used when updating
style and layout with pending stylesheets - which has been removed for
some time.

Change-Id: I878be2ca642a7f714f632746bca25f3c09d5db80
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2257912Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#780924}
parent 1f288721
......@@ -176,18 +176,8 @@ const HeapVector<Member<StyleSheet>>& StyleEngine::StyleSheetsForStyleSheetList(
DCHECK(Master());
TreeScopeStyleSheetCollection& collection =
EnsureStyleSheetCollectionFor(tree_scope);
if (Master()->IsActive()) {
if (all_tree_scopes_dirty_) {
// If all tree scopes are dirty, update all of active style. Otherwise, we
// would have to mark all tree scopes explicitly dirty for stylesheet list
// or repeatedly update the stylesheet list on styleSheets access. Note
// that this can only happen once if we kDidLayoutWithPendingSheets in
// Document::UpdateStyleAndLayoutTreeIgnoringPendingStyleSheets.
UpdateActiveStyle();
} else {
collection.UpdateStyleSheetList();
}
}
if (Master()->IsActive())
collection.UpdateStyleSheetList();
return collection.StyleSheetsForStyleSheetList();
}
......@@ -451,11 +441,11 @@ void StyleEngine::WatchedSelectorsChanged() {
}
bool StyleEngine::ShouldUpdateDocumentStyleSheetCollection() const {
return all_tree_scopes_dirty_ || document_scope_dirty_;
return document_scope_dirty_;
}
bool StyleEngine::ShouldUpdateShadowTreeStyleSheetCollection() const {
return all_tree_scopes_dirty_ || !dirty_tree_scopes_.IsEmpty();
return !dirty_tree_scopes_.IsEmpty();
}
void StyleEngine::MediaQueryAffectingValueChanged(
......@@ -525,9 +515,6 @@ void StyleEngine::UpdateActiveStyleSheetsInImport(
subcollector);
GetDocumentStyleSheetCollection().SwapSheetsForSheetList(sheets_for_list);
// all_tree_scopes_dirty_ should only be set on main documents, never html
// imports.
DCHECK(!all_tree_scopes_dirty_);
// Mark false for consistency. It is never checked for import documents.
document_scope_dirty_ = false;
}
......@@ -580,14 +567,8 @@ void StyleEngine::UpdateActiveStyleSheets() {
if (ShouldUpdateShadowTreeStyleSheetCollection()) {
UnorderedTreeScopeSet tree_scopes_removed;
if (all_tree_scopes_dirty_) {
for (TreeScope* tree_scope : active_tree_scopes_)
UpdateActiveStyleSheetsInShadow(tree_scope, tree_scopes_removed);
} else {
for (TreeScope* tree_scope : dirty_tree_scopes_)
UpdateActiveStyleSheetsInShadow(tree_scope, tree_scopes_removed);
}
for (TreeScope* tree_scope : dirty_tree_scopes_)
UpdateActiveStyleSheetsInShadow(tree_scope, tree_scopes_removed);
for (TreeScope* tree_scope : tree_scopes_removed)
active_tree_scopes_.erase(tree_scope);
}
......@@ -596,7 +577,6 @@ void StyleEngine::UpdateActiveStyleSheets() {
dirty_tree_scopes_.clear();
document_scope_dirty_ = false;
all_tree_scopes_dirty_ = false;
tree_scopes_removed_ = false;
user_style_dirty_ = false;
}
......
......@@ -161,7 +161,6 @@ class CORE_EXPORT StyleEngine final : public GarbageCollected<StyleEngine>,
StyleEngine& master_engine,
DocumentStyleSheetCollector& parent_collector);
void UpdateActiveStyle();
void MarkAllTreeScopesDirty() { all_tree_scopes_dirty_ = true; }
String PreferredStylesheetSetName() const {
return preferred_stylesheet_set_name_;
......@@ -398,9 +397,8 @@ class CORE_EXPORT StyleEngine final : public GarbageCollected<StyleEngine>,
private:
bool NeedsActiveStyleSheetUpdate() const {
return all_tree_scopes_dirty_ || tree_scopes_removed_ ||
document_scope_dirty_ || dirty_tree_scopes_.size() ||
user_style_dirty_;
return tree_scopes_removed_ || document_scope_dirty_ ||
dirty_tree_scopes_.size() || user_style_dirty_;
}
TreeScopeStyleSheetCollection& EnsureStyleSheetCollectionFor(TreeScope&);
......@@ -541,7 +539,6 @@ class CORE_EXPORT StyleEngine final : public GarbageCollected<StyleEngine>,
StyleSheetCollectionMap style_sheet_collection_map_;
bool document_scope_dirty_ = true;
bool all_tree_scopes_dirty_ = false;
bool tree_scopes_removed_ = false;
bool user_style_dirty_ = false;
UnorderedTreeScopeSet dirty_tree_scopes_;
......
......@@ -1182,10 +1182,6 @@ TEST_F(StyleEngineTest, StyleSheetsForStyleSheetList_Document) {
GetStyleEngine().StyleSheetsForStyleSheetList(GetDocument());
EXPECT_EQ(2u, second_sheet_list.size());
EXPECT_TRUE(GetStyleEngine().NeedsActiveStyleUpdate());
GetStyleEngine().MarkAllTreeScopesDirty();
GetStyleEngine().StyleSheetsForStyleSheetList(GetDocument());
EXPECT_FALSE(GetStyleEngine().NeedsActiveStyleUpdate());
}
TEST_F(StyleEngineTest, StyleSheetsForStyleSheetList_ShadowRoot) {
......@@ -1213,10 +1209,6 @@ TEST_F(StyleEngineTest, StyleSheetsForStyleSheetList_ShadowRoot) {
GetStyleEngine().StyleSheetsForStyleSheetList(shadow_root);
EXPECT_EQ(2u, second_sheet_list.size());
EXPECT_TRUE(GetStyleEngine().NeedsActiveStyleUpdate());
GetStyleEngine().MarkAllTreeScopesDirty();
GetStyleEngine().StyleSheetsForStyleSheetList(shadow_root);
EXPECT_FALSE(GetStyleEngine().NeedsActiveStyleUpdate());
}
class StyleEngineClient : public frame_test_helpers::TestWebWidgetClient {
......
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