| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 Master()->GetStyleEngine().UpdateActiveStyle(); | 129 Master()->GetStyleEngine().UpdateActiveStyle(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 if (tree_scope == document_) | 132 if (tree_scope == document_) |
| 133 return GetDocumentStyleSheetCollection().StyleSheetsForStyleSheetList(); | 133 return GetDocumentStyleSheetCollection().StyleSheetsForStyleSheetList(); |
| 134 | 134 |
| 135 return EnsureStyleSheetCollectionFor(tree_scope) | 135 return EnsureStyleSheetCollectionFor(tree_scope) |
| 136 ->StyleSheetsForStyleSheetList(); | 136 ->StyleSheetsForStyleSheetList(); |
| 137 } | 137 } |
| 138 | 138 |
| 139 void StyleEngine::InjectAuthorSheet(StyleSheetContents* author_sheet) { | 139 unsigned StyleEngine::InjectAuthorSheet(StyleSheetContents* author_sheet) { |
| 140 injected_author_style_sheets_.push_back(TraceWrapperMember<CSSStyleSheet>( | 140 injected_author_style_sheets_.push_back(std::make_pair( |
| 141 this, CSSStyleSheet::Create(author_sheet, *document_))); | 141 ++injected_author_sheets_id_count_, |
| 142 TraceWrapperMember<CSSStyleSheet>( |
| 143 this, CSSStyleSheet::Create(author_sheet, *document_)))); |
| 144 |
| 142 MarkDocumentDirty(); | 145 MarkDocumentDirty(); |
| 146 return injected_author_sheets_id_count_; |
| 147 } |
| 148 |
| 149 void StyleEngine::RemoveInjectedAuthorSheet(unsigned author_sheet_id) { |
| 150 for (size_t i = 0; i < injected_author_style_sheets_.size(); ++i) { |
| 151 if (injected_author_style_sheets_[i].first == author_sheet_id) { |
| 152 injected_author_style_sheets_.erase(i); |
| 153 MarkDocumentDirty(); |
| 154 } |
| 155 } |
| 143 } | 156 } |
| 144 | 157 |
| 145 CSSStyleSheet& StyleEngine::EnsureInspectorStyleSheet() { | 158 CSSStyleSheet& StyleEngine::EnsureInspectorStyleSheet() { |
| 146 if (inspector_style_sheet_) | 159 if (inspector_style_sheet_) |
| 147 return *inspector_style_sheet_; | 160 return *inspector_style_sheet_; |
| 148 | 161 |
| 149 StyleSheetContents* contents = | 162 StyleSheetContents* contents = |
| 150 StyleSheetContents::Create(CSSParserContext::Create(*document_)); | 163 StyleSheetContents::Create(CSSParserContext::Create(*document_)); |
| 151 inspector_style_sheet_ = CSSStyleSheet::Create(contents, *document_); | 164 inspector_style_sheet_ = CSSStyleSheet::Create(contents, *document_); |
| 152 MarkDocumentDirty(); | 165 MarkDocumentDirty(); |
| (...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 visitor->Trace(media_query_evaluator_); | 1181 visitor->Trace(media_query_evaluator_); |
| 1169 visitor->Trace(style_invalidator_); | 1182 visitor->Trace(style_invalidator_); |
| 1170 visitor->Trace(font_selector_); | 1183 visitor->Trace(font_selector_); |
| 1171 visitor->Trace(text_to_sheet_cache_); | 1184 visitor->Trace(text_to_sheet_cache_); |
| 1172 visitor->Trace(sheet_to_text_cache_); | 1185 visitor->Trace(sheet_to_text_cache_); |
| 1173 visitor->Trace(tracker_); | 1186 visitor->Trace(tracker_); |
| 1174 CSSFontSelectorClient::Trace(visitor); | 1187 CSSFontSelectorClient::Trace(visitor); |
| 1175 } | 1188 } |
| 1176 | 1189 |
| 1177 DEFINE_TRACE_WRAPPERS(StyleEngine) { | 1190 DEFINE_TRACE_WRAPPERS(StyleEngine) { |
| 1178 for (auto sheet : injected_author_style_sheets_) { | 1191 for (const auto& sheet : injected_author_style_sheets_) { |
| 1179 visitor->TraceWrappers(sheet); | 1192 visitor->TraceWrappers(sheet.second); |
| 1180 } | 1193 } |
| 1181 visitor->TraceWrappers(document_style_sheet_collection_); | 1194 visitor->TraceWrappers(document_style_sheet_collection_); |
| 1182 } | 1195 } |
| 1183 | 1196 |
| 1184 } // namespace blink | 1197 } // namespace blink |
| OLD | NEW |