Index: third_party/WebKit/Source/core/dom/StyleEngine.cpp |
diff --git a/third_party/WebKit/Source/core/dom/StyleEngine.cpp b/third_party/WebKit/Source/core/dom/StyleEngine.cpp |
index 0634c6ef6687e915f7a688860400b3aca78550f3..9d10e578b316779a59e87ce8ddd7a11ff435cd48 100644 |
--- a/third_party/WebKit/Source/core/dom/StyleEngine.cpp |
+++ b/third_party/WebKit/Source/core/dom/StyleEngine.cpp |
@@ -136,10 +136,23 @@ StyleEngine::StyleSheetsForStyleSheetList(TreeScope& tree_scope) { |
->StyleSheetsForStyleSheetList(); |
} |
-void StyleEngine::InjectAuthorSheet(StyleSheetContents* author_sheet) { |
- injected_author_style_sheets_.push_back(TraceWrapperMember<CSSStyleSheet>( |
- this, CSSStyleSheet::Create(author_sheet, *document_))); |
+unsigned StyleEngine::InjectAuthorSheet(StyleSheetContents* author_sheet) { |
+ injected_author_style_sheets_.push_back(std::make_pair( |
+ ++injected_author_sheets_id_count_, |
+ TraceWrapperMember<CSSStyleSheet>( |
+ this, CSSStyleSheet::Create(author_sheet, *document_)))); |
+ |
MarkDocumentDirty(); |
+ return injected_author_sheets_id_count_; |
+} |
+ |
+void StyleEngine::RemoveInjectedAuthorSheet(unsigned author_sheet_id) { |
+ for (size_t i = 0; i < injected_author_style_sheets_.size(); ++i) { |
+ if (injected_author_style_sheets_[i].first == author_sheet_id) { |
+ injected_author_style_sheets_.erase(i); |
+ MarkDocumentDirty(); |
+ } |
+ } |
} |
CSSStyleSheet& StyleEngine::EnsureInspectorStyleSheet() { |
@@ -1175,8 +1188,8 @@ DEFINE_TRACE(StyleEngine) { |
} |
DEFINE_TRACE_WRAPPERS(StyleEngine) { |
- for (auto sheet : injected_author_style_sheets_) { |
- visitor->TraceWrappers(sheet); |
+ for (const auto& sheet : injected_author_style_sheets_) { |
+ visitor->TraceWrappers(sheet.second); |
} |
visitor->TraceWrappers(document_style_sheet_collection_); |
} |