OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All |
7 * rights reserved. | 7 * rights reserved. |
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 return; | 148 return; |
149 if (!ShouldUpdateDocumentStyleSheetCollection()) | 149 if (!ShouldUpdateDocumentStyleSheetCollection()) |
150 return; | 150 return; |
151 | 151 |
152 GetDocumentStyleSheetCollection().CollectStyleSheetsForList(); | 152 GetDocumentStyleSheetCollection().CollectStyleSheetsForList(); |
153 // Avoid updating the styleSheets list repeatedly. Only safe for imports. | 153 // Avoid updating the styleSheets list repeatedly. Only safe for imports. |
154 document_scope_dirty_ = false; | 154 document_scope_dirty_ = false; |
155 DCHECK(!all_tree_scopes_dirty_); | 155 DCHECK(!all_tree_scopes_dirty_); |
156 } | 156 } |
157 | 157 |
158 void StyleEngine::InjectAuthorSheet(StyleSheetContents* author_sheet) { | 158 WebStyleSheetId StyleEngine::InjectAuthorSheet( |
159 injected_author_style_sheets_.push_back(TraceWrapperMember<CSSStyleSheet>( | 159 StyleSheetContents* author_sheet) { |
160 this, CSSStyleSheet::Create(author_sheet, *document_))); | 160 injected_author_style_sheets_.push_back(std::make_pair( |
| 161 ++injected_author_sheets_id_count_, |
| 162 TraceWrapperMember<CSSStyleSheet>( |
| 163 this, CSSStyleSheet::Create(author_sheet, *document_)))); |
| 164 |
161 MarkDocumentDirty(); | 165 MarkDocumentDirty(); |
| 166 return injected_author_sheets_id_count_; |
| 167 } |
| 168 |
| 169 void StyleEngine::RemoveInjectedAuthorSheet(WebStyleSheetId author_sheet_id) { |
| 170 for (size_t i = 0; i < injected_author_style_sheets_.size(); ++i) { |
| 171 if (injected_author_style_sheets_[i].first == author_sheet_id) { |
| 172 injected_author_style_sheets_.erase(i); |
| 173 MarkDocumentDirty(); |
| 174 } |
| 175 } |
162 } | 176 } |
163 | 177 |
164 CSSStyleSheet& StyleEngine::EnsureInspectorStyleSheet() { | 178 CSSStyleSheet& StyleEngine::EnsureInspectorStyleSheet() { |
165 if (inspector_style_sheet_) | 179 if (inspector_style_sheet_) |
166 return *inspector_style_sheet_; | 180 return *inspector_style_sheet_; |
167 | 181 |
168 StyleSheetContents* contents = | 182 StyleSheetContents* contents = |
169 StyleSheetContents::Create(CSSParserContext::Create(*document_)); | 183 StyleSheetContents::Create(CSSParserContext::Create(*document_)); |
170 inspector_style_sheet_ = CSSStyleSheet::Create(contents, *document_); | 184 inspector_style_sheet_ = CSSStyleSheet::Create(contents, *document_); |
171 MarkDocumentDirty(); | 185 MarkDocumentDirty(); |
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 visitor->Trace(global_rule_set_); | 1237 visitor->Trace(global_rule_set_); |
1224 visitor->Trace(style_invalidator_); | 1238 visitor->Trace(style_invalidator_); |
1225 visitor->Trace(font_selector_); | 1239 visitor->Trace(font_selector_); |
1226 visitor->Trace(text_to_sheet_cache_); | 1240 visitor->Trace(text_to_sheet_cache_); |
1227 visitor->Trace(sheet_to_text_cache_); | 1241 visitor->Trace(sheet_to_text_cache_); |
1228 visitor->Trace(tracker_); | 1242 visitor->Trace(tracker_); |
1229 CSSFontSelectorClient::Trace(visitor); | 1243 CSSFontSelectorClient::Trace(visitor); |
1230 } | 1244 } |
1231 | 1245 |
1232 DEFINE_TRACE_WRAPPERS(StyleEngine) { | 1246 DEFINE_TRACE_WRAPPERS(StyleEngine) { |
1233 for (auto sheet : injected_author_style_sheets_) { | 1247 for (const auto& sheet : injected_author_style_sheets_) { |
1234 visitor->TraceWrappers(sheet); | 1248 visitor->TraceWrappers(sheet.second); |
1235 } | 1249 } |
1236 visitor->TraceWrappers(document_style_sheet_collection_); | 1250 visitor->TraceWrappers(document_style_sheet_collection_); |
1237 } | 1251 } |
1238 | 1252 |
1239 } // namespace blink | 1253 } // namespace blink |
OLD | NEW |