<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[170891] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/170891">170891</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-07-08 10:53:34 -0700 (Tue, 08 Jul 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>[GTK] Move user style sheet API out of WebKitWebViewGroup
https://bugs.webkit.org/show_bug.cgi?id=134551
Patch by Adrian Perez de Castro <aperez@igalia.com> on 2014-07-08
Reviewed by Carlos Garcia Campos.
Source/WebKit2:
* PlatformGTK.cmake: Include the new source files in the build.
* UIProcess/API/C/gtk/WKView.cpp:
(WKViewCreate):
Adapt to the additional webkitWebViewBaseCreateWebPage() parameter.
* UIProcess/API/gtk/WebKitUserContent.cpp: Added.
(toUserContentInjectedFrames):
(toUserStyleLevel):
(toStringVector):
(_WebKitUserStyleSheet::_WebKitUserStyleSheet):
(webkit_user_style_sheet_ref):
(webkit_user_style_sheet_unref):
(webkit_user_style_sheet_new):
(webkitWebKitUserStyleSheetToUserStyleSheet):
* UIProcess/API/gtk/WebKitUserContent.h: Added.
* UIProcess/API/gtk/WebKitUserContentManager.cpp: Added.
(_WebKitUserContentManagerPrivate::_WebKitUserContentManagerPrivate):
(webkit_user_content_manager_class_init):
(webkit_user_content_manager_new):
(webkit_user_content_manager_add_style_sheet):
(webkit_user_content_manager_remove_all_style_sheets):
(webkitUserContentManagerGetUserContentControllerProxy):
* UIProcess/API/gtk/WebKitUserContentManager.h: Added.
* UIProcess/API/gtk/WebKitUserContentManagerPrivate.h: Added.
* UIProcess/API/gtk/WebKitUserContentPrivate.h: Added.
* UIProcess/API/gtk/WebKitWebContext.cpp:
(webkitWebContextCreatePageForWebView): Add a new parameter to allow
passing the WebKitUserContentManager that the web view will use.
* UIProcess/API/gtk/WebKitWebContextPrivate.h: Ditto.
* UIProcess/API/gtk/WebKitWebView.cpp:
(webkitWebViewConstructed): Added handling of the
"user-content-manager" property on construction.
(webkitWebViewSetProperty): Added support for the
"user-content-manager" property.
(webkitWebViewGetProperty): Added support for the
"user-content-manager" property.
(webkit_web_view_class_init): Added the "user-content-manager"
property definition to the WebKitWebView class.
(webkit_web_view_new_with_related_view): Made related views share
the same WebKitUserContentManager used by the view they are
related to.
(webkit_web_view_new_with_user_content_manager): Added.
(webkit_web_view_get_user_content_manager): Added.
* UIProcess/API/gtk/WebKitWebView.h: Add new API methods.
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseCreate): Added a parameter to pass the user
content manager.
(webkitWebViewBaseCreateWebPage): Added a parameter to pass the user
content manager.
* UIProcess/API/gtk/WebKitWebViewBasePrivate.h: Ditto.
* UIProcess/API/gtk/WebKitWebViewGroup.cpp: Removed the bits related
to user style sheet support from WebKitWebViewGroup.
(webkit_web_view_group_set_settings):
(toAPIArray): Deleted.
(webkit_web_view_group_add_user_style_sheet): Deleted.
(webkit_web_view_group_remove_all_user_style_sheets): Deleted.
* UIProcess/API/gtk/WebKitWebViewGroup.h: Deleted the API methods
for user style sheet handling.
* UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Added the new API
functions and types, and removed the methods which are no longer
available in WebKitWebViewGroup.
* UIProcess/API/gtk/webkit2.h: Add the new headers.
* UIProcess/UserContent/WebUserContentControllerProxy.cpp: Added
methods to add and remove user style sheets, alike those used for
user scripts.
(WebKit::WebUserContentControllerProxy::addProcess):
(WebKit::WebUserContentControllerProxy::addUserStyleSheet):
(WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
* UIProcess/UserContent/WebUserContentControllerProxy.h: Ditto.
* UIProcess/gtk/WebInspectorProxyGtk.cpp:
(WebKit::WebInspectorProxy::platformCreateInspectorPage):
Adapt to the additional webkitWebViewBaseCreateWebPage() parameter.
* WebProcess/UserContent/WebUserContentController.cpp: Added methods
to add and remove user style sheets, alike those used for user scripts.
(WebKit::WebUserContentController::addUserStyleSheets):
(WebKit::WebUserContentController::removeAllUserStyleSheets):
* WebProcess/UserContent/WebUserContentController.h: Ditto.
* WebProcess/UserContent/WebUserContentController.messages.in:
Ditto.
Tools:
Removes testing user style sheet injection from
TestWebKitWebViewGroup and moves that into a new
TestWebKitUserContentManager, adapting the existing tests to the new
API. Also, it contains a new test case for
webkit_web_view_new_with_user_content_manager().
* TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt:
* TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitUserContentManager.cpp: Added.
(UserContentManagerTest::UserContentManagerTest):
(testWebViewNewWithUserContentManager):
(isStyleSheetInjectedForURLAtPath):
(fillURLListFromPaths):
(removeOldInjectedStyleSheetsAndResetLists):
(testUserContentManagerInjectedStyleSheet):
(serverCallback):
(beforeAll):
(afterAll):
* TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebViewGroup.cpp:
(beforeAll):
(afterAll):
(isStyleSheetInjectedForURLAtPath): Deleted.
(fillURLListFromPaths): Deleted.
(removeOldInjectedStyleSheetsAndResetLists): Deleted.
(testWebViewGroupInjectedStyleSheet): Deleted.
(serverCallback): Deleted.
* TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp:
(WebViewTest::WebViewTest):
* TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2PlatformGTKcmake">trunk/Source/WebKit2/PlatformGTK.cmake</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICgtkWKViewcpp">trunk/Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebContextcpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebContextPrivateh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewcpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewBasecpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewBasePrivateh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewGroupcpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewGroup.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewGrouph">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewGroup.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtksectionstxt">trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkwebkit2h">trunk/Source/WebKit2/UIProcess/API/gtk/webkit2.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessUserContentWebUserContentControllerProxycpp">trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessUserContentWebUserContentControllerProxyh">trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessgtkWebInspectorProxyGtkcpp">trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessUserContentWebUserContentControllercpp">trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessUserContentWebUserContentControllerh">trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessUserContentWebUserContentControllermessagesin">trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.messages.in</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkCMakeListstxt">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkTestWebKitWebViewGroupcpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebViewGroup.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPIgtkWebKit2GtkWebViewTestcpp">trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPIgtkWebKit2GtkWebViewTesth">trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitUserContentcpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUserContent.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitUserContenth">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUserContent.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitUserContentManagercpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManager.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitUserContentManagerh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManager.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitUserContentManagerPrivateh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManagerPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitUserContentPrivateh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentPrivate.h</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkTestWebKitUserContentManagercpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitUserContentManager.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (170890 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-07-08 17:50:27 UTC (rev 170890)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -924,7 +924,9 @@
</span><span class="cx"> __ZN7WebCore21SerializedScriptValueD1Ev
</span><span class="cx"> __ZN7WebCore21URLByRemovingUserInfoEP5NSURL
</span><span class="cx"> __ZN7WebCore21UserContentController13addUserScriptERNS_15DOMWrapperWorldENSt3__110unique_ptrINS_10UserScriptENS3_14default_deleteIS5_EEEE
</span><ins>+__ZN7WebCore21UserContentController17addUserStyleSheetERNS_15DOMWrapperWorldENSt3__110unique_ptrINS_14UserStyleSheetENS3_14default_deleteIS5_EEEENS_22UserStyleInjectionTimeE
</ins><span class="cx"> __ZN7WebCore21UserContentController17removeUserScriptsERNS_15DOMWrapperWorldE
</span><ins>+__ZN7WebCore21UserContentController21removeUserStyleSheetsERNS_15DOMWrapperWorldE
</ins><span class="cx"> __ZN7WebCore21UserContentController31addUserMessageHandlerDescriptorERNS_28UserMessageHandlerDescriptorE
</span><span class="cx"> __ZN7WebCore21UserContentController34removeUserMessageHandlerDescriptorERNS_28UserMessageHandlerDescriptorE
</span><span class="cx"> __ZN7WebCore21UserContentController6createEv
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (170890 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-07-08 17:50:27 UTC (rev 170890)
+++ trunk/Source/WebKit2/ChangeLog        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -1,3 +1,89 @@
</span><ins>+2014-07-08 Adrian Perez de Castro <aperez@igalia.com>
+
+ [GTK] Move user style sheet API out of WebKitWebViewGroup
+ https://bugs.webkit.org/show_bug.cgi?id=134551
+
+ Reviewed by Carlos Garcia Campos.
+
+ * PlatformGTK.cmake: Include the new source files in the build.
+ * UIProcess/API/C/gtk/WKView.cpp:
+ (WKViewCreate):
+ Adapt to the additional webkitWebViewBaseCreateWebPage() parameter.
+ * UIProcess/API/gtk/WebKitUserContent.cpp: Added.
+ (toUserContentInjectedFrames):
+ (toUserStyleLevel):
+ (toStringVector):
+ (_WebKitUserStyleSheet::_WebKitUserStyleSheet):
+ (webkit_user_style_sheet_ref):
+ (webkit_user_style_sheet_unref):
+ (webkit_user_style_sheet_new):
+ (webkitWebKitUserStyleSheetToUserStyleSheet):
+ * UIProcess/API/gtk/WebKitUserContent.h: Added.
+ * UIProcess/API/gtk/WebKitUserContentManager.cpp: Added.
+ (_WebKitUserContentManagerPrivate::_WebKitUserContentManagerPrivate):
+ (webkit_user_content_manager_class_init):
+ (webkit_user_content_manager_new):
+ (webkit_user_content_manager_add_style_sheet):
+ (webkit_user_content_manager_remove_all_style_sheets):
+ (webkitUserContentManagerGetUserContentControllerProxy):
+ * UIProcess/API/gtk/WebKitUserContentManager.h: Added.
+ * UIProcess/API/gtk/WebKitUserContentManagerPrivate.h: Added.
+ * UIProcess/API/gtk/WebKitUserContentPrivate.h: Added.
+ * UIProcess/API/gtk/WebKitWebContext.cpp:
+ (webkitWebContextCreatePageForWebView): Add a new parameter to allow
+ passing the WebKitUserContentManager that the web view will use.
+ * UIProcess/API/gtk/WebKitWebContextPrivate.h: Ditto.
+ * UIProcess/API/gtk/WebKitWebView.cpp:
+ (webkitWebViewConstructed): Added handling of the
+ "user-content-manager" property on construction.
+ (webkitWebViewSetProperty): Added support for the
+ "user-content-manager" property.
+ (webkitWebViewGetProperty): Added support for the
+ "user-content-manager" property.
+ (webkit_web_view_class_init): Added the "user-content-manager"
+ property definition to the WebKitWebView class.
+ (webkit_web_view_new_with_related_view): Made related views share
+ the same WebKitUserContentManager used by the view they are
+ related to.
+ (webkit_web_view_new_with_user_content_manager): Added.
+ (webkit_web_view_get_user_content_manager): Added.
+ * UIProcess/API/gtk/WebKitWebView.h: Add new API methods.
+ * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+ (webkitWebViewBaseCreate): Added a parameter to pass the user
+ content manager.
+ (webkitWebViewBaseCreateWebPage): Added a parameter to pass the user
+ content manager.
+ * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: Ditto.
+ * UIProcess/API/gtk/WebKitWebViewGroup.cpp: Removed the bits related
+ to user style sheet support from WebKitWebViewGroup.
+ (webkit_web_view_group_set_settings):
+ (toAPIArray): Deleted.
+ (webkit_web_view_group_add_user_style_sheet): Deleted.
+ (webkit_web_view_group_remove_all_user_style_sheets): Deleted.
+ * UIProcess/API/gtk/WebKitWebViewGroup.h: Deleted the API methods
+ for user style sheet handling.
+ * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Added the new API
+ functions and types, and removed the methods which are no longer
+ available in WebKitWebViewGroup.
+ * UIProcess/API/gtk/webkit2.h: Add the new headers.
+ * UIProcess/UserContent/WebUserContentControllerProxy.cpp: Added
+ methods to add and remove user style sheets, alike those used for
+ user scripts.
+ (WebKit::WebUserContentControllerProxy::addProcess):
+ (WebKit::WebUserContentControllerProxy::addUserStyleSheet):
+ (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
+ * UIProcess/UserContent/WebUserContentControllerProxy.h: Ditto.
+ * UIProcess/gtk/WebInspectorProxyGtk.cpp:
+ (WebKit::WebInspectorProxy::platformCreateInspectorPage):
+ Adapt to the additional webkitWebViewBaseCreateWebPage() parameter.
+ * WebProcess/UserContent/WebUserContentController.cpp: Added methods
+ to add and remove user style sheets, alike those used for user scripts.
+ (WebKit::WebUserContentController::addUserStyleSheets):
+ (WebKit::WebUserContentController::removeAllUserStyleSheets):
+ * WebProcess/UserContent/WebUserContentController.h: Ditto.
+ * WebProcess/UserContent/WebUserContentController.messages.in:
+ Ditto.
+
</ins><span class="cx"> 2014-07-08 Zan Dobersek <zdobersek@igalia.com>
</span><span class="cx">
</span><span class="cx"> [GTK] Guard uses of RedirectedXCompositeWindow in WebKitWebViewBase with PLATFORM(X11)
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/PlatformGTK.cmake (170890 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PlatformGTK.cmake        2014-07-08 17:50:27 UTC (rev 170890)
+++ trunk/Source/WebKit2/PlatformGTK.cmake        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -210,6 +210,12 @@
</span><span class="cx"> UIProcess/API/gtk/WebKitURISchemeRequest.cpp
</span><span class="cx"> UIProcess/API/gtk/WebKitURISchemeRequest.h
</span><span class="cx"> UIProcess/API/gtk/WebKitURISchemeRequestPrivate.h
</span><ins>+ UIProcess/API/gtk/WebKitUserContent.h
+ UIProcess/API/gtk/WebKitUserContent.cpp
+ UIProcess/API/gtk/WebKitUserContentPrivate.h
+ UIProcess/API/gtk/WebKitUserContentManager.h
+ UIProcess/API/gtk/WebKitUserContentManagerPrivate.h
+ UIProcess/API/gtk/WebKitUserContentManager.cpp
</ins><span class="cx"> UIProcess/API/gtk/WebKitVersion.cpp
</span><span class="cx"> UIProcess/API/gtk/WebKitVersion.h.in
</span><span class="cx"> UIProcess/API/gtk/WebKitWebContext.cpp
</span><span class="lines">@@ -353,6 +359,8 @@
</span><span class="cx"> ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitURIRequest.h
</span><span class="cx"> ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitURIResponse.h
</span><span class="cx"> ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitURISchemeRequest.h
</span><ins>+ ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitUserContent.h
+ ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitUserContentManager.h
</ins><span class="cx"> ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitWebContext.h
</span><span class="cx"> ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitWebInspector.h
</span><span class="cx"> ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitWebResource.h
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICgtkWKViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp (170890 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp        2014-07-08 17:50:27 UTC (rev 170890)
+++ trunk/Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -37,7 +37,7 @@
</span><span class="cx">
</span><span class="cx"> WKViewRef WKViewCreate(WKContextRef contextRef, WKPageGroupRef pageGroupRef)
</span><span class="cx"> {
</span><del>- return toAPI(webkitWebViewBaseCreate(toImpl(contextRef), toImpl(pageGroupRef), nullptr));
</del><ins>+ return toAPI(webkitWebViewBaseCreate(toImpl(contextRef), toImpl(pageGroupRef), nullptr, nullptr));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> WKPageRef WKViewGetPage(WKViewRef viewRef)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitUserContentcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUserContent.cpp (0 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUserContent.cpp         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUserContent.cpp        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -0,0 +1,161 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebKitUserContent.h"
+
+#include "WebKitPrivate.h"
+#include "WebKitUserContentPrivate.h"
+#include <wtf/text/CString.h>
+#include <wtf/text/StringBuilder.h>
+
+using namespace WebCore;
+
+/**
+ * SECTION:WebKitUserContent
+ * @short_description: Defines user content types which affect web pages.
+ * @title: User content
+ *
+ * See also: #WebKitUserContentManager
+ *
+ * Since: 2.6
+ */
+
+static inline UserContentInjectedFrames toUserContentInjectedFrames(WebKitUserContentInjectedFrames injectedFrames)
+{
+ switch (injectedFrames) {
+ case WEBKIT_USER_CONTENT_INJECT_TOP_FRAME:
+ return InjectInTopFrameOnly;
+ case WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES:
+ return InjectInAllFrames;
+ default:
+ ASSERT_NOT_REACHED();
+ return InjectInAllFrames;
+ }
+}
+
+static inline UserStyleLevel toUserStyleLevel(WebKitUserStyleLevel styleLevel)
+{
+ switch (styleLevel) {
+ case WEBKIT_USER_STYLE_LEVEL_USER:
+ return UserStyleUserLevel;
+ case WEBKIT_USER_STYLE_LEVEL_AUTHOR:
+ return UserStyleAuthorLevel;
+ default:
+ ASSERT_NOT_REACHED();
+ return UserStyleAuthorLevel;
+ }
+}
+
+static inline Vector<String> toStringVector(const char* const* strv)
+{
+ if (!strv)
+ return Vector<String>();
+
+ Vector<String> result;
+ for (auto str = strv; *str; ++str)
+ result.append(std::move(String::fromUTF8(*str)));
+ return result;
+}
+
+struct _WebKitUserStyleSheet {
+ _WebKitUserStyleSheet(const gchar* source, WebKitUserContentInjectedFrames injectedFrames, WebKitUserStyleLevel level, const char* const* whitelist, const char* const* blacklist)
+ : userStyleSheet(std::make_unique<UserStyleSheet>(
+ String::fromUTF8(source), URL { },
+ toStringVector(whitelist), toStringVector(blacklist),
+ toUserContentInjectedFrames(injectedFrames),
+ toUserStyleLevel(level)))
+ , referenceCount(1)
+ {
+ }
+
+ std::unique_ptr<UserStyleSheet> userStyleSheet;
+ int referenceCount;
+};
+
+G_DEFINE_BOXED_TYPE(WebKitUserStyleSheet, webkit_user_style_sheet, webkit_user_style_sheet_ref, webkit_user_style_sheet_unref)
+
+/**
+ * webkit_user_style_sheet_ref:
+ * @user_style_sheet: a #WebKitUserStyleSheet
+ *
+ * Atomically increments the reference count of @user_style_sheet by one.
+ * This function is MT-safe and may be called from any thread.
+ *
+ * Returns: The passed #WebKitUserStyleSheet
+ *
+ * Since: 2.6
+ */
+WebKitUserStyleSheet* webkit_user_style_sheet_ref(WebKitUserStyleSheet* userStyleSheet)
+{
+ g_atomic_int_inc(&userStyleSheet->referenceCount);
+ return userStyleSheet;
+}
+
+/**
+ * webkit_user_style_sheet_unref:
+ * @user_style_sheet: a #WebKitUserStyleSheet
+ *
+ * Atomically decrements the reference count of @user_style_sheet by one.
+ * If the reference count drops to 0, all memory allocated by
+ * #WebKitUserStyleSheet is released. This function is MT-safe and may be
+ * called from any thread.
+ *
+ * Since: 2.6
+ */
+void webkit_user_style_sheet_unref(WebKitUserStyleSheet* userStyleSheet)
+{
+ if (g_atomic_int_dec_and_test(&userStyleSheet->referenceCount)) {
+ userStyleSheet->~WebKitUserStyleSheet();
+ g_slice_free(WebKitUserStyleSheet, userStyleSheet);
+ }
+}
+
+/**
+ * webkit_user_style_sheet_new:
+ * @source: Source code of the user style sheet.
+ * @injected_frames: A #WebKitUserContentInjectedFrames value
+ * @level: A #WebKitUserStyleLevel
+ * @whitelist: (array zero-terminated=1) (allow-none): A whitelist of URI patterns or %NULL
+ * @blacklist: (array zero-terminated=1) (allow-none): A blacklist of URI patterns or %NULL
+ *
+ * Creates a new user style sheet. Style sheets can be applied to some URIs
+ * only by passing non-null values for @whitelist or @blacklist. Passing a
+ * %NULL whitelist implies that all URIs are on the whitelist. The style
+ * sheet is applied if an URI matches the whitelist and not the blacklist.
+ * URI patterns must be of the form `[protocol]://[host]/[path]`, where the
+ * *host* and *path* components can contain the wildcard character (`*`) to
+ * represent zero or more other characters.
+ *
+ * Returns: A new #WebKitUserStyleSheet
+ *
+ * Since: 2.6
+ */
+WebKitUserStyleSheet* webkit_user_style_sheet_new(const gchar* source, WebKitUserContentInjectedFrames injectedFrames, WebKitUserStyleLevel level, const char* const* whitelist, const char* const* blacklist)
+{
+ g_return_val_if_fail(source, nullptr);
+ WebKitUserStyleSheet* userStyleSheet = g_slice_new(WebKitUserStyleSheet);
+ new (userStyleSheet) WebKitUserStyleSheet(source, injectedFrames, level, whitelist, blacklist);
+ return userStyleSheet;
+}
+
+const UserStyleSheet& webkitUserStyleSheetGetUserStyleSheet(WebKitUserStyleSheet* userStyleSheet)
+{
+ return *userStyleSheet->userStyleSheet;
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitUserContenth"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUserContent.h (0 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUserContent.h         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUserContent.h        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -0,0 +1,89 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
+#error "Only <webkit2/webkit2.h> can be included directly."
+#endif
+
+#ifndef WebKitUserContent_h
+#define WebKitUserContent_h
+
+#include <glib-object.h>
+#include <webkit2/WebKitDefines.h>
+
+G_BEGIN_DECLS
+
+/**
+ * WebKitUserContentInjectedFrames:
+ * @WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES: Insert the user style
+ * sheet in all the frames loaded by the web view, including
+ * nested frames. This is the default.
+ * @WEBKIT_USER_CONTENT_INJECT_TOP_FRAME: Insert the user style
+ * sheet *only* in the top-level frame loaded by the web view,
+ * and *not* in the nested frames.
+ *
+ * Specifies in which frames user style sheets are to be inserted in.
+ *
+ * Since: 2.6
+ */
+typedef enum {
+ WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES,
+ WEBKIT_USER_CONTENT_INJECT_TOP_FRAME,
+} WebKitUserContentInjectedFrames;
+
+/**
+ * WebKitUserStyleLevel:
+ * @WEBKIT_USER_STYLE_LEVEL_USER: The style sheet is an user style sheet,
+ * its contents always override other style sheets. This is the default.
+ * @WEBKIT_USER_STYLE_LEVEL_AUTHOR: The style sheet will be treated as if
+ * it was provided by the loaded documents. That means other user style
+ * sheets may still override it.
+ *
+ * Specifies how to treat an user style sheet.
+ *
+ * Since: 2.6
+ */
+typedef enum {
+ WEBKIT_USER_STYLE_LEVEL_USER,
+ WEBKIT_USER_STYLE_LEVEL_AUTHOR,
+} WebKitUserStyleLevel;
+
+#define WEBKIT_TYPE_USER_STYLE_SHEET (webkit_user_style_sheet_get_type())
+
+typedef struct _WebKitUserStyleSheet WebKitUserStyleSheet;
+
+WEBKIT_API GType
+webkit_user_style_sheet_get_type (void);
+
+WEBKIT_API WebKitUserStyleSheet *
+webkit_user_style_sheet_ref (WebKitUserStyleSheet *user_style_sheet);
+
+WEBKIT_API void
+webkit_user_style_sheet_unref (WebKitUserStyleSheet *user_style_sheet);
+
+WEBKIT_API WebKitUserStyleSheet *
+webkit_user_style_sheet_new (const gchar *source,
+ WebKitUserContentInjectedFrames injected_frames,
+ WebKitUserStyleLevel level,
+ const gchar* const *whitelist,
+ const gchar* const *blacklist);
+
+G_END_DECLS
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitUserContentManagercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManager.cpp (0 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManager.cpp         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManager.cpp        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -0,0 +1,115 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebKitUserContentManager.h"
+
+#include "WebKitPrivate.h"
+#include "WebKitUserContentManagerPrivate.h"
+#include "WebKitUserContentPrivate.h"
+#include <wtf/gobject/GRefPtr.h>
+
+using namespace WebCore;
+using namespace WebKit;
+
+struct _WebKitUserContentManagerPrivate {
+ _WebKitUserContentManagerPrivate()
+ : userContentController(WebUserContentControllerProxy::create())
+ {
+ }
+
+ RefPtr<WebUserContentControllerProxy> userContentController;
+};
+
+/**
+ * SECTION:WebKitUserContentManager
+ * @short_description: Manages user-defined content which affects web pages.
+ * @title: WebKitUserContentManager
+ *
+ * Using a #WebKitUserContentManager user CSS style sheets can be set to
+ * be injected in the web pages loaded by a #WebKitWebView, by
+ * webkit_user_content_manager_add_style_sheet().
+ *
+ * To use a #WebKitUserContentManager, it must be created using
+ * webkit_user_content_manager_new(), and then passed to
+ * webkit_web_view_new_with_user_content_manager(). User style
+ * sheets can be created with webkit_user_style_sheet_new().
+ *
+ * User style sheets can be added and removed at any time, but
+ * they will affect the web pages loaded afterwards.
+ *
+ * Since: 2.6
+ */
+
+WEBKIT_DEFINE_TYPE(WebKitUserContentManager, webkit_user_content_manager, G_TYPE_OBJECT)
+
+static void webkit_user_content_manager_class_init(WebKitUserContentManagerClass*)
+{
+}
+
+/**
+ * webkit_user_content_manager_new:
+ *
+ * Creates a new user content manager.
+ *
+ * Returns: A #WebKitUserContentManager
+ *
+ * Since: 2.6
+ */
+WebKitUserContentManager* webkit_user_content_manager_new()
+{
+ return WEBKIT_USER_CONTENT_MANAGER(g_object_new(WEBKIT_TYPE_USER_CONTENT_MANAGER, nullptr));
+}
+
+/**
+ * webkit_user_content_manager_add_style_sheet:
+ * @manager: A #WebKitUserContentManager
+ * @stylesheet: A #WebKitUserStyleSheet
+ *
+ * Adds a #WebKitUserStyleSheet to the given #WebKitUserContentManager.
+ * The same #WebKitUserStyleSheet can be reused with multiple
+ * #WebKitUserContentManager instances.
+ *
+ * Since: 2.6
+ */
+void webkit_user_content_manager_add_style_sheet(WebKitUserContentManager* manager, WebKitUserStyleSheet* styleSheet)
+{
+ g_return_if_fail(WEBKIT_IS_USER_CONTENT_MANAGER(manager));
+ g_return_if_fail(styleSheet);
+ manager->priv->userContentController->addUserStyleSheet(webkitUserStyleSheetGetUserStyleSheet(styleSheet));
+}
+
+/**
+ * webkit_user_content_manager_remove_all_style_sheets:
+ * @manager: A #WebKitUserContentManager
+ *
+ * Removes all user style sheets from the given #WebKitUserContentManager.
+ *
+ * Since: 2.6
+ */
+void webkit_user_content_manager_remove_all_style_sheets(WebKitUserContentManager* manager)
+{
+ g_return_if_fail(WEBKIT_IS_USER_CONTENT_MANAGER(manager));
+ manager->priv->userContentController->removeAllUserStyleSheets();
+}
+
+WebUserContentControllerProxy* webkitUserContentManagerGetUserContentControllerProxy(WebKitUserContentManager* manager)
+{
+ return manager->priv->userContentController.get();
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitUserContentManagerh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManager.h (0 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManager.h         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManager.h        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -0,0 +1,76 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
+#error "Only <webkit2/webkit2.h> can be included directly."
+#endif
+
+#ifndef WebKitUserContentManager_h
+#define WebKitUserContentManager_h
+
+#include <glib-object.h>
+#include <webkit2/WebKitDefines.h>
+#include <webkit2/WebKitUserContent.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_TYPE_USER_CONTENT_MANAGER (webkit_user_content_manager_get_type())
+#define WEBKIT_USER_CONTENT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_USER_CONTENT_MANAGER, WebKitUserContentManager))
+#define WEBKIT_IS_USER_CONTENT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_USER_CONTENT_MANAGER))
+#define WEBKIT_USER_CONTENT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_USER_CONTENT_MANAGER, WebKitUserContentManagerClass))
+#define WEBKIT_IS_USER_CONTENT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_USER_CONTENT_MANAGER))
+#define WEBKIT_USER_CONTENT_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_USER_CONTENT_MANAGER, WebKitUserContentManagerClass))
+
+typedef struct _WebKitUserContentManager WebKitUserContentManager;
+typedef struct _WebKitUserContentManagerClass WebKitUserContentManagerClass;
+typedef struct _WebKitUserContentManagerPrivate WebKitUserContentManagerPrivate;
+
+
+struct _WebKitUserContentManager {
+ GObject parent;
+
+ /*< private >*/
+ WebKitUserContentManagerPrivate *priv;
+};
+
+struct _WebKitUserContentManagerClass {
+ GObjectClass parent_class;
+
+ void (*_webkit_reserved0) (void);
+ void (*_webkit_reserved1) (void);
+ void (*_webkit_reserved2) (void);
+ void (*_webkit_reserved3) (void);
+};
+
+
+WEBKIT_API GType
+webkit_user_content_manager_get_type (void);
+
+WEBKIT_API WebKitUserContentManager *
+webkit_user_content_manager_new (void);
+
+WEBKIT_API void
+webkit_user_content_manager_add_style_sheet (WebKitUserContentManager *manager,
+ WebKitUserStyleSheet *stylesheet);
+WEBKIT_API void
+webkit_user_content_manager_remove_all_style_sheets (WebKitUserContentManager *manager);
+
+G_END_DECLS
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitUserContentManagerPrivateh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManagerPrivate.h (0 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManagerPrivate.h         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManagerPrivate.h        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebKitUserContentManagerPrivate_h
+#define WebKitUserContentManagerPrivate_h
+
+#include "WebKitUserContentManager.h"
+#include "WebUserContentControllerProxy.h"
+
+WebKit::WebUserContentControllerProxy* webkitUserContentManagerGetUserContentControllerProxy(WebKitUserContentManager*);
+
+#endif // WebKitUserContentManagerPrivate_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitUserContentPrivateh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentPrivate.h (0 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentPrivate.h         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentPrivate.h        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebKitUserContentPrivate_h
+#define WebKitUserContentPrivate_h
+
+#include "WebKitUserContent.h"
+#include <WebCore/UserStyleSheet.h>
+
+const WebCore::UserStyleSheet& webkitUserStyleSheetGetUserStyleSheet(WebKitUserStyleSheet*);
+
+#endif // WebKitUserContentPrivate_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp (170890 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp        2014-07-08 17:50:27 UTC (rev 170890)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx"> #include "WebKitSecurityManagerPrivate.h"
</span><span class="cx"> #include "WebKitTextChecker.h"
</span><span class="cx"> #include "WebKitURISchemeRequestPrivate.h"
</span><ins>+#include "WebKitUserContentManagerPrivate.h"
</ins><span class="cx"> #include "WebKitWebContextPrivate.h"
</span><span class="cx"> #include "WebKitWebViewBasePrivate.h"
</span><span class="cx"> #include "WebKitWebViewGroupPrivate.h"
</span><span class="lines">@@ -1050,12 +1051,13 @@
</span><span class="cx"> context->priv->uriSchemeRequests.remove(customProtocolID);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void webkitWebContextCreatePageForWebView(WebKitWebContext* context, WebKitWebView* webView, WebKitWebViewGroup* webViewGroup, WebKitWebView* relatedView)
</del><ins>+void webkitWebContextCreatePageForWebView(WebKitWebContext* context, WebKitWebView* webView, WebKitWebViewGroup* webViewGroup, WebKitUserContentManager* userContentManager, WebKitWebView* relatedView)
</ins><span class="cx"> {
</span><span class="cx"> WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(webView);
</span><span class="cx"> WebPageGroup* pageGroup = webViewGroup ? webkitWebViewGroupGetPageGroup(webViewGroup) : 0;
</span><span class="cx"> WebPageProxy* relatedPage = relatedView ? webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(relatedView)) : nullptr;
</span><del>- webkitWebViewBaseCreateWebPage(webViewBase, context->priv->context.get(), pageGroup, relatedPage);
</del><ins>+ WebUserContentControllerProxy* userContentControllerProxy = userContentManager ? webkitUserContentManagerGetUserContentControllerProxy(userContentManager) : nullptr;
+ webkitWebViewBaseCreateWebPage(webViewBase, context->priv->context.get(), pageGroup, userContentControllerProxy, relatedPage);
</ins><span class="cx">
</span><span class="cx"> WebPageProxy* page = webkitWebViewBaseGetPage(webViewBase);
</span><span class="cx"> context->priv->webViews.set(page->pageID(), webView);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebContextPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h (170890 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h        2014-07-08 17:50:27 UTC (rev 170890)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #include "DownloadProxy.h"
</span><span class="cx"> #include "WebContext.h"
</span><span class="cx"> #include "WebKitPrivate.h"
</span><ins>+#include "WebKitUserContentManager.h"
</ins><span class="cx"> #include "WebKitWebContext.h"
</span><span class="cx"> #include "WebKitWebViewGroup.h"
</span><span class="cx"> #include "WebSoupCustomProtocolRequestManager.h"
</span><span class="lines">@@ -42,7 +43,7 @@
</span><span class="cx"> void webkitWebContextStartLoadingCustomProtocol(WebKitWebContext*, uint64_t customProtocolID, API::URLRequest*);
</span><span class="cx"> void webkitWebContextStopLoadingCustomProtocol(WebKitWebContext*, uint64_t customProtocolID);
</span><span class="cx"> void webkitWebContextDidFinishLoadingCustomProtocol(WebKitWebContext*, uint64_t customProtocolID);
</span><del>-void webkitWebContextCreatePageForWebView(WebKitWebContext*, WebKitWebView*, WebKitWebViewGroup*, WebKitWebView*);
</del><ins>+void webkitWebContextCreatePageForWebView(WebKitWebContext*, WebKitWebView*, WebKitWebViewGroup*, WebKitUserContentManager*, WebKitWebView*);
</ins><span class="cx"> void webkitWebContextWebViewDestroyed(WebKitWebContext*, WebKitWebView*);
</span><span class="cx"> WebKitWebView* webkitWebContextGetWebViewForPage(WebKitWebContext*, WebKit::WebPageProxy*);
</span><span class="cx"> WebKitWebViewGroup* webkitWebContextGetDefaultWebViewGroup(WebKitWebContext*);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp (170890 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp        2014-07-08 17:50:27 UTC (rev 170890)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -133,6 +133,7 @@
</span><span class="cx"> PROP_WEB_CONTEXT,
</span><span class="cx"> PROP_RELATED_VIEW,
</span><span class="cx"> PROP_GROUP,
</span><ins>+ PROP_USER_CONTENT_MANAGER,
</ins><span class="cx"> PROP_TITLE,
</span><span class="cx"> PROP_ESTIMATED_LOAD_PROGRESS,
</span><span class="cx"> PROP_FAVICON,
</span><span class="lines">@@ -171,6 +172,7 @@
</span><span class="cx"> GRefPtr<WebKitSettings> settings;
</span><span class="cx"> unsigned long settingsChangedHandlerID;
</span><span class="cx"> GRefPtr<WebKitWebViewGroup> group;
</span><ins>+ GRefPtr<WebKitUserContentManager> userContentManager;
</ins><span class="cx"> GRefPtr<WebKitWindowProperties> windowProperties;
</span><span class="cx">
</span><span class="cx"> GRefPtr<GMainLoop> modalLoop;
</span><span class="lines">@@ -501,7 +503,7 @@
</span><span class="cx">
</span><span class="cx"> WebKitWebView* webView = WEBKIT_WEB_VIEW(object);
</span><span class="cx"> WebKitWebViewPrivate* priv = webView->priv;
</span><del>- webkitWebContextCreatePageForWebView(priv->context, webView, priv->group.get(), priv->relatedView);
</del><ins>+ webkitWebContextCreatePageForWebView(priv->context, webView, priv->group.get(), priv->userContentManager.get(), priv->relatedView);
</ins><span class="cx"> // The related view is only valid during the construction.
</span><span class="cx"> priv->relatedView = nullptr;
</span><span class="cx">
</span><span class="lines">@@ -542,6 +544,11 @@
</span><span class="cx"> webView->priv->group = group ? WEBKIT_WEB_VIEW_GROUP(group) : 0;
</span><span class="cx"> break;
</span><span class="cx"> }
</span><ins>+ case PROP_USER_CONTENT_MANAGER: {
+ gpointer userContentManager = g_value_get_object(value);
+ webView->priv->userContentManager = userContentManager ? WEBKIT_USER_CONTENT_MANAGER(userContentManager) : nullptr;
+ break;
+ }
</ins><span class="cx"> case PROP_ZOOM_LEVEL:
</span><span class="cx"> webkit_web_view_set_zoom_level(webView, g_value_get_double(value));
</span><span class="cx"> break;
</span><span class="lines">@@ -561,6 +568,9 @@
</span><span class="cx"> case PROP_GROUP:
</span><span class="cx"> g_value_set_object(value, webkit_web_view_get_group(webView));
</span><span class="cx"> break;
</span><ins>+ case PROP_USER_CONTENT_MANAGER:
+ g_value_set_object(value, webkit_web_view_get_user_content_manager(webView));
+ break;
</ins><span class="cx"> case PROP_TITLE:
</span><span class="cx"> g_value_set_string(value, webView->priv->title.data());
</span><span class="cx"> break;
</span><span class="lines">@@ -671,6 +681,23 @@
</span><span class="cx"> static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * WebKitWebView:user-content-manager:
+ *
+ * The #WebKitUserContentManager of the view.
+ *
+ * Since: 2.6
+ */
+ g_object_class_install_property(
+ gObjectClass,
+ PROP_USER_CONTENT_MANAGER,
+ g_param_spec_object(
+ "user-content-manager",
+ _("WebView user content manager"),
+ _("The WebKitUserContentManager of the view"),
+ WEBKIT_TYPE_USER_CONTENT_MANAGER,
+ static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
+
+ /**
</ins><span class="cx"> * WebKitWebView:title:
</span><span class="cx"> *
</span><span class="cx"> * The main frame document title of this #WebKitWebView. If
</span><span class="lines">@@ -1924,6 +1951,8 @@
</span><span class="cx"> * You can also use this method to implement other process models based on %WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES,
</span><span class="cx"> * like for example, sharing the same web process for all the views in the same security domain.
</span><span class="cx"> *
</span><ins>+ * The newly created #WebKitWebView will also have the same #WebKitUserContentManager as @web_view.
+ *
</ins><span class="cx"> * Returns: (transfer full): The newly created #WebKitWebView widget
</span><span class="cx"> *
</span><span class="cx"> * Since: 2.4
</span><span class="lines">@@ -1932,7 +1961,10 @@
</span><span class="cx"> {
</span><span class="cx"> g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), nullptr);
</span><span class="cx">
</span><del>- return GTK_WIDGET(g_object_new(WEBKIT_TYPE_WEB_VIEW, "related-view", webView, nullptr));
</del><ins>+ return GTK_WIDGET(g_object_new(WEBKIT_TYPE_WEB_VIEW,
+ "user-content-manager", webView->priv->userContentManager.get(),
+ "related-view", webView,
+ nullptr));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -1953,6 +1985,25 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * webkit_web_view_new_with_user_content_manager:
+ * @user_content_manager: a #WebKitUserContentManager.
+ *
+ * Creates a new #WebKitWebView with the given #WebKitUserContentManager.
+ * The content loaded in the view may be affected by the content injected
+ * in the view by the user content manager.
+ *
+ * Returns: The newly created #WebKitWebView widget
+ *
+ * Since: 2.6
+ */
+GtkWidget* webkit_web_view_new_with_user_content_manager(WebKitUserContentManager* userContentManager)
+{
+ g_return_val_if_fail(WEBKIT_IS_USER_CONTENT_MANAGER(userContentManager), nullptr);
+
+ return GTK_WIDGET(g_object_new(WEBKIT_TYPE_WEB_VIEW, "user-content-manager", userContentManager, nullptr));
+}
+
+/**
</ins><span class="cx"> * webkit_web_view_get_context:
</span><span class="cx"> * @web_view: a #WebKitWebView
</span><span class="cx"> *
</span><span class="lines">@@ -1986,6 +2037,24 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * webkit_web_view_get_user_content_manager:
+ * @web_view: a #WebKitWebView
+ *
+ * Gets the user content manager associated to @web_view, or %NULL if the
+ * view does not have an user content manager.
+ *
+ * Returns: (transfer none): the #WebKitUserContentManager associated with the view
+ *
+ * Since: 2.6
+ */
+WebKitUserContentManager* webkit_web_view_get_user_content_manager(WebKitWebView* webView)
+{
+ g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), nullptr);
+
+ return webView->priv->userContentManager.get();
+}
+
+/**
</ins><span class="cx"> * webkit_web_view_load_uri:
</span><span class="cx"> * @web_view: a #WebKitWebView
</span><span class="cx"> * @uri: an URI string
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h (170890 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h        2014-07-08 17:50:27 UTC (rev 170890)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> #include <webkit2/WebKitScriptDialog.h>
</span><span class="cx"> #include <webkit2/WebKitSettings.h>
</span><span class="cx"> #include <webkit2/WebKitURIRequest.h>
</span><ins>+#include <webkit2/WebKitUserContentManager.h>
</ins><span class="cx"> #include <webkit2/WebKitWebContext.h>
</span><span class="cx"> #include <webkit2/WebKitWebInspector.h>
</span><span class="cx"> #include <webkit2/WebKitWebResource.h>
</span><span class="lines">@@ -260,6 +261,9 @@
</span><span class="cx"> WEBKIT_API GtkWidget *
</span><span class="cx"> webkit_web_view_new_with_group (WebKitWebViewGroup *group);
</span><span class="cx">
</span><ins>+WEBKIT_API GtkWidget *
+webkit_web_view_new_with_user_content_manager (WebKitUserContentManager *user_content_manager);
+
</ins><span class="cx"> WEBKIT_API WebKitWebContext *
</span><span class="cx"> webkit_web_view_get_context (WebKitWebView *web_view);
</span><span class="cx">
</span><span class="lines">@@ -455,6 +459,10 @@
</span><span class="cx"> webkit_web_view_get_snapshot_finish (WebKitWebView *web_view,
</span><span class="cx"> GAsyncResult *result,
</span><span class="cx"> GError **error);
</span><ins>+
+WEBKIT_API WebKitUserContentManager *
+webkit_web_view_get_user_content_manager (WebKitWebView *web_view);
+
</ins><span class="cx"> G_END_DECLS
</span><span class="cx">
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp (170890 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp        2014-07-08 17:50:27 UTC (rev 170890)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx"> #include "WebPageGroup.h"
</span><span class="cx"> #include "WebPageProxy.h"
</span><span class="cx"> #include "WebPreferences.h"
</span><ins>+#include "WebUserContentControllerProxy.h"
</ins><span class="cx"> #include "WebViewBaseInputMethodFilter.h"
</span><span class="cx"> #include <WebCore/CairoUtilities.h>
</span><span class="cx"> #include <WebCore/ClipboardUtilitiesGtk.h>
</span><span class="lines">@@ -945,10 +946,10 @@
</span><span class="cx"> containerClass->forall = webkitWebViewBaseContainerForall;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-WebKitWebViewBase* webkitWebViewBaseCreate(WebContext* context, WebPageGroup* pageGroup, WebPageProxy* relatedPage)
</del><ins>+WebKitWebViewBase* webkitWebViewBaseCreate(WebContext* context, WebPageGroup* pageGroup, WebUserContentControllerProxy* userContentController, WebPageProxy* relatedPage)
</ins><span class="cx"> {
</span><span class="cx"> WebKitWebViewBase* webkitWebViewBase = WEBKIT_WEB_VIEW_BASE(g_object_new(WEBKIT_TYPE_WEB_VIEW_BASE, NULL));
</span><del>- webkitWebViewBaseCreateWebPage(webkitWebViewBase, context, pageGroup, relatedPage);
</del><ins>+ webkitWebViewBaseCreateWebPage(webkitWebViewBase, context, pageGroup, userContentController, relatedPage);
</ins><span class="cx"> return webkitWebViewBase;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -981,13 +982,14 @@
</span><span class="cx"> }
</span><span class="cx"> #endif // HAVE(GTK_SCALE_FACTOR)
</span><span class="cx">
</span><del>-void webkitWebViewBaseCreateWebPage(WebKitWebViewBase* webkitWebViewBase, WebContext* context, WebPageGroup* pageGroup, WebPageProxy* relatedPage)
</del><ins>+void webkitWebViewBaseCreateWebPage(WebKitWebViewBase* webkitWebViewBase, WebContext* context, WebPageGroup* pageGroup, WebUserContentControllerProxy* userContentController, WebPageProxy* relatedPage)
</ins><span class="cx"> {
</span><span class="cx"> WebKitWebViewBasePrivate* priv = webkitWebViewBase->priv;
</span><span class="cx">
</span><span class="cx"> WebPageConfiguration webPageConfiguration;
</span><span class="cx"> webPageConfiguration.pageGroup = pageGroup;
</span><span class="cx"> webPageConfiguration.relatedPage = relatedPage;
</span><ins>+ webPageConfiguration.userContentController = userContentController;
</ins><span class="cx"> priv->pageProxy = context->createWebPage(*priv->pageClient, WTF::move(webPageConfiguration));
</span><span class="cx"> priv->pageProxy->initializeWebPage();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewBasePrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h (170890 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h        2014-07-08 17:50:27 UTC (rev 170890)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -34,10 +34,10 @@
</span><span class="cx"> #include "WebKitWebViewBase.h"
</span><span class="cx"> #include "WebPageProxy.h"
</span><span class="cx">
</span><del>-WebKitWebViewBase* webkitWebViewBaseCreate(WebKit::WebContext*, WebKit::WebPageGroup*, WebKit::WebPageProxy*);
</del><ins>+WebKitWebViewBase* webkitWebViewBaseCreate(WebKit::WebContext*, WebKit::WebPageGroup*, WebKit::WebUserContentControllerProxy*, WebKit::WebPageProxy*);
</ins><span class="cx"> GtkIMContext* webkitWebViewBaseGetIMContext(WebKitWebViewBase*);
</span><span class="cx"> WebKit::WebPageProxy* webkitWebViewBaseGetPage(WebKitWebViewBase*);
</span><del>-void webkitWebViewBaseCreateWebPage(WebKitWebViewBase*, WebKit::WebContext*, WebKit::WebPageGroup*, WebKit::WebPageProxy*);
</del><ins>+void webkitWebViewBaseCreateWebPage(WebKitWebViewBase*, WebKit::WebContext*, WebKit::WebPageGroup*, WebKit::WebUserContentControllerProxy*, WebKit::WebPageProxy*);
</ins><span class="cx"> void webkitWebViewBaseSetTooltipText(WebKitWebViewBase*, const char*);
</span><span class="cx"> void webkitWebViewBaseSetTooltipArea(WebKitWebViewBase*, const WebCore::IntRect&);
</span><span class="cx"> void webkitWebViewBaseForwardNextKeyEvent(WebKitWebViewBase*);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewGroupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewGroup.cpp (170890 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewGroup.cpp        2014-07-08 17:50:27 UTC (rev 170890)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewGroup.cpp        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -236,63 +236,3 @@
</span><span class="cx"> webkitWebViewGroupAttachSettingsToPageGroup(group);
</span><span class="cx"> g_object_notify(G_OBJECT(group), "settings");
</span><span class="cx"> }
</span><del>-
-static PassRefPtr<API::Array> toAPIArray(const char* const* list)
-{
- if (!list)
- return 0;
-
- Vector<RefPtr<API::Object> > entries;
- while (*list) {
- entries.append(API::String::createFromUTF8String(*list));
- list++;
- }
- return API::Array::create(WTF::move(entries));
-}
-
-/**
- * webkit_web_view_group_add_user_style_sheet:
- * @group: a #WebKitWebViewGroup
- * @source: the source of the style_sheet to inject
- * @base_uri: (allow-none): the base URI to use when processing the style_sheet contents or %NULL for about:blank
- * @whitelist: (array zero-terminated=1) (allow-none): a whitelist of URI patterns or %NULL
- * @blacklist: (array zero-terminated=1) (allow-none): a blacklist of URI patterns or %NULL
- * @injected_frames: a #WebKitInjectedContentFrames describing to which frames the style_sheet should apply
- *
- * Inject an external style sheet into pages. It is possible to only apply the style sheet
- * to some URIs by passing non-null values for @whitelist or @blacklist. Passing a %NULL
- * whitelist implies that all URIs are on the whitelist. The style sheet is applied if a URI matches
- * the whitelist and not the blacklist. URI patterns must be of the form [protocol]://[host]/[path]
- * where the host and path components can contain the wildcard character ('*') to represent zero
- * or more other characters.
- */
-void webkit_web_view_group_add_user_style_sheet(WebKitWebViewGroup* group, const char* source, const char* baseURI, const char* const* whitelist, const char* const* blacklist, WebKitInjectedContentFrames injectedFrames)
-{
- g_return_if_fail(WEBKIT_IS_WEB_VIEW_GROUP(group));
- g_return_if_fail(source);
-
- RefPtr<API::Array> webWhitelist = toAPIArray(whitelist);
- RefPtr<API::Array> webBlacklist = toAPIArray(blacklist);
-
- // We always use UserStyleUserLevel to match the behavior of WKPageGroupAddUserStyleSheet.
- group->priv->pageGroup->addUserStyleSheet(
- String::fromUTF8(source),
- String::fromUTF8(baseURI),
- webWhitelist.get(),
- webBlacklist.get(),
- toWebCoreUserContentInjectedFrames(injectedFrames),
- WebCore::UserStyleUserLevel);
-}
-
-/**
- * webkit_web_view_group_remove_all_user_style_sheets:
- * @group: a #WebKitWebViewGroup
- *
- * Remove all style sheets previously injected into this #WebKitWebViewGroup
- * via webkit_web_view_group_add_user_style_sheet().
- */
-void webkit_web_view_group_remove_all_user_style_sheets(WebKitWebViewGroup* group)
-{
- g_return_if_fail(WEBKIT_IS_WEB_VIEW_GROUP(group));
- group->priv->pageGroup->removeAllUserStyleSheets();
-}
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewGrouph"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewGroup.h (170890 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewGroup.h        2014-07-08 17:50:27 UTC (rev 170890)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewGroup.h        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -84,17 +84,6 @@
</span><span class="cx"> webkit_web_view_group_set_settings (WebKitWebViewGroup *group,
</span><span class="cx"> WebKitSettings *settings);
</span><span class="cx">
</span><del>-WEBKIT_API void
-webkit_web_view_group_add_user_style_sheet (WebKitWebViewGroup *group,
- const gchar *source,
- const gchar *base_uri,
- const gchar * const *whitelist,
- const gchar * const *blacklist,
- WebKitInjectedContentFrames injected_frames);
-
-WEBKIT_API void
-webkit_web_view_group_remove_all_user_style_sheets (WebKitWebViewGroup *group);
-
</del><span class="cx"> G_END_DECLS
</span><span class="cx">
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtksectionstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt (170890 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt        2014-07-08 17:50:27 UTC (rev 170890)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -73,6 +73,45 @@
</span><span class="cx"> </SECTION>
</span><span class="cx">
</span><span class="cx"> <SECTION>
</span><ins>+<FILE>WebKitUserContent</FILE>
+<TITLE>WebKitUserContent</TITLE>
+WebKitUserStyleSheet
+WebKitUserContentInjectedFrames
+WebKitUserStyleLevel
+webkit_user_style_sheet_ref
+webkit_user_style_sheet_unref
+webkit_user_style_sheet_new
+
+<SUBSECTION Standard>
+WEBKIT_TYPE_USER_STYLE_SHEET
+
+<SUBSECTION Private>
+webkit_user_style_sheet_get_type
+</SECTION>
+
+<SECTION>
+<FILE>WebKitUserContentManager</FILE>
+<TITLE>WebKitUserContentManager</TITLE>
+WebKitUserContentManager
+webkit_user_content_manager_new
+webkit_user_content_manager_add_style_sheet
+webkit_user_content_manager_remove_all_style_sheets
+
+<SUBSECTION Standard>
+WEBKIT_IS_USER_CONTENT_MANAGER
+WEBKIT_IS_USER_CONTENT_MANAGER_CLASS
+WEBKIT_TYPE_USER_CONTENT_MANAGER
+WEBKIT_USER_CONTENT_MANAGER
+WEBKIT_USER_CONTENT_MANAGER_CLASS
+WEBKIT_USER_CONTENT_MANAGER_GET_CLASS
+WebKitUserContentManagerClass
+
+<SUBSECTION Private>
+WebKitUserContentManagerPrivate
+webkit_user_content_manager_get_type
+</SECTION>
+
+<SECTION>
</ins><span class="cx"> <FILE>WebKitWebView</FILE>
</span><span class="cx"> <TITLE>WebKitWebView</TITLE>
</span><span class="cx"> WebKitWebView
</span><span class="lines">@@ -96,8 +135,10 @@
</span><span class="cx"> webkit_web_view_new_with_context
</span><span class="cx"> webkit_web_view_new_with_related_view
</span><span class="cx"> webkit_web_view_new_with_group
</span><ins>+webkit_web_view_new_with_user_content_manager
</ins><span class="cx"> webkit_web_view_get_context
</span><span class="cx"> webkit_web_view_get_group
</span><ins>+webkit_web_view_get_user_content_manager
</ins><span class="cx"> webkit_web_view_load_uri
</span><span class="cx"> webkit_web_view_load_html
</span><span class="cx"> webkit_web_view_load_alternate_html
</span><span class="lines">@@ -1025,8 +1066,6 @@
</span><span class="cx"> webkit_web_view_group_get_name
</span><span class="cx"> webkit_web_view_group_get_settings
</span><span class="cx"> webkit_web_view_group_set_settings
</span><del>-webkit_web_view_group_add_user_style_sheet
-webkit_web_view_group_remove_all_user_style_sheets
</del><span class="cx">
</span><span class="cx"> <SUBSECTION Standard>
</span><span class="cx"> WebKitWebViewGroupClass
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkwebkit2h"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/webkit2.h (170890 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/webkit2.h        2014-07-08 17:50:27 UTC (rev 170890)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/webkit2.h        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -61,6 +61,8 @@
</span><span class="cx"> #include <webkit2/WebKitURIRequest.h>
</span><span class="cx"> #include <webkit2/WebKitURIResponse.h>
</span><span class="cx"> #include <webkit2/WebKitURISchemeRequest.h>
</span><ins>+#include <webkit2/WebKitUserContent.h>
+#include <webkit2/WebKitUserContentManager.h>
</ins><span class="cx"> #include <webkit2/WebKitVersion.h>
</span><span class="cx"> #include <webkit2/WebKitWebContext.h>
</span><span class="cx"> #include <webkit2/WebKitWebInspector.h>
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessUserContentWebUserContentControllerProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp (170890 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp        2014-07-08 17:50:27 UTC (rev 170890)
+++ trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -66,7 +66,8 @@
</span><span class="cx"> webProcessProxy.addMessageReceiver(Messages::WebUserContentControllerProxy::messageReceiverName(), m_identifier, *this);
</span><span class="cx">
</span><span class="cx"> webProcessProxy.connection()->send(Messages::WebUserContentController::AddUserScripts(m_userScripts), m_identifier);
</span><del>-
</del><ins>+ webProcessProxy.connection()->send(Messages::WebUserContentController::AddUserStyleSheets(m_userStyleSheets), m_identifier);
+
</ins><span class="cx"> Vector<WebScriptMessageHandlerHandle> messageHandlerHandles;
</span><span class="cx"> for (auto& handler : m_scriptMessageHandlers.values())
</span><span class="cx"> messageHandlerHandles.append(handler->handle());
</span><span class="lines">@@ -97,6 +98,22 @@
</span><span class="cx"> processAndCount.key->connection()->send(Messages::WebUserContentController::RemoveAllUserScripts(), m_identifier);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebUserContentControllerProxy::addUserStyleSheet(WebCore::UserStyleSheet userStyleSheet)
+{
+ m_userStyleSheets.append(WTF::move(userStyleSheet));
+
+ for (auto& processAndCount : m_processes)
+ processAndCount.key->connection()->send(Messages::WebUserContentController::AddUserStyleSheets({ m_userStyleSheets.last() }), m_identifier);
+}
+
+void WebUserContentControllerProxy::removeAllUserStyleSheets()
+{
+ m_userStyleSheets.clear();
+
+ for (auto& processAndCount : m_processes)
+ processAndCount.key->connection()->send(Messages::WebUserContentController::RemoveAllUserStyleSheets(), m_identifier);
+}
+
</ins><span class="cx"> bool WebUserContentControllerProxy::addUserScriptMessageHandler(WebScriptMessageHandler* handler)
</span><span class="cx"> {
</span><span class="cx"> for (auto& existingHandler : m_scriptMessageHandlers.values()) {
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessUserContentWebUserContentControllerProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.h (170890 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.h        2014-07-08 17:50:27 UTC (rev 170890)
+++ trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.h        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> class UserScript;
</span><ins>+class UserStyleSheet;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="lines">@@ -59,6 +60,9 @@
</span><span class="cx"> void addUserScript(WebCore::UserScript);
</span><span class="cx"> void removeAllUserScripts();
</span><span class="cx">
</span><ins>+ void addUserStyleSheet(WebCore::UserStyleSheet);
+ void removeAllUserStyleSheets();
+
</ins><span class="cx"> // Returns false if there was a name conflict.
</span><span class="cx"> bool addUserScriptMessageHandler(WebScriptMessageHandler*);
</span><span class="cx"> void removeUserMessageHandlerForName(const String&);
</span><span class="lines">@@ -75,6 +79,7 @@
</span><span class="cx"> HashCountedSet<WebProcessProxy*> m_processes;
</span><span class="cx">
</span><span class="cx"> Vector<WebCore::UserScript> m_userScripts;
</span><ins>+ Vector<WebCore::UserStyleSheet> m_userStyleSheets;
</ins><span class="cx"> HashMap<uint64_t, RefPtr<WebScriptMessageHandler>> m_scriptMessageHandlers;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessgtkWebInspectorProxyGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp (170890 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp        2014-07-08 17:50:27 UTC (rev 170890)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -62,7 +62,7 @@
</span><span class="cx"> {
</span><span class="cx"> ASSERT(m_page);
</span><span class="cx"> ASSERT(!m_inspectorView);
</span><del>- m_inspectorView = GTK_WIDGET(webkitWebViewBaseCreate(&page()->process().context(), inspectorPageGroup(), m_page));
</del><ins>+ m_inspectorView = GTK_WIDGET(webkitWebViewBaseCreate(&page()->process().context(), inspectorPageGroup(), nullptr, m_page));
</ins><span class="cx"> g_object_add_weak_pointer(G_OBJECT(m_inspectorView), reinterpret_cast<void**>(&m_inspectorView));
</span><span class="cx"> return webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(m_inspectorView));
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessUserContentWebUserContentControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp (170890 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp        2014-07-08 17:50:27 UTC (rev 170890)
+++ trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> #include <WebCore/DOMWrapperWorld.h>
</span><span class="cx"> #include <WebCore/ScriptController.h>
</span><span class="cx"> #include <WebCore/SerializedScriptValue.h>
</span><ins>+#include <WebCore/UserStyleSheet.h>
</ins><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="cx">
</span><span class="cx"> #if ENABLE(USER_MESSAGE_HANDLERS)
</span><span class="lines">@@ -92,6 +93,19 @@
</span><span class="cx"> m_userContentController->removeUserScripts(mainThreadNormalWorld());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebUserContentController::addUserStyleSheets(const Vector<WebCore::UserStyleSheet>& userStyleSheets)
+{
+ for (const auto& userStyleSheet : userStyleSheets) {
+ m_userContentController->addUserStyleSheet(mainThreadNormalWorld(),
+ std::make_unique<WebCore::UserStyleSheet>(userStyleSheet), InjectInExistingDocuments);
+ }
+}
+
+void WebUserContentController::removeAllUserStyleSheets()
+{
+ m_userContentController->removeUserStyleSheets(mainThreadNormalWorld());
+}
+
</ins><span class="cx"> #if ENABLE(USER_MESSAGE_HANDLERS)
</span><span class="cx"> class WebUserMessageHandlerDescriptorProxy : public RefCounted<WebUserMessageHandlerDescriptorProxy>, public WebCore::UserMessageHandlerDescriptor::Client {
</span><span class="cx"> public:
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessUserContentWebUserContentControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.h (170890 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.h        2014-07-08 17:50:27 UTC (rev 170890)
+++ trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.h        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -54,6 +54,9 @@
</span><span class="cx"> void addUserScripts(const Vector<WebCore::UserScript>& userScripts);
</span><span class="cx"> void removeAllUserScripts();
</span><span class="cx">
</span><ins>+ void addUserStyleSheets(const Vector<WebCore::UserStyleSheet>& userStyleSheets);
+ void removeAllUserStyleSheets();
+
</ins><span class="cx"> void addUserScriptMessageHandlers(const Vector<WebScriptMessageHandlerHandle>& scriptMessageHandlers);
</span><span class="cx"> void removeUserScriptMessageHandler(uint64_t);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessUserContentWebUserContentControllermessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.messages.in (170890 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.messages.in        2014-07-08 17:50:27 UTC (rev 170890)
+++ trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.messages.in        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -27,6 +27,9 @@
</span><span class="cx"> AddUserScripts(Vector<WebCore::UserScript> userScripts);
</span><span class="cx"> RemoveAllUserScripts()
</span><span class="cx">
</span><ins>+ AddUserStyleSheets(Vector<WebCore::UserStyleSheet> userStyleShhets);
+ RemoveAllUserStyleSheets()
+
</ins><span class="cx"> AddUserScriptMessageHandlers(Vector<WebKit::WebScriptMessageHandlerHandle> scriptMessageHandlers);
</span><span class="cx"> RemoveUserScriptMessageHandler(uint64_t identifier)
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (170890 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-07-08 17:50:27 UTC (rev 170890)
+++ trunk/Tools/ChangeLog        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2014-07-08 Adrian Perez de Castro <aperez@igalia.com>
+
+ [GTK] Move user style sheet API out of WebKitWebViewGroup
+ https://bugs.webkit.org/show_bug.cgi?id=134551
+
+ Reviewed by Carlos Garcia Campos.
+
+ Removes testing user style sheet injection from
+ TestWebKitWebViewGroup and moves that into a new
+ TestWebKitUserContentManager, adapting the existing tests to the new
+ API. Also, it contains a new test case for
+ webkit_web_view_new_with_user_content_manager().
+
+ * TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt:
+ * TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitUserContentManager.cpp: Added.
+ (UserContentManagerTest::UserContentManagerTest):
+ (testWebViewNewWithUserContentManager):
+ (isStyleSheetInjectedForURLAtPath):
+ (fillURLListFromPaths):
+ (removeOldInjectedStyleSheetsAndResetLists):
+ (testUserContentManagerInjectedStyleSheet):
+ (serverCallback):
+ (beforeAll):
+ (afterAll):
+ * TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebViewGroup.cpp:
+ (beforeAll):
+ (afterAll):
+ (isStyleSheetInjectedForURLAtPath): Deleted.
+ (fillURLListFromPaths): Deleted.
+ (removeOldInjectedStyleSheetsAndResetLists): Deleted.
+ (testWebViewGroupInjectedStyleSheet): Deleted.
+ (serverCallback): Deleted.
+ * TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp:
+ (WebViewTest::WebViewTest):
+ * TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.h:
+
</ins><span class="cx"> 2014-07-08 Ziran Sun <ziran.sun@samsung.com>
</span><span class="cx">
</span><span class="cx"> [GTK] Gstreamer missing from the install-dependencies script
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt (170890 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt        2014-07-08 17:50:27 UTC (rev 170890)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -112,6 +112,7 @@
</span><span class="cx"> ADD_WK2_TEST(TestWebKitWebViewGroup TestWebKitWebViewGroup.cpp)
</span><span class="cx"> ADD_WK2_TEST(TestWebKitWebContext TestWebKitWebContext.cpp)
</span><span class="cx"> ADD_WK2_TEST(TestWebKitWebView TestWebKitWebView.cpp)
</span><ins>+ADD_WK2_TEST(TestWebKitUserContentManager TestWebKitUserContentManager.cpp)
</ins><span class="cx">
</span><span class="cx"> if (ATSPI_FOUND)
</span><span class="cx"> ADD_WK2_TEST(AccessibilityTestServer AccessibilityTestServer.cpp)
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkTestWebKitUserContentManagercpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitUserContentManager.cpp (0 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitUserContentManager.cpp         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitUserContentManager.cpp        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -0,0 +1,172 @@
</span><ins>+/*
+ * Copyright (C) 2013 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2,1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#include "WebKitTestServer.h"
+#include "WebViewTest.h"
+#include <cstdarg>
+#include <gtk/gtk.h>
+#include <webkit2/webkit2.h>
+#include <wtf/gobject/GRefPtr.h>
+
+class UserContentManagerTest : public WebViewTest {
+public:
+ MAKE_GLIB_TEST_FIXTURE(UserContentManagerTest);
+
+ UserContentManagerTest()
+ : WebViewTest(WEBKIT_WEB_VIEW(webkit_web_view_new_with_user_content_manager(webkit_user_content_manager_new())))
+ {
+ // A reference is leaked when passing the result of webkit_user_content_manager_new()
+ // directly to webkit_web_view_new_with_user_content_manager() above. Adopting the
+ // reference here avoids the leak.
+ m_userContentManager = adoptGRef(webkit_web_view_get_user_content_manager(m_webView));
+ assertObjectIsDeletedWhenTestFinishes(G_OBJECT(m_userContentManager.get()));
+ }
+
+ GRefPtr<WebKitUserContentManager> m_userContentManager;
+};
+
+static WebKitTestServer* kServer;
+
+// These are all here so that they can be changed easily, if necessary.
+static const char* kStyleSheetHTML = "<html><div id=\"styledElement\">Sweet stylez!</div></html>";
+static const char* kInjectedStyleSheet = "#styledElement { font-weight: bold; }";
+static const char* kStyleSheetTestScript = "getComputedStyle(document.getElementById('styledElement'))['font-weight']";
+static const char* kStyleSheetTestScriptResult = "bold";
+
+static void testWebViewNewWithUserContentManager(Test* test, gconstpointer)
+{
+ GRefPtr<WebKitUserContentManager> userContentManager1 = adoptGRef(webkit_user_content_manager_new());
+ test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(userContentManager1.get()));
+ GRefPtr<WebKitWebView> webView1 = WEBKIT_WEB_VIEW(webkit_web_view_new_with_user_content_manager(userContentManager1.get()));
+ g_assert(webkit_web_view_get_user_content_manager(webView1.get()) == userContentManager1.get());
+
+ GRefPtr<WebKitWebView> webView2 = WEBKIT_WEB_VIEW(webkit_web_view_new());
+ g_assert(webkit_web_view_get_user_content_manager(webView2.get()) != userContentManager1.get());
+}
+
+static bool isStyleSheetInjectedForURLAtPath(WebViewTest* test, const char* path)
+{
+ test->loadURI(kServer->getURIForPath(path).data());
+ test->waitUntilLoadFinished();
+
+ GUniqueOutPtr<GError> error;
+ WebKitJavascriptResult* javascriptResult = test->runJavaScriptAndWaitUntilFinished(kStyleSheetTestScript, &error.outPtr());
+ g_assert(javascriptResult);
+ g_assert(!error.get());
+
+ GUniquePtr<char> resultString(WebViewTest::javascriptResultToCString(javascriptResult));
+ return !g_strcmp0(resultString.get(), kStyleSheetTestScriptResult);
+}
+
+static void fillURLListFromPaths(char** list, const char* path, ...)
+{
+ va_list argumentList;
+ va_start(argumentList, path);
+
+ int i = 0;
+ while (path) {
+ // FIXME: We must use a wildcard for the host here until http://wkbug.com/112476 is fixed.
+ // Until that time patterns with port numbers in them will not properly match URLs with port numbers.
+ list[i++] = g_strdup_printf("http://*/%s*", path);
+ path = va_arg(argumentList, const char*);
+ }
+}
+
+static void removeOldInjectedStyleSheetsAndResetLists(WebKitUserContentManager* userContentManager, char** whitelist, char** blacklist)
+{
+ webkit_user_content_manager_remove_all_style_sheets(userContentManager);
+
+ while (*whitelist) {
+ g_free(*whitelist);
+ *whitelist = 0;
+ whitelist++;
+ }
+
+ while (*blacklist) {
+ g_free(*blacklist);
+ *blacklist = 0;
+ blacklist++;
+ }
+}
+
+static void testUserContentManagerInjectedStyleSheet(UserContentManagerTest* test, gconstpointer)
+{
+ char* whitelist[3] = { 0, 0, 0 };
+ char* blacklist[3] = { 0, 0, 0 };
+
+ removeOldInjectedStyleSheetsAndResetLists(test->m_userContentManager.get(), whitelist, blacklist);
+
+ // Without a whitelist or a blacklist all URLs should have the injected style sheet.
+ static const char* randomPath = "somerandompath";
+ g_assert(!isStyleSheetInjectedForURLAtPath(test, randomPath));
+ WebKitUserStyleSheet* styleSheet = webkit_user_style_sheet_new(kInjectedStyleSheet, WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES, WEBKIT_USER_STYLE_LEVEL_USER, nullptr, nullptr);
+ webkit_user_content_manager_add_style_sheet(test->m_userContentManager.get(), styleSheet);
+ webkit_user_style_sheet_unref(styleSheet);
+ g_assert(isStyleSheetInjectedForURLAtPath(test, randomPath));
+
+ removeOldInjectedStyleSheetsAndResetLists(test->m_userContentManager.get(), whitelist, blacklist);
+
+ fillURLListFromPaths(blacklist, randomPath, 0);
+ styleSheet = webkit_user_style_sheet_new(kInjectedStyleSheet, WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES, WEBKIT_USER_STYLE_LEVEL_USER, nullptr, blacklist);
+ webkit_user_content_manager_add_style_sheet(test->m_userContentManager.get(), styleSheet);
+ webkit_user_style_sheet_unref(styleSheet);
+ g_assert(!isStyleSheetInjectedForURLAtPath(test, randomPath));
+ g_assert(isStyleSheetInjectedForURLAtPath(test, "someotherrandompath"));
+
+ removeOldInjectedStyleSheetsAndResetLists(test->m_userContentManager.get(), whitelist, blacklist);
+
+ static const char* inTheWhiteList = "inthewhitelist";
+ static const char* notInWhitelist = "notinthewhitelist";
+ static const char* inTheWhiteListAndBlackList = "inthewhitelistandblacklist";
+
+ fillURLListFromPaths(whitelist, inTheWhiteList, inTheWhiteListAndBlackList, 0);
+ fillURLListFromPaths(blacklist, inTheWhiteListAndBlackList, 0);
+ styleSheet = webkit_user_style_sheet_new(kInjectedStyleSheet, WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES, WEBKIT_USER_STYLE_LEVEL_USER, whitelist, blacklist);
+ webkit_user_content_manager_add_style_sheet(test->m_userContentManager.get(), styleSheet);
+ webkit_user_style_sheet_unref(styleSheet);
+ g_assert(isStyleSheetInjectedForURLAtPath(test, inTheWhiteList));
+ g_assert(!isStyleSheetInjectedForURLAtPath(test, inTheWhiteListAndBlackList));
+ g_assert(!isStyleSheetInjectedForURLAtPath(test, notInWhitelist));
+
+ // It's important to clean up the environment before other tests.
+ removeOldInjectedStyleSheetsAndResetLists(test->m_userContentManager.get(), whitelist, blacklist);
+}
+
+static void serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer)
+{
+ soup_message_set_status(message, SOUP_STATUS_OK);
+ soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, kStyleSheetHTML, strlen(kStyleSheetHTML));
+ soup_message_body_complete(message->response_body);
+}
+
+void beforeAll()
+{
+ kServer = new WebKitTestServer();
+ kServer->run(serverCallback);
+
+ Test::add("WebKitWebView", "new-with-user-content-manager", testWebViewNewWithUserContentManager);
+ UserContentManagerTest::add("WebKitUserContentManager", "injected-style-sheet", testUserContentManagerInjectedStyleSheet);
+}
+
+void afterAll()
+{
+ delete kServer;
+}
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkTestWebKitWebViewGroupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebViewGroup.cpp (170890 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebViewGroup.cpp        2014-07-08 17:50:27 UTC (rev 170890)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebViewGroup.cpp        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -26,14 +26,6 @@
</span><span class="cx"> #include <webkit2/webkit2.h>
</span><span class="cx"> #include <wtf/gobject/GRefPtr.h>
</span><span class="cx">
</span><del>-static WebKitTestServer* kServer;
-
-// These are all here so that they can be changed easily, if necessary.
-static const char* kStyleSheetHTML = "<html><div id=\"styledElement\">Sweet stylez!</div></html>";
-static const char* kInjectedStyleSheet = "#styledElement { font-weight: bold; }";
-static const char* kStyleSheetTestScript = "getComputedStyle(document.getElementById('styledElement'))['font-weight']";
-static const char* kStyleSheetTestScriptResult = "bold";
-
</del><span class="cx"> static void testWebViewGroupDefault(Test* test, gconstpointer)
</span><span class="cx"> {
</span><span class="cx"> // Default group is shared by all WebViews by default.
</span><span class="lines">@@ -98,109 +90,14 @@
</span><span class="cx"> g_assert(webkit_web_view_group_get_settings(webkit_web_view_get_group(webView1.get())) == webView2Settings);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static bool isStyleSheetInjectedForURLAtPath(WebViewTest* test, const char* path)
-{
- test->loadURI(kServer->getURIForPath(path).data());
- test->waitUntilLoadFinished();
-
- GUniqueOutPtr<GError> error;
- WebKitJavascriptResult* javascriptResult = test->runJavaScriptAndWaitUntilFinished(kStyleSheetTestScript, &error.outPtr());
- g_assert(javascriptResult);
- g_assert(!error.get());
-
- GUniquePtr<char> resultString(WebViewTest::javascriptResultToCString(javascriptResult));
- return !g_strcmp0(resultString.get(), kStyleSheetTestScriptResult);
-}
-
-static void fillURLListFromPaths(char** list, const char* path, ...)
-{
- va_list argumentList;
- va_start(argumentList, path);
-
- int i = 0;
- while (path) {
- // FIXME: We must use a wildcard for the host here until http://wkbug.com/112476 is fixed.
- // Until that time patterns with port numbers in them will not properly match URLs with port numbers.
- list[i++] = g_strdup_printf("http://*/%s*", path);
- path = va_arg(argumentList, const char*);
- }
-}
-
-static void removeOldInjectedStyleSheetsAndResetLists(WebKitWebViewGroup* group, char** whitelist, char** blacklist)
-{
- webkit_web_view_group_remove_all_user_style_sheets(group);
-
- while (*whitelist) {
- g_free(*whitelist);
- *whitelist = 0;
- whitelist++;
- }
-
- while (*blacklist) {
- g_free(*blacklist);
- *blacklist = 0;
- blacklist++;
- }
-}
-
-static void testWebViewGroupInjectedStyleSheet(WebViewTest* test, gconstpointer)
-{
- WebKitWebViewGroup* group = webkit_web_view_get_group(test->m_webView);
- char* whitelist[3] = { 0, 0, 0 };
- char* blacklist[3] = { 0, 0, 0 };
-
- removeOldInjectedStyleSheetsAndResetLists(group, whitelist, blacklist);
-
- // Without a whitelist or a blacklist all URLs should have the injected style sheet.
- static const char* randomPath = "somerandompath";
- g_assert(!isStyleSheetInjectedForURLAtPath(test, randomPath));
- webkit_web_view_group_add_user_style_sheet(group, kInjectedStyleSheet, 0, 0, 0, WEBKIT_INJECTED_CONTENT_FRAMES_ALL);
- g_assert(isStyleSheetInjectedForURLAtPath(test, randomPath));
-
- removeOldInjectedStyleSheetsAndResetLists(group, whitelist, blacklist);
-
- fillURLListFromPaths(blacklist, randomPath, 0);
- webkit_web_view_group_add_user_style_sheet(group, kInjectedStyleSheet, 0, 0, blacklist, WEBKIT_INJECTED_CONTENT_FRAMES_ALL);
- g_assert(!isStyleSheetInjectedForURLAtPath(test, randomPath));
- g_assert(isStyleSheetInjectedForURLAtPath(test, "someotherrandompath"));
-
- removeOldInjectedStyleSheetsAndResetLists(group, whitelist, blacklist);
-
- static const char* inTheWhiteList = "inthewhitelist";
- static const char* notInWhitelist = "notinthewhitelist";
- static const char* inTheWhiteListAndBlackList = "inthewhitelistandblacklist";
-
- fillURLListFromPaths(whitelist, inTheWhiteList, inTheWhiteListAndBlackList, 0);
- fillURLListFromPaths(blacklist, inTheWhiteListAndBlackList, 0);
- webkit_web_view_group_add_user_style_sheet(group, kInjectedStyleSheet, 0, whitelist, blacklist, WEBKIT_INJECTED_CONTENT_FRAMES_ALL);
- g_assert(isStyleSheetInjectedForURLAtPath(test, inTheWhiteList));
- g_assert(!isStyleSheetInjectedForURLAtPath(test, inTheWhiteListAndBlackList));
- g_assert(!isStyleSheetInjectedForURLAtPath(test, notInWhitelist));
-
- // It's important to clean up the environment before other tests.
- removeOldInjectedStyleSheetsAndResetLists(group, whitelist, blacklist);
-}
-
-static void serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer)
-{
- soup_message_set_status(message, SOUP_STATUS_OK);
- soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, kStyleSheetHTML, strlen(kStyleSheetHTML));
- soup_message_body_complete(message->response_body);
-}
-
</del><span class="cx"> void beforeAll()
</span><span class="cx"> {
</span><del>- kServer = new WebKitTestServer();
- kServer->run(serverCallback);
-
</del><span class="cx"> Test::add("WebKitWebViewGroup", "default-group", testWebViewGroupDefault);
</span><span class="cx"> Test::add("WebKitWebViewGroup", "new-group", testWebViewGroupNewGroup);
</span><span class="cx"> Test::add("WebKitWebView", "new-with-group", testWebViewNewWithGroup);
</span><span class="cx"> Test::add("WebKitWebViewGroup", "settings", testWebViewGroupSettings);
</span><del>- WebViewTest::add("WebKitWebViewGroup", "injected-style-sheet", testWebViewGroupInjectedStyleSheet);
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void afterAll()
</span><span class="cx"> {
</span><del>- delete kServer;
</del><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIgtkWebKit2GtkWebViewTestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp (170890 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp        2014-07-08 17:50:27 UTC (rev 170890)
+++ trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -25,7 +25,10 @@
</span><span class="cx"> #include <WebCore/GUniquePtrGtk.h>
</span><span class="cx">
</span><span class="cx"> WebViewTest::WebViewTest()
</span><del>- : m_webView(WEBKIT_WEB_VIEW(g_object_ref_sink(webkit_web_view_new())))
</del><ins>+ : WebViewTest(WEBKIT_WEB_VIEW(webkit_web_view_new())) { }
+
+WebViewTest::WebViewTest(WebKitWebView* webView)
+ : m_webView(WEBKIT_WEB_VIEW(g_object_ref_sink(webView)))
</ins><span class="cx"> , m_mainLoop(g_main_loop_new(0, TRUE))
</span><span class="cx"> , m_parentWindow(0)
</span><span class="cx"> , m_javascriptResult(0)
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIgtkWebKit2GtkWebViewTesth"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.h (170890 => 170891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.h        2014-07-08 17:50:27 UTC (rev 170890)
+++ trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.h        2014-07-08 17:53:34 UTC (rev 170891)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> class WebViewTest: public Test {
</span><span class="cx"> public:
</span><span class="cx"> MAKE_GLIB_TEST_FIXTURE(WebViewTest);
</span><ins>+ WebViewTest(WebKitWebView*);
</ins><span class="cx"> WebViewTest();
</span><span class="cx"> virtual ~WebViewTest();
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>