diff options
| author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-23 09:28:44 +0200 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-23 09:28:44 +0200 |
| commit | 815f1ed417bd26fbe2abbdf20ac5d3423b30796c (patch) | |
| tree | 923c9a9e2834ccab60f5caecfb8f0ac410c1dd9e /Source/WebKit2 | |
| parent | b4ad5d9d2b96baacd0180ead50de5195ca78af2d (diff) | |
| download | qtwebkit-815f1ed417bd26fbe2abbdf20ac5d3423b30796c.tar.gz | |
Imported WebKit commit e65cbc5b6ac32627c797e7fc7f46eb7794410c92 (http://svn.webkit.org/repository/webkit/trunk@123308)
New snapshot with better configure tests
Diffstat (limited to 'Source/WebKit2')
83 files changed, 2165 insertions, 443 deletions
diff --git a/Source/WebKit2/CMakeLists.txt b/Source/WebKit2/CMakeLists.txt index c8d1c35fc..04cc719ee 100644 --- a/Source/WebKit2/CMakeLists.txt +++ b/Source/WebKit2/CMakeLists.txt @@ -298,6 +298,7 @@ SET(WebKit2_SOURCES UIProcess/API/C/WKKeyValueStorageManager.cpp UIProcess/API/C/WKMediaCacheManager.cpp UIProcess/API/C/WKNavigationData.cpp + UIProcess/API/C/WKNetworkInfo.cpp UIProcess/API/C/WKNetworkInfoManager.cpp UIProcess/API/C/WKNotification.cpp UIProcess/API/C/WKNotificationManager.cpp diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index 42222d87c..e1855a33c 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,592 @@ +2012-07-23 Kent Tamura <tkent@chromium.org> + + Rename ENABLE_METER_TAG and ENABLE_PROGRESS_TAG to ENABLE_METER_ELEMENT and ENABLE_PROGRESS_ELEMENT respectively + https://bugs.webkit.org/show_bug.cgi?id=91941 + + Reviewed by Kentaro Hara. + + A flag name for an elmement should be ENABLE_*_ELEMENT. + + * Configurations/FeatureDefines.xcconfig: + +2012-07-22 Kent Tamura <tkent@chromium.org> + + Rename ENABLE_DETAILS to ENABLE_DETAILS_ELEMENT + https://bugs.webkit.org/show_bug.cgi?id=91928 + + Reviewed by Kentaro Hara. + + A flag name for an elmement should be ENABLE_*_ELEMENT. + + * Configurations/FeatureDefines.xcconfig: + +2012-07-20 Kent Tamura <tkent@chromium.org> + + Rename ENABLE_DATALIST to ENABLE_DATALIST_ELEMENT + https://bugs.webkit.org/show_bug.cgi?id=91846 + + Reviewed by Kentaro Hara. + + A flag name for an elmement should be ENABLE_*_ELEMENT. + + * Configurations/FeatureDefines.xcconfig: + +2012-07-20 Rafael Brandao <rafael.lobo@openbossa.org> + + QtNetworkAccessManager should not rely on signal sslErrors when QT_NO_SSL is defined + https://bugs.webkit.org/show_bug.cgi?id=91866 + + Reviewed by Noam Rosenthal. + + * WebProcess/qt/QtNetworkAccessManager.cpp: + (WebKit::QtNetworkAccessManager::QtNetworkAccessManager): QNAM's signal is only defined when + that flag is undefined. Removed the connection when we have the flag set. + (WebKit::QtNetworkAccessManager::onSslErrors): When the flag is set, this slot becomes unused. + +2012-07-20 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] Proxy configuration should honor the no_proxy environment variable + https://bugs.webkit.org/show_bug.cgi?id=91747 + + Reviewed by Kenneth Rohde Christiansen. + + Use the new custom proxy resolver from WebCore in + WebKit2-EFL so that it is possible for the client + to set proxy exceptions via the "no_proxy" + environment variable. + + By default, the proxy set in the "http_proxy" + environment variable will not be used for requests + to localhost or 127.0.0.1. + + * WebProcess/efl/WebProcessMainEfl.cpp: + (WebKit::WebProcessMainEfl): + +2012-06-01 Dinu Jacob <dinu.jacob@nokia.com> + + [Qt][WK2] Add support for multi-select list + https://bugs.webkit.org/show_bug.cgi?id=85527 + + Reviewed by Kenneth Rohde Christiansen. + + Added support for multi-select list: + - Added multi-selection flag to PlatformPopupMenuData to indicate whether to accept multiple selections or not. + - Added selected state to WebPopupItem. + - Modified WebPopupMenuQt to support multiple selections. + + * Shared/PlatformPopupMenuData.cpp: + (WebKit::PlatformPopupMenuData::PlatformPopupMenuData): + (WebKit::PlatformPopupMenuData::encode): + (WebKit::PlatformPopupMenuData::decode): + * Shared/PlatformPopupMenuData.h: + (PlatformPopupMenuData): + * Shared/WebPopupItem.cpp: + (WebKit::WebPopupItem::WebPopupItem): + (WebKit::WebPopupItem::encode): + (WebKit::WebPopupItem::decode): + * Shared/WebPopupItem.h: + * UIProcess/API/qt/tests/qmltests/WebView/tst_multiSelect.qml: Added. + * UIProcess/API/qt/tests/qmltests/common/multiselect.html: Added. + * UIProcess/WebPageProxy.h: + (WebPageProxy): + * UIProcess/WebPopupMenuProxy.h: + (Client): + * UIProcess/qt/WebPageProxyQt.cpp: + (WebKit::WebPageProxy::changeSelectedIndex): + (WebKit): + (WebKit::WebPageProxy::closePopupMenu): + * UIProcess/qt/WebPopupMenuProxyQt.cpp: + (WebKit::PopupMenuItemModel::multiple): + (PopupMenuItemModel): + (WebKit::PopupMenuItemModel::Item::Item): + (ItemSelectorContextObject): + (WebKit::ItemSelectorContextObject::allowMultiSelect): + (WebKit::ItemSelectorContextObject::reject): + (WebKit::ItemSelectorContextObject::dismiss): + (WebKit::ItemSelectorContextObject::ItemSelectorContextObject): + (WebKit): + (WebKit::ItemSelectorContextObject::onIndexUpdate): + (WebKit::ItemSelectorContextObject::accept): + (WebKit::PopupMenuItemModel::PopupMenuItemModel): + (WebKit::PopupMenuItemModel::select): + (WebKit::PopupMenuItemModel::toggleItem): + (WebKit::PopupMenuItemModel::buildItems): + (WebKit::WebPopupMenuProxyQt::showPopupMenu): + (WebKit::WebPopupMenuProxyQt::hidePopupMenu): + (WebKit::WebPopupMenuProxyQt::selectIndex): + (WebKit::WebPopupMenuProxyQt::createItem): + * UIProcess/qt/WebPopupMenuProxyQt.h: + (WebPopupMenuProxyQt): + * WebProcess/WebCoreSupport/WebPopupMenu.cpp: + (WebKit::WebPopupMenu::didChangeSelectedIndex): + (WebKit::WebPopupMenu::populateItems): + * WebProcess/WebCoreSupport/WebPopupMenu.h: + (WebPopupMenu): + * WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp: + (WebKit::WebPopupMenu::setUpPlatformData): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::didChangeSelectedIndexForActivePopupMenu): + (WebKit): + (WebKit::WebPage::changeSelectedIndex): + * WebProcess/WebPage/WebPage.h: + (WebPage): + * WebProcess/WebPage/WebPage.messages.in: + * WebProcess/WebPage/qt/WebPageQt.cpp: + (WebKit::WebPage::selectedIndex): + (WebKit): + (WebKit::WebPage::hidePopupMenu): + +2012-07-20 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Unreviewed, rolling out r123085. + http://trac.webkit.org/changeset/123085 + https://bugs.webkit.org/show_bug.cgi?id=91719 + + r123085 causes crashes on EFL layout test bot. + + * UIProcess/efl/WebContextEfl.cpp: + (WebKit::WebContext::applicationCacheDirectory): + +2012-07-20 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Use "load,finished" signal in EWK2UnitTestBase::loadUrlSync() instead of "load,progress" + https://bugs.webkit.org/show_bug.cgi?id=91721 + + Reviewed by Kenneth Rohde Christiansen. + + The purpose of EWK2UnitTestBase::loadUrlSync() is to load + a URL in the view and wait synchronously for the load to finish. + The current implementation uses the "load,progress" signal to + detect when the load is finished, which is inefficient because + it gets emitted several times. + + It is better to wait for the "load,finished" signal which gets + emitted only once when the load is complete. + + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp: + (EWK2UnitTest::onLoadFinished): + (EWK2UnitTest::EWK2UnitTestBase::EWK2UnitTestBase): + (EWK2UnitTest::EWK2UnitTestBase::loadUrlSync): + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h: + (EWK2UnitTestBase): + +2012-07-19 MORITA Hajime <morrita@google.com> + + [Refactoring] Replace Node's Document pointer with a TreeScope pointer + https://bugs.webkit.org/show_bug.cgi?id=59816 + + Reviewed by Ryosuke Niwa. + + * win/WebKit2.def: Added newly exported symbols. + * win/WebKit2CFLite.def: Ditto. + +2012-07-19 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> + + [EFL] [WK2] Add methods to get/set a custom text encoding + https://bugs.webkit.org/show_bug.cgi?id=90604 + + Reviewed by Kenneth Rohde Christiansen. + + Add methods to get/set custom character encoding. + + * UIProcess/API/efl/ewk_view.cpp: + (_Ewk_View_Private_Data): + (_ewk_view_priv_del): + (ewk_view_setting_encoding_custom_get): + (ewk_view_setting_encoding_custom_set): + * UIProcess/API/efl/ewk_view.h: + +2012-07-19 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Unreviewed. Fix build break because of changing parameter type of + vibration virtual function on EFL port. + + * WebProcess/WebCoreSupport/WebVibrationClient.cpp: + (WebKit::WebVibrationClient::vibrate): + * WebProcess/WebCoreSupport/WebVibrationClient.h: + (WebVibrationClient): + +2012-07-19 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> + + [WK2] Add Vibration API integration to WebContext and WebPage + https://bugs.webkit.org/show_bug.cgi?id=91081 + + Reviewed by Anders Carlsson. + + Integrate Vibration API to WebPage, WebContext and properly route + messages to the WebVibrationProxy. + + * UIProcess/API/C/WKContext.cpp: + (WKContextGetVibration): + * UIProcess/API/C/WKContext.h: + * UIProcess/WebContext.cpp: + (WebKit::WebContext::WebContext): + (WebKit::WebContext::~WebContext): + (WebKit::WebContext::disconnectProcess): + (WebKit::WebContext::didReceiveMessage): + * UIProcess/WebContext.h: + (WebKit): + (WebContext): + (WebKit::WebContext::vibrationProxy): + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::didReceiveMessage): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + +2012-07-19 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Qt] Enable CSS shaders in Qt (software mode) + https://bugs.webkit.org/show_bug.cgi?id=85140 + + Reviewed by Simon Hausmann. + + Add CSSCustomFilterEnabled to QWebPreferences. It's disabled by default. + + * UIProcess/API/qt/qwebpreferences.cpp: + (QWebPreferencesPrivate::testAttribute): + (QWebPreferencesPrivate::setAttribute): + * UIProcess/API/qt/qwebpreferences_p_p.h: + +2012-07-19 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Qt] Enable CSS shaders in Qt (software mode) + https://bugs.webkit.org/show_bug.cgi?id=85140 + + Reviewed by Simon Hausmann. + + Add CSSCustomFilterEnabled to QWebPreferences. It's disabled by default. + + * UIProcess/API/qt/qwebpreferences.cpp: + (QWebPreferencesPrivate::testAttribute): + (QWebPreferencesPrivate::setAttribute): + * UIProcess/API/qt/qwebpreferences_p_p.h: + +2012-07-19 Pierre Rossi <pierre.rossi@gmail.com> + + [Qt][WK2] Map the elementRect exposed in QML to the view for popup menu + https://bugs.webkit.org/show_bug.cgi?id=91645 + + Reviewed by Simon Hausmann. + + This way the geometry of the QML item is still sensible even if we panned + and zoomed. + + * UIProcess/qt/WebPopupMenuProxyQt.cpp: + (ItemSelectorContextObject): + (WebKit::ItemSelectorContextObject::elementRect): + (WebKit::ItemSelectorContextObject::ItemSelectorContextObject): + (WebKit::WebPopupMenuProxyQt::showPopupMenu): + +2012-07-19 Zoltan Nyul <zoltan.nyul@intel.com> + + [EFL][WK2] Using different cache directory for each WTR process + https://bugs.webkit.org/show_bug.cgi?id=91719 + + Reviewed by Kenneth Rohde Christiansen. + + Make sure we return a valid application cache directory in + WebContextEfl. + + * UIProcess/efl/WebContextEfl.cpp: + (WebKit::WebContext::applicationCacheDirectory): + +2012-07-18 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] EFL should use DownloadSoup instead of defining DownloadEfl + https://bugs.webkit.org/show_bug.cgi?id=91602 + + Reviewed by Kenneth Rohde Christiansen. + + Reuse WebProcess/Downloads/soup/DownloadSoup.cpp in EFL port + instead of redefining our own DownloadEfl.cpp. The EFL port + is also using libsoup so it is best to avoid code duplication. + + * GNUmakefile.am: + * GNUmakefile.list.am: + * PlatformEfl.cmake: + * WebProcess/Downloads/Download.h: + (WebKit): + (Download): + * WebProcess/Downloads/efl/DownloadEfl.cpp: Removed. + * WebProcess/Downloads/efl/DownloadSoupErrorsEfl.cpp: Added. + (WebKit): + (WebKit::platformDownloadNetworkError): + (WebKit::platformDownloadDestinationError): + * WebProcess/Downloads/efl/FileDownloaderEfl.cpp: Removed. + * WebProcess/Downloads/efl/FileDownloaderEfl.h: Removed. + * WebProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp: Added. + (WebKit): + (WebKit::platformDownloadNetworkError): + (WebKit::platformDownloadDestinationError): + * WebProcess/Downloads/soup/DownloadSoup.cpp: Make the code + compile for other ports than GTK. + (WebKit::DownloadClient::didReceiveResponse): + (WebKit::DownloadClient::didReceiveData): + (WebKit::DownloadClient::didFail): + (WebKit::Download::continueWithoutCredential): + (WebKit): + (WebKit::Download::useCredential): + (WebKit::Download::cancelAuthenticationChallenge): + * WebProcess/Downloads/soup/DownloadSoupErrors.h: Added. + (WebKit): + +2012-07-18 Christophe Dumez <christophe.dumez@intel.com> + + [WK2] Add C API for Network Information API + https://bugs.webkit.org/show_bug.cgi?id=90762 + + Reviewed by Kenneth Rohde Christiansen. + + Add C API for WKNetworkInfo and WKNetworkInfoManager + so that they can be used by the client. + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * UIProcess/API/C/WKContext.cpp: + (WKContextGetNetworkInfoManager): + * UIProcess/API/C/WKContext.h: + * UIProcess/API/C/WKNetworkInfo.cpp: Copied from Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.cpp. + (WKNetworkInfoGetTypeID): + (WKNetworkInfoCreate): + * UIProcess/API/C/WKNetworkInfo.h: Copied from Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.cpp. + * UIProcess/API/C/WKNetworkInfoManager.cpp: + (WKNetworkInfoManagerSetProvider): + (WKNetworkInfoManagerProviderDidChangeNetworkInformation): + * UIProcess/API/C/WKNetworkInfoManager.h: + +2012-07-18 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] ewk_cookie_manager_persistent_storage_set is not exported + https://bugs.webkit.org/show_bug.cgi?id=91647 + + Reviewed by Gustavo Noronha Silva. + + Properly export ewk_cookie_manager_persistent_storage_set in + ewk_cookie_manager.h by using EAPI. + + * UIProcess/API/efl/ewk_cookie_manager.h: + +2012-07-18 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] Add central error management to EFL port + https://bugs.webkit.org/show_bug.cgi?id=91598 + + Reviewed by Kenneth Rohde Christiansen. + + Make use of ErrorsEfl header from WebCore in + WebKit2, for Ewk_Web_Error and WebErrorsEfl. + + * UIProcess/API/efl/ewk_web_error.cpp: + (ewk_web_error_type_get): + * UIProcess/API/efl/ewk_web_error.h: + * WebProcess/WebCoreSupport/efl/WebErrorsEfl.cpp: + (WebKit::cancelledError): + (WebKit::blockedError): + (WebKit::cannotShowURLError): + (WebKit::interruptedForPolicyChangeError): + (WebKit::cannotShowMIMETypeError): + (WebKit::fileDoesNotExistError): + (WebKit::pluginWillHandleLoadError): + +2012-07-18 Thiago Marcos P. Santos <thiago.santos@intel.com> + + [EFL] Set a theme for EFL WebKit2 unit test fixture + https://bugs.webkit.org/show_bug.cgi?id=91618 + + Reviewed by Kenneth Rohde Christiansen. + + The test fixture should load the theme generated by the build + instead of trying to load the system theme. + + * PlatformEfl.cmake: + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp: + (EWK2UnitTest::EWK2UnitTestBase::SetUp): + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp: + (EWK2UnitTest::EWK2UnitTestEnvironment::defaultTheme): + (EWK2UnitTest): + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h: + (EWK2UnitTestEnvironment): + +2012-07-18 Pierre Rossi <pierre.rossi@gmail.com> + + [Qt] QQuickWebView shouldn't recieve mouse events while dialogs are active + https://bugs.webkit.org/show_bug.cgi?id=91634 + + Reviewed by Alexis Menard. + + One side-effect of reimplementing childMouseEventFilter() in r122438 is that it can end up + bypassing the mouseArea mechanism used in QML dialogs and still forward some mouse events + over to the web process. We can rely on the same m_dialogActive mechanism already used for + touch events in there as well. + + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebView::childMouseEventFilter): ignore events and return early if a dialog is active. + +2012-07-18 Pierre Rossi <pierre.rossi@gmail.com> + + [Qt] Build fix for ENABLE_TOUCH_EVENTS=0 + + Rubber-stamped by No'am Rosenthal. + + Add the appropriate ENABLE(TOUCH_EVENTS) where they're needed. + + * UIProcess/API/qt/raw/qrawwebview.cpp: + * UIProcess/API/qt/raw/qrawwebview_p.h: include Platform.h so we can use the ENABLE macro. + * UIProcess/InspectorServer/qt/WebInspectorServerQt.cpp: Also add the missing QFile include. + * UIProcess/qt/QtWebPageEventHandler.cpp: + (WebKit::QtWebPageEventHandler::deactivateTapHighlight): + +2012-07-18 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Add Ewk class for cookie manager + https://bugs.webkit.org/show_bug.cgi?id=91053 + + Reviewed by Gustavo Noronha Silva. + + Add new Ewk_Cookie_Manager class to allow the client + to set/get the cookie acceptance policy, support + persistent cookie storage and clear cookies. + + The Ewk_Cookie_Manager instance can be retrieved + from the Ewk_Context API. + + * PlatformEfl.cmake: + * UIProcess/API/efl/EWebKit2.h: + * UIProcess/API/efl/ewk_context.cpp: + (_Ewk_Context): + (_Ewk_Context::_Ewk_Context): + (_Ewk_Context::~_Ewk_Context): + (ewk_context_cookie_manager_get): + * UIProcess/API/efl/ewk_context.h: + * UIProcess/API/efl/ewk_cookie_manager.cpp: Added. + (_Ewk_Cookie_Manager): + (_Ewk_Cookie_Manager::_Ewk_Cookie_Manager): + (ewk_cookie_manager_persistent_storage_set): + (ewk_cookie_manager_accept_policy_set): + (Get_Policy_Async_Data): + (getAcceptPolicyCallback): + (ewk_cookie_manager_async_accept_policy_get): + (Get_Hostnames_Async_Data): + (getHostnamesWithCookiesCallback): + (ewk_cookie_manager_async_hostnames_with_cookies_get): + (ewk_cookie_manager_hostname_cookies_clear): + (ewk_cookie_manager_cookies_clear): + (ewk_cookie_manager_free): + (ewk_cookie_manager_new): + * UIProcess/API/efl/ewk_cookie_manager.h: Added. + * UIProcess/API/efl/ewk_cookie_manager_private.h: Added. + +2012-07-18 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Add WebKitWebView::submit-form signal to WebKit2 GTK+ API + https://bugs.webkit.org/show_bug.cgi?id=91605 + + Reviewed by Gustavo Noronha Silva. + + The signal is emitted when a form is about to submitted, with a + form submission request that can be used to get the text fields + and to continue the form submission wheh done. + + * GNUmakefile.list.am: Add new files to compilation. + * UIProcess/API/gtk/WebKitFormClient.cpp: Added. + (willSubmitForm): Create a WebKitFormSubmissionRequest and call + webkitWebViewSubmitFormRequest() with the request. + (attachFormClientToView): Add impementation for willSubmitForm + callback. + * UIProcess/API/gtk/WebKitFormClient.h: Added. + * UIProcess/API/gtk/WebKitFormSubmissionRequest.cpp: Added. + (webkit_form_submission_request_init): + (webkitFormSubmissionRequestFinalize): + (webkit_form_submission_request_class_init): + (webkitFormSubmissionRequestCreate): Create a new + WebKitFormSubmissionRequest for the given values dictionary and + submission listener. + (webkit_form_submission_request_get_text_fields): Create a + GHashTable with the text fields values and return it. + (webkit_form_submission_request_submit): Continue the form + submission. + * UIProcess/API/gtk/WebKitFormSubmissionRequest.h: Added. + * UIProcess/API/gtk/WebKitFormSubmissionRequestPrivate.h: Added. + * UIProcess/API/gtk/WebKitWebView.cpp: + (webkitWebViewConstructed): Attach web view to form client. + (webkit_web_view_class_init): Add WebKitWebView::submit-form + signal. + (webkitWebViewSubmitFormRequest): Emit WebKitWebView::submit-form + signal. + * UIProcess/API/gtk/WebKitWebView.h: + * UIProcess/API/gtk/WebKitWebViewPrivate.h: + * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Add new section for + WebKitFormSubmissionRequest. + * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbols. + * UIProcess/API/gtk/tests/TestWebKitWebView.cpp: + (testWebViewSubmitForm): + (beforeAll): + * UIProcess/API/gtk/webkit2.h: Include + WebKitFormSubmissionRequest.h. + +2012-07-18 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] No main resource in WebView when page has been loaded from history cache + https://bugs.webkit.org/show_bug.cgi?id=91478 + + Reviewed by Gustavo Noronha Silva. + + We are assuming that a resource loaded for the main frame that is + provisionally loading is the main resource of the web view. However + that's not true for pages loaded from history cache, so when you + go back/forward webkit_web_view_get_main_resource() always returns + NULL. We can assume that the first resource loaded for the main + frame is the main resource of the web view when + pageIsProvisionallyLoading is false. + + * UIProcess/API/gtk/WebKitWebView.cpp: + (webkitWebViewResourceLoadStarted): Make sure we always have a + main resource for the web view. + * UIProcess/API/gtk/tests/TestResources.cpp: + (testWebViewResourcesHistoryCache): Test we always have a main + resource even after going back/forward. + (beforeAll): Add new test case. + +2012-07-18 Seokju Kwon <seokju.kwon@samsung.com> + + [EFL] Rename WebInspectorEfl.cpp as WebInspectorProxyEfl.cpp + https://bugs.webkit.org/show_bug.cgi?id=91585 + + Reviewed by Andreas Kling. + + Rename WebInspectorEfl.cpp as WebInspectorProxyEfl.cpp + since it implements the platform specific methods of WebInspectorProxy. + + * PlatformEfl.cmake: + * UIProcess/efl/WebInspectorProxyEfl.cpp: Renamed from Source/WebKit2/UIProcess/efl/WebInspectorEfl.cpp. + (WebKit): + (WebKit::WebInspectorProxy::platformCreateInspectorPage): + (WebKit::WebInspectorProxy::platformOpen): + (WebKit::WebInspectorProxy::platformDidClose): + (WebKit::WebInspectorProxy::platformBringToFront): + (WebKit::WebInspectorProxy::platformIsFront): + (WebKit::WebInspectorProxy::platformInspectedURLChanged): + (WebKit::WebInspectorProxy::inspectorPageURL): + (WebKit::WebInspectorProxy::inspectorBaseURL): + (WebKit::WebInspectorProxy::platformInspectedWindowHeight): + (WebKit::WebInspectorProxy::platformAttach): + (WebKit::WebInspectorProxy::platformDetach): + (WebKit::WebInspectorProxy::platformSetAttachedWindowHeight): + +2012-07-18 Zoltan Horvath <zoltan@webkit.org> + + [Qt] Modify the using of the QImage::Format enum to the appropriate functions from NativeImageQt + https://bugs.webkit.org/show_bug.cgi?id=91600 + + Reviewed by Andreas Kling. + + Use NativeImageQt::defaultFormatForAlphaEnabledImages() and NativeImageQt::defaultFormatForOpaqueImages() + instead of the direct imagetypes at the appropriate places. + + * Shared/qt/ShareableBitmapQt.cpp: + (WebKit::ShareableBitmap::createQImage): + 2012-07-18 Zeno Albisser <zeno@webkit.org> [Qt][WK2] Caching of ShareableSurfaces breaks tiling. diff --git a/Source/WebKit2/Configurations/FeatureDefines.xcconfig b/Source/WebKit2/Configurations/FeatureDefines.xcconfig index 1fc82597c..dedcb83f2 100644 --- a/Source/WebKit2/Configurations/FeatureDefines.xcconfig +++ b/Source/WebKit2/Configurations/FeatureDefines.xcconfig @@ -49,9 +49,9 @@ ENABLE_CSS_VARIABLES = ; ENABLE_CUSTOM_SCHEME_HANDLER = ; ENABLE_DASHBOARD_SUPPORT = $(ENABLE_DASHBOARD_SUPPORT_$(REAL_PLATFORM_NAME)); ENABLE_DASHBOARD_SUPPORT_macosx = ENABLE_DASHBOARD_SUPPORT; -ENABLE_DATALIST = ; +ENABLE_DATALIST_ELEMENT = ; ENABLE_DATA_TRANSFER_ITEMS = ; -ENABLE_DETAILS = ENABLE_DETAILS; +ENABLE_DETAILS_ELEMENT = ENABLE_DETAILS_ELEMENT; ENABLE_DEVICE_ORIENTATION = ; ENABLE_DIALOG_ELEMENT = ; ENABLE_DIRECTORY_UPLOAD = ; @@ -98,7 +98,7 @@ ENABLE_LINK_PRERENDER = ; ENABLE_MATHML = ENABLE_MATHML; ENABLE_MEDIA_SOURCE = ; ENABLE_MEDIA_STATISTICS = ; -ENABLE_METER_TAG = ENABLE_METER_TAG; +ENABLE_METER_ELEMENT = ENABLE_METER_ELEMENT; ENABLE_MHTML = ; ENABLE_MICRODATA = ; ENABLE_MUTATION_OBSERVERS = ENABLE_MUTATION_OBSERVERS; @@ -108,7 +108,7 @@ ENABLE_NOTIFICATIONS_macosx_1070 = ; ENABLE_NOTIFICATIONS_macosx_1080 = ENABLE_NOTIFICATIONS; ENABLE_NOTIFICATIONS_macosx_1090 = ENABLE_NOTIFICATIONS; ENABLE_PAGE_VISIBILITY_API = ; -ENABLE_PROGRESS_TAG = ENABLE_PROGRESS_TAG; +ENABLE_PROGRESS_ELEMENT = ENABLE_PROGRESS_ELEMENT; ENABLE_QUOTA = ; ENABLE_REGISTER_PROTOCOL_HANDLER = ; ENABLE_REQUEST_ANIMATION_FRAME = ENABLE_REQUEST_ANIMATION_FRAME; @@ -135,4 +135,4 @@ ENABLE_WEB_TIMING = ; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS3_FLEXBOX) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_VARIABLES) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS3_FLEXBOX) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_VARIABLES) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/WebKit2/GNUmakefile.am b/Source/WebKit2/GNUmakefile.am index 3e2ecaee4..9108bb4c9 100644 --- a/Source/WebKit2/GNUmakefile.am +++ b/Source/WebKit2/GNUmakefile.am @@ -63,6 +63,7 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_CPP -I$(srcdir)/Source/WebKit2/WebProcess/Battery \ -I$(srcdir)/Source/WebKit2/WebProcess/Cookies \ -I$(srcdir)/Source/WebKit2/WebProcess/Downloads \ + -I$(srcdir)/Source/WebKit2/WebProcess/Downloads/soup \ -I$(srcdir)/Source/WebKit2/WebProcess/FullScreen \ -I$(srcdir)/Source/WebKit2/WebProcess/Geolocation \ -I$(srcdir)/Source/WebKit2/WebProcess/gtk \ diff --git a/Source/WebKit2/GNUmakefile.list.am b/Source/WebKit2/GNUmakefile.list.am index e9348dee9..cfae2d707 100644 --- a/Source/WebKit2/GNUmakefile.list.am +++ b/Source/WebKit2/GNUmakefile.list.am @@ -71,6 +71,7 @@ webkit2_h_api += \ $(WebKit2)/UIProcess/API/C/WKMediaCacheManager.h \ $(WebKit2)/UIProcess/API/C/WKNativeEvent.h \ $(WebKit2)/UIProcess/API/C/WKNavigationData.h \ + $(WebKit2)/UIProcess/API/C/WKNetworkInfo.h \ $(WebKit2)/UIProcess/API/C/WKNetworkInfoManager.h \ $(WebKit2)/UIProcess/API/C/WKNotification.h \ $(WebKit2)/UIProcess/API/C/WKNotificationManager.h \ @@ -104,6 +105,7 @@ webkit2gtk_h_api += \ $(WebKit2)/UIProcess/API/gtk/WebKitError.h \ $(WebKit2)/UIProcess/API/gtk/WebKitFileChooserRequest.h \ $(WebKit2)/UIProcess/API/gtk/WebKitFindController.h \ + $(WebKit2)/UIProcess/API/gtk/WebKitFormSubmissionRequest.h \ $(WebKit2)/UIProcess/API/gtk/WebKitGeolocationPermissionRequest.h \ $(WebKit2)/UIProcess/API/gtk/WebKitHitTestResult.h \ $(WebKit2)/UIProcess/API/gtk/WebKitJavascriptResult.h \ @@ -571,6 +573,8 @@ webkit2_sources += \ Source/WebKit2/UIProcess/API/C/WKNativeEvent.h \ Source/WebKit2/UIProcess/API/C/WKNavigationData.cpp \ Source/WebKit2/UIProcess/API/C/WKNavigationData.h \ + Source/WebKit2/UIProcess/API/C/WKNetworkInfo.cpp \ + Source/WebKit2/UIProcess/API/C/WKNetworkInfo.h \ Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.cpp \ Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.h \ Source/WebKit2/UIProcess/API/C/WKNotification.cpp \ @@ -637,6 +641,11 @@ webkit2_sources += \ Source/WebKit2/UIProcess/API/gtk/WebKitFileChooserRequest.cpp \ Source/WebKit2/UIProcess/API/gtk/WebKitFileChooserRequest.h \ Source/WebKit2/UIProcess/API/gtk/WebKitFileChooserRequestPrivate.h \ + Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequest.cpp \ + Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequest.h \ + Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequestPrivate.h \ + Source/WebKit2/UIProcess/API/gtk/WebKitFormClient.cpp \ + Source/WebKit2/UIProcess/API/gtk/WebKitFormClient.h \ Source/WebKit2/UIProcess/API/gtk/WebKitFullscreenClient.cpp \ Source/WebKit2/UIProcess/API/gtk/WebKitFullscreenClient.h \ Source/WebKit2/UIProcess/API/gtk/WebKitGeolocationPermissionRequest.cpp \ @@ -920,7 +929,9 @@ webkit2_sources += \ Source/WebKit2/WebProcess/Downloads/DownloadAuthenticationClient.h \ Source/WebKit2/WebProcess/Downloads/DownloadManager.cpp \ Source/WebKit2/WebProcess/Downloads/DownloadManager.h \ + Source/WebKit2/WebProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp \ Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp \ + Source/WebKit2/WebProcess/Downloads/soup/DownloadSoupErrors.h \ Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp \ Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.h \ Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp \ diff --git a/Source/WebKit2/PlatformEfl.cmake b/Source/WebKit2/PlatformEfl.cmake index db0e45914..97f7095a6 100644 --- a/Source/WebKit2/PlatformEfl.cmake +++ b/Source/WebKit2/PlatformEfl.cmake @@ -37,6 +37,7 @@ LIST(APPEND WebKit2_SOURCES UIProcess/API/efl/BatteryProvider.cpp UIProcess/API/efl/PageClientImpl.cpp UIProcess/API/efl/ewk_context.cpp + UIProcess/API/efl/ewk_cookie_manager.cpp UIProcess/API/efl/ewk_intent.cpp UIProcess/API/efl/ewk_intent_service.cpp UIProcess/API/efl/ewk_navigation_policy_decision.cpp @@ -54,7 +55,7 @@ LIST(APPEND WebKit2_SOURCES UIProcess/efl/TextCheckerEfl.cpp UIProcess/efl/WebContextEfl.cpp UIProcess/efl/WebFullScreenManagerProxyEfl.cpp - UIProcess/efl/WebInspectorEfl.cpp + UIProcess/efl/WebInspectorProxyEfl.cpp UIProcess/efl/WebPageProxyEfl.cpp UIProcess/efl/WebPreferencesEfl.cpp @@ -70,8 +71,8 @@ LIST(APPEND WebKit2_SOURCES WebProcess/Cookies/soup/WebCookieManagerSoup.cpp WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.cpp - WebProcess/Downloads/efl/DownloadEfl.cpp - WebProcess/Downloads/efl/FileDownloaderEfl.cpp + WebProcess/Downloads/efl/DownloadSoupErrorsEfl.cpp + WebProcess/Downloads/soup/DownloadSoup.cpp WebProcess/efl/WebProcessEfl.cpp WebProcess/efl/WebProcessMainEfl.cpp @@ -108,7 +109,7 @@ LIST(APPEND WebKit2_INCLUDE_DIRECTORIES "${WEBKIT2_DIR}/UIProcess/API/C/soup" "${WEBKIT2_DIR}/UIProcess/API/efl" "${WEBKIT2_DIR}/UIProcess/soup" - "${WEBKIT2_DIR}/WebProcess/Downloads/efl" + "${WEBKIT2_DIR}/WebProcess/Downloads/soup" "${WEBKIT2_DIR}/WebProcess/efl" "${WEBKIT2_DIR}/WebProcess/soup" "${WEBKIT2_DIR}/WebProcess/WebCoreSupport/efl" @@ -172,6 +173,7 @@ CONFIGURE_FILE(efl/ewebkit2.pc.in ${CMAKE_BINARY_DIR}/WebKit2/efl/ewebkit2.pc @O SET (EWebKit2_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/EWebKit2.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_context.h" + "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_cookie_manager.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_intent.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_intent_service.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_navigation_policy_decision.h" @@ -209,6 +211,7 @@ SET(WEBKIT2_EFL_TEST_DIR "${WEBKIT2_DIR}/UIProcess/API/efl/tests") SET(TEST_RESOURCES_DIR ${WEBKIT2_EFL_TEST_DIR}/resources) ADD_DEFINITIONS(-DTEST_RESOURCES_DIR=\"${TEST_RESOURCES_DIR}\" + -DTEST_THEME_DIR=\"${THEME_BINARY_DIR}\" -DGTEST_LINKED_AS_SHARED_LIBRARY=1 ) diff --git a/Source/WebKit2/Shared/PlatformPopupMenuData.cpp b/Source/WebKit2/Shared/PlatformPopupMenuData.cpp index 6c4d20e64..b627afe24 100644 --- a/Source/WebKit2/Shared/PlatformPopupMenuData.cpp +++ b/Source/WebKit2/Shared/PlatformPopupMenuData.cpp @@ -38,6 +38,8 @@ PlatformPopupMenuData::PlatformPopupMenuData() , m_clientInsetRight(0) , m_popupWidth(0) , m_itemHeight(0) +#elif PLATFORM(QT) + : multipleSelections(false) #endif { } @@ -62,6 +64,8 @@ void PlatformPopupMenuData::encode(CoreIPC::ArgumentEncoder* encoder) const #elif PLATFORM(MAC) encoder->encode(fontInfo); encoder->encode(shouldPopOver); +#elif PLATFORM(QT) + encoder->encode(multipleSelections); #endif } @@ -95,6 +99,9 @@ bool PlatformPopupMenuData::decode(CoreIPC::ArgumentDecoder* decoder, PlatformPo return false; if (!decoder->decode(data.shouldPopOver)) return false; +#elif PLATFORM(QT) + if (!decoder->decode(data.multipleSelections)) + return false; #endif return true; diff --git a/Source/WebKit2/Shared/PlatformPopupMenuData.h b/Source/WebKit2/Shared/PlatformPopupMenuData.h index f85008a8d..21abde4ff 100644 --- a/Source/WebKit2/Shared/PlatformPopupMenuData.h +++ b/Source/WebKit2/Shared/PlatformPopupMenuData.h @@ -55,6 +55,8 @@ struct PlatformPopupMenuData { #elif PLATFORM(MAC) FontInfo fontInfo; bool shouldPopOver; +#elif PLATFORM(QT) + bool multipleSelections; #endif }; diff --git a/Source/WebKit2/Shared/WebPopupItem.cpp b/Source/WebKit2/Shared/WebPopupItem.cpp index a9ac03225..c215f3568 100644 --- a/Source/WebKit2/Shared/WebPopupItem.cpp +++ b/Source/WebKit2/Shared/WebPopupItem.cpp @@ -39,6 +39,7 @@ WebPopupItem::WebPopupItem() , m_textDirection(LTR) , m_hasTextDirectionOverride(false) , m_isEnabled(true) + , m_isSelected(false) { } @@ -48,10 +49,11 @@ WebPopupItem::WebPopupItem(Type type) , m_hasTextDirectionOverride(false) , m_isEnabled(true) , m_isLabel(false) + , m_isSelected(false) { } -WebPopupItem::WebPopupItem(Type type, const String& text, TextDirection textDirection, bool hasTextDirectionOverride, const String& toolTip, const String& accessibilityText, bool isEnabled, bool isLabel) +WebPopupItem::WebPopupItem(Type type, const String& text, TextDirection textDirection, bool hasTextDirectionOverride, const String& toolTip, const String& accessibilityText, bool isEnabled, bool isLabel, bool isSelected) : m_type(type) , m_text(text) , m_textDirection(textDirection) @@ -60,12 +62,14 @@ WebPopupItem::WebPopupItem(Type type, const String& text, TextDirection textDire , m_accessibilityText(accessibilityText) , m_isEnabled(isEnabled) , m_isLabel(isLabel) + , m_isSelected(isSelected) { } void WebPopupItem::encode(CoreIPC::ArgumentEncoder* encoder) const { encoder->encode(CoreIPC::In(static_cast<uint32_t>(m_type), m_text, static_cast<uint64_t>(m_textDirection), m_hasTextDirectionOverride, m_toolTip, m_accessibilityText, m_isEnabled, m_isLabel)); + encoder->encode(CoreIPC::In(m_isSelected)); } bool WebPopupItem::decode(CoreIPC::ArgumentDecoder* decoder, WebPopupItem& item) @@ -78,10 +82,15 @@ bool WebPopupItem::decode(CoreIPC::ArgumentDecoder* decoder, WebPopupItem& item) String accessibilityText; bool isEnabled; bool isLabel; + bool isSelected; + if (!decoder->decode(CoreIPC::Out(type, text, textDirection, hasTextDirectionOverride, toolTip, accessibilityText, isEnabled, isLabel))) return false; - item = WebPopupItem(static_cast<Type>(type), text, static_cast<TextDirection>(textDirection), hasTextDirectionOverride, toolTip, accessibilityText, isEnabled, isLabel); + if (!decoder->decode(CoreIPC::Out(isSelected))) + return false; + + item = WebPopupItem(static_cast<Type>(type), text, static_cast<TextDirection>(textDirection), hasTextDirectionOverride, toolTip, accessibilityText, isEnabled, isLabel, isSelected); return true; } diff --git a/Source/WebKit2/Shared/WebPopupItem.h b/Source/WebKit2/Shared/WebPopupItem.h index 3dc61d77e..d8584bea5 100644 --- a/Source/WebKit2/Shared/WebPopupItem.h +++ b/Source/WebKit2/Shared/WebPopupItem.h @@ -44,7 +44,7 @@ struct WebPopupItem { WebPopupItem(); WebPopupItem(Type); - WebPopupItem(Type, const String& text, WebCore::TextDirection, bool hasTextDirectionOverride, const String& toolTip, const String& accessibilityText, bool isEnabled, bool isLabel); + WebPopupItem(Type, const String& text, WebCore::TextDirection, bool hasTextDirectionOverride, const String& toolTip, const String& accessibilityText, bool isEnabled, bool isLabel, bool isSelected); void encode(CoreIPC::ArgumentEncoder*) const; static bool decode(CoreIPC::ArgumentDecoder*, WebPopupItem&); @@ -57,6 +57,7 @@ struct WebPopupItem { String m_accessibilityText; bool m_isEnabled; bool m_isLabel; + bool m_isSelected; }; } // namespace WebKit diff --git a/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp b/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp index b6ceb3e15..88e4d3aec 100644 --- a/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp +++ b/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "ShareableBitmap.h" +#include "NativeImageQt.h" #include <QImage> #include <QPainter> #include <QtGlobal> @@ -41,7 +42,7 @@ QImage ShareableBitmap::createQImage() { ref(); // Balanced by deref in releaseSharedMemoryData return QImage(reinterpret_cast<uchar*>(data()), m_size.width(), m_size.height(), m_size.width() * 4, - m_flags & SupportsAlpha ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32, + m_flags & SupportsAlpha ? NativeImageQt::defaultFormatForAlphaEnabledImages() : NativeImageQt::defaultFormatForOpaqueImages(), releaseSharedMemoryData, this); } diff --git a/Source/WebKit2/Target.pri b/Source/WebKit2/Target.pri index 25d894f7e..80e5a651c 100644 --- a/Source/WebKit2/Target.pri +++ b/Source/WebKit2/Target.pri @@ -167,6 +167,7 @@ HEADERS += \ UIProcess/API/C/WKOpenPanelParameters.h \ UIProcess/API/C/WKOpenPanelResultListener.h \ UIProcess/API/C/WKNavigationData.h \ + UIProcess/API/C/WKNetworkInfo.h \ UIProcess/API/C/WKNetworkInfoManager.h \ UIProcess/API/C/WKNotification.h \ UIProcess/API/C/WKNotificationManager.h \ @@ -547,6 +548,7 @@ SOURCES += \ UIProcess/API/C/WKOpenPanelParameters.cpp \ UIProcess/API/C/WKOpenPanelResultListener.cpp \ UIProcess/API/C/WKNavigationData.cpp \ + UIProcess/API/C/WKNetworkInfo.cpp \ UIProcess/API/C/WKNetworkInfoManager.cpp \ UIProcess/API/C/WKPage.cpp \ UIProcess/API/C/WKPageGroup.cpp \ diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.cpp b/Source/WebKit2/UIProcess/API/C/WKContext.cpp index 7bfc04aed..d168363e8 100644 --- a/Source/WebKit2/UIProcess/API/C/WKContext.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKContext.cpp @@ -189,6 +189,15 @@ WKGeolocationManagerRef WKContextGetGeolocationManager(WKContextRef contextRef) return toAPI(toImpl(contextRef)->geolocationManagerProxy()); } +WKNetworkInfoManagerRef WKContextGetNetworkInfoManager(WKContextRef contextRef) +{ +#if ENABLE(NETWORK_INFO) + return toAPI(toImpl(contextRef)->networkInfoManagerProxy()); +#else + return 0; +#endif +} + WKIconDatabaseRef WKContextGetIconDatabase(WKContextRef contextRef) { return toAPI(toImpl(contextRef)->iconDatabase()); @@ -219,6 +228,15 @@ WKResourceCacheManagerRef WKContextGetResourceCacheManager(WKContextRef contextR return toAPI(toImpl(contextRef)->resourceCacheManagerProxy()); } +WKVibrationRef WKContextGetVibration(WKContextRef contextRef) +{ +#if ENABLE(VIBRATION) + return toAPI(toImpl(contextRef)->vibrationProxy()); +#else + return 0; +#endif +} + void WKContextStartMemorySampler(WKContextRef contextRef, WKDoubleRef interval) { toImpl(contextRef)->startMemorySampler(toImpl(interval)->value()); diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.h b/Source/WebKit2/UIProcess/API/C/WKContext.h index 85e4c157c..412227de7 100644 --- a/Source/WebKit2/UIProcess/API/C/WKContext.h +++ b/Source/WebKit2/UIProcess/API/C/WKContext.h @@ -155,9 +155,11 @@ WK_EXPORT WKGeolocationManagerRef WKContextGetGeolocationManager(WKContextRef co WK_EXPORT WKIconDatabaseRef WKContextGetIconDatabase(WKContextRef context); WK_EXPORT WKKeyValueStorageManagerRef WKContextGetKeyValueStorageManager(WKContextRef context); WK_EXPORT WKMediaCacheManagerRef WKContextGetMediaCacheManager(WKContextRef context); +WK_EXPORT WKNetworkInfoManagerRef WKContextGetNetworkInfoManager(WKContextRef context); WK_EXPORT WKNotificationManagerRef WKContextGetNotificationManager(WKContextRef context); WK_EXPORT WKPluginSiteDataManagerRef WKContextGetPluginSiteDataManager(WKContextRef context); WK_EXPORT WKResourceCacheManagerRef WKContextGetResourceCacheManager(WKContextRef context); +WK_EXPORT WKVibrationRef WKContextGetVibration(WKContextRef context); typedef void (*WKContextGetStatisticsFunction)(WKDictionaryRef statistics, WKErrorRef error, void* functionContext); WK_EXPORT void WKContextGetStatistics(WKContextRef context, void* functionContext, WKContextGetStatisticsFunction function); diff --git a/Source/WebKit2/UIProcess/API/C/WKNetworkInfo.cpp b/Source/WebKit2/UIProcess/API/C/WKNetworkInfo.cpp new file mode 100644 index 000000000..a9bfd3cb1 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKNetworkInfo.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WKNetworkInfo.h" + +#if ENABLE(NETWORK_INFO) +#include "WKAPICast.h" +#include "WebNetworkInfo.h" + +using namespace WebKit; +#endif + +WKTypeID WKNetworkInfoGetTypeID() +{ +#if ENABLE(NETWORK_INFO) + return toAPI(WebNetworkInfo::APIType); +#else + return 0; +#endif +} + +WKNetworkInfoRef WKNetworkInfoCreate(double bandwidth, bool isMetered) +{ +#if ENABLE(NETWORK_INFO) + RefPtr<WebNetworkInfo> networkInfo = WebNetworkInfo::create(bandwidth, isMetered); + return toAPI(networkInfo.release().leakRef()); +#else + return 0; +#endif +} diff --git a/Source/WebKit2/UIProcess/API/C/WKNetworkInfo.h b/Source/WebKit2/UIProcess/API/C/WKNetworkInfo.h new file mode 100644 index 000000000..cff864a75 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKNetworkInfo.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKNetworkInfo_h +#define WKNetworkInfo_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKNetworkInfoGetTypeID(); + +WK_EXPORT WKNetworkInfoRef WKNetworkInfoCreate(double bandwidth, bool isMetered); + +#ifdef __cplusplus +} +#endif + +#endif // WKNetworkInfo_h diff --git a/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.cpp b/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.cpp index 1e0733ac2..85620ad61 100644 --- a/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.cpp @@ -39,3 +39,17 @@ WKTypeID WKNetworkInfoManagerGetTypeID() return 0; #endif } + +void WKNetworkInfoManagerSetProvider(WKNetworkInfoManagerRef networkInfoManager, const WKNetworkInfoProvider* provider) +{ +#if ENABLE(NETWORK_INFO) + toImpl(networkInfoManager)->initializeProvider(provider); +#endif +} + +void WKNetworkInfoManagerProviderDidChangeNetworkInformation(WKNetworkInfoManagerRef networkInfoManager, WKStringRef eventType, WKNetworkInfoRef networkInfo) +{ +#if ENABLE(NETWORK_INFO) + toImpl(networkInfoManager)->providerDidChangeNetworkInformation(AtomicString(toImpl(eventType)->string()), toImpl(networkInfo)); +#endif +} diff --git a/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.h b/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.h index efecf4ef8..dd92eb868 100644 --- a/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.h +++ b/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.h @@ -52,6 +52,10 @@ enum { kWKNetworkInfoProviderCurrentVersion = 0 }; WK_EXPORT WKTypeID WKNetworkInfoManagerGetTypeID(); +WK_EXPORT void WKNetworkInfoManagerSetProvider(WKNetworkInfoManagerRef networkInfoManager, const WKNetworkInfoProvider* provider); + +WK_EXPORT void WKNetworkInfoManagerProviderDidChangeNetworkInformation(WKNetworkInfoManagerRef networkInfoManager, WKStringRef eventType, WKNetworkInfoRef networkInfo); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/efl/EWebKit2.h b/Source/WebKit2/UIProcess/API/efl/EWebKit2.h index 8fa90aeb9..d7d796368 100644 --- a/Source/WebKit2/UIProcess/API/efl/EWebKit2.h +++ b/Source/WebKit2/UIProcess/API/efl/EWebKit2.h @@ -28,6 +28,7 @@ #define EWebKit2_h #include "ewk_context.h" +#include "ewk_cookie_manager.h" #include "ewk_intent.h" #include "ewk_intent_service.h" #include "ewk_navigation_policy_decision.h" diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp index e1ccff23b..21c157c22 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp @@ -25,20 +25,40 @@ #include "WKAPICast.h" #include "WKRetainPtr.h" #include "ewk_context_private.h" +#include "ewk_cookie_manager_private.h" using namespace WebKit; struct _Ewk_Context { WKRetainPtr<WKContextRef> context; + + Ewk_Cookie_Manager* cookieManager; #if ENABLE(BATTERY_STATUS) RefPtr<BatteryProvider> batteryProvider; #endif _Ewk_Context(WKContextRef contextRef) : context(contextRef) + , cookieManager(0) { } + + ~_Ewk_Context() + { + if (cookieManager) + ewk_cookie_manager_free(cookieManager); + } }; +Ewk_Cookie_Manager* ewk_context_cookie_manager_get(const Ewk_Context* ewkContext) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, 0); + + if (!ewkContext->cookieManager) + const_cast<Ewk_Context*>(ewkContext)->cookieManager = ewk_cookie_manager_new(WKContextGetCookieManager(ewkContext->context.get())); + + return ewkContext->cookieManager; +} + WKContextRef ewk_context_WKContext_get(const Ewk_Context* ewkContext) { return ewkContext->context.get(); diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context.h b/Source/WebKit2/UIProcess/API/efl/ewk_context.h index 794d05204..e89037766 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_context.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_context.h @@ -29,6 +29,7 @@ #ifndef ewk_context_h #define ewk_context_h +#include "ewk_cookie_manager.h" #include <Evas.h> #ifdef __cplusplus @@ -45,6 +46,15 @@ typedef struct _Ewk_Context Ewk_Context; */ EAPI Ewk_Context *ewk_context_default_get(); +/** + * Gets the cookie manager instance for this @a context. + * + * @param context context object to query. + * + * @return Ewk_Cookie_Manager object instance or @c NULL in case of failure. + */ +EAPI Ewk_Cookie_Manager *ewk_context_cookie_manager_get(const Ewk_Context *context); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.cpp new file mode 100644 index 000000000..02f1fbd76 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.cpp @@ -0,0 +1,197 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ewk_cookie_manager.h" + +#include "SoupCookiePersistentStorageType.h" +#include "WKAPICast.h" +#include "WKArray.h" +#include "WKCookieManager.h" +#include "WKRetainPtr.h" +#include "WKString.h" +#include "WebCookieManagerProxy.h" +#include "ewk_private.h" +#include "ewk_web_error_private.h" +#include <wtf/text/CString.h> +#include <wtf/text/WTFString.h> + +using namespace WebKit; + +/** + * \struct _Ewk_Cookie_Manager + * @brief Contains the cookie manager data. + */ +struct _Ewk_Cookie_Manager { + WKRetainPtr<WKCookieManagerRef> wkCookieManager; + + _Ewk_Cookie_Manager(WKCookieManagerRef cookieManagerRef) + : wkCookieManager(cookieManagerRef) + { } +}; + +#define EWK_COOKIE_MANAGER_WK_GET_OR_RETURN(manager, wkManager_, ...) \ + if (!(manager)) { \ + EINA_LOG_CRIT("manager is NULL."); \ + return __VA_ARGS__; \ + } \ + if (!(manager)->wkCookieManager) { \ + EINA_LOG_CRIT("manager->wkCookieManager is NULL."); \ + return __VA_ARGS__; \ + } \ + WKCookieManagerRef wkManager_ = (manager)->wkCookieManager.get() + +// Ewk_Cookie_Accept_Policy enum validation +COMPILE_ASSERT_MATCHING_ENUM(EWK_COOKIE_ACCEPT_POLICY_ALWAYS, kWKHTTPCookieAcceptPolicyAlways); +COMPILE_ASSERT_MATCHING_ENUM(EWK_COOKIE_ACCEPT_POLICY_NEVER, kWKHTTPCookieAcceptPolicyNever); +COMPILE_ASSERT_MATCHING_ENUM(EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY, kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain); + +// Ewk_Cookie_Persistent_Storage enum validation +COMPILE_ASSERT_MATCHING_ENUM(EWK_COOKIE_PERSISTENT_STORAGE_TEXT, SoupCookiePersistentStorageText); +COMPILE_ASSERT_MATCHING_ENUM(EWK_COOKIE_PERSISTENT_STORAGE_SQLITE, SoupCookiePersistentStorageSQLite); + +void ewk_cookie_manager_persistent_storage_set(Ewk_Cookie_Manager* manager, const char* filename, Ewk_Cookie_Persistent_Storage storage) +{ + EWK_COOKIE_MANAGER_WK_GET_OR_RETURN(manager, wkManager); + EINA_SAFETY_ON_NULL_RETURN(filename); + + toImpl(wkManager)->setCookiePersistentStorage(String::fromUTF8(filename), storage); +} + +void ewk_cookie_manager_accept_policy_set(Ewk_Cookie_Manager* manager, Ewk_Cookie_Accept_Policy policy) +{ + EWK_COOKIE_MANAGER_WK_GET_OR_RETURN(manager, wkManager); + + WKCookieManagerSetHTTPCookieAcceptPolicy(wkManager, static_cast<WKHTTPCookieAcceptPolicy>(policy)); +} + +struct Get_Policy_Async_Data { + Ewk_Cookie_Manager_Async_Policy_Get_Cb callback; + void* userData; +}; + +static void getAcceptPolicyCallback(WKHTTPCookieAcceptPolicy policy, WKErrorRef wkError, void* data) +{ + Get_Policy_Async_Data* callbackData = static_cast<Get_Policy_Async_Data*>(data); + Ewk_Web_Error* ewkError = wkError ? ewk_web_error_new(wkError) : 0; + + callbackData->callback(static_cast<Ewk_Cookie_Accept_Policy>(policy), ewkError, callbackData->userData); + + if (ewkError) + ewk_web_error_free(ewkError); + delete callbackData; +} + +void ewk_cookie_manager_async_accept_policy_get(const Ewk_Cookie_Manager* manager, Ewk_Cookie_Manager_Async_Policy_Get_Cb callback, void* data) +{ + EWK_COOKIE_MANAGER_WK_GET_OR_RETURN(manager, wkManager); + EINA_SAFETY_ON_NULL_RETURN(callback); + + Get_Policy_Async_Data* callbackData = new Get_Policy_Async_Data; + callbackData->callback = callback; + callbackData->userData = data; + + WKCookieManagerGetHTTPCookieAcceptPolicy(wkManager, callbackData, getAcceptPolicyCallback); +} + +struct Get_Hostnames_Async_Data { + Ewk_Cookie_Manager_Async_Hostnames_Get_Cb callback; + void* userData; +}; + +static void getHostnamesWithCookiesCallback(WKArrayRef wkHostnames, WKErrorRef wkError, void* context) +{ + Eina_List* hostnames = 0; + Get_Hostnames_Async_Data* callbackData = static_cast<Get_Hostnames_Async_Data*>(context); + Ewk_Web_Error* ewkError = wkError ? ewk_web_error_new(wkError) : 0; + + const size_t hostnameCount = WKArrayGetSize(wkHostnames); + for (size_t i = 0; i < hostnameCount; ++i) { + WKStringRef wkHostname = static_cast<WKStringRef>(WKArrayGetItemAtIndex(wkHostnames, i)); + String hostname = toImpl(wkHostname)->string(); + if (hostname.isEmpty()) + continue; + hostnames = eina_list_append(hostnames, eina_stringshare_add(hostname.utf8().data())); + } + + callbackData->callback(hostnames, ewkError, callbackData->userData); + + void* item; + EINA_LIST_FREE(hostnames, item) + eina_stringshare_del(static_cast<Eina_Stringshare*>(item)); + if (ewkError) + ewk_web_error_free(ewkError); + delete callbackData; +} + +void ewk_cookie_manager_async_hostnames_with_cookies_get(const Ewk_Cookie_Manager* manager, Ewk_Cookie_Manager_Async_Hostnames_Get_Cb callback, void* data) +{ + EWK_COOKIE_MANAGER_WK_GET_OR_RETURN(manager, wkManager); + EINA_SAFETY_ON_NULL_RETURN(callback); + + Get_Hostnames_Async_Data* callbackData = new Get_Hostnames_Async_Data; + callbackData->callback = callback; + callbackData->userData = data; + + WKCookieManagerGetHostnamesWithCookies(wkManager, callbackData, getHostnamesWithCookiesCallback); +} + +void ewk_cookie_manager_hostname_cookies_clear(Ewk_Cookie_Manager* manager, const char* hostName) +{ + EWK_COOKIE_MANAGER_WK_GET_OR_RETURN(manager, wkManager); + EINA_SAFETY_ON_NULL_RETURN(hostName); + + WKRetainPtr<WKStringRef> wkHostName(AdoptWK, WKStringCreateWithUTF8CString(hostName)); + WKCookieManagerDeleteCookiesForHostname(wkManager, wkHostName.get()); +} + +void ewk_cookie_manager_cookies_clear(Ewk_Cookie_Manager* manager) +{ + EWK_COOKIE_MANAGER_WK_GET_OR_RETURN(manager, wkManager); + + WKCookieManagerDeleteAllCookies(wkManager); +} + +/** + * @internal + * Frees a Ewk_Cookie_Manager object. + */ +void ewk_cookie_manager_free(Ewk_Cookie_Manager* manager) +{ + EINA_SAFETY_ON_NULL_RETURN(manager); + + delete manager; +} + +/** + * @internal + * Constructs a Ewk_Cookie_Manager from a WKCookieManagerRef. + */ +Ewk_Cookie_Manager* ewk_cookie_manager_new(WKCookieManagerRef wkCookieManager) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(wkCookieManager, 0); + + return new Ewk_Cookie_Manager(wkCookieManager); +} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.h b/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.h new file mode 100644 index 000000000..442c4f7ca --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.h @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_cookie_manager.h + * @brief Describes the Ewk Cookie Manager API. + */ + +#ifndef ewk_cookie_manager_h +#define ewk_cookie_manager_h + +#include "ewk_web_error.h" +#include <Eina.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** Creates a type name for _Ewk_Cookie_Manager */ +typedef struct _Ewk_Cookie_Manager Ewk_Cookie_Manager; + +/** + * \enum _Ewk_Cookie_Accept_Policy + * + * @brief Contains accept policies for the cookies. + */ +enum _Ewk_Cookie_Accept_Policy { + /// Accepts every cookie sent from any page. + EWK_COOKIE_ACCEPT_POLICY_ALWAYS, + /// Rejects all cookies. + EWK_COOKIE_ACCEPT_POLICY_NEVER, + /// Accepts cookies only from the main page. + EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY +}; + +/// Creates a type name for the _Ewk_Cookie_Accept_Policy. +typedef enum _Ewk_Cookie_Accept_Policy Ewk_Cookie_Accept_Policy; + +/** + * \enum _Ewk_Cookie_Persistent_Storage + * + * @brief Enum values to denote cookies persistent storage type. + */ +enum _Ewk_Cookie_Persistent_Storage { + /// Cookies are stored in a text file in the Mozilla "cookies.txt" format. + EWK_COOKIE_PERSISTENT_STORAGE_TEXT, + /// Cookies are stored in a SQLite file in the current Mozilla format. + EWK_COOKIE_PERSISTENT_STORAGE_SQLITE +}; + +/// Creates a type name for the _Ewk_Cookie_Persistent_Storage. +typedef enum _Ewk_Cookie_Persistent_Storage Ewk_Cookie_Persistent_Storage; + +/** + * @typedef Ewk_Cookie_Manager_Async_Policy_Get_Cb Ewk_Cookie_Manager_Async_Policy_Get_Cb + * @brief Callback type for use with ewk_cookie_manager_async_accept_policy_get + */ +typedef void (*Ewk_Cookie_Manager_Async_Policy_Get_Cb)(Ewk_Cookie_Accept_Policy policy, Ewk_Web_Error *error, void *event_info); + +/** + * @typedef Ewk_Cookie_Manager_Async_Hostnames_Get_Cb Ewk_Cookie_Manager_Async_Hostnames_Get_Cb + * @brief Callback type for use with ewk_cookie_manager_async_hostnames_with_cookies_get + * + * @note The @a hostnames list items are guaranteed to be eina_stringshare. Whenever possible + * save yourself some cpu cycles and use eina_stringshare_ref() instead of eina_stringshare_add() + * or strdup(). + */ +typedef void (*Ewk_Cookie_Manager_Async_Hostnames_Get_Cb)(Eina_List* hostnames, Ewk_Web_Error *error, void *event_info); + +/** + * Set the @a filename where non-session cookies are stored persistently using @a storage as the format to read/write the cookies. + * + * Cookies are initially read from @filename to create an initial set of cookies. + * Then, non-session cookies will be written to @filename. + * + * By default, @a manager doesn't store the cookies persistenly, so you need to call this + * method to keep cookies saved across sessions. + * + * @param cookie_manager The cookie manager to update. + * @param filename the filename to read to/write from. + * @param storage the type of storage. + */ +EAPI void ewk_cookie_manager_persistent_storage_set(Ewk_Cookie_Manager *manager, const char *filename, Ewk_Cookie_Persistent_Storage storage); + +/** + * Set @a policy as the cookie acceptance policy for @a manager. + * + * By default, cookies are always accepted. + * + * @param manager The cookie manager to update. + * @param policy a #Ewk_Cookie_Accept_Policy + */ + +EAPI void ewk_cookie_manager_accept_policy_set(Ewk_Cookie_Manager *manager, Ewk_Cookie_Accept_Policy policy); + +/** + * Asynchronously get the cookie acceptance policy of @a manager. + * + * By default, cookies are always accepted. + * + * @param manager The cookie manager to query. + * @param callback The function to call when the policy is received or an error occured. + * @param data User data (may be @c NULL). + */ +EAPI void ewk_cookie_manager_async_accept_policy_get(const Ewk_Cookie_Manager *manager, Ewk_Cookie_Manager_Async_Policy_Get_Cb callback, void *data); + +/** + * Asynchronously get the list of host names for which @a manager contains cookies. + * + * @param manager The cookie manager to query. + * @param callback The function to call when the host names have been received. + * @param data User data (may be @c NULL). + */ +EAPI void ewk_cookie_manager_async_hostnames_with_cookies_get(const Ewk_Cookie_Manager *manager, Ewk_Cookie_Manager_Async_Hostnames_Get_Cb callback, void *data); + +/** + * Remove all cookies of @a manager for the given @a hostname. + * + * @param manager The cookie manager to update. + * @param hostname A host name. + */ +EAPI void ewk_cookie_manager_hostname_cookies_clear(Ewk_Cookie_Manager *manager, const char *hostname); + +/** + * Delete all cookies of @a manager. + * + * @param manager The cookie manager to update. + */ +EAPI void ewk_cookie_manager_cookies_clear(Ewk_Cookie_Manager *manager); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_cookie_manager_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager_private.h new file mode 100644 index 000000000..64285c981 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager_private.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_cookie_manager_private_h +#define ewk_cookie_manager_private_h + +#include <WebKit2/WKBase.h> + +typedef struct _Ewk_Cookie_Manager Ewk_Cookie_Manager; + +Ewk_Cookie_Manager* ewk_cookie_manager_new(WKCookieManagerRef wkCookieManager); +void ewk_cookie_manager_free(Ewk_Cookie_Manager* manager); + +#endif // ewk_cookie_manager_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp index 8b7132b48..3f80aa11d 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp @@ -27,6 +27,7 @@ #include "PageClientImpl.h" #include "WKAPICast.h" #include "WKRetainPtr.h" +#include "WKString.h" #include "WKURL.h" #include "ewk_context.h" #include "ewk_context_private.h" @@ -50,12 +51,14 @@ struct _Ewk_View_Private_Data { const char* uri; const char* title; const char* theme; + const char* customEncoding; LoadingResourcesMap loadingResourcesMap; _Ewk_View_Private_Data() : uri(0) , title(0) , theme(0) + , customEncoding(0) { } ~_Ewk_View_Private_Data() @@ -63,6 +66,7 @@ struct _Ewk_View_Private_Data { eina_stringshare_del(uri); eina_stringshare_del(title); eina_stringshare_del(theme); + eina_stringshare_del(customEncoding); } }; @@ -960,3 +964,27 @@ WebPageProxy* ewk_view_page_get(const Evas_Object* ewkView) return priv->pageClient->page(); } + +const char* ewk_view_setting_encoding_custom_get(const Evas_Object* ewkView) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + + WKRetainPtr<WKStringRef> wkEncodingName(AdoptWK, WKPageCopyCustomTextEncodingName(toAPI(priv->pageClient->page()))); + if (WKStringIsEmpty(wkEncodingName.get())) + return 0; + + eina_stringshare_replace(&priv->customEncoding, toImpl(wkEncodingName.get())->string().utf8().data()); + return priv->customEncoding; +} + +Eina_Bool ewk_view_setting_encoding_custom_set(Evas_Object* ewkView, const char* encoding) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + + WKRetainPtr<WKStringRef> wkEncodingName = encoding ? adoptWK(WKStringCreateWithUTF8CString(encoding)) : 0; + if (eina_stringshare_replace(&priv->customEncoding, encoding)) + WKPageSetCustomTextEncodingName(toAPI(priv->pageClient->page()), wkEncodingName.get()); + return true; +} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.h b/Source/WebKit2/UIProcess/API/efl/ewk_view.h index fe3f10675..6a8e74f82 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.h @@ -420,6 +420,26 @@ EAPI void ewk_view_theme_set(Evas_Object *o, const char *path); */ EAPI const char *ewk_view_theme_get(const Evas_Object *o); +/** + * Gets the current custom character encoding name. + * + * @param o view object to get the current encoding + * + * @return @c eina_strinshare containing the current encoding, or + * @c NULL if it's not set + */ +EAPI const char *ewk_view_setting_encoding_custom_get(const Evas_Object *o); + +/** + * Sets the custom character encoding and reloads the page. + * + * @param o view to set the encoding + * @param encoding the new encoding to set or @c NULL to restore the default one + * + * @return @c EINA_TRUE on success @c EINA_FALSE otherwise + */ +EAPI Eina_Bool ewk_view_setting_encoding_custom_set(Evas_Object *o, const char *encoding); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp index f16fb2cc3..e6e3eb891 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "ewk_web_error.h" +#include "ErrorsEfl.h" #include "WKString.h" #include "WKURL.h" #include "ewk_web_error_private.h" @@ -34,11 +35,9 @@ #include <WKRetainPtr.h> #include <wtf/text/CString.h> +using namespace WebCore; using namespace WebKit; -// Copied from ErrorsGtk.h which is used by DownloadSoup.cpp. -static const char errorDomainDownload[] = "WebKitDownloadError"; - struct _Ewk_Web_Error { WKRetainPtr<WKErrorRef> wkError; @@ -83,12 +82,16 @@ Ewk_Web_Error_Type ewk_web_error_type_get(const Ewk_Web_Error* error) WKRetainPtr<WKStringRef> wkDomain(AdoptWK, WKErrorCopyDomain(wkError)); WTF::String errorDomain = toWTFString(wkDomain.get()); - if (errorDomain == String(g_quark_to_string(SOUP_HTTP_ERROR))) - return EWK_WEB_ERROR_TYPE_HTTP; - if (errorDomain == String(g_quark_to_string(G_IO_ERROR))) - return EWK_WEB_ERROR_TYPE_IO; + if (errorDomain == errorDomainNetwork) + return EWK_WEB_ERROR_TYPE_NETWORK; + if (errorDomain == errorDomainPolicy) + return EWK_WEB_ERROR_TYPE_POLICY; + if (errorDomain == errorDomainPlugin) + return EWK_WEB_ERROR_TYPE_PLUGIN; if (errorDomain == errorDomainDownload) return EWK_WEB_ERROR_TYPE_DOWNLOAD; + if (errorDomain == errorDomainPrint) + return EWK_WEB_ERROR_TYPE_PRINT; return EWK_WEB_ERROR_TYPE_INTERNAL; } diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_web_error.h b/Source/WebKit2/UIProcess/API/efl/ewk_web_error.h index 2d9666581..4ba0c7acd 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_web_error.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_web_error.h @@ -44,9 +44,11 @@ typedef struct _Ewk_Web_Error Ewk_Web_Error; typedef enum { EWK_WEB_ERROR_TYPE_NONE, EWK_WEB_ERROR_TYPE_INTERNAL, - EWK_WEB_ERROR_TYPE_HTTP, - EWK_WEB_ERROR_TYPE_IO, - EWK_WEB_ERROR_TYPE_DOWNLOAD + EWK_WEB_ERROR_TYPE_NETWORK, + EWK_WEB_ERROR_TYPE_POLICY, + EWK_WEB_ERROR_TYPE_PLUGIN, + EWK_WEB_ERROR_TYPE_DOWNLOAD, + EWK_WEB_ERROR_TYPE_PRINT } Ewk_Web_Error_Type; /** diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp index b96643049..05168e26d 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp @@ -29,19 +29,17 @@ extern EWK2UnitTest::EWK2UnitTestEnvironment* environment; namespace EWK2UnitTest { -static void onLoadProgress(void* userData, Evas_Object* webView, void* eventInfo) +static void onLoadFinished(void* userData, Evas_Object* webView, void* eventInfo) { UNUSED_PARAM(webView); + UNUSED_PARAM(eventInfo); - EWK2UnitTestBase* test = static_cast<EWK2UnitTestBase*>(userData); - double progress = *static_cast<double*>(eventInfo); - - test->setLoadProgress(progress); + bool* loadFinished = static_cast<bool*>(userData); + *loadFinished = true; } EWK2UnitTestBase::EWK2UnitTestBase() - : m_loadProgress(0) - , m_ecoreEvas(0) + : m_ecoreEvas(0) , m_webView(0) { } @@ -62,6 +60,8 @@ void EWK2UnitTestBase::SetUp() Evas* evas = ecore_evas_get(m_ecoreEvas); m_webView = ewk_view_add(evas); + ewk_view_theme_set(m_webView, environment->defaultTheme()); + evas_object_resize(m_webView, width, height); evas_object_show(m_webView); evas_object_focus_set(m_webView, true); @@ -76,15 +76,15 @@ void EWK2UnitTestBase::TearDown() void EWK2UnitTestBase::loadUrlSync(const char* url) { - m_loadProgress = 0; + bool loadFinished = false; - evas_object_smart_callback_add(m_webView, "load,progress", onLoadProgress, this); + evas_object_smart_callback_add(m_webView, "load,finished", onLoadFinished, &loadFinished); ewk_view_uri_set(m_webView, url); - while (m_loadProgress != 1) + while (!loadFinished) ecore_main_loop_iterate(); - evas_object_smart_callback_del(m_webView, "load,progress", onLoadProgress); + evas_object_smart_callback_del(m_webView, "load,finished", onLoadFinished); } } // namespace EWK2UnitTest diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h index 794688140..8fa1b5021 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h @@ -28,7 +28,6 @@ namespace EWK2UnitTest { class EWK2UnitTestBase : public ::testing::Test { public: - void setLoadProgress(float progress) { m_loadProgress = progress; } Evas_Object* webView() { return m_webView; } protected: @@ -42,8 +41,6 @@ protected: private: Evas_Object* m_webView; Ecore_Evas* m_ecoreEvas; - - float m_loadProgress; }; } // namespace EWK2UnitTest diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp index 61cb53e0f..e7bc0d621 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp @@ -34,4 +34,9 @@ const char* EWK2UnitTestEnvironment::defaultTestPageUrl() const return "file://"TEST_RESOURCES_DIR"/default_test_page.html"; } +const char* EWK2UnitTestEnvironment::defaultTheme() const +{ + return TEST_THEME_DIR"/default.edj"; +} + } // namespace EWK2UnitTest diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h index 9e076bea0..fac0f5988 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h @@ -29,6 +29,7 @@ public: bool useX11Window() const { return m_useX11Window; } const char* defaultTestPageUrl() const; + const char* defaultTheme() const; virtual unsigned int defaultWidth() const { return m_defaultWidth; } virtual unsigned int defaultHeight() const { return m_defaultHeight; } diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFormClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitFormClient.cpp new file mode 100644 index 000000000..fd5be3daf --- /dev/null +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitFormClient.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2012 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 "WebKitFormClient.h" + +#include "WebKitFormSubmissionRequestPrivate.h" +#include "WebKitPrivate.h" +#include "WebKitWebViewBasePrivate.h" +#include "WebKitWebViewPrivate.h" +#include <wtf/gobject/GRefPtr.h> + +using namespace WebKit; + +static void willSubmitForm(WKPageRef page, WKFrameRef frame, WKFrameRef sourceFrame, WKDictionaryRef values, WKTypeRef userData, WKFormSubmissionListenerRef listener, const void* clientInfo) +{ + GRefPtr<WebKitFormSubmissionRequest> request = adoptGRef(webkitFormSubmissionRequestCreate(values, listener)); + webkitWebViewSubmitFormRequest(WEBKIT_WEB_VIEW(clientInfo), request.get()); +} + +void attachFormClientToView(WebKitWebView* webView) +{ + WKPageFormClient wkFormClient = { + kWKPageFormClientCurrentVersion, + webView, // clientInfo + willSubmitForm + }; + WKPageRef wkPage = toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView))); + WKPageSetPageFormClient(wkPage, &wkFormClient); +} diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFormClient.h b/Source/WebKit2/UIProcess/API/gtk/WebKitFormClient.h new file mode 100644 index 000000000..a37022731 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitFormClient.h @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2012 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 WebKitFormClient_h +#define WebKitFormClient_h + +#include "WebKitWebView.h" + +void attachFormClientToView(WebKitWebView*); + +#endif diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequest.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequest.cpp new file mode 100644 index 000000000..40e2d17f1 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequest.cpp @@ -0,0 +1,118 @@ +/* + * Copyright (C) 2012 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 "WebKitFormSubmissionRequest.h" + +#include "WebKitFormSubmissionRequestPrivate.h" +#include <wtf/gobject/GRefPtr.h> +#include <wtf/text/CString.h> + +using namespace WebKit; + +G_DEFINE_TYPE(WebKitFormSubmissionRequest, webkit_form_submission_request, G_TYPE_OBJECT) + +struct _WebKitFormSubmissionRequestPrivate { + WKRetainPtr<WKDictionaryRef> wkValues; + WKRetainPtr<WKFormSubmissionListenerRef> wkListener; + GRefPtr<GHashTable> values; + bool handledRequest; +}; + +static void webkit_form_submission_request_init(WebKitFormSubmissionRequest* request) +{ + WebKitFormSubmissionRequestPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(request, WEBKIT_TYPE_FORM_SUBMISSION_REQUEST, WebKitFormSubmissionRequestPrivate); + request->priv = priv; + new (priv) WebKitFormSubmissionRequestPrivate(); +} + +static void webkitFormSubmissionRequestFinalize(GObject* object) +{ + WebKitFormSubmissionRequest* request = WEBKIT_FORM_SUBMISSION_REQUEST(object); + + // Make sure the request is always handled before finalizing. + if (!request->priv->handledRequest) + webkit_form_submission_request_submit(request); + + request->priv->~WebKitFormSubmissionRequestPrivate(); + G_OBJECT_CLASS(webkit_form_submission_request_parent_class)->finalize(object); +} + +static void webkit_form_submission_request_class_init(WebKitFormSubmissionRequestClass* requestClass) +{ + GObjectClass* objectClass = G_OBJECT_CLASS(requestClass); + objectClass->finalize = webkitFormSubmissionRequestFinalize; + g_type_class_add_private(requestClass, sizeof(WebKitFormSubmissionRequestPrivate)); +} + +WebKitFormSubmissionRequest* webkitFormSubmissionRequestCreate(WKDictionaryRef wkValues, WKFormSubmissionListenerRef wkListener) +{ + WebKitFormSubmissionRequest* request = WEBKIT_FORM_SUBMISSION_REQUEST(g_object_new(WEBKIT_TYPE_FORM_SUBMISSION_REQUEST, NULL)); + request->priv->wkValues = wkValues; + request->priv->wkListener = wkListener; + return request; +} + +/** + * webkit_form_submission_request_get_text_fields: + * @request: a #WebKitFormSubmissionRequest + * + * Get a #GHashTable with the values of the text fields contained in the form + * associated to @request. + * + * Returns: (transfer none): a #GHashTable with the form text fields, or %NULL if the + * form doesn't contain text fields. + */ +GHashTable* webkit_form_submission_request_get_text_fields(WebKitFormSubmissionRequest* request) +{ + g_return_val_if_fail(WEBKIT_IS_FORM_SUBMISSION_REQUEST(request), 0); + + if (request->priv->values) + return request->priv->values.get(); + + if (!WKDictionaryGetSize(request->priv->wkValues.get())) + return 0; + + request->priv->values = adoptGRef(g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free)); + + WKRetainPtr<WKArrayRef> wkKeys(AdoptWK, WKDictionaryCopyKeys(request->priv->wkValues.get())); + for (size_t i = 0; i < WKArrayGetSize(wkKeys.get()); ++i) { + WKStringRef wkKey = static_cast<WKStringRef>(WKArrayGetItemAtIndex(wkKeys.get(), i)); + WKStringRef wkValue = static_cast<WKStringRef>(WKDictionaryGetItemForKey(request->priv->wkValues.get(), wkKey)); + g_hash_table_insert(request->priv->values.get(), g_strdup(toImpl(wkKey)->string().utf8().data()), g_strdup(toImpl(wkValue)->string().utf8().data())); + } + + request->priv->wkValues = 0; + + return request->priv->values.get(); +} + +/** + * webkit_form_submission_request_submit: + * @request: a #WebKitFormSubmissionRequest + * + * Continue the form submission. + */ +void webkit_form_submission_request_submit(WebKitFormSubmissionRequest* request) +{ + g_return_if_fail(WEBKIT_IS_FORM_SUBMISSION_REQUEST(request)); + + WKFormSubmissionListenerContinue(request->priv->wkListener.get()); + request->priv->handledRequest = true; +} diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequest.h b/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequest.h new file mode 100644 index 000000000..910a81c6d --- /dev/null +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequest.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2012 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 WebKitFormSubmissionRequest_h +#define WebKitFormSubmissionRequest_h + +#include <glib-object.h> +#include <webkit2/WebKitDefines.h> + +G_BEGIN_DECLS + +#define WEBKIT_TYPE_FORM_SUBMISSION_REQUEST (webkit_form_submission_request_get_type()) +#define WEBKIT_FORM_SUBMISSION_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_FORM_SUBMISSION_REQUEST, WebKitFormSubmissionRequest)) +#define WEBKIT_IS_FORM_SUBMISSION_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_FORM_SUBMISSION_REQUEST)) +#define WEBKIT_FORM_SUBMISSION_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_FORM_SUBMISSION_REQUEST, WebKitFormSubmissionRequestClass)) +#define WEBKIT_IS_FORM_SUBMISSION_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_FORM_SUBMISSION_REQUEST)) +#define WEBKIT_FORM_SUBMISSION_REQUEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_FORM_SUBMISSION_REQUEST, WebKitFormSubmissionRequestClass)) + +typedef struct _WebKitFormSubmissionRequest WebKitFormSubmissionRequest; +typedef struct _WebKitFormSubmissionRequestClass WebKitFormSubmissionRequestClass; +typedef struct _WebKitFormSubmissionRequestPrivate WebKitFormSubmissionRequestPrivate; + +struct _WebKitFormSubmissionRequest { + GObject parent; + + /*< private >*/ + WebKitFormSubmissionRequestPrivate *priv; +}; + +struct _WebKitFormSubmissionRequestClass { + GObjectClass parent_class; +}; + +WEBKIT_API GType +webkit_form_submission_request_get_type (void); + +WEBKIT_API GHashTable * +webkit_form_submission_request_get_text_fields (WebKitFormSubmissionRequest *request); + +WEBKIT_API void +webkit_form_submission_request_submit (WebKitFormSubmissionRequest *request); + +G_END_DECLS + +#endif diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequestPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequestPrivate.h new file mode 100644 index 000000000..ad4a6190b --- /dev/null +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequestPrivate.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2012 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 WebKitFormSubmissionRequestPrivate_h +#define WebKitFormSubmissionRequestPrivate_h + +#include "WebKitFormSubmissionRequest.h" +#include "WebKitPrivate.h" + +WebKitFormSubmissionRequest* webkitFormSubmissionRequestCreate(WKDictionaryRef, WKFormSubmissionListenerRef); + +#endif // WebKitFormSubmissionRequestPrivate_h diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp index 8bfabeec6..8bf4d8fe0 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp @@ -29,6 +29,7 @@ #include "WebKitContextMenuPrivate.h" #include "WebKitEnumTypes.h" #include "WebKitError.h" +#include "WebKitFormClient.h" #include "WebKitFullscreenClient.h" #include "WebKitHitTestResultPrivate.h" #include "WebKitJavascriptResultPrivate.h" @@ -90,6 +91,8 @@ enum { CONTEXT_MENU, CONTEXT_MENU_DISMISSED, + SUBMIT_FORM, + LAST_SIGNAL }; @@ -325,6 +328,7 @@ static void webkitWebViewConstructed(GObject* object) attachResourceLoadClientToView(webView); attachFullScreenClientToView(webView); attachContextMenuClientToView(webView); + attachFormClientToView(webView); WebPageProxy* page = webkitWebViewBaseGetPage(webViewBase); priv->backForwardList = adoptGRef(webkitBackForwardListCreate(WKPageGetBackForwardList(toAPI(page)))); @@ -1060,6 +1064,33 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) 0, 0, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + + /** + * WebKitWebView::submit-form: + * @web_view: the #WebKitWebView on which the signal is emitted + * @request: a #WebKitFormSubmissionRequest + * + * This signal is emitted when a form is about to be submitted. The @request + * argument passed contains information about the text fields of the form. This + * is typically used to store login information that can be used later to + * pre-fill the form. + * The form will not be submitted until webkit_form_submission_request_submit() is called. + * + * It is possible to handle the form submission request asynchronously, by + * simply calling g_object_ref() on the @request argument and calling + * webkit_form_submission_request_submit() when done to continue with the form submission. + * If the last reference is removed on a #WebKitFormSubmissionRequest and the + * form has not been submitted, webkit_form_submission_request_submit() will be called. + */ + signals[SUBMIT_FORM] = + g_signal_new("submit-form", + G_TYPE_FROM_CLASS(webViewClass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(WebKitWebViewClass, submit_form), + 0, 0, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + WEBKIT_TYPE_FORM_SUBMISSION_REQUEST); } static bool updateReplaceContentStatus(WebKitWebView* webView, WebKitLoadEvent loadEvent) @@ -1250,7 +1281,7 @@ void webkitWebViewResourceLoadStarted(WebKitWebView* webView, WKFrameRef wkFrame WebKitWebViewPrivate* priv = webView->priv; WebKitWebResource* resource = webkitWebResourceCreate(wkFrame, request, isMainResource); - if (WKFrameIsMainFrame(wkFrame) && isMainResource) + if (WKFrameIsMainFrame(wkFrame) && (isMainResource || !priv->mainResource)) priv->mainResource = resource; priv->loadingResourcesMap.set(resourceIdentifier, adoptGRef(resource)); g_signal_emit(webView, signals[RESOURCE_LOAD_STARTED], 0, resource, request); @@ -1388,6 +1419,11 @@ void webkitWebViewPopulateContextMenu(WebKitWebView* webView, WKArrayRef wkPropo webkit_context_menu_remove_all(contextMenu.get()); } +void webkitWebViewSubmitFormRequest(WebKitWebView* webView, WebKitFormSubmissionRequest* request) +{ + g_signal_emit(webView, signals[SUBMIT_FORM], 0, request); +} + /** * webkit_web_view_new: * diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h index bac32a78e..2553b1840 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h @@ -33,6 +33,7 @@ #include <webkit2/WebKitDefines.h> #include <webkit2/WebKitFileChooserRequest.h> #include <webkit2/WebKitFindController.h> +#include <webkit2/WebKitFormSubmissionRequest.h> #include <webkit2/WebKitHitTestResult.h> #include <webkit2/WebKitJavascriptResult.h> #include <webkit2/WebKitPermissionRequest.h> @@ -127,43 +128,45 @@ struct _WebKitWebView { struct _WebKitWebViewClass { WebKitWebViewBaseClass parent; - void (* load_changed) (WebKitWebView *web_view, - WebKitLoadEvent load_event); - gboolean (* load_failed) (WebKitWebView *web_view, - WebKitLoadEvent load_event, - const gchar *failing_uri, - GError *error); - - GtkWidget *(* create) (WebKitWebView *web_view); - void (* ready_to_show) (WebKitWebView *web_view); - void (* run_as_modal) (WebKitWebView *web_view); - void (* close) (WebKitWebView *web_view); - - gboolean (* script_dialog) (WebKitWebView *web_view, - WebKitScriptDialog *dialog); - - gboolean (* decide_policy) (WebKitWebView *web_view, - WebKitPolicyDecision *decision, - WebKitPolicyDecisionType type); - gboolean (* permission_request) (WebKitWebView *web_view, - WebKitPermissionRequest *permission_request); - void (* mouse_target_changed) (WebKitWebView *web_view, - WebKitHitTestResult *hit_test_result, - guint modifiers); - gboolean (* print_requested) (WebKitWebView *web_view, - WebKitPrintOperation *print_operation); - void (* resource_load_started) (WebKitWebView *web_view, - WebKitWebResource *resource, - WebKitURIRequest *request); - gboolean (* enter_fullscreen) (WebKitWebView *web_view); - gboolean (* leave_fullscreen) (WebKitWebView *web_view); - gboolean (* run_file_chooser) (WebKitWebView *web_view, - WebKitFileChooserRequest *request); - gboolean (* context_menu) (WebKitWebView *web_view, - WebKitContextMenu *context_menu, - GdkEvent *event, - WebKitHitTestResult *hit_test_result); - void (* context_menu_dismissed) (WebKitWebView *web_view); + void (* load_changed) (WebKitWebView *web_view, + WebKitLoadEvent load_event); + gboolean (* load_failed) (WebKitWebView *web_view, + WebKitLoadEvent load_event, + const gchar *failing_uri, + GError *error); + + GtkWidget *(* create) (WebKitWebView *web_view); + void (* ready_to_show) (WebKitWebView *web_view); + void (* run_as_modal) (WebKitWebView *web_view); + void (* close) (WebKitWebView *web_view); + + gboolean (* script_dialog) (WebKitWebView *web_view, + WebKitScriptDialog *dialog); + + gboolean (* decide_policy) (WebKitWebView *web_view, + WebKitPolicyDecision *decision, + WebKitPolicyDecisionType type); + gboolean (* permission_request) (WebKitWebView *web_view, + WebKitPermissionRequest *permission_request); + void (* mouse_target_changed) (WebKitWebView *web_view, + WebKitHitTestResult *hit_test_result, + guint modifiers); + gboolean (* print_requested) (WebKitWebView *web_view, + WebKitPrintOperation *print_operation); + void (* resource_load_started) (WebKitWebView *web_view, + WebKitWebResource *resource, + WebKitURIRequest *request); + gboolean (* enter_fullscreen) (WebKitWebView *web_view); + gboolean (* leave_fullscreen) (WebKitWebView *web_view); + gboolean (* run_file_chooser) (WebKitWebView *web_view, + WebKitFileChooserRequest *request); + gboolean (* context_menu) (WebKitWebView *web_view, + WebKitContextMenu *context_menu, + GdkEvent *event, + WebKitHitTestResult *hit_test_result); + void (* context_menu_dismissed) (WebKitWebView *web_view); + void (* submit_form) (WebKitWebView *web_view, + WebKitFormSubmissionRequest *request); /* Padding for future expansion */ void (*_webkit_reserved0) (void); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h index b602f4fe0..1833fb111 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h @@ -55,5 +55,6 @@ WebKitWebResource* webkitWebViewResourceLoadFinished(WebKitWebView*, uint64_t re bool webkitWebViewEnterFullScreen(WebKitWebView*); bool webkitWebViewLeaveFullScreen(WebKitWebView*); void webkitWebViewPopulateContextMenu(WebKitWebView*, WKArrayRef proposedMenu, WKHitTestResultRef); +void webkitWebViewSubmitFormRequest(WebKitWebView*, WebKitFormSubmissionRequest*); #endif // WebKitWebViewPrivate_h diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml index 6b62d6f69..6aac7c843 100644 --- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml +++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml @@ -39,6 +39,7 @@ <xi:include href="xml/WebKitVersion.xml"/> <xi:include href="xml/WebKitContextMenu.xml"/> <xi:include href="xml/WebKitContextMenuItem.xml"/> + <xi:include href="xml/WebKitFormSubmissionRequest.xml"/> </chapter> <index id="index-all"> diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt index f5c84753c..3164177cc 100644 --- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt +++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt @@ -814,3 +814,23 @@ WEBKIT_CONTEXT_MENU_ITEM_GET_CLASS WebKitContextMenuItemPrivate webkit_context_menu_item_get_type </SECTION> + +<SECTION> +<FILE>WebKitFormSubmissionRequest</FILE> +WebKitFormSubmissionRequest +webkit_form_submission_request_get_text_fields +webkit_form_submission_request_submit + +<SUBSECTION Standard> +WebKitFormSubmissionRequestClass +WEBKIT_TYPE_FORM_SUBMISSION_REQUEST +WEBKIT_FORM_SUBMISSION_REQUEST +WEBKIT_IS_FORM_SUBMISSION_REQUEST +WEBKIT_FORM_SUBMISSION_REQUEST_CLASS +WEBKIT_IS_FORM_SUBMISSION_REQUEST_CLASS +WEBKIT_FORM_SUBMISSION_REQUEST_GET_CLASS + +<SUBSECTION Private> +WebKitFormSubmissionRequestPrivate +webkit_form_submission_request_get_type +</SECTION> diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp index 43f59e1e7..dc7a518dd 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp @@ -520,6 +520,25 @@ static void testWebViewResourcesReplacedContent(ResourcesTest* test, gconstpoint g_assert(!webkit_web_view_get_subresources(test->m_webView)); } +static void testWebViewResourcesHistoryCache(SingleResourceLoadTest* test, gconstpointer) +{ + test->loadURI(kServer->getURIForPath("/").data()); + test->waitUntilResourceLoadFinished(); + g_assert(webkit_web_view_get_main_resource(test->m_webView)); + + test->loadURI(kServer->getURIForPath("/javascript.html").data()); + test->waitUntilResourceLoadFinished(); + g_assert(webkit_web_view_get_main_resource(test->m_webView)); + + test->goBack(); + test->waitUntilResourceLoadFinished(); + g_assert(webkit_web_view_get_main_resource(test->m_webView)); + + test->goForward(); + test->waitUntilResourceLoadFinished(); + g_assert(webkit_web_view_get_main_resource(test->m_webView)); +} + static void addCacheHTTPHeadersToResponse(SoupMessage* message) { // The actual date doesn't really matter. @@ -604,6 +623,7 @@ void beforeAll() ResourceURITrackingTest::add("WebKitWebResource", "active-uri", testWebResourceActiveURI); ResourcesTest::add("WebKitWebResource", "get-data", testWebResourceGetData); ResourcesTest::add("WebKitWebView", "replaced-content", testWebViewResourcesReplacedContent); + SingleResourceLoadTest::add("WebKitWebView", "history-cache", testWebViewResourcesHistoryCache); } void afterAll() diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp index 3e194a179..eec6fc786 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp @@ -865,6 +865,87 @@ static void testWebViewCanShowMIMEType(WebViewTest* test, gconstpointer) g_assert(!webkit_web_view_can_show_mime_type(test->m_webView, "application/octet-stream")); } +class FormClientTest: public WebViewTest { +public: + MAKE_GLIB_TEST_FIXTURE(FormClientTest); + + static void submitFormCallback(WebKitWebView*, WebKitFormSubmissionRequest* request, FormClientTest* test) + { + test->submitForm(request); + } + + FormClientTest() + : m_submitPositionX(0) + , m_submitPositionY(0) + { + g_signal_connect(m_webView, "submit-form", G_CALLBACK(submitFormCallback), this); + } + + ~FormClientTest() + { + g_signal_handlers_disconnect_matched(m_webView, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this); + } + + void submitForm(WebKitFormSubmissionRequest* request) + { + assertObjectIsDeletedWhenTestFinishes(G_OBJECT(request)); + m_request = request; + webkit_form_submission_request_submit(request); + quitMainLoop(); + } + + GHashTable* waitUntilFormSubmittedAndGetTextFields() + { + g_main_loop_run(m_mainLoop); + return webkit_form_submission_request_get_text_fields(m_request.get()); + } + + static gboolean doClickIdleCallback(FormClientTest* test) + { + test->clickMouseButton(test->m_submitPositionX, test->m_submitPositionY, 1); + return FALSE; + } + + void submitFormAtPosition(int x, int y) + { + m_submitPositionX = x; + m_submitPositionY = y; + g_idle_add(reinterpret_cast<GSourceFunc>(doClickIdleCallback), this); + } + + int m_submitPositionX; + int m_submitPositionY; + GRefPtr<WebKitFormSubmissionRequest> m_request; +}; + +static void testWebViewSubmitForm(FormClientTest* test, gconstpointer) +{ + test->showInWindowAndWaitUntilMapped(); + + const char* formHTML = + "<html><body>" + " <form action='#'>" + " <input type='text' name='text1' value='value1'>" + " <input type='text' name='text2' value='value2'>" + " <input type='password' name='password' value='secret'>" + " <textarea cols='5' rows='5' name='textarea'>Text</textarea>" + " <input type='hidden' name='hidden1' value='hidden1'>" + " <input type='submit' value='Submit' style='position:absolute; left:1; top:1' size='10'>" + " </form>" + "</body></html>"; + + test->loadHtml(formHTML, "file:///"); + test->waitUntilLoadFinished(); + + test->submitFormAtPosition(5, 5); + GHashTable* values = test->waitUntilFormSubmittedAndGetTextFields(); + g_assert(values); + g_assert_cmpuint(g_hash_table_size(values), ==, 3); + g_assert_cmpstr(static_cast<char*>(g_hash_table_lookup(values, "text1")), ==, "value1"); + g_assert_cmpstr(static_cast<char*>(g_hash_table_lookup(values, "text2")), ==, "value2"); + g_assert_cmpstr(static_cast<char*>(g_hash_table_lookup(values, "password")), ==, "secret"); +} + void beforeAll() { WebViewTest::add("WebKitWebView", "default-context", testWebViewDefaultContext); @@ -883,6 +964,7 @@ void beforeAll() FileChooserTest::add("WebKitWebView", "file-chooser-request", testWebViewFileChooserRequest); FullScreenClientTest::add("WebKitWebView", "fullscreen", testWebViewFullScreen); WebViewTest::add("WebKitWebView", "can-show-mime-type", testWebViewCanShowMIMEType); + FormClientTest::add("WebKitWebView", "submit-form", testWebViewSubmitForm); } void afterAll() diff --git a/Source/WebKit2/UIProcess/API/gtk/webkit2.h b/Source/WebKit2/UIProcess/API/gtk/webkit2.h index 58ac2b7e9..116dafc2d 100644 --- a/Source/WebKit2/UIProcess/API/gtk/webkit2.h +++ b/Source/WebKit2/UIProcess/API/gtk/webkit2.h @@ -36,6 +36,7 @@ #include <webkit2/WebKitError.h> #include <webkit2/WebKitFileChooserRequest.h> #include <webkit2/WebKitFindController.h> +#include <webkit2/WebKitFormSubmissionRequest.h> #include <webkit2/WebKitGeolocationPermissionRequest.h> #include <webkit2/WebKitHitTestResult.h> #include <webkit2/WebKitJavascriptResult.h> diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp index 25bf2e7df..1ba028f23 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp @@ -1660,6 +1660,12 @@ bool QQuickWebView::childMouseEventFilter(QQuickItem* item, QEvent* event) if (!isVisible() || !isEnabled() || !s_flickableViewportEnabled) return QQuickFlickable::childMouseEventFilter(item, event); + Q_D(QQuickWebView); + if (d->m_dialogActive) { + event->ignore(); + return false; + } + // This function is used by MultiPointTouchArea and PinchArea to filter // touch events, thus to hinder the canvas from sending synthesized // mouse events to the Flickable implementation we need to reimplement diff --git a/Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp b/Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp index 9a30e1fd6..e66f368c5 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp @@ -66,6 +66,10 @@ bool QWebPreferencesPrivate::testAttribute(QWebPreferencesPrivate::WebAttribute #if ENABLE(WEBGL) case WebGLEnabled: return WKPreferencesGetWebGLEnabled(preferencesRef()); +#if ENABLE(CSS_SHADERS) + case CSSCustomFilterEnabled: + return WKPreferencesGetCSSCustomFilterEnabled(preferencesRef()); +#endif #endif default: ASSERT_NOT_REACHED(); @@ -114,6 +118,11 @@ void QWebPreferencesPrivate::setAttribute(QWebPreferencesPrivate::WebAttribute a case WebGLEnabled: WKPreferencesSetWebGLEnabled(preferencesRef(), enable); break; +#if ENABLE(CSS_SHADERS) + case CSSCustomFilterEnabled: + WKPreferencesSetCSSCustomFilterEnabled(preferencesRef(), enable); + break; +#endif #endif default: ASSERT_NOT_REACHED(); diff --git a/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p_p.h b/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p_p.h index 7c1c9bd4f..004500c90 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p_p.h @@ -39,7 +39,8 @@ public: PrivateBrowsingEnabled, DnsPrefetchEnabled, DeveloperExtrasEnabled, - WebGLEnabled + WebGLEnabled, + CSSCustomFilterEnabled }; enum FontFamily { diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp index 16bb567ba..121f90d88 100644 --- a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp @@ -25,7 +25,9 @@ #include "LayerTreeCoordinatorProxy.h" #include "NativeWebKeyboardEvent.h" #include "NativeWebMouseEvent.h" +#if ENABLE(TOUCH_EVENTS) #include "NativeWebTouchEvent.h" +#endif #include "NativeWebWheelEvent.h" #include "NotImplemented.h" #include "WebContext.h" @@ -378,7 +380,9 @@ void QRawWebView::sendWheelEvent(QWheelEvent* event) d->m_webPageProxy->handleWheelEvent(WebKit::NativeWebWheelEvent(event, QTransform())); } +#if ENABLE(TOUCH_EVENTS) void QRawWebView::sendTouchEvent(QTouchEvent* event) { d->m_webPageProxy->handleTouchEvent(WebKit::NativeWebTouchEvent(event, QTransform())); } +#endif diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h index b8cba692d..a4bef5dd2 100644 --- a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h +++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h @@ -30,6 +30,7 @@ #include <WebKit2/WKContext.h> #include <WebKit2/WKPage.h> #include <WebKit2/WKPageGroup.h> +#include <wtf/Platform.h> class QRect; class QRectF; @@ -92,7 +93,9 @@ public: void sendKeyEvent(QKeyEvent*); void sendMouseEvent(QMouseEvent*, int clickCount = 0); void sendWheelEvent(QWheelEvent*); +#if ENABLE(TOUCH_EVENTS) void sendTouchEvent(QTouchEvent*); +#endif private: QRawWebViewPrivate* d; diff --git a/Source/WebKit2/UIProcess/InspectorServer/qt/WebInspectorServerQt.cpp b/Source/WebKit2/UIProcess/InspectorServer/qt/WebInspectorServerQt.cpp index 55eef25ac..8de0f932d 100644 --- a/Source/WebKit2/UIProcess/InspectorServer/qt/WebInspectorServerQt.cpp +++ b/Source/WebKit2/UIProcess/InspectorServer/qt/WebInspectorServerQt.cpp @@ -25,6 +25,7 @@ #include "WebInspectorProxy.h" #include "WebPageProxy.h" +#include <QFile> #include <WebCore/MIMETypeRegistry.h> #include <wtf/text/CString.h> #include <wtf/text/StringBuilder.h> diff --git a/Source/WebKit2/UIProcess/WebContext.cpp b/Source/WebKit2/UIProcess/WebContext.cpp index 381a25603..c9c0b94df 100644 --- a/Source/WebKit2/UIProcess/WebContext.cpp +++ b/Source/WebKit2/UIProcess/WebContext.cpp @@ -78,6 +78,10 @@ #include "WebSoupRequestManagerProxy.h" #endif +#if ENABLE(VIBRATION) +#include "WebVibrationProxy.h" +#endif + #ifndef NDEBUG #include <wtf/RefCountedLeakCounter.h> #endif @@ -156,6 +160,9 @@ WebContext::WebContext(ProcessModel processModel, const String& injectedBundlePa #if USE(SOUP) , m_soupRequestManagerProxy(WebSoupRequestManagerProxy::create(this)) #endif +#if ENABLE(VIBRATION) + , m_vibrationProxy(WebVibrationProxy::create(this)) +#endif #if PLATFORM(WIN) , m_shouldPaintNativeControls(true) , m_initialHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicyAlways) @@ -237,6 +244,11 @@ WebContext::~WebContext() m_soupRequestManagerProxy->clearContext(); #endif +#if ENABLE(VIBRATION) + m_vibrationProxy->invalidate(); + m_vibrationProxy->clearContext(); +#endif + invalidateCallbackMap(m_dictionaryCallbacks); platformInvalidateContext(); @@ -438,6 +450,9 @@ void WebContext::disconnectProcess(WebProcessProxy* process) #if USE(SOUP) m_soupRequestManagerProxy->invalidate(); #endif +#if ENABLE(VIBRATION) + m_vibrationProxy->invalidate(); +#endif // When out of process plug-ins are enabled, we don't want to invalidate the plug-in site data // manager just because the web process crashes since it's not involved. @@ -822,6 +837,13 @@ void WebContext::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Mes } #endif +#if ENABLE(VIBRATION) + if (messageID.is<CoreIPC::MessageClassWebVibrationProxy>()) { + m_vibrationProxy->didReceiveMessage(connection, messageID, arguments); + return; + } +#endif + switch (messageID.get<WebContextLegacyMessage::Kind>()) { case WebContextLegacyMessage::PostMessage: { String messageName; diff --git a/Source/WebKit2/UIProcess/WebContext.h b/Source/WebKit2/UIProcess/WebContext.h index f01561031..c748f22f2 100644 --- a/Source/WebKit2/UIProcess/WebContext.h +++ b/Source/WebKit2/UIProcess/WebContext.h @@ -67,6 +67,9 @@ class WebResourceCacheManagerProxy; #if USE(SOUP) class WebSoupRequestManagerProxy; #endif +#if ENABLE(VIBRATION) +class WebVibrationProxy; +#endif struct StatisticsData; struct WebProcessCreationParameters; @@ -178,6 +181,9 @@ public: #if USE(SOUP) WebSoupRequestManagerProxy* soupRequestManagerProxy() const { return m_soupRequestManagerProxy.get(); } #endif +#if ENABLE(VIBRATION) + WebVibrationProxy* vibrationProxy() const { return m_vibrationProxy.get(); } +#endif struct Statistics { unsigned wkViewCount; @@ -329,6 +335,9 @@ private: #if USE(SOUP) RefPtr<WebSoupRequestManagerProxy> m_soupRequestManagerProxy; #endif +#if ENABLE(VIBRATION) + RefPtr<WebVibrationProxy> m_vibrationProxy; +#endif #if PLATFORM(WIN) bool m_shouldPaintNativeControls; diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h index 29a6c65c5..e70036645 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.h +++ b/Source/WebKit2/UIProcess/WebPageProxy.h @@ -719,7 +719,11 @@ private: virtual void setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index); #if PLATFORM(GTK) virtual void failedToShowPopupMenu(); -#endif +#endif +#if PLATFORM(QT) + virtual void changeSelectedIndex(int32_t newSelectedIndex); + virtual void closePopupMenu(); +#endif // Implemented in generated WebPageProxyMessageReceiver.cpp void didReceiveWebPageProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); diff --git a/Source/WebKit2/UIProcess/WebPopupMenuProxy.h b/Source/WebKit2/UIProcess/WebPopupMenuProxy.h index 3cefc0d67..d5bfa4c5c 100644 --- a/Source/WebKit2/UIProcess/WebPopupMenuProxy.h +++ b/Source/WebKit2/UIProcess/WebPopupMenuProxy.h @@ -55,7 +55,11 @@ public: virtual NativeWebMouseEvent* currentlyProcessedMouseDownEvent() = 0; #if PLATFORM(GTK) virtual void failedToShowPopupMenu() = 0; -#endif +#endif +#if PLATFORM(QT) + virtual void changeSelectedIndex(int32_t newSelectedIndex) = 0; + virtual void closePopupMenu() = 0; +#endif }; virtual ~WebPopupMenuProxy() diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.cpp b/Source/WebKit2/UIProcess/WebProcessProxy.cpp index 54e0ec39b..e3cdc8809 100644 --- a/Source/WebKit2/UIProcess/WebProcessProxy.cpp +++ b/Source/WebKit2/UIProcess/WebProcessProxy.cpp @@ -328,6 +328,9 @@ void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC #if USE(SOUP) || messageID.is<CoreIPC::MessageClassWebSoupRequestManagerProxy>() #endif +#if ENABLE(VIBRATION) + || messageID.is<CoreIPC::MessageClassWebVibrationProxy>() +#endif || messageID.is<CoreIPC::MessageClassWebResourceCacheManagerProxy>()) { m_context->didReceiveMessage(connection, messageID, arguments); return; diff --git a/Source/WebKit2/UIProcess/efl/WebInspectorEfl.cpp b/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp index a2683ba2e..b2b68bccc 100644 --- a/Source/WebKit2/UIProcess/efl/WebInspectorEfl.cpp +++ b/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Samsung Electronics + * Copyright (C) 2012 Samsung Electronics * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp index 2236d37ee..ea595951b 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp @@ -246,12 +246,14 @@ void QtWebPageEventHandler::activateTapHighlight(const QTouchEvent::TouchPoint& void QtWebPageEventHandler::deactivateTapHighlight() { +#if ENABLE(TOUCH_EVENTS) if (!m_isTapHighlightActive) return; // An empty point deactivates the highlighting. m_webPageProxy->handlePotentialActivation(IntPoint(), IntSize()); m_isTapHighlightActive = false; +#endif } void QtWebPageEventHandler::handleSingleTapEvent(const QTouchEvent::TouchPoint& point) diff --git a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp index 5cafad59c..fa2c74f1f 100644 --- a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp @@ -119,4 +119,14 @@ void WebPageProxy::windowedPluginGeometryDidChange(const WebCore::IntRect& frame } #endif +void WebPageProxy::changeSelectedIndex(int32_t selectedIndex) +{ + process()->send(Messages::WebPage::SelectedIndex(selectedIndex), m_pageID); +} + +void WebPageProxy::closePopupMenu() +{ + process()->send(Messages::WebPage::HidePopupMenu(), m_pageID); +} + } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp index 2f92098ca..7512892bb 100644 --- a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp @@ -52,23 +52,28 @@ public: IsSeparatorRole = Qt::UserRole + 3 }; - PopupMenuItemModel(const Vector<WebPopupItem>&, int selectedOriginalIndex); + PopupMenuItemModel(const Vector<WebPopupItem>&, bool multiple); virtual int rowCount(const QModelIndex& parent = QModelIndex()) const { return m_items.size(); } virtual QVariant data(const QModelIndex&, int role = Qt::DisplayRole) const; Q_INVOKABLE void select(int); int selectedOriginalIndex() const; + bool multiple() const { return m_allowMultiples; } + void toggleItem(int); + +Q_SIGNALS: + void indexUpdated(); private: struct Item { - Item(const WebPopupItem& webPopupItem, const QString& group, int originalIndex, bool selected) + Item(const WebPopupItem& webPopupItem, const QString& group, int originalIndex) : text(webPopupItem.m_text) , toolTip(webPopupItem.m_toolTip) , group(group) , originalIndex(originalIndex) , enabled(webPopupItem.m_isEnabled) - , selected(selected) + , selected(webPopupItem.m_isSelected) , isSeparator(webPopupItem.m_type == WebPopupItem::Separator) { } @@ -82,47 +87,68 @@ private: bool isSeparator; }; - void buildItems(const Vector<WebPopupItem>& webPopupItems, int selectedOriginalIndex); + void buildItems(const Vector<WebPopupItem>& webPopupItems); Vector<Item> m_items; int m_selectedModelIndex; + bool m_allowMultiples; }; class ItemSelectorContextObject : public QObject { Q_OBJECT - Q_PROPERTY(QRect elementRect READ elementRect CONSTANT FINAL) + Q_PROPERTY(QRectF elementRect READ elementRect CONSTANT FINAL) Q_PROPERTY(QObject* items READ items CONSTANT FINAL) + Q_PROPERTY(bool allowMultiSelect READ allowMultiSelect CONSTANT FINAL) public: - ItemSelectorContextObject(const IntRect& elementRect, const Vector<WebPopupItem>&, int selectedIndex); + ItemSelectorContextObject(const QRectF& elementRect, const Vector<WebPopupItem>&, bool multiple); - QRect elementRect() const { return m_elementRect; } + QRectF elementRect() const { return m_elementRect; } PopupMenuItemModel* items() { return &m_items; } + bool allowMultiSelect() { return m_items.multiple(); } Q_INVOKABLE void accept(int index = -1); - Q_INVOKABLE void reject() { emit rejected(); } + Q_INVOKABLE void reject() { emit done(); } + Q_INVOKABLE void dismiss() { emit done(); } Q_SIGNALS: void acceptedWithOriginalIndex(int); - void rejected(); + void done(); + +private Q_SLOTS: + void onIndexUpdate(); private: - QRect m_elementRect; + QRectF m_elementRect; PopupMenuItemModel m_items; }; -ItemSelectorContextObject::ItemSelectorContextObject(const IntRect& elementRect, const Vector<WebPopupItem>& webPopupItems, int selectedIndex) +ItemSelectorContextObject::ItemSelectorContextObject(const QRectF& elementRect, const Vector<WebPopupItem>& webPopupItems, bool multiple) : m_elementRect(elementRect) - , m_items(webPopupItems, selectedIndex) + , m_items(webPopupItems, multiple) { + connect(&m_items, SIGNAL(indexUpdated()), SLOT(onIndexUpdate())); } +void ItemSelectorContextObject::onIndexUpdate() +{ + // Send the update for multi-select list. + if (m_items.multiple()) + emit acceptedWithOriginalIndex(m_items.selectedOriginalIndex()); +} + + void ItemSelectorContextObject::accept(int index) { - if (index != -1) - m_items.select(index); - int originalIndex = m_items.selectedOriginalIndex(); - emit acceptedWithOriginalIndex(originalIndex); + // If the index is not valid for multi-select lists, just hide the pop up as the selected indices have + // already been sent. + if ((index == -1) && m_items.multiple()) + emit done(); + else { + if (index != -1) + m_items.toggleItem(index); + emit acceptedWithOriginalIndex(m_items.selectedOriginalIndex()); + } } static QHash<int, QByteArray> createRoleNamesHash() @@ -137,12 +163,13 @@ static QHash<int, QByteArray> createRoleNamesHash() return roles; } -PopupMenuItemModel::PopupMenuItemModel(const Vector<WebPopupItem>& webPopupItems, int selectedOriginalIndex) +PopupMenuItemModel::PopupMenuItemModel(const Vector<WebPopupItem>& webPopupItems, bool multiple) : m_selectedModelIndex(-1) + , m_allowMultiples(multiple) { static QHash<int, QByteArray> roles = createRoleNamesHash(); setRoleNames(roles); - buildItems(webPopupItems, selectedOriginalIndex); + buildItems(webPopupItems); } QVariant PopupMenuItemModel::data(const QModelIndex& index, int role) const @@ -177,22 +204,31 @@ QVariant PopupMenuItemModel::data(const QModelIndex& index, int role) const void PopupMenuItemModel::select(int index) { + toggleItem(index); + emit indexUpdated(); +} + +void PopupMenuItemModel::toggleItem(int index) +{ int oldIndex = m_selectedModelIndex; - if (index == oldIndex) - return; if (index < 0 || index >= m_items.size()) return; Item& item = m_items[index]; if (!item.enabled) return; - item.selected = true; m_selectedModelIndex = index; - - if (oldIndex != -1) { - Item& oldItem = m_items[oldIndex]; - oldItem.selected = false; - emit dataChanged(this->index(oldIndex), this->index(oldIndex)); + if (m_allowMultiples) + item.selected = !item.selected; + else { + if (index == oldIndex) + return; + item.selected = true; + if (oldIndex != -1) { + Item& oldItem = m_items[oldIndex]; + oldItem.selected = false; + emit dataChanged(this->index(oldIndex), this->index(oldIndex)); + } } emit dataChanged(this->index(index), this->index(index)); @@ -205,7 +241,7 @@ int PopupMenuItemModel::selectedOriginalIndex() const return m_items[m_selectedModelIndex].originalIndex; } -void PopupMenuItemModel::buildItems(const Vector<WebPopupItem>& webPopupItems, int selectedOriginalIndex) +void PopupMenuItemModel::buildItems(const Vector<WebPopupItem>& webPopupItems) { QString currentGroup; m_items.reserveInitialCapacity(webPopupItems.size()); @@ -215,10 +251,9 @@ void PopupMenuItemModel::buildItems(const Vector<WebPopupItem>& webPopupItems, i currentGroup = webPopupItem.m_text; continue; } - const bool selected = i == selectedOriginalIndex; - if (selected) + if (webPopupItem.m_isSelected && !m_allowMultiples) m_selectedModelIndex = m_items.size(); - m_items.append(Item(webPopupItem, currentGroup, i, selected)); + m_items.append(Item(webPopupItem, currentGroup, i)); } } @@ -232,14 +267,15 @@ WebPopupMenuProxyQt::~WebPopupMenuProxyQt() { } -void WebPopupMenuProxyQt::showPopupMenu(const IntRect& rect, WebCore::TextDirection, double, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex) +void WebPopupMenuProxyQt::showPopupMenu(const IntRect& rect, WebCore::TextDirection, double, const Vector<WebPopupItem>& items, const PlatformPopupMenuData& data, int32_t) { - m_selectedIndex = selectedIndex; + m_selectionType = (data.multipleSelections) ? WebPopupMenuProxyQt::MultipleSelection : WebPopupMenuProxyQt::SingleSelection; - ItemSelectorContextObject* contextObject = new ItemSelectorContextObject(rect, items, m_selectedIndex); + const QRectF mappedRect= m_webView->mapRectFromWebContent(QRect(rect)); + ItemSelectorContextObject* contextObject = new ItemSelectorContextObject(mappedRect, items, (m_selectionType == WebPopupMenuProxyQt::MultipleSelection)); createItem(contextObject); if (!m_itemSelector) { - notifyValueChanged(); + hidePopupMenu(); return; } QQuickWebViewPrivate::get(m_webView)->setDialogActive(true); @@ -250,12 +286,16 @@ void WebPopupMenuProxyQt::hidePopupMenu() m_itemSelector.clear(); QQuickWebViewPrivate::get(m_webView)->setDialogActive(false); m_context.clear(); - notifyValueChanged(); + + if (m_client) { + m_client->closePopupMenu(); + invalidate(); + } } void WebPopupMenuProxyQt::selectIndex(int index) { - m_selectedIndex = index; + m_client->changeSelectedIndex(index); } void WebPopupMenuProxyQt::createItem(QObject* contextObject) @@ -268,23 +308,19 @@ void WebPopupMenuProxyQt::createItem(QObject* contextObject) createContext(component, contextObject); QObject* object = component->beginCreate(m_context.get()); - if (!object) { - m_context.clear(); + if (!object) return; - } m_itemSelector = adoptPtr(qobject_cast<QQuickItem*>(object)); - if (!m_itemSelector) { - m_context.clear(); - m_itemSelector.clear(); + if (!m_itemSelector) return; - } connect(contextObject, SIGNAL(acceptedWithOriginalIndex(int)), SLOT(selectIndex(int))); // We enqueue these because they are triggered by m_itemSelector and will lead to its destruction. - connect(contextObject, SIGNAL(acceptedWithOriginalIndex(int)), SLOT(hidePopupMenu()), Qt::QueuedConnection); - connect(contextObject, SIGNAL(rejected()), SLOT(hidePopupMenu()), Qt::QueuedConnection); + connect(contextObject, SIGNAL(done()), SLOT(hidePopupMenu()), Qt::QueuedConnection); + if (m_selectionType == WebPopupMenuProxyQt::SingleSelection) + connect(contextObject, SIGNAL(acceptedWithOriginalIndex(int)), SLOT(hidePopupMenu()), Qt::QueuedConnection); QQuickWebViewPrivate::get(m_webView)->addAttachedPropertyTo(m_itemSelector.get()); m_itemSelector->setParentItem(m_webView); @@ -307,14 +343,6 @@ void WebPopupMenuProxyQt::createContext(QQmlComponent* component, QObject* conte m_context->setContextObject(contextObject); } -void WebPopupMenuProxyQt::notifyValueChanged() -{ - if (m_client) { - m_client->valueChangedForPopupMenu(this, m_selectedIndex); - invalidate(); - } -} - } // namespace WebKit // Since we define QObjects in WebPopupMenuProxyQt.cpp, this will trigger moc to run on .cpp. diff --git a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h index 21eec5d1d..3eb544d61 100644 --- a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h +++ b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h @@ -42,6 +42,11 @@ class WebPopupMenuProxyQt : public QObject, public WebPopupMenuProxy { Q_OBJECT public: + enum SelectionType { + SingleSelection, + MultipleSelection + }; + static PassRefPtr<WebPopupMenuProxyQt> create(WebPopupMenuProxy::Client* client, QQuickWebView* webView) { return adoptRef(new WebPopupMenuProxyQt(client, webView)); @@ -61,13 +66,11 @@ private: void createItem(QObject*); void createContext(QQmlComponent*, QObject*); - void notifyValueChanged(); - OwnPtr<QQmlContext> m_context; OwnPtr<QQuickItem> m_itemSelector; QQuickWebView* m_webView; - int32_t m_selectedIndex; + SelectionType m_selectionType; }; } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Downloads/Download.h b/Source/WebKit2/WebProcess/Downloads/Download.h index 2688b72d1..d751087a1 100644 --- a/Source/WebKit2/WebProcess/Downloads/Download.h +++ b/Source/WebKit2/WebProcess/Downloads/Download.h @@ -38,7 +38,7 @@ OBJC_CLASS NSURLDownload; OBJC_CLASS WKDownloadAsDelegate; #endif -#if PLATFORM(GTK) +#if PLATFORM(GTK) || PLATFORM(EFL) #include <WebCore/ResourceHandle.h> #include <WebCore/ResourceHandleClient.h> #endif @@ -47,10 +47,6 @@ OBJC_CLASS WKDownloadAsDelegate; #include <CFNetwork/CFURLDownloadPriv.h> #endif -#if PLATFORM(EFL) -#include <FileDownloaderEfl.h> -#endif - namespace CoreIPC { class DataReference; } @@ -73,10 +69,6 @@ class WebPage; class QtFileDownloader; #endif -#if PLATFORM(EFL) -class FileDownloaderEfl; -#endif - class Download : public CoreIPC::MessageSender<Download> { WTF_MAKE_NONCOPYABLE(Download); public: @@ -150,13 +142,10 @@ private: #if PLATFORM(QT) QtFileDownloader* m_qtDownloader; #endif -#if PLATFORM(GTK) +#if PLATFORM(GTK) || PLATFORM(EFL) OwnPtr<WebCore::ResourceHandleClient> m_downloadClient; RefPtr<WebCore::ResourceHandle> m_resourceHandle; #endif -#if PLATFORM(EFL) - OwnPtr<FileDownloaderEfl> m_fileDownloader; -#endif }; } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Downloads/efl/DownloadEfl.cpp b/Source/WebKit2/WebProcess/Downloads/efl/DownloadEfl.cpp deleted file mode 100755 index 9828c2b0c..000000000 --- a/Source/WebKit2/WebProcess/Downloads/efl/DownloadEfl.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2012 Samsung Electronics - * - * 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; if not, write to the - * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" -#include "Download.h" - -#include "FileDownloaderEfl.h" -#include <WebCore/NotImplemented.h> - -using namespace WebCore; - -namespace WebKit { - -void Download::start(WebPage* initiatingWebPage) -{ - m_fileDownloader = FileDownloaderEfl::create(this); - m_fileDownloader->start(initiatingWebPage, m_request); -} - -void Download::startWithHandle(WebPage* initiatingPage, ResourceHandle* handle, const ResourceResponse& response) -{ - notImplemented(); -} - -void Download::cancel() -{ - notImplemented(); -} - -void Download::platformInvalidate() -{ - notImplemented(); -} - -void Download::didDecideDestination(const String& destination, bool allowOverwrite) -{ - notImplemented(); -} - -void Download::platformDidFinish() -{ - notImplemented(); -} - -void Download::receivedCredential(const AuthenticationChallenge& authenticationChallenge, const Credential& credential) -{ - notImplemented(); -} - -void Download::receivedRequestToContinueWithoutCredential(const AuthenticationChallenge& authenticationChallenge) -{ - notImplemented(); -} - -void Download::receivedCancellation(const AuthenticationChallenge& authenticationChallenge) -{ - notImplemented(); -} - -void Download::useCredential(const WebCore::AuthenticationChallenge& authenticationChallenge, const WebCore::Credential& credential) -{ - notImplemented(); -} - -void Download::continueWithoutCredential(const WebCore::AuthenticationChallenge& authenticationChallenge) -{ - notImplemented(); -} - -void Download::cancelAuthenticationChallenge(const WebCore::AuthenticationChallenge& authenticationChallenge) -{ - notImplemented(); -} - -} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Downloads/efl/DownloadSoupErrorsEfl.cpp b/Source/WebKit2/WebProcess/Downloads/efl/DownloadSoupErrorsEfl.cpp new file mode 100644 index 000000000..d1ba587f3 --- /dev/null +++ b/Source/WebKit2/WebProcess/Downloads/efl/DownloadSoupErrorsEfl.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "DownloadSoupErrors.h" + +#include <WebCore/ErrorsEfl.h> + +using namespace WebCore; + +namespace WebKit { + +ResourceError platformDownloadNetworkError(int errorCode, const String& failingURL, const String& localizedDescription) +{ + return downloadNetworkError(ResourceError(errorDomainDownload, errorCode, failingURL, localizedDescription)); +} + +ResourceError platformDownloadDestinationError(const ResourceResponse& response, const String& message) +{ + return downloadDestinationError(response, message); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.cpp b/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.cpp deleted file mode 100644 index 8f17840e1..000000000 --- a/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2012 Samsung Electronics - * - * 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; if not, write to the - * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" -#include "FileDownloaderEfl.h" - -#include <WebCore/NotImplemented.h> - -using namespace WebCore; - -namespace WebKit { - -PassOwnPtr<FileDownloaderEfl> FileDownloaderEfl::create(Download* download) -{ - return adoptPtr(new FileDownloaderEfl(download)); -} - -FileDownloaderEfl::FileDownloaderEfl(Download* download) - : m_download(download) -{ - ASSERT(download); -} - -FileDownloaderEfl::~FileDownloaderEfl() -{ -} - -void FileDownloaderEfl::start(WebPage*, ResourceRequest&) -{ - notImplemented(); -} - -void FileDownloaderEfl::didReceiveResponse(ResourceHandle*, const ResourceResponse&) -{ - notImplemented(); -} - -void FileDownloaderEfl::didReceiveData(ResourceHandle*, const char*, int, int) -{ - notImplemented(); -} - -void FileDownloaderEfl::didFinishLoading(ResourceHandle*, double) -{ - notImplemented(); -} - -void FileDownloaderEfl::didFail(ResourceHandle*, const ResourceError&) -{ - notImplemented(); -} - -bool FileDownloaderEfl::shouldUseCredentialStorage(ResourceHandle*) -{ - return false; -} - -void FileDownloaderEfl::didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) -{ - notImplemented(); -} - -void FileDownloaderEfl::didCancelAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) -{ - notImplemented(); -} - -void FileDownloaderEfl::receivedCancellation(ResourceHandle*, const AuthenticationChallenge&) -{ - notImplemented(); -} - -} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.h b/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.h deleted file mode 100644 index d8f998be9..000000000 --- a/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2012 Samsung Electronics - * - * 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; if not, write to the - * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef FileDownloaderEfl_h -#define FileDownloaderEfl_h - -#include <WebCore/ResourceError.h> -#include <WebCore/ResourceHandle.h> -#include <WebCore/ResourceHandleClient.h> -#include <WebCore/ResourceRequest.h> -#include <WebCore/ResourceResponse.h> -#include <wtf/PassOwnPtr.h> - -namespace WebCore { -class AuthenticationChallenge; -class ResourceError; -class ResourceHandle; -class ResourceHandleClient; -class ResourceRequest; -class ResourceResponse; -} - -namespace WebKit { - -class Download; -class WebPage; - -class FileDownloaderEfl : public WebCore::ResourceHandleClient { -public: - static PassOwnPtr<FileDownloaderEfl> create(Download*); - virtual ~FileDownloaderEfl(); - - void start(WebPage*, WebCore::ResourceRequest&); - - // callbacks for ResourceHandleClient, which are called by ResourceHandle - virtual void didReceiveResponse(WebCore::ResourceHandle*, const WebCore::ResourceResponse&) OVERRIDE; - virtual void didReceiveData(WebCore::ResourceHandle*, const char* data, int length, int encodedDataLength) OVERRIDE; - virtual void didFinishLoading(WebCore::ResourceHandle*, double finishTime) OVERRIDE; - virtual void didFail(WebCore::ResourceHandle*, const WebCore::ResourceError&) OVERRIDE; - virtual bool shouldUseCredentialStorage(WebCore::ResourceHandle*) OVERRIDE; - virtual void didReceiveAuthenticationChallenge(WebCore::ResourceHandle*, const WebCore::AuthenticationChallenge&) OVERRIDE; - virtual void didCancelAuthenticationChallenge(WebCore::ResourceHandle*, const WebCore::AuthenticationChallenge&) OVERRIDE; - virtual void receivedCancellation(WebCore::ResourceHandle*, const WebCore::AuthenticationChallenge&) OVERRIDE; - -private: - FileDownloaderEfl(Download*); - - Download* m_download; -}; - -} // namespace WebKit - -#endif // FileDownloaderEfl_h diff --git a/Source/WebKit2/WebProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp b/Source/WebKit2/WebProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp new file mode 100644 index 000000000..0d23e6e64 --- /dev/null +++ b/Source/WebKit2/WebProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "DownloadSoupErrors.h" + +#include <WebCore/ErrorsGtk.h> + +using namespace WebCore; + +namespace WebKit { + +ResourceError platformDownloadNetworkError(int errorCode, const String& failingURL, const String& localizedDescription) +{ + return downloadNetworkError(ResourceError(errorDomainDownload, errorCode, failingURL, localizedDescription)); +} + +ResourceError platformDownloadDestinationError(const ResourceResponse& response, const String& message) +{ + return downloadDestinationError(response, message); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp b/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp index 5c96eba48..bb295e09b 100644 --- a/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp +++ b/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp @@ -28,15 +28,18 @@ #include "Download.h" #include "DataReference.h" -#include <WebCore/ErrorsGtk.h> +#include "DownloadSoupErrors.h" #include <WebCore/NotImplemented.h> #include <WebCore/ResourceHandleInternal.h> #include <gio/gio.h> -#include <glib/gi18n-lib.h> #include <wtf/gobject/GOwnPtr.h> #include <wtf/gobject/GRefPtr.h> #include <wtf/text/CString.h> +#if PLATFORM(GTK) +#include <glib/gi18n-lib.h> +#endif + using namespace WebCore; namespace WebKit { @@ -60,8 +63,7 @@ public: m_download->didReceiveResponse(response); if (response.httpStatusCode() >= 400) { - downloadFailed(downloadNetworkError(ResourceError(errorDomainDownload, response.httpStatusCode(), - response.url().string(), response.httpStatusText()))); + downloadFailed(platformDownloadNetworkError(response.httpStatusCode(), response.url().string(), response.httpStatusText())); return; } @@ -76,9 +78,13 @@ public: bool overwrite; String destinationURI = m_download->decideDestinationWithSuggestedFilename(suggestedFilename.utf8().data(), overwrite); if (destinationURI.isEmpty()) { - GOwnPtr<char> errorMessage(g_strdup_printf(_("Cannot determine destination URI for download with suggested filename %s"), - suggestedFilename.utf8().data())); - downloadFailed(downloadDestinationError(response, errorMessage.get())); +#if PLATFORM(GTK) + GOwnPtr<char> buffer(g_strdup_printf(_("Cannot determine destination URI for download with suggested filename %s"), suggestedFilename.utf8().data())); + String errorMessage = String::fromUTF8(buffer.get()); +#else + String errorMessage = makeString("Cannot determine destination URI for download with suggested filename ", suggestedFilename); +#endif + downloadFailed(platformDownloadDestinationError(response, errorMessage)); return; } @@ -86,7 +92,7 @@ public: GOwnPtr<GError> error; m_outputStream = adoptGRef(g_file_replace(file.get(), 0, TRUE, G_FILE_CREATE_NONE, 0, &error.outPtr())); if (!m_outputStream) { - downloadFailed(downloadDestinationError(response, error->message)); + downloadFailed(platformDownloadDestinationError(response, error->message)); return; } @@ -99,7 +105,7 @@ public: GOwnPtr<GError> error; g_output_stream_write_all(G_OUTPUT_STREAM(m_outputStream.get()), data, length, &bytesWritten, 0, &error.outPtr()); if (error) { - downloadFailed(downloadDestinationError(ResourceResponse(m_response.get()), error->message)); + downloadFailed(platformDownloadDestinationError(ResourceResponse(m_response.get()), error->message)); return; } m_download->didReceiveData(bytesWritten); @@ -113,7 +119,7 @@ public: void didFail(ResourceHandle*, const ResourceError& error) { - downloadFailed(downloadNetworkError(error)); + downloadFailed(platformDownloadNetworkError(error.errorCode(), error.failingURL(), error.localizedDescription())); } void wasBlocked(ResourceHandle*) @@ -198,4 +204,19 @@ void Download::receivedCancellation(const AuthenticationChallenge& authenticatio notImplemented(); } +void Download::continueWithoutCredential(const AuthenticationChallenge &) +{ + notImplemented(); +} + +void Download::useCredential(const AuthenticationChallenge&, const Credential&) +{ + notImplemented(); +} + +void Download::cancelAuthenticationChallenge(const AuthenticationChallenge&) +{ + notImplemented(); +} + } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoupErrors.h b/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoupErrors.h new file mode 100644 index 000000000..89e23e083 --- /dev/null +++ b/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoupErrors.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef DownloadSoupErrors_h +#define DownloadSoupErrors_h + +#include <WebCore/ResourceHandle.h> +#include <wtf/text/WTFString.h> + +namespace WebKit { + +WebCore::ResourceError platformDownloadNetworkError(int errorCode, const String& failingURL, const String& localizedDescription); +WebCore::ResourceError platformDownloadDestinationError(const WebCore::ResourceResponse&, const String& message); + +} // namespace WebKit + +#endif // DownloadSoupErrors_h diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp index 940cb95d8..4c309dcaf 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp @@ -59,9 +59,14 @@ void WebPopupMenu::didChangeSelectedIndex(int newIndex) if (!m_popupClient) return; +#if PLATFORM(QT) + if (newIndex >= 0) + m_popupClient->listBoxSelectItem(newIndex, m_popupClient->multiple(), false); +#else m_popupClient->popupDidHide(); if (newIndex >= 0) m_popupClient->valueChanged(newIndex); +#endif } void WebPopupMenu::setTextForIndex(int index) @@ -87,7 +92,7 @@ Vector<WebPopupItem> WebPopupMenu::populateItems() // FIXME: Add support for styling the foreground and background colors. // FIXME: Find a way to customize text color when an item is highlighted. PopupMenuStyle itemStyle = m_popupClient->itemStyle(i); - items.append(WebPopupItem(WebPopupItem::Item, m_popupClient->itemText(i), itemStyle.textDirection(), itemStyle.hasTextDirectionOverride(), m_popupClient->itemToolTip(i), m_popupClient->itemAccessibilityText(i), m_popupClient->itemIsEnabled(i), m_popupClient->itemIsLabel(i))); + items.append(WebPopupItem(WebPopupItem::Item, m_popupClient->itemText(i), itemStyle.textDirection(), itemStyle.hasTextDirectionOverride(), m_popupClient->itemToolTip(i), m_popupClient->itemAccessibilityText(i), m_popupClient->itemIsEnabled(i), m_popupClient->itemIsLabel(i), m_popupClient->itemIsSelected(i))); } } diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h index 8e6625018..6319b9d55 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h @@ -48,7 +48,7 @@ public: void disconnectFromPage() { m_page = 0; } void didChangeSelectedIndex(int newIndex); void setTextForIndex(int newIndex); -#if PLATFORM(GTK) +#if PLATFORM(GTK) || PLATFORM(QT) WebCore::PopupMenuClient* client() const { return m_popupClient; } #endif diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebVibrationClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebVibrationClient.cpp index f635df45f..8a891753b 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebVibrationClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebVibrationClient.cpp @@ -36,7 +36,7 @@ using namespace WebCore; namespace WebKit { -void WebVibrationClient::vibrate(const uint64_t& vibrationTime) +void WebVibrationClient::vibrate(const unsigned long& vibrationTime) { WebProcess::shared().connection()->send(Messages::WebVibrationProxy::Vibrate(vibrationTime), m_page->pageID()); } diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebVibrationClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebVibrationClient.h index e71db2895..a06b4f9e1 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebVibrationClient.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebVibrationClient.h @@ -44,7 +44,7 @@ public: virtual ~WebVibrationClient() { } private: - virtual void vibrate(const uint64_t& vibrationTime) OVERRIDE; + virtual void vibrate(const unsigned long& vibrationTime) OVERRIDE; virtual void cancelVibration() OVERRIDE; virtual void vibrationDestroyed() OVERRIDE; diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebErrorsEfl.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebErrorsEfl.cpp index dda93722a..9d8dfda0d 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebErrorsEfl.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebErrorsEfl.cpp @@ -26,8 +26,7 @@ #include "config.h" #include "WebErrors.h" -#include "WKError.h" -#include "WebError.h" +#include <WebCore/ErrorsEfl.h> #include <WebCore/ResourceError.h> #include <WebCore/ResourceRequest.h> #include <WebCore/ResourceResponse.h> @@ -36,47 +35,39 @@ using namespace WebCore; namespace WebKit { -// FIXME: Export following error codes so that application can understand. -// We should establish Efl port's error system because application cannot understand those local define. -// See https://bugs.webkit.org/show_bug.cgi?id=90783 for detail. -enum { - kWKErrorCodeCancelled = 300, - kWKErrorCodeFileDoesNotExist = 301, -}; - ResourceError cancelledError(const ResourceRequest& request) { - return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeCancelled, request.url().string(), "Request cancelled"); + return WebCore::cancelledError(request); } ResourceError blockedError(const ResourceRequest& request) { - return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeCannotUseRestrictedPort, request.url().string(), "Request blocked"); + return WebCore::blockedError(request); } ResourceError cannotShowURLError(const ResourceRequest& request) { - return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeCannotShowURL, request.url().string(), "Cannot show URL"); + return WebCore::cannotShowURLError(request); } ResourceError interruptedForPolicyChangeError(const ResourceRequest& request) { - return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeFrameLoadInterruptedByPolicyChange, request.url().string(), "Frame load interrupted by policy change"); + return WebCore::interruptedForPolicyChangeError(request); } ResourceError cannotShowMIMETypeError(const ResourceResponse& response) { - return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeCannotShowMIMEType, response.url().string(), "Cannot show mimetype"); + return WebCore::cannotShowMIMETypeError(response); } ResourceError fileDoesNotExistError(const ResourceResponse& response) { - return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeFileDoesNotExist, response.url().string(), "File does not exist"); + return WebCore::fileDoesNotExistError(response); } ResourceError pluginWillHandleLoadError(const ResourceResponse& response) { - return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodePlugInWillHandleLoad, response.url().string(), "Plugin will handle load"); + return WebCore::pluginWillHandleLoadError(response); } } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp index b21f06ccf..f0a8f7763 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp @@ -27,13 +27,15 @@ #include "WebPopupMenu.h" #include "PlatformPopupMenuData.h" +#include <WebCore/PopupMenuClient.h> using namespace WebCore; namespace WebKit { -void WebPopupMenu::setUpPlatformData(const IntRect&, PlatformPopupMenuData&) +void WebPopupMenu::setUpPlatformData(const IntRect&, PlatformPopupMenuData& data) { + data.multipleSelections = m_popupClient->multiple(); } } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp index 77987f26c..9571ffbaa 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp @@ -138,6 +138,10 @@ #include "IntentData.h" #endif +#if ENABLE(VIBRATION) +#include "WebVibrationClient.h" +#endif + #if PLATFORM(MAC) #include "BuiltInPDFView.h" #endif @@ -288,6 +292,9 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters) #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) WebCore::provideNotification(m_page.get(), new WebNotificationClient(this)); #endif +#if ENABLE(VIBRATION) + WebCore::provideVibrationTo(m_page.get(), new WebVibrationClient(this)); +#endif // Qt does not yet call setIsInWindow. Until it does, just leave // this line out so plug-ins and video will work. Eventually all platforms @@ -2394,11 +2401,16 @@ void WebPage::countStringMatches(const String& string, uint32_t options, uint32_ void WebPage::didChangeSelectedIndexForActivePopupMenu(int32_t newIndex) { + changeSelectedIndex(newIndex); + m_activePopupMenu = 0; +} + +void WebPage::changeSelectedIndex(int32_t index) +{ if (!m_activePopupMenu) return; - m_activePopupMenu->didChangeSelectedIndex(newIndex); - m_activePopupMenu = 0; + m_activePopupMenu->didChangeSelectedIndex(index); } void WebPage::didChooseFilesForOpenPanel(const Vector<String>& files) diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h index 4d20421e0..1b7708a4c 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.h +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h @@ -697,6 +697,10 @@ private: #if PLATFORM(GTK) void failedToShowPopupMenu(); #endif +#if PLATFORM(QT) + void hidePopupMenu(); + void selectedIndex(int32_t newIndex); +#endif void didChooseFilesForOpenPanel(const Vector<String>&); void didCancelForOpenPanel(); @@ -724,6 +728,7 @@ private: void didSelectItemFromActiveContextMenu(const WebContextMenuItemData&); #endif + void changeSelectedIndex(int32_t index); void setCanStartMediaTimerFired(); static bool platformCanHandleRequest(const WebCore::ResourceRequest&); diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in index 4c260eb90..39c8114b5 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in @@ -166,7 +166,11 @@ messages -> WebPage { SetTextForActivePopupMenu(int32_t index); #if PLATFORM(GTK) FailedToShowPopupMenu(); -#endif +#endif +#if PLATFORM(QT) + HidePopupMenu(); + SelectedIndex(int32_t newIndex); +#endif #if ENABLE(CONTEXT_MENUS) # Context menu. diff --git a/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp index 2e90a7360..18e4f948a 100644 --- a/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp +++ b/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp @@ -28,9 +28,11 @@ #include "WebPage.h" #include "NotImplemented.h" +#include "PopupMenuClient.h" #include "WebEditorClient.h" #include "WebEvent.h" #include "WebPageProxyMessages.h" +#include "WebPopupMenu.h" #include "WebProcess.h" #include <WebCore/DOMWrapperWorld.h> #include <WebCore/FocusController.h> @@ -422,4 +424,18 @@ void WebPage::setUserScripts(const Vector<String>& scripts) pageGroup->addUserScriptToWorld(mainThreadNormalWorld(), scripts.at(i), KURL(), nullptr, nullptr, InjectAtDocumentEnd, InjectInTopFrameOnly); } +void WebPage::selectedIndex(int32_t newIndex) +{ + changeSelectedIndex(newIndex); +} + +void WebPage::hidePopupMenu() +{ + if (!m_activePopupMenu) + return; + + m_activePopupMenu->client()->popupDidHide(); + m_activePopupMenu = 0; +} + } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp b/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp index 92d3516a5..16278a38e 100644 --- a/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp +++ b/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "WebProcessMainEfl.h" +#include "ProxyResolverSoup.h" #include "WKBase.h" #include <Ecore.h> #include <WebCore/ResourceHandle.h> @@ -67,11 +68,12 @@ WK_EXPORT int WebProcessMainEfl(int argc, char* argv[]) RunLoop::initializeMainRunLoop(); SoupSession* session = WebCore::ResourceHandle::defaultSession(); - const char* httpProxy = g_getenv("http_proxy"); + const char* httpProxy = getenv("http_proxy"); if (httpProxy) { - SoupURI* proxyUri = soup_uri_new(httpProxy); - g_object_set(session, SOUP_SESSION_PROXY_URI, proxyUri, NULL); - soup_uri_free(proxyUri); + const char* noProxy = getenv("no_proxy"); + SoupProxyURIResolver* resolverEfl = soupProxyResolverWkNew(httpProxy, noProxy); + soup_session_add_feature(session, SOUP_SESSION_FEATURE(resolverEfl)); + g_object_unref(resolverEfl); } int socket = atoi(argv[1]); diff --git a/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp b/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp index ce46be854..2251c2ed1 100644 --- a/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp +++ b/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp @@ -45,7 +45,9 @@ QtNetworkAccessManager::QtNetworkAccessManager(WebProcess* webProcess) { connect(this, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)), SLOT(onAuthenticationRequired(QNetworkReply*, QAuthenticator*))); connect(this, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)), SLOT(onProxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*))); +#ifndef QT_NO_SSL connect(this, SIGNAL(sslErrors(QNetworkReply*, QList<QSslError>)), SLOT(onSslErrors(QNetworkReply*, QList<QSslError>))); +#endif } WebPage* QtNetworkAccessManager::obtainOriginatingWebPage(const QNetworkRequest& request) @@ -126,6 +128,7 @@ void QtNetworkAccessManager::onAuthenticationRequired(QNetworkReply* reply, QAut void QtNetworkAccessManager::onSslErrors(QNetworkReply* reply, const QList<QSslError>& qSslErrors) { +#ifndef QT_NO_SSL WebPage* webPage = obtainOriginatingWebPage(reply->request()); // FIXME: This check can go away once our Qt version is up-to-date. See: QTBUG-23512. @@ -138,15 +141,10 @@ void QtNetworkAccessManager::onSslErrors(QNetworkReply* reply, const QList<QSslE if (webPage->sendSync( Messages::WebPageProxy::CertificateVerificationRequest(hostname), Messages::WebPageProxy::CertificateVerificationRequest::Reply(ignoreErrors))) { - if (ignoreErrors) { -#ifndef QT_NO_OPENSSL + if (ignoreErrors) reply->ignoreSslErrors(qSslErrors); -#else - Q_UNUSED(qSslErrors); - reply->ignoreSslErrors(); -#endif - } } +#endif } } diff --git a/Source/WebKit2/win/WebKit2.def b/Source/WebKit2/win/WebKit2.def index 563758064..d8e0a6f52 100644 --- a/Source/WebKit2/win/WebKit2.def +++ b/Source/WebKit2/win/WebKit2.def @@ -253,6 +253,7 @@ EXPORTS ??1ContextDestructionObserver@WebCore@@MAE@XZ ?contextDestroyed@ContextDestructionObserver@WebCore@@UAEXXZ ??0ContextDestructionObserver@WebCore@@QAE@PAVScriptExecutionContext@1@@Z + ?nullInstance@TreeScope@WebCore@@SAPAV12@XZ ?nodesFromRect@Document@WebCore@@QBE?AV?$PassRefPtr@VNodeList@WebCore@@@WTF@@HHIIII_N0@Z ?selectionStartHasMarkerFor@Editor@WebCore@@QBE_NW4MarkerType@DocumentMarker@2@HH@Z ?webkitWillEnterFullScreenForElement@Document@WebCore@@QAEXPAVElement@2@@Z diff --git a/Source/WebKit2/win/WebKit2CFLite.def b/Source/WebKit2/win/WebKit2CFLite.def index 0e5d1b2c7..32f4e8748 100644 --- a/Source/WebKit2/win/WebKit2CFLite.def +++ b/Source/WebKit2/win/WebKit2CFLite.def @@ -246,6 +246,7 @@ EXPORTS ?userPreferredLanguages@WebCore@@YA?AV?$Vector@VString@WTF@@$0A@@WTF@@XZ ?utf8@String@WTF@@QBE?AVCString@2@_N@Z ?view@Document@WebCore@@QBEPAVFrameView@2@XZ + ?nullInstance@TreeScope@WebCore@@SAPAV12@XZ ?nodesFromRect@Document@WebCore@@QBE?AV?$PassRefPtr@VNodeList@WebCore@@@WTF@@HHIIII_N0@Z ?selectionStartHasMarkerFor@Editor@WebCore@@QBE_NW4MarkerType@DocumentMarker@2@HH@Z ?restrictScaleFactorToInitialScaleIfNotUserScalable@WebCore@@YAXAAUViewportAttributes@1@@Z |
