[GTK] Move user style sheet API out of WebKitWebViewGroup
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Jul 2014 17:53:34 +0000 (17:53 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Jul 2014 17:53:34 +0000 (17:53 +0000)
commite1ca614dbb3a1c5e079792747ced23ec3b03ab52
treeefcc1fff39586cab8b4f27fc50d5a7b970c4e907
parentd775257ca3bfc7a804ec1d0d9ab82ee65d7706e4
[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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170891 268f45cc-cd09-0410-ab3c-d52691b4dbfc
32 files changed:
Source/WebCore/WebCore.exp.in
Source/WebKit2/ChangeLog
Source/WebKit2/PlatformGTK.cmake
Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp
Source/WebKit2/UIProcess/API/gtk/WebKitUserContent.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/gtk/WebKitUserContent.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManager.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManager.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManagerPrivate.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/gtk/WebKitUserContentPrivate.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h
Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h
Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp
Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h
Source/WebKit2/UIProcess/API/gtk/WebKitWebViewGroup.cpp
Source/WebKit2/UIProcess/API/gtk/WebKitWebViewGroup.h
Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt
Source/WebKit2/UIProcess/API/gtk/webkit2.h
Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp
Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.h
Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp
Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp
Source/WebKit2/WebProcess/UserContent/WebUserContentController.h
Source/WebKit2/WebProcess/UserContent/WebUserContentController.messages.in
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt
Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitUserContentManager.cpp [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebViewGroup.cpp
Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp
Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.h