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

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

Issue 66383005: Remove the concept of user stylesheets. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix WebFrameCSSCallbackTest tests Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « Source/testing/runner/WebPreferences.cpp ('k') | Source/web/WebSettingsImpl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 WebNode WebDocument::focusedNode() const 199 WebNode WebDocument::focusedNode() const
200 { 200 {
201 return WebNode(constUnwrap<Document>()->focusedElement()); 201 return WebNode(constUnwrap<Document>()->focusedElement());
202 } 202 }
203 203
204 WebDocumentType WebDocument::doctype() const 204 WebDocumentType WebDocument::doctype() const
205 { 205 {
206 return WebDocumentType(constUnwrap<Document>()->doctype()); 206 return WebDocumentType(constUnwrap<Document>()->doctype());
207 } 207 }
208 208
209 void WebDocument::insertUserStyleSheet(const WebString& sourceCode, UserStyleLev el styleLevel) 209 void WebDocument::insertUserStyleSheet(const WebString& sourceCode, UserStyleLev el)
210 {
211 insertStyleSheet(sourceCode);
212 }
213
214 void WebDocument::insertStyleSheet(const WebString& sourceCode)
210 { 215 {
211 RefPtr<Document> document = unwrap<Document>(); 216 RefPtr<Document> document = unwrap<Document>();
212 ASSERT(document); 217 ASSERT(document);
213 RefPtr<StyleSheetContents> parsedSheet = StyleSheetContents::create(*documen t.get()); 218 RefPtr<StyleSheetContents> parsedSheet = StyleSheetContents::create(*documen t.get());
214 parsedSheet->setIsUserStyleSheet(styleLevel == UserStyleUserLevel);
215 parsedSheet->parseString(sourceCode); 219 parsedSheet->parseString(sourceCode);
216 if (parsedSheet->isUserStyleSheet()) 220 document->styleEngine()->addAuthorSheet(parsedSheet);
217 document->styleEngine()->addUserSheet(parsedSheet);
218 else
219 document->styleEngine()->addAuthorSheet(parsedSheet);
220 } 221 }
221 222
222 void WebDocument::watchCSSSelectors(const WebVector<WebString>& webSelectors) 223 void WebDocument::watchCSSSelectors(const WebVector<WebString>& webSelectors)
223 { 224 {
224 RefPtr<Document> document = unwrap<Document>(); 225 RefPtr<Document> document = unwrap<Document>();
225 Vector<String> selectors; 226 Vector<String> selectors;
226 selectors.append(webSelectors.data(), webSelectors.size()); 227 selectors.append(webSelectors.data(), webSelectors.size());
227 CSSSelectorWatch::from(*document).watchCSSSelectors(selectors); 228 CSSSelectorWatch::from(*document).watchCSSSelectors(selectors);
228 } 229 }
229 230
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 m_private = elem; 315 m_private = elem;
315 return *this; 316 return *this;
316 } 317 }
317 318
318 WebDocument::operator PassRefPtr<Document>() const 319 WebDocument::operator PassRefPtr<Document>() const
319 { 320 {
320 return toDocument(m_private.get()); 321 return toDocument(m_private.get());
321 } 322 }
322 323
323 } // namespace blink 324 } // namespace blink
OLDNEW
« no previous file with comments | « Source/testing/runner/WebPreferences.cpp ('k') | Source/web/WebSettingsImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698