Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: third_party/WebKit/Source/web/WebDocument.cpp

Issue 2835183002: Provide a method to remove inserted style sheet (Closed)
Patch Set: rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 } 175 }
176 176
177 WebElement WebDocument::GetElementById(const WebString& id) const { 177 WebElement WebDocument::GetElementById(const WebString& id) const {
178 return WebElement(ConstUnwrap<Document>()->getElementById(id)); 178 return WebElement(ConstUnwrap<Document>()->getElementById(id));
179 } 179 }
180 180
181 WebElement WebDocument::FocusedElement() const { 181 WebElement WebDocument::FocusedElement() const {
182 return WebElement(ConstUnwrap<Document>()->FocusedElement()); 182 return WebElement(ConstUnwrap<Document>()->FocusedElement());
183 } 183 }
184 184
185 void WebDocument::InsertStyleSheet(const WebString& source_code) { 185 WebStyleSheetId WebDocument::InsertStyleSheet(const WebString& source_code) {
186 Document* document = Unwrap<Document>(); 186 Document* document = Unwrap<Document>();
187 DCHECK(document); 187 DCHECK(document);
188 StyleSheetContents* parsed_sheet = 188 StyleSheetContents* parsed_sheet =
189 StyleSheetContents::Create(CSSParserContext::Create(*document)); 189 StyleSheetContents::Create(CSSParserContext::Create(*document));
190 parsed_sheet->ParseString(source_code); 190 parsed_sheet->ParseString(source_code);
191 document->GetStyleEngine().InjectAuthorSheet(parsed_sheet); 191 return document->GetStyleEngine().InjectAuthorSheet(parsed_sheet);
192 }
193
194 void WebDocument::RemoveInsertedStyleSheet(WebStyleSheetId stylesheet_id) {
195 Unwrap<Document>()->GetStyleEngine().RemoveInjectedAuthorSheet(stylesheet_id);
192 } 196 }
193 197
194 void WebDocument::WatchCSSSelectors(const WebVector<WebString>& web_selectors) { 198 void WebDocument::WatchCSSSelectors(const WebVector<WebString>& web_selectors) {
195 Document* document = Unwrap<Document>(); 199 Document* document = Unwrap<Document>();
196 CSSSelectorWatch* watch = CSSSelectorWatch::FromIfExists(*document); 200 CSSSelectorWatch* watch = CSSSelectorWatch::FromIfExists(*document);
197 if (!watch && web_selectors.empty()) 201 if (!watch && web_selectors.empty())
198 return; 202 return;
199 Vector<String> selectors; 203 Vector<String> selectors;
200 selectors.Append(web_selectors.Data(), web_selectors.size()); 204 selectors.Append(web_selectors.Data(), web_selectors.size());
201 CSSSelectorWatch::From(*document).WatchCSSSelectors(selectors); 205 CSSSelectorWatch::From(*document).WatchCSSSelectors(selectors);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 WebDocument& WebDocument::operator=(Document* elem) { 300 WebDocument& WebDocument::operator=(Document* elem) {
297 private_ = elem; 301 private_ = elem;
298 return *this; 302 return *this;
299 } 303 }
300 304
301 WebDocument::operator Document*() const { 305 WebDocument::operator Document*() const {
302 return ToDocument(private_.Get()); 306 return ToDocument(private_.Get());
303 } 307 }
304 308
305 } // namespace blink 309 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleEngineTest.cpp ('k') | third_party/WebKit/Source/web/tests/WebDocumentTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698