| 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 720758e56148c3a9fe66b32955bfca3e56c998c1..bc1a1699c3a8ca0908af62442f074942b3e343bc 100644
|
| --- a/third_party/WebKit/Source/core/dom/StyleEngine.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
|
| @@ -155,10 +155,24 @@ void StyleEngine::UpdateStyleSheetList(TreeScope& tree_scope) {
|
| DCHECK(!all_tree_scopes_dirty_);
|
| }
|
|
|
| -void StyleEngine::InjectAuthorSheet(StyleSheetContents* author_sheet) {
|
| - injected_author_style_sheets_.push_back(TraceWrapperMember<CSSStyleSheet>(
|
| - this, CSSStyleSheet::Create(author_sheet, *document_)));
|
| +WebStyleSheetId 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(WebStyleSheetId 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() {
|
| @@ -1230,8 +1244,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_);
|
| }
|
|
|