Index: Source/web/WebViewImpl.cpp |
diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp |
index ca0ddc7bb21b392181f2a278f4c66bfd01f8fc8b..79a4b6a6120e5654b9408e00facd6dd4e66a58a5 100644 |
--- a/Source/web/WebViewImpl.cpp |
+++ b/Source/web/WebViewImpl.cpp |
@@ -3661,30 +3661,29 @@ void WebViewImpl::setSelectionColors(unsigned activeBackgroundColor, |
#endif |
} |
-void WebView::addUserStyleSheet(const WebString& sourceCode, |
- const WebVector<WebString>& patternsIn, |
- WebView::UserContentInjectIn injectIn, |
- WebView::UserStyleInjectionTime injectionTime) |
+void WebView::injectStyleSheet(const WebString& sourceCode, const WebVector<WebString>& patternsIn, WebView::StyleInjectionTarget injectIn) |
{ |
Vector<String> patterns; |
for (size_t i = 0; i < patternsIn.size(); ++i) |
patterns.append(patternsIn[i]); |
PageGroup* pageGroup = PageGroup::sharedGroup(); |
+ pageGroup->injectStyleSheet(sourceCode, patterns, static_cast<WebCore::StyleInjectionTarget>(injectIn)); |
+} |
- // FIXME: Current callers always want the level to be "author". It probably makes sense to let |
- // callers specify this though, since in other cases the caller will probably want "user" level. |
- // |
- // FIXME: It would be nice to populate the URL correctly, instead of passing an empty URL. |
- pageGroup->addUserStyleSheet(sourceCode, WebURL(), patterns, Vector<String>(), |
- static_cast<UserContentInjectedFrames>(injectIn), |
- UserStyleAuthorLevel, |
- static_cast<WebCore::UserStyleInjectionTime>(injectionTime)); |
+void WebView::removeInjectedStyleSheets() |
+{ |
+ PageGroup::sharedGroup()->removeInjectedStyleSheets(); |
+} |
+ |
+void WebView::addUserStyleSheet(const WebString& sourceCode, const WebVector<WebString>& patternsIn, WebView::UserContentInjectIn injectIn, WebView::UserStyleInjectionTime) |
+{ |
+ injectStyleSheet(sourceCode, patternsIn, injectIn == UserContentInjectInAllFrames ? InjectStyleInAllFrames : InjectStyleInTopFrameOnly); |
} |
void WebView::removeAllUserContent() |
{ |
- PageGroup::sharedGroup()->removeAllUserContent(); |
+ removeInjectedStyleSheets(); |
} |
void WebViewImpl::didCommitLoad(bool* isNewNavigation, bool isNavigationWithinPage) |