diff options
Diffstat (limited to 'Source/WebKit2')
560 files changed, 20332 insertions, 6342 deletions
diff --git a/Source/WebKit2/CMakeLists.txt b/Source/WebKit2/CMakeLists.txt index b6bfc7c6f..6e46f48a9 100644 --- a/Source/WebKit2/CMakeLists.txt +++ b/Source/WebKit2/CMakeLists.txt @@ -237,6 +237,7 @@ SET(WebKit2_SOURCES UIProcess/GeolocationPermissionRequestManagerProxy.cpp UIProcess/GeolocationPermissionRequestProxy.cpp + UIProcess/PageViewportController.cpp UIProcess/ResponsivenessTimer.cpp UIProcess/VisitedLinkProvider.cpp UIProcess/WebApplicationCacheManagerProxy.cpp diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index 04a92a04e..4253caa5f 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,6082 @@ +2012-11-07 Christophe Dumez <christophe.dumez@intel.com> + + Add replaceWithLiteral() method to WTF::String + https://bugs.webkit.org/show_bug.cgi?id=101257 + + Reviewed by Benjamin Poulain. + + Substitute String::replace() calls by String::replaceWithLiteral() where + adequate, for efficiency. + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::makeURLString): + +2012-11-06 Vivek Galatage <vivekgalatage@gmail.com> + + Move DrawingAreaImpl methods graphicsLayerFactory, setRootCompositingLayer & scheduleCompositingLayerSync under ACCELERATED_COMPOSITING + https://bugs.webkit.org/show_bug.cgi?id=101427 + + Reviewed by Anders Carlsson. + + Moving these methods under the ACCELERATED_COMPOSITING flag. + This fixes broken wincairo due to use of override specifier. + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit): + * WebProcess/WebPage/DrawingAreaImpl.h: + (DrawingAreaImpl): + +2012-11-06 Viatcheslav Ostapenko <v.ostapenko@samsung.com> + + [EFL][WK2] API test crash with accelerated compositing on. + https://bugs.webkit.org/show_bug.cgi?id=101384 + + Reviewed by Gyuyoung Kim. + + If accelerated compositing is enabled API tests should create GL evas engine + instead of default one. + Also, in API tests first window resize and display often comes earlier + than enterAcceleratedCompositingMode call, so let's create GL surface in + _ewk_view_smart_calculate on first window resize. + + * UIProcess/API/efl/ewk_view.cpp: + (_ewk_view_smart_calculate): + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp: + (EWK2UnitTest::EWK2UnitTestBase::SetUp): + +2012-11-06 Anders Carlsson <andersca@apple.com> + + Update Java related WKSI function names + https://bugs.webkit.org/show_bug.cgi?id=101414 + + Reviewed by Sam Weinig. + + * UIProcess/Plugins/mac/PluginInfoStoreMac.mm: + (WebKit::PluginInfoStore::shouldUsePlugin): + (WebKit::PluginInfoStore::policyForPlugin): + (WebKit::PluginInfoStore::reactivateInactivePlugin): + +2012-11-06 Kiran Muppala <cmuppala@apple.com> + + Add application occlusion criterion to enable/disable process suppression on Mac + https://bugs.webkit.org/show_bug.cgi?id=100997 + + Reviewed by Alexey Proskuryakov. + + Provide support for enabling and disabling process suppression when application is completely occluded on Mac. + + * NetworkProcess/NetworkProcess.messages.in: Added message to update application occlusion status. + * NetworkProcess/mac/NetworkProcessMainMac.mm: + (WebKit::NetworkProcessMain): Removed call to take process suppression assertion since ChildProcess + takes one on constrution. + * PluginProcess/PluginProcess.messages.in: Added message to update application occlusion status. + * PluginProcess/mac/PluginProcessMainMac.mm: + (WebKit::PluginProcessMain): Removed call to take process suppression assertion since ChildProcess + takes one on construction. + * Shared/ChildProcess.cpp: + (WebKit::ChildProcess::ChildProcess): Take process suppression assertion on construction. + * Shared/ChildProcess.h: + (WebKit::ChildProcess::applicationIsOccluded): + * Shared/mac/ChildProcessMac.mm: Added. + (WebKit::ChildProcess::setApplicationIsOccluded): Release process suppression assertion if application + becomes occluded or take a new assertion if application becomes visible. + (WebKit::ChildProcess::disableProcessSuppression): + (WebKit::ChildProcess::enableProcessSuppression): + Helper methods to take and release process suppression assertion. + * SharedWorkerProcess/SharedWorkerProcess.messages.in: Added message to update application occlusion status. + * SharedWorkerProcess/mac/SharedWorkerProcessMainMac.mm: + (WebKit::SharedWorkerProcessMain): Removed call to take process suppression assertion since ChildProcess + takes one on construction. + * UIProcess/Network/NetworkProcessManager.h: + * UIProcess/Network/NetworkProcessProxy.cpp: + (WebKit::NetworkProcessProxy::didFinishLaunching): Update application occlusion status post launch. + * UIProcess/Network/NetworkProcessProxy.h: + (WebKit::NetworkProcessProxy::isValid): + * UIProcess/Network/mac/NetworkProcessManagerMac.mm: Added. + (WebKit::NetworkProcessManager::setApplicationIsOccluded): + * UIProcess/Network/mac/NetworkProcessProxyMac.mm: + (WebKit::NetworkProcessProxy::setApplicationIsOccluded): + * UIProcess/Plugins/PluginProcessManager.h: + * UIProcess/Plugins/PluginProcessProxy.cpp: + (WebKit::PluginProcessProxy::didFinishLaunching): Update application occlusion status post launch. + * UIProcess/Plugins/PluginProcessProxy.h: + (WebKit::PluginProcessProxy::isValid): + * UIProcess/Plugins/mac/PluginProcessManagerMac.mm: Added. + (WebKit::PluginProcessManager::setApplicationIsOccluded): + * UIProcess/Plugins/mac/PluginProcessProxyMac.mm: + (WebKit::PluginProcessProxy::setApplicationIsOccluded): + * UIProcess/SharedWorkers/SharedWorkerProcessManager.h: + * UIProcess/SharedWorkers/SharedWorkerProcessProxy.cpp: + (WebKit::SharedWorkerProcessProxy::didFinishLaunching): Update application occlusion status post launch. + * UIProcess/SharedWorkers/SharedWorkerProcessProxy.h: + (WebKit::SharedWorkerProcessProxy::isValid): + * UIProcess/SharedWorkers/mac/SharedWorkerProcessManagerMac.mm: Added. + (WebKit::SharedWorkerProcessManager::setApplicationIsOccluded): + * UIProcess/SharedWorkers/mac/SharedWorkerProcessProxyMac.mm: Added. + (WebKit::SharedWorkerProcessProxy::setApplicationIsOccluded): + * UIProcess/WebContext.cpp: + (WebKit::WebContext::create): Added call to initialize process suppression support. + * UIProcess/WebContext.h: + (WebKit::WebContext::applicationIsOccluded): + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::didFinishLaunching): Update application occlusion status post launch. + * UIProcess/mac/WebContextMac.mm: + (WebKit::WebContext::applicationBecameVisible): + (WebKit::WebContext::applicationBecameOccluded): + Notification handlers for informing non UI WebKit2 processes of changes to application occlusion state. + (WebKit::WebContext::registerOcclusionNotificationHandlers): + (WebKit::WebContext::initializeProcessSuppressionSupport): + Helper method to register occlusion notification handlers if process suppression support is enabled. + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebProcess.messages.in: Added message to update application occlusion status. + * WebProcess/mac/WebProcessInitialization.mm: + (WebKit::InitializeWebProcess): Removed call to take process supression assertion since ChildProcess + takes one on construction. + +2012-11-06 Alexey Proskuryakov <ap@apple.com> + + Clean up which storage cookie jar functions use + https://bugs.webkit.org/show_bug.cgi?id=101395 + + Reviewed by Brady Eidson. + + * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: (InitWebCoreSystemInterface): + Updated for two new functions. + +2012-11-06 Jihye Kang <jye.kang@samsung.com> + + [EFL][WK2] Add ewk_database_manager APIs + https://bugs.webkit.org/show_bug.cgi?id=101193 + + Reviewed by Gyuyoung Kim. + + Add ewk_database_manager to manage web database and + ewk_database_manaager_origins_get to get origins list of web storage. + Add unit tests for ewk_database_manager APIs. + + * PlatformEfl.cmake: + * UIProcess/API/efl/ewk_context.cpp: + (Ewk_Context::Ewk_Context): + (Ewk_Context::databaseManager): + (ewk_context_database_manager_get): + * UIProcess/API/efl/ewk_context.h: + * UIProcess/API/efl/ewk_context_private.h: + (Ewk_Context): + * UIProcess/API/efl/ewk_database_manager.cpp: Added. + (Ewk_Database_Manager::Ewk_Database_Manager): + (Ewk_Database_Manager::getDatabaseOrigins): + (Ewk_Database_Manager::createOriginList): + (Ewk_Database_Origins_Async_Get_Context): + (Ewk_Database_Origins_Async_Get_Context::Ewk_Database_Origins_Async_Get_Context): + (getDatabaseOriginsCallback): + (ewk_database_manager_origins_get): + * UIProcess/API/efl/ewk_database_manager.h: Added. + * UIProcess/API/efl/ewk_database_manager_private.h: Added. + (Ewk_Database_Manager): + (Ewk_Database_Manager::create): + * UIProcess/API/efl/tests/test_ewk2_context.cpp: + (TEST_F): + * UIProcess/API/efl/tests/test_ewk2_database_manager.cpp: Added. + (OriginData): + (OriginData::OriginData): + (getDatabaseOriginsCallback): + (timerCallback): + (TEST_F): + +2012-11-06 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][WK2] Refactor Ewk_Auth_Request, Ewk_Url_Scheme_Request and Ewk_Download_Job to be Ewk_Objects + https://bugs.webkit.org/show_bug.cgi?id=101383 + + Reviewed by Kenneth Rohde Christiansen. + + Ewk_Auth_Request, Ewk_Url_Scheme_Request and Ewk_Download_Job are Ewk_Objects now. + + * UIProcess/API/efl/EwkViewCallbacks.h: + * UIProcess/API/efl/EwkViewImpl.h: + * UIProcess/API/efl/ewk_auth_request.cpp: + (EwkAuthRequest::EwkAuthRequest): + (EwkAuthRequest::~EwkAuthRequest): + (EwkAuthRequest::suggestedUsername): + (EwkAuthRequest::realm): + (EwkAuthRequest::host): + (EwkAuthRequest::continueWithoutCredential): + (EwkAuthRequest::authenticate): + (EwkAuthRequest::isRetrying): + (ewk_auth_request_suggested_username_get): + (ewk_auth_request_cancel): + (ewk_auth_request_authenticate): + (ewk_auth_request_retrying_get): + (ewk_auth_request_realm_get): + (ewk_auth_request_host_get): + * UIProcess/API/efl/ewk_auth_request.h: + * UIProcess/API/efl/ewk_auth_request_private.h: + (EwkAuthRequest): + (EwkAuthRequest::create): + * UIProcess/API/efl/ewk_back_forward_list.h: + * UIProcess/API/efl/ewk_context_private.h: + (EwkContext): + * UIProcess/API/efl/ewk_download_job.cpp: + (EwkDownloadJob::EwkDownloadJob): + (EwkDownloadJob::id): + (EwkDownloadJob::viewImpl): + (ewk_download_job_state_get): + (EwkDownloadJob::state): + (ewk_download_job_request_get): + (EwkDownloadJob::request): + (ewk_download_job_response_get): + (EwkDownloadJob::response): + (ewk_download_job_destination_get): + (EwkDownloadJob::destination): + (ewk_download_job_destination_set): + (EwkDownloadJob::setDestination): + (ewk_download_job_suggested_filename_get): + (EwkDownloadJob::suggestedFileName): + (ewk_download_job_cancel): + (EwkDownloadJob::cancel): + (ewk_download_job_estimated_progress_get): + (EwkDownloadJob::estimatedProgress): + (ewk_download_job_elapsed_time_get): + (EwkDownloadJob::elapsedTime): + (EwkDownloadJob::setResponse): + (EwkDownloadJob::setSuggestedFileName): + (EwkDownloadJob::incrementReceivedData): + (EwkDownloadJob::setState): + * UIProcess/API/efl/ewk_download_job.h: + * UIProcess/API/efl/ewk_download_job_private.h: + (EwkDownloadJob): + (EwkDownloadJob::create): + * UIProcess/API/efl/ewk_url_scheme_request.cpp: + (EwkUrlSchemeRequest::EwkUrlSchemeRequest): + (EwkUrlSchemeRequest::id): + (EwkUrlSchemeRequest::url): + (EwkUrlSchemeRequest::scheme): + (EwkUrlSchemeRequest::path): + (EwkUrlSchemeRequest::finish): + (ewk_url_scheme_request_scheme_get): + (ewk_url_scheme_request_url_get): + (ewk_url_scheme_request_path_get): + (ewk_url_scheme_request_finish): + * UIProcess/API/efl/ewk_url_scheme_request.h: + * UIProcess/API/efl/ewk_url_scheme_request_private.h: + (EwkUrlSchemeRequest): + (EwkUrlSchemeRequest::create): + * UIProcess/API/efl/tests/test_ewk2_auth_request.cpp: + (onAuthenticationRequest): + (TEST_F): + * UIProcess/efl/DownloadManagerEfl.cpp: + (WebKit::DownloadManagerEfl::decideDestinationWithSuggestedFilename): + (WebKit::DownloadManagerEfl::didReceiveResponse): + (WebKit::DownloadManagerEfl::didCreateDestination): + (WebKit::DownloadManagerEfl::didReceiveData): + (WebKit::DownloadManagerEfl::didFail): + (WebKit::DownloadManagerEfl::didCancel): + (WebKit::DownloadManagerEfl::didFinish): + (WebKit::DownloadManagerEfl::registerDownload): + (WebKit::DownloadManagerEfl::downloadJob): + * UIProcess/efl/DownloadManagerEfl.h: + (DownloadManagerEfl): + * UIProcess/efl/PageLoadClientEfl.cpp: + (WebKit::PageLoadClientEfl::didReceiveAuthenticationChallengeInFrame): + * UIProcess/efl/RequestManagerClientEfl.cpp: + (WebKit::RequestManagerClientEfl::didReceiveURIRequest): + +2012-11-06 Yael Aharon <yael.aharon@intel.com> + + [WK2] Wrong scroll position when going back in history + https://bugs.webkit.org/show_bug.cgi?id=101358 + + Reviewed by Kenneth Rohde Christiansen. + + Reset the contentsSize after a new load was committed. We should not continue + to use the contentsSize of the previous page in any calculation. + + * UIProcess/PageViewportController.cpp: + (WebKit::PageViewportController::didCommitLoad): + +2012-11-06 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Declare all smart callbacks in EwkViewCallbacks.h + https://bugs.webkit.org/show_bug.cgi?id=101360 + + Reviewed by Kenneth Rohde Christiansen. + + Declare all EwkView smart callbacks in EwkViewCallbacks.h + and remove remaining calls to evas_object_smart_callback_call(). + It is a good idea to have all the callbacks declared in one + place for convenience and consistency. We also have better + argument type checking if we use the new callback mechanism. + + * UIProcess/API/efl/EwkViewCallbacks.h: + (EwkViewCallbacks::CallBack::call): + (CallBack): + (EwkViewCallbacks): + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::informIconChange): + (EwkViewImpl::informURLChange): + (EwkViewImpl::createNewPage): + (EwkViewImpl::closePage): + +2012-11-05 Anders Carlsson <andersca@apple.com> + + Hook up the remote layer tree drawing area to an environment variable + https://bugs.webkit.org/show_bug.cgi?id=101267 + + Reviewed by Andreas Kling. + + * UIProcess/API/mac/WKView.mm: + * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm: + (WebKit::RemoteLayerTreeDrawingAreaProxy::sizeDidChange): + (WebKit::RemoteLayerTreeDrawingAreaProxy::deviceScaleFactorDidChange): + +2012-11-06 Andras Becsi <andras.becsi@digia.com> + + [Qt][WK2] Fit-to-width broken on pages with viewport meta tag + https://bugs.webkit.org/show_bug.cgi?id=99715 + + Reviewed by Jocelyn Turcotte. + + The initial scale from the viewport attributes should only + be applied if the scale was explicitly specified in the + viewport meta tag. + If the initial scale is auto it should be calculated using + the final contents size, which might be larger than the + layout size, so that the content fits horizontally into + the view. + + Also add QML unit tests that cover this functionality. + + * UIProcess/API/qt/tests/qmltests/WebView/tst_fitToView.qml: + * UIProcess/API/qt/tests/qmltests/common/test5.html: Added. + * UIProcess/PageViewportController.cpp: + (WebKit::PageViewportController::PageViewportController): + (WebKit::PageViewportController::pageTransitionViewportReady): + +2012-11-06 Huang Dongsung <luxtella@company100.net> + + Coordinated Graphics: Remove a parent member in WebLayerInfo. + https://bugs.webkit.org/show_bug.cgi?id=101142 + + Reviewed by Noam Rosenthal. + + The parent member is not used in UI Process, and GraphicsLayer::setParent is + internally used only, so we don't need to send the parent layer id to UI Process. + + * Shared/WebLayerTreeInfo.h: + (WebKit::WebLayerInfo::WebLayerInfo): + * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp: + (WebCore::CoordinatedGraphicsLayer::syncLayerState): + +2012-11-06 Huang Dongsung <luxtella@company100.net> + + Coordinated Graphics: Remove two methods' virtual modifiers in CoordinatedGraphicsLayer. + https://bugs.webkit.org/show_bug.cgi?id=101141 + + Reviewed by Noam Rosenthal. + + The methods exist for only CoordinatedGraphicsLayer and we have no plan to + extend CoordinatedGraphicsLayer. + + * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h: + (CoordinatedGraphicsLayer): + +2012-11-06 Balazs Kelemen <kbalazs@webkit.org> + + [CoordinatedGraphics] Access to LayerTreeRenderer::m_renderQueue should be thread safe + https://bugs.webkit.org/show_bug.cgi?id=101341 + + Reviewed by Noam Rosenthal. + + The queue can be accessed from public API so we should make + sure it is not updated concurrently with a threaded render loop. + + * UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp: + (WebKit::LayerTreeRenderer::syncRemoteContent): + (WebKit::LayerTreeRenderer::appendUpdate): + * UIProcess/CoordinatedGraphics/LayerTreeRenderer.h: + (LayerTreeRenderer): + +2012-11-06 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][WK2] Make Ewk_Context Ewk_Object + https://bugs.webkit.org/show_bug.cgi?id=101322 + + Reviewed by Kenneth Rohde Christiansen. + + Ewk_Context is Ewk_Object now and using common ref/unref API. + + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::EwkViewImpl): + * UIProcess/API/efl/EwkViewImpl.h: + (EwkViewImpl::ewkContext): + (EwkViewImpl): + * UIProcess/API/efl/ewk_context.cpp: + (EwkContext::EwkContext): + (EwkContext::~EwkContext): + (EwkContext::create): + (EwkContext::defaultContext): + (EwkContext::cookieManager): + (EwkContext::ensureFaviconDatabase): + (EwkContext::setFaviconDatabaseDirectoryPath): + (EwkContext::faviconDatabase): + (EwkContext::storageManager): + (EwkContext::requestManager): + (EwkContext::vibrationProvider): + (EwkContext::addVisitedLink): + (EwkContext::setCacheModel): + (EwkContext::cacheModel): + (ewk_context_cookie_manager_get): + (ewk_context_favicon_database_directory_set): + (ewk_context_favicon_database_get): + (ewk_context_storage_manager_get): + (EwkContext::wkContext): + (EwkContext::downloadManager): + (EwkContext::historyClient): + (ewk_context_default_get): + (ewk_context_new): + (ewk_context_new_with_injected_bundle_path): + (ewk_context_url_scheme_register): + (ewk_context_vibration_client_callbacks_set): + (ewk_context_history_callbacks_set): + (ewk_context_visited_link_add): + (ewk_context_cache_model_set): + (ewk_context_cache_model_get): + * UIProcess/API/efl/ewk_context.h: + * UIProcess/API/efl/ewk_context_private.h: + (EwkContext): + * UIProcess/API/efl/ewk_view.cpp: + (createEwkView): + (ewk_view_base_add): + (ewk_view_smart_add): + (ewk_view_add_with_context): + * UIProcess/API/efl/tests/test_ewk2_context.cpp: + (TEST_F): + * UIProcess/efl/DownloadManagerEfl.cpp: + (WebKit::DownloadManagerEfl::DownloadManagerEfl): + * UIProcess/efl/DownloadManagerEfl.h: + (WebKit::DownloadManagerEfl::create): + (DownloadManagerEfl): + * UIProcess/efl/PageClientBase.cpp: + (WebKit::PageClientBase::handleDownloadRequest): + * UIProcess/efl/RequestManagerClientEfl.cpp: + (WebKit::RequestManagerClientEfl::RequestManagerClientEfl): + * UIProcess/efl/RequestManagerClientEfl.h: + (WebKit::RequestManagerClientEfl::create): + (RequestManagerClientEfl): + +2012-11-06 Balazs Kelemen <kbalazs@webkit.org> + + [CoordinatedGraphics] compositing/iframes/connect-compositing-iframe.html crashes + https://bugs.webkit.org/show_bug.cgi?id=101232 + + Reviewed by Jocelyn Turcotte. + + The crash is happening in CoordinatedGraphicsLayer::flushCompositingState + because we dereferencing a null m_coordinatedGraphicsLayerClient. + This happens when the root layer became composited because it has content overlapping + with an inner iframe that is composited. In this case the RenderLayerCompositor attaches + the layer with RootLayerAttachedViaEnclosingFrame attachment flag and do not call + ChromeClient::attachRootGraphcisLayer so we don't have a chance to set m_coordinatedGraphicsLayerClient. + The solution is to set the client early in the factory method. + + * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp: + (WebKit::LayerTreeCoordinator::createGraphicsLayer): + +2012-11-06 Viatcheslav Ostapenko <v.ostapenko@samsung.com> + + [EFL] [WK2] Random crash in Minibrowser + https://bugs.webkit.org/show_bug.cgi?id=101241 + + Reviewed by Gyuyoung Kim. + + Do not clear GL context and GL surface in exitAcceleratedCompositing. + + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::createGLSurface): + (EwkViewImpl::enterAcceleratedCompositingMode): + (EwkViewImpl::exitAcceleratedCompositingMode): + +2012-11-05 Sam Weinig <sam@webkit.org> + + Need a way to send and receive messages between the WKWebProcessPlugIn object and the client + https://bugs.webkit.org/show_bug.cgi?id=101282 + + Reviewed by Anders Carlsson. + + API wise, this adds: + - A connection property on the WKWebProcessPlugInController + - A method to send messages across a WKConnection (sendMessageWithName:body). + + It also implements message sending and receiving for WKConnection. Message bodies are currently + restricted to being object graphs with values that are property list types, but in the future, should + support all types conforming to the NSSecureCoding protocol. + + * Shared/WebConnection.cpp: + (WebKit::WebConnection::postMessage): + (WebKit::WebConnection::handleMessage): + * Shared/WebConnection.h: + (WebConnection): + * Shared/WebConnection.messages.in: + Switch HandleMessage to be a variadic message to avoid an extra copy and support attachments correctly. + + * Shared/mac/ArgumentCodersMac.h: + * Shared/mac/ArgumentCodersMac.mm: + (CoreIPC::typeFromObject): + (CoreIPC::encode): + (CoreIPC::decode): + Add support for encoding/decoding NSArray, NSDate and NSData. + + * UIProcess/API/mac/WKConnection.h: + * UIProcess/API/mac/WKConnection.mm: + (-[WKConnection sendMessageWithName:body:]): + (didReceiveMessage): + Implement message sending and receiving. + + * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h: + * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm: + (-[WKWebProcessPlugInController _initWithPrincipalClassInstance:bundleRef:]): + (-[WKWebProcessPlugInController connection]): + Add a wrapper for the WKConnectionRef vended via WKBundleGetApplicationConnection() and expose it as + API on the WKWebProcessPlugInController. + +2012-11-05 Jinwoo Song <jinwoo7.song@samsung.com> + + [EFL][WK2] Fix wrong coding style in the boilerplates + https://bugs.webkit.org/show_bug.cgi?id=101283 + + Reviewed by Gyuyoung Kim. + + Fix boilerplate which have wrong coding style. + + * UIProcess/efl/InputMethodContextEfl.cpp: + * UIProcess/efl/InputMethodContextEfl.h: + * UIProcess/efl/PageClientDefaultImpl.cpp: + * UIProcess/efl/PageClientDefaultImpl.h: + * UIProcess/efl/PageClientLegacyImpl.cpp: + * UIProcess/efl/PageClientLegacyImpl.h: + +2012-11-05 KyungTae Kim <ktf.kim@samsung.com> + + [EFL][WK2] Fix build warning in PageClientLegacyImpl.cpp + https://bugs.webkit.org/show_bug.cgi?id=101266 + + Reviewed by Laszlo Gombos. + + The 'size' is not used when !USE(TILED_BACKING_STORE) + Use UNUSED_PARAM macro for removing -Wunused-parameter warning + + * UIProcess/efl/PageClientLegacyImpl.cpp: + (WebKit::PageClientLegacyImpl::updateViewportSize): + +2012-11-05 Anders Carlsson <andersca@apple.com> + + Begin stubbing out the new remote layer tree drawing area + https://bugs.webkit.org/show_bug.cgi?id=101256 + + Reviewed by Andreas Kling. + + * Shared/DrawingAreaInfo.h: + * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h: + * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebPage/DrawingArea.cpp: + * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: + * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: + +2012-11-05 Alexey Proskuryakov <ap@apple.com> + + Get rid of setCookieStoragePrivateBrowsingEnabled. + https://bugs.webkit.org/show_bug.cgi?id=101247 + + Reviewed by Brady Eidson. + + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::switchNetworkLoaderToNewTestingSession): Added a FIXME. + + * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: (InitWebCoreSystemInterface): + We no longer have this function. + +2012-11-05 Simon Fraser <simon.fraser@apple.com> + + Fix layer borders to cleaning appear and disappear on switching + https://bugs.webkit.org/show_bug.cgi?id=101136 + + Reviewed by Sam Weinig. + + Remove the GraphicsLayerClient methods showDebugBorders() and + showRepaintCounter(). + + * UIProcess/CoordinatedGraphics/LayerTreeRenderer.h: + * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp: + * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h: + (LayerTreeCoordinator): + * WebProcess/WebPage/ca/LayerTreeHostCA.cpp: + * WebProcess/WebPage/ca/LayerTreeHostCA.h: + (LayerTreeHostCA): + * WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp: + * WebProcess/WebPage/gtk/LayerTreeHostGtk.h: + (LayerTreeHostGtk): + * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: + (TiledCoreAnimationDrawingArea): + * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: + +2012-11-05 Yael Aharon <yael.aharon@intel.com> + + [EFL][WK2] Allow using ACCELERATED_COMPOSITING without COORDINATED_GRAPHICS + https://bugs.webkit.org/show_bug.cgi?id=100674 + + Reviewed by Kenneth Rohde Christiansen. + + Make a distinction between calling ewk_view_base_add and ewk_view_smart_add. + Calling ewk_view_base_add creates a desktop style view, that does not support + fixed layout size, while calling ewk_view_smart_add does support fixed layout size. + As a result, WebKitTestRunner and the inspector window do not support + fixed layout size, while MiniBrowser does. This change allows many DumpAsText + layout tests to pass without modification, when AC is enabled. + + * PlatformEfl.cmake: + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::EwkViewImpl): + (EwkViewImpl::transformFromScene): + (EwkViewImpl::informLoadCommitted): + (EwkViewImpl::enterAcceleratedCompositingMode): + (EwkViewImpl::informContentsSizeChange): + * UIProcess/API/efl/EwkViewImpl.h: + (WebKit): + (EwkViewImpl): + (EwkViewImpl::pageClient): + (EwkViewImpl::setScaleFactor): + (EwkViewImpl::scaleFactor): + (EwkViewImpl::setScrollPosition): + (EwkViewImpl::scrollPosition): + * UIProcess/API/efl/ewk_view.cpp: + (_ewk_view_smart_calculate): + (createEwkView): + (ewk_view_base_add): + * UIProcess/efl/PageClientBase.cpp: Copied from Source/WebKit2/UIProcess/efl/PageClientImpl.cpp. + (WebKit::PageClientBase::PageClientBase): + (WebKit::PageClientBase::~PageClientBase): + (WebKit::PageClientBase::viewImpl): + (WebKit::PageClientBase::createDrawingAreaProxy): + (WebKit::PageClientBase::setViewNeedsDisplay): + (WebKit::PageClientBase::displayView): + (WebKit::PageClientBase::scrollView): + (WebKit::PageClientBase::viewSize): + (WebKit::PageClientBase::isViewWindowActive): + (WebKit::PageClientBase::isViewFocused): + (WebKit::PageClientBase::isViewVisible): + (WebKit::PageClientBase::isViewInWindow): + (WebKit::PageClientBase::processDidCrash): + (WebKit::PageClientBase::didRelaunchProcess): + (WebKit::PageClientBase::pageClosed): + (WebKit::PageClientBase::toolTipChanged): + (WebKit::PageClientBase::setCursor): + (WebKit::PageClientBase::setCursorHiddenUntilMouseMoves): + (WebKit::PageClientBase::registerEditCommand): + (WebKit::PageClientBase::clearAllEditCommands): + (WebKit::PageClientBase::canUndoRedo): + (WebKit::PageClientBase::executeUndoRedo): + (WebKit::PageClientBase::convertToDeviceSpace): + (WebKit::PageClientBase::convertToUserSpace): + (WebKit::PageClientBase::screenToWindow): + (WebKit::PageClientBase::windowToScreen): + (WebKit::PageClientBase::doneWithKeyEvent): + (WebKit::PageClientBase::doneWithTouchEvent): + (WebKit::PageClientBase::createPopupMenuProxy): + (WebKit::PageClientBase::createContextMenuProxy): + (WebKit::PageClientBase::createColorChooserProxy): + (WebKit::PageClientBase::setFindIndicator): + (WebKit::PageClientBase::enterAcceleratedCompositingMode): + (WebKit::PageClientBase::exitAcceleratedCompositingMode): + (WebKit::PageClientBase::updateAcceleratedCompositingMode): + (WebKit::PageClientBase::didChangeScrollbarsForMainFrame): + (WebKit::PageClientBase::didCommitLoadForMainFrame): + (WebKit::PageClientBase::didFinishLoadingDataForCustomRepresentation): + (WebKit::PageClientBase::customRepresentationZoomFactor): + (WebKit::PageClientBase::setCustomRepresentationZoomFactor): + (WebKit::PageClientBase::flashBackingStoreUpdates): + (WebKit::PageClientBase::findStringInCustomRepresentation): + (WebKit::PageClientBase::countStringMatchesInCustomRepresentation): + (WebKit::PageClientBase::updateTextInputState): + (WebKit::PageClientBase::handleDownloadRequest): + * UIProcess/efl/PageClientBase.h: Copied from Source/WebKit2/UIProcess/efl/PageClientImpl.h. + (PageClientBase): + * UIProcess/efl/PageClientDefaultImpl.cpp: Added. + (WebKit): + (WebKit::PageClientDefaultImpl::PageClientDefaultImpl): + (WebKit::PageClientDefaultImpl::didCommitLoad): + (WebKit::PageClientDefaultImpl::updateViewportSize): + (WebKit::PageClientDefaultImpl::didChangeViewportProperties): + (WebKit::PageClientDefaultImpl::didChangeContentsSize): + (WebKit::PageClientDefaultImpl::pageDidRequestScroll): + (WebKit::PageClientDefaultImpl::didRenderFrame): + (WebKit::PageClientDefaultImpl::pageTransitionViewportReady): + * UIProcess/efl/PageClientDefaultImpl.h: Added. + (WebKit): + (PageClientDefaultImpl): + (WebKit::PageClientDefaultImpl::create): + (WebKit::PageClientDefaultImpl::~PageClientDefaultImpl): + * UIProcess/efl/PageClientImpl.cpp: Removed. + * UIProcess/efl/PageClientImpl.h: Removed. + * UIProcess/efl/PageClientLegacyImpl.cpp: Added. + (WebKit): + (WebKit::PageClientLegacyImpl::PageClientLegacyImpl): + (WebKit::PageClientLegacyImpl::didCommitLoad): + (WebKit::PageClientLegacyImpl::updateViewportSize): + (WebKit::PageClientLegacyImpl::didChangeViewportProperties): + (WebKit::PageClientLegacyImpl::didChangeContentsSize): + (WebKit::PageClientLegacyImpl::pageDidRequestScroll): + (WebKit::PageClientLegacyImpl::didRenderFrame): + (WebKit::PageClientLegacyImpl::pageTransitionViewportReady): + * UIProcess/efl/PageClientLegacyImpl.h: Added. + (WebKit): + (PageClientLegacyImpl): + (WebKit::PageClientLegacyImpl::create): + (WebKit::PageClientLegacyImpl::~PageClientLegacyImpl): + * UIProcess/efl/PageViewportControllerClientEfl.cpp: + (WebKit::PageViewportControllerClientEfl::updateViewportSize): + (WebKit::PageViewportControllerClientEfl::didChangeContentsSize): + (WebKit::PageViewportControllerClientEfl::setViewportPosition): + (WebKit::PageViewportControllerClientEfl::setContentsScale): + * UIProcess/efl/PageViewportControllerClientEfl.h: + * UIProcess/efl/WebPageProxyEfl.cpp: + (WebKit::WebPageProxy::viewWidget): + +2012-11-05 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][WK2] Make Ewk_Url_Request, Ewk_Url_Response, Ewk_Navigation_Data Ewk_Objects + https://bugs.webkit.org/show_bug.cgi?id=101205 + + Reviewed by Gyuyoung Kim. + + Ewk_Url_Request, Ewk_Url_Response, Ewk_Navigation_Data are using common Ewk_Object interface now. + + * UIProcess/API/efl/EwkViewImpl.h: + * UIProcess/API/efl/ewk_download_job.cpp: + (Ewk_Download_Job::request): + (Ewk_Download_Job::response): + (Ewk_Download_Job::setResponse): + * UIProcess/API/efl/ewk_download_job_private.h: + (Ewk_Download_Job): + * UIProcess/API/efl/ewk_navigation_data.cpp: + (EwkNavigationData::EwkNavigationData): + (EwkNavigationData::originalRequest): + (EwkNavigationData::title): + (EwkNavigationData::url): + (ewk_navigation_data_title_get): + (ewk_navigation_data_original_request_get): + (ewk_navigation_data_url_get): + * UIProcess/API/efl/ewk_navigation_data.h: + * UIProcess/API/efl/ewk_navigation_data_private.h: + (EwkNavigationData): + (EwkNavigationData::create): + * UIProcess/API/efl/ewk_navigation_policy_decision.cpp: + (Ewk_Navigation_Policy_Decision::Ewk_Navigation_Policy_Decision): + (Ewk_Navigation_Policy_Decision::request): + * UIProcess/API/efl/ewk_navigation_policy_decision_private.h: + (Ewk_Navigation_Policy_Decision::create): + (Ewk_Navigation_Policy_Decision): + * UIProcess/API/efl/ewk_url_request.cpp: + (EwkUrlRequest::EwkUrlRequest): + (EwkUrlRequest::url): + (EwkUrlRequest::firstParty): + (EwkUrlRequest::httpMethod): + (ewk_url_request_url_get): + (ewk_request_cookies_first_party_get): + (ewk_url_request_http_method_get): + * UIProcess/API/efl/ewk_url_request.h: + * UIProcess/API/efl/ewk_url_request_private.h: + (EwkUrlRequest): + (EwkUrlRequest::create): + * UIProcess/API/efl/ewk_url_response.cpp: + (EwkUrlResponse::EwkUrlResponse): + (EwkUrlResponse::httpStatusCode): + (EwkUrlResponse::url): + (EwkUrlResponse::mimeType): + (EwkUrlResponse::contentLength): + (ewk_url_response_url_get): + (ewk_url_response_status_code_get): + (ewk_url_response_mime_type_get): + (ewk_url_response_content_length_get): + * UIProcess/API/efl/ewk_url_response.h: + * UIProcess/API/efl/ewk_url_response_private.h: + (EwkUrlResponse): + (EwkUrlResponse::create): + * UIProcess/efl/ContextHistoryClientEfl.cpp: + (WebKit::ContextHistoryClientEfl::didNavigateWithNavigationData): + * UIProcess/efl/DownloadManagerEfl.cpp: + (WebKit::DownloadManagerEfl::didReceiveResponse): + * UIProcess/efl/ResourceLoadClientEfl.cpp: + (WebKit::ResourceLoadClientEfl::didInitiateLoadForResource): + (WebKit::ResourceLoadClientEfl::didSendRequestForResource): + (WebKit::ResourceLoadClientEfl::didReceiveResponseForResource): + +2012-11-05 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] EWK2UnitTestBase.ewk_auth_request_cancel API test is failing after r133389 + https://bugs.webkit.org/show_bug.cgi?id=101203 + + Reviewed by Kenneth Rohde Christiansen. + + Attempt for continue without credential when the client cancels + authentication (or does not handle the authentication request) + instead of cancelling the load. We now get a 402 error when + when cancelling the authentication, which is the behavior we + want (and the behavior we used to have before r133389). + + * UIProcess/API/efl/ewk_auth_request.cpp: + (Ewk_Auth_Request::~Ewk_Auth_Request): + (Ewk_Auth_Request::continueWithoutCredential): + (ewk_auth_request_cancel): + * UIProcess/API/efl/ewk_auth_request_private.h: + (Ewk_Auth_Request): + * UIProcess/API/efl/tests/test_ewk2_auth_request.cpp: + (TEST_F): + +2012-11-05 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] The icon database path should be set by the client + https://bugs.webkit.org/show_bug.cgi?id=101182 + + Reviewed by Kenneth Rohde Christiansen. + + No longer set the favicon database path in database instance getter. + Instead, a new ewk_context_favicon_database_directory_set() API + function was added to let the client set the icon database path. + This is needed because the icon database path can only be set once + and setting it unconditionally in the getter prevents the client + from setting it. + + This will also avoid crashes in WebKitTestRunner since WKTR was + setting the path once and ewk_context was attempting to override it. + + Note that the favicon database functionality is disabled until the + client sets its path. + + * UIProcess/API/efl/ewk_context.cpp: + (Ewk_Context::ensureFaviconDatabase): + (Ewk_Context::setFaviconDatabaseDirectoryPath): + (Ewk_Context::faviconDatabase): + (ewk_context_favicon_database_directory_set): + * UIProcess/API/efl/ewk_context.h: + * UIProcess/API/efl/ewk_context_private.h: + (Ewk_Context): + * UIProcess/API/efl/ewk_favicon_database.cpp: + (Ewk_Favicon_Database::Ewk_Favicon_Database): + (Ewk_Favicon_Database::~Ewk_Favicon_Database): + (Ewk_Favicon_Database::iconURLForPageURL): + (Ewk_Favicon_Database::iconForPageURL): + (Ewk_Favicon_Database::getIconSurfaceSynchronously): + * UIProcess/API/efl/ewk_favicon_database_private.h: + (WebKit): + (Ewk_Favicon_Database::create): + (Ewk_Favicon_Database): + * UIProcess/API/efl/tests/test_ewk2_favicon_database.cpp: + (TEST_F): + +2012-11-04 Halton Huo <halton.huo@intel.com> + + [EFL] Use _LIBRARIES instead of _LIBRARY + https://bugs.webkit.org/show_bug.cgi?id=101042 + + Reviewed by Gyuyoung Kim. + + In CMake Find files, _LIBRARY is intended for internal use, should + use _LIBRARIES instead. + + * PlatformEfl.cmake: s/_LIBRARY}/_LIBRARIES} + +2012-11-04 Jon Lee <jonlee@apple.com> + + Expose security origin to BundleFrame + https://bugs.webkit.org/show_bug.cgi?id=101139 + <rdar://problem/12629900> + + Reviewed by Darin Adler. + + Create a WebSecurityOrigin instance, sharing the security origin instance + that comes directly from the frame's document. We can do this because the + WK2 API only retrieves information about the origin, and because those + results are returned as copies. The security origin holds no references + that could lead to a retain cycle, avoiding the possibility that the + injected bundle accidentally keeps something alive. + + * Shared/API/c/WKSharedAPICast.h: + (WebKit::toCopiedAPI): Create copied API for WebCore::SecurityOrigin + instances. + * Shared/WebSecurityOrigin.h: + (WebKit::WebSecurityOrigin::create): Add a new create() function that + takes a PassRefPtr to a WebCore SecurityOrigin instance. + (WebKit::WebSecurityOrigin::createFromString): Refactor to use new create() + function. + (WebKit::WebSecurityOrigin::createFromDatabaseIdentifier): Refactor to + use new create() function. + (WebKit::WebSecurityOrigin::create): Refactor to use new create() + function. + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameCopySecurityOrigin): Add function to retrieve the security + origin as a WK2 API object. + * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: + +2012-11-02 Kenneth Rohde Christiansen <kenneth@webkit.org> + + [EFL] Unify transforms in WK2 + https://bugs.webkit.org/show_bug.cgi?id=101051 + + Reviewed by Simon Hausmann. + + Move our transforms into EwkViewImpl and use them + everywhere needed. + + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::smartData): + (EwkViewImpl::transformFromScene): + (EwkViewImpl::transformToScene): + (EwkViewImpl::transformToScreen): + (EwkViewImpl::displayTimerFired): + * UIProcess/API/efl/EwkViewImpl.h: + (WebCore): + (EwkViewImpl): + (EwkViewImpl::pageViewportControllerClient): + (EwkViewImpl::pageViewportController): + * UIProcess/API/efl/ewk_view.cpp: + (_ewk_view_smart_mouse_wheel): + (_ewk_view_smart_mouse_down): + (_ewk_view_smart_mouse_up): + (_ewk_view_smart_mouse_move): + (ewk_view_feed_touch_event): + +2012-11-03 Alexey Proskuryakov <ap@apple.com> + + Get rid of USE(CFURLSTORAGESESSIONS) + https://bugs.webkit.org/show_bug.cgi?id=101131 + + Reviewed by Sam Weinig. + + * Shared/WebProcessCreationParameters.cpp: + (WebKit::WebProcessCreationParameters::encode): + (WebKit::WebProcessCreationParameters::decode): + * Shared/WebProcessCreationParameters.h: + (WebProcessCreationParameters): + * UIProcess/win/WebContextWin.cpp: + (WebKit::WebContext::platformInitializeWebProcess): + * WebProcess/Cookies/mac/WebCookieManagerMac.mm: + (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy): + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::switchNetworkLoaderToNewTestingSession): + * WebProcess/WebPage/mac/WebPageMac.mm: + (WebKit::WebPage::platformHasLocalDataForURL): + (WebKit::cachedResponseForURL): + * WebProcess/WebPage/win/WebPageWin.cpp: + (WebKit::cachedResponseForURL): + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::initializeWebProcess): + * WebProcess/win/WebProcessWin.cpp: + (WebKit::WebProcess::platformSetCacheModel): + (WebKit::WebProcess::platformClearResourceCaches): + +2012-11-03 Pavel Feldman <pfeldman@chromium.org> + + REGRESSION (r132014-r132047): Webkit Inspector Window docking broken + https://bugs.webkit.org/show_bug.cgi?id=101125 + + Reviewed by Vsevolod Vlasov. + + Migrated from ?docked= to ?dockSide= format. + + * UIProcess/WebInspectorProxy.cpp: + (WebKit::WebInspectorProxy::createInspectorPage): + +2012-10-25 Martin Robinson <mrobinson@igalia.com> + + [GTK] Move soup authentication from GtkAuthenticationDialog to WebCore + https://bugs.webkit.org/show_bug.cgi?id=99914 + + Reviewed by Carlos Garcia Campos. + + Instead of passing the libsoup objects to the GtkAuthenticationDialog, pass the + AuthenticationChallenge itself. + + * WebProcess/WebCoreSupport/gtk/WebFrameLoaderClientGtk.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge): + +2012-11-02 Anders Carlsson <andersca@apple.com> + + Very speculative ArgumentDecoder crash fix + https://bugs.webkit.org/show_bug.cgi?id=101130 + <rdar://problem/11917046> + + Reviewed by Sam Weinig. + + Switch from fastMalloc/fastFree to system malloc/free in the hopes that it'll give more information about + a crash inside TCMalloc when freeing the argument data. (It seems unlikely that this is a bug in TCMalloc, but + switching to the system malloc could potentially give better error reporting). + + * Platform/CoreIPC/ArgumentDecoder.cpp: + (CoreIPC::ArgumentDecoder::~ArgumentDecoder): + (CoreIPC::ArgumentDecoder::initialize): + +2012-11-02 Anders Carlsson <andersca@apple.com> + + Don't instantiate the Java plug-in if it's inactive + https://bugs.webkit.org/show_bug.cgi?id=101102 + <rdar://problem/12595679> + + Reviewed by Andreas Kling. + + * Shared/Plugins/PluginModuleInfo.h: + Add a PluginModuleLoadPolicy enum. + + * UIProcess/Plugins/PluginInfoStore.cpp: + (WebKit::PluginInfoStore::policyForPlugin): + * UIProcess/Plugins/PluginInfoStore.h: + (PluginInfoStore): + Rename shouldBlockPlugin to policyForPlugin and make it return an enum so we can handle inactive plug-ins. + + * UIProcess/Plugins/mac/PluginInfoStoreMac.mm: + (WebKit::shouldBlockPlugin): + Add helper function. + + (WebKit::PluginInfoStore::policyForPlugin): + If the Java plug-in is inactive, return PluginModuleInactive. + + (WebKit::PluginInfoStore::reactivateInactivePlugin): + If the given plug-in is the Java plug-in, call WKJLReportWebComponentsUsed() to reactivate it. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::unavailablePluginButtonClicked): + If the plug-in is inactive, try to reactivate it and reload the page if reactivation succeeded. + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::getPluginPath): + * UIProcess/WebProcessProxy.h: + This now returns a plug-in load policy. + + * UIProcess/WebProcessProxy.messages.in: + GetPluginPack now returns a load policy enum. + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::shouldUnavailablePluginMessageBeButton): + Change this to a switch statement and always return true for RenderEmbeddedObject::PluginInactive. + + (WebKit::WebChromeClient::unavailablePluginButtonClicked): + Add RenderEmbeddedObject::PluginInactive to the assertion. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::createPlugin): + Update now that GetPluginPath returns a pluginLoadPolicy enum. + + (WebKit::canPluginHandleResponse): + Ditto. + +2012-11-02 Alexey Proskuryakov <ap@apple.com> + + [Mac] ResourceHandle changes for network process + https://bugs.webkit.org/show_bug.cgi?id=101111 + + Reviewed by Jessie Berlin. + + * NetworkProcess/mac/NetworkProcessMainMac.mm: (WebKit::NetworkProcessMain): + We want to use WebKitSystemInterface in network process. + * NetworkProcess/mac/RemoteNetworkingContext.h: + (WebKit::RemoteNetworkingContext::create): Added a constructor and a create function. + Switched from scheduledRunLoopPairs() to the new scheduledOperationQueue(). + + * NetworkProcess/mac/RemoteNetworkingContext.mm: + (WebKit::RemoteNetworkingContext::RemoteNetworkingContext): + (WebKit::RemoteNetworkingContext::scheduledOperationQueue): + Ditto. + +2012-11-02 Simon Fraser <simon.fraser@apple.com> + + Enable SUBPIXEL_LAYOUT on Mac + https://bugs.webkit.org/show_bug.cgi?id=101076 + + Reviewed by Dave Hyatt. + + Define ENABLE_SUBPIXEL_LAYOUT and include it in FEATURE_DEFINES. + + * Configurations/FeatureDefines.xcconfig: + +2012-11-02 Anders Carlsson <andersca@apple.com> + + Add a PluginInactive plug-in unavailability reason + https://bugs.webkit.org/show_bug.cgi?id=101089 + + Reviewed by Sam Weinig. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::unavailablePluginButtonClicked): + +2012-11-02 Adam Barth <abarth@webkit.org> + + ENABLE(UNDO_MANAGER) is disabled everywhere and is not under active development + https://bugs.webkit.org/show_bug.cgi?id=100711 + + Reviewed by Eric Seidel. + + * Configurations/FeatureDefines.xcconfig: + +2012-11-02 Christophe Dumez <christophe.dumez@intel.com> + + [WK2][EFL] Crash when calling WebOpenPanelResultListenerProxy::cancel() after PageClient is destroyed + https://bugs.webkit.org/show_bug.cgi?id=100977 + + Reviewed by Alexey Proskuryakov. + + Call WebPageProxy::close() in EwkViewImpl's destructor to avoid crashes + if other objects keep a reference to the WebPageProxy and try to use + it after the view (and therefore the PageClient) is destroyed. + + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::~EwkViewImpl): + +2012-11-02 Martin Robinson <mrobinson@igalia.com> + + [GTK] Remove dependency on SoupPasswordManager + https://bugs.webkit.org/show_bug.cgi?id=100775 + + Reviewed by Carlos Garcia Campos. + + Add a libsecret dependency to the build. This is necessary so that we can remove + a dependency on SoupPasswordManager. + + * GNUmakefile.am: Add libsecret CFLAGS to the WebKit2 build. + +2012-11-02 Byungwoo Lee <bw80.lee@samsung.com> + + [EFL][WK2] Change the scope of locking in WorkQueueEfl.cpp. + https://bugs.webkit.org/show_bug.cgi?id=98978 + + Reviewed by Kenneth Rohde Christiansen. + + Release the m_workItemQueueLock and m_timerWorkItemsLock mutexes + immediately after the protected resource is no longer modified to + prevent a possible source of a deadlock. + + And additional mutex locker for the m_writeToPipeDescriptor is added + to ensure thread-safety of the sendMessageToThread() function. + + * Platform/WorkQueue.h: + (WorkQueue): + * Platform/efl/WorkQueueEfl.cpp: + (WorkQueue::insertTimerWorkItem): + (WorkQueue::performTimerWork): + (WorkQueue::sendMessageToThread): + (WorkQueue::dispatch): + (WorkQueue::dispatchAfterDelay): + +2012-11-02 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][WK2] Add API unit tests for Ewk_Object + https://bugs.webkit.org/show_bug.cgi?id=101037 + + Reviewed by Kenneth Rohde Christiansen. + + Added API unit tests for Ewk_Object. + + * PlatformEfl.cmake: + * UIProcess/API/efl/tests/test_ewk2_object.cpp: Added. + (TestEwkObject1): + (TestEwkObject1::create): + (TestEwkObject1::~TestEwkObject1): + (TestEwkObject2): + (TestEwkObject2::create): + (TEST_F): + +2012-11-02 Sudarsana Nagineni <sudarsana.nagineni@intel.com> + + REGRESSION (r133075): plugins/plugin-javascript-access.html is failing + https://bugs.webkit.org/show_bug.cgi?id=101045 + + Reviewed by Kenneth Rohde Christiansen. + + Encode the plugin filename in ArgumentCoder<PluginInfo> so that + plugin.filename returns the filename instead of name of the plugin. + + * Shared/WebCoreArgumentCoders.cpp: + (CoreIPC::::encode): + +2012-11-01 Yael Aharon <yael.aharon@intel.com> + + [EFL][WK2][AC] Wrong translation of mouse events + https://bugs.webkit.org/show_bug.cgi?id=100983 + + Reviewed by Kenneth Rohde Christiansen. + + The transform that we build for mouse events is scaled by the scale factor. + The url bar should not be scaled, so it should be scaled in the oposite + direction to compensate for that. + + * UIProcess/API/efl/ewk_view.cpp: + (toWebContentTransform): + +2012-11-02 Andras Becsi <andras.becsi@digia.com> + + [Qt][WK2] Add missing variable initialization in PageViewportController + + Reviewed by Jocelyn Turcotte. + + Updating the viewport state depends on uninitialized booleans + which it should not. + + * UIProcess/PageViewportController.cpp: + (WebKit::PageViewportController::PageViewportController): + +2012-11-02 Byungwoo Lee <bw80.lee@samsung.com> + + [EFL][WK2] Use MutexLocker instead of lock()/unlock(). + https://bugs.webkit.org/show_bug.cgi?id=101015 + + Reviewed by Kenneth Rohde Christiansen. + + Instead of lock()/unlock(), use MutexLocker in WorkQueue::performWork() + and WorkQueue::performTimerWork(). + + The locking scope will be more clear and simple with using MutexLocker. + + * Platform/efl/WorkQueueEfl.cpp: + (WorkQueue::performWork): + (WorkQueue::insertTimerWorkItem): + (WorkQueue::performTimerWork): + (WorkQueue::dispatchAfterDelay): + +2012-11-02 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][WK2] Common ref and unref functions for EFL WK2 objects + https://bugs.webkit.org/show_bug.cgi?id=100751 + + Reviewed by Kenneth Rohde Christiansen. + + Added common Ewk_Object class with ref/unref API also added several aux functions for safe + Ewk_Object conversion. Used new approach on ewk_back_forward_list_item as example. + + * PlatformEfl.cmake: + * UIProcess/API/efl/EWebKit2.h: + * UIProcess/API/efl/ewk_back_forward_list.cpp: + (Ewk_Back_Forward_List::getFromCacheOrCreate): + (Ewk_Back_Forward_List::createEinaList): + * UIProcess/API/efl/ewk_back_forward_list_item.cpp: + (EwkBackForwardListItem::EwkBackForwardListItem): + (EwkBackForwardListItem::url): + (EwkBackForwardListItem::title): + (EwkBackForwardListItem::originalURL): + (ewk_back_forward_list_item_url_get): + (ewk_back_forward_list_item_title_get): + (ewk_back_forward_list_item_original_url_get): + * UIProcess/API/efl/ewk_back_forward_list_item.h: + * UIProcess/API/efl/ewk_back_forward_list_item_private.h: + (EwkBackForwardListItem): + (EwkBackForwardListItem::create): + * UIProcess/API/efl/ewk_back_forward_list_private.h: + * UIProcess/API/efl/ewk_object.cpp: Copied from Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item_private.h. + (ewk_object_ref): + (ewk_object_unref): + * UIProcess/API/efl/ewk_object.h: Copied from Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item_private.h. + * UIProcess/API/efl/ewk_object_private.h: Added. + (Ewk_Object): + (Ewk_Object::~Ewk_Object): + (ewk_object_is_of_type): + (ewk_object_cast_check): + (ewk_object_cast): + * UIProcess/API/efl/tests/test_ewk2_back_forward_list.cpp: + (freeEinaList): + +2012-11-02 Nandor Huszka <hnandor@inf.u-szeged.hu> + + [Qt][Mac][Win] Unreviewed build fix after r133182 + https://bugs.webkit.org/show_bug.cgi?id=100995 + + Remove two methods' OVERRIDE and virtual modifiers, because they cannot be found in any base class. + Also relocate their prototypes, because they mix with the overridden ones. + + * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h: + (CoordinatedGraphicsLayer): + +2012-11-02 Jihye Kang <jye.kang@samsung.com> + + [EFL][WK2] Add ewk_security_origin and ewk_storage_manager APIs + https://bugs.webkit.org/show_bug.cgi?id=92827 + + Reviewed by Gyuyoung Kim. + + Add ewk_security_origin APIs to get security origin. + These APIs will be used to get host, protocol and port of security + origin. + Add ewk_storage_manager to manage web storage and + ewk_storage_manager_origins_get to get origins list of web storage. + Add Unit tests for ewk_storage_manager and ewk_security_origin APIs. + + * PlatformEfl.cmake: + * UIProcess/API/efl/EWebKit2.h: + * UIProcess/API/efl/ewk_context.cpp: + (Ewk_Context::storageManager): + (ewk_context_storage_manager_get): + * UIProcess/API/efl/ewk_context.h: + * UIProcess/API/efl/ewk_context_private.h: + (Ewk_Context): + * UIProcess/API/efl/ewk_security_origin.cpp: Added. + (Ewk_Security_Origin::Ewk_Security_Origin): + (Ewk_Security_Origin::host): + (Ewk_Security_Origin::protocol): + (Ewk_Security_Origin::port): + (ewk_security_origin_ref): + (ewk_security_origin_unref): + (ewk_security_origin_host_get): + (ewk_security_origin_protocol_get): + (ewk_security_origin_port_get): + * UIProcess/API/efl/ewk_security_origin.h: Added. + * UIProcess/API/efl/ewk_security_origin_private.h: Added. + (Ewk_Security_Origin): + (Ewk_Security_Origin::create): + * UIProcess/API/efl/ewk_storage_manager.cpp: Added. + (Ewk_Storage_Manager::Ewk_Storage_Manager): + (Ewk_Storage_Manager::getStorageOrigins): + (Ewk_Storage_Manager::createOriginList): + (_Ewk_Storage_Origins_Async_Get_Context): + (_Ewk_Storage_Origins_Async_Get_Context::_Ewk_Storage_Origins_Async_Get_Context): + (getStorageOriginsCallback): + (ewk_storage_manager_origins_get): + * UIProcess/API/efl/ewk_storage_manager.h: Added. + * UIProcess/API/efl/ewk_storage_manager_private.h: Added. + (Ewk_Storage_Manager): + (Ewk_Storage_Manager::create): + * UIProcess/API/efl/tests/test_ewk2_context.cpp: + (TEST_F): + * UIProcess/API/efl/tests/test_ewk2_storage_manager.cpp: Added. + (getStorageOriginsCallback): + (TEST_F): + +2012-11-02 Huang Dongsung <luxtella@company100.net> + + Coordinated Graphics: Manage the lifecycle of shareable surfaces precisely. + https://bugs.webkit.org/show_bug.cgi?id=100797 + + Reviewed by Noam Rosenthal. + + Internal Review by Gwang Yoon Hwang and Jae Hyun Park. + + This patch makes UpdateAtlas manage the lifecycle of shareable surfaces + containing the updates in the way how CoordinatedTile manages the lifecycle of + tiles. Currently, UI Process creates the shareable surface when receiving an + UpdateTileForLayer message, but there is no exact point to remove the shareable + surface. Now, we introduce new two messages to handle the lifecycle: + CreateUpdateAtlas and RemoveUpdateAtlas. + + This patch gives us two benefits. + 1. Reduce file and mmap operations. Web Process does not need to duplicate a + file handle every tile update. UI Process does not need to create a + ShareableSurface every UpdateTileForLayer message. + 2. Save memory. We can remove a ShareableSurface in UI Process when UpdateAtlas + in Web Process is removed. + + * Shared/SurfaceUpdateInfo.cpp: + (WebKit::SurfaceUpdateInfo::encode): + (WebKit::SurfaceUpdateInfo::decode): + * Shared/SurfaceUpdateInfo.h: + (SurfaceUpdateInfo): + * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp: + (WebKit::LayerTreeCoordinatorProxy::updateTileForLayer): + (WebKit::LayerTreeCoordinatorProxy::createUpdateAtlas): + (WebKit): + (WebKit::LayerTreeCoordinatorProxy::removeUpdateAtlas): + (WebKit::LayerTreeCoordinatorProxy::purgeBackingStores): + * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h: + (LayerTreeCoordinatorProxy): + * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in: + * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp: + (WebCore::CoordinatedGraphicsLayer::beginContentUpdate): + * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h: + (CoordinatedGraphicsLayerClient): + (CoordinatedGraphicsLayer): + * WebProcess/WebPage/CoordinatedGraphics/CoordinatedTile.cpp: + (WebKit::CoordinatedTile::updateBackBuffer): + * WebProcess/WebPage/CoordinatedGraphics/CoordinatedTile.h: + (CoordinatedTileClient): + * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp: + (WebKit::LayerTreeCoordinator::createUpdateAtlas): + (WebKit): + (WebKit::LayerTreeCoordinator::removeUpdateAtlas): + (WebKit::LayerTreeCoordinator::beginContentUpdate): + * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h: + (LayerTreeCoordinator): + * WebProcess/WebPage/UpdateAtlas.cpp: + (WebKit::UpdateAtlas::UpdateAtlas): + (WebKit): + (WebKit::UpdateAtlas::~UpdateAtlas): + (WebKit::UpdateAtlas::beginPaintingOnAvailableBuffer): + * WebProcess/WebPage/UpdateAtlas.h: + (UpdateAtlasClient): + (WebKit): + (UpdateAtlas): + +2012-11-02 Jinwoo Song <jinwoo7.song@samsung.com> + + [EFL][WK2] Remove redundant internal function + https://bugs.webkit.org/show_bug.cgi?id=100969 + + Reviewed by Gyuyoung Kim. + + Remove ewk_view_text_found() in ewk_view.cpp which is not used anymore. + Now, "text,found" signal is emitted by DECLARE_EWK_VIEW_CALLBACK(TextFound, "text,found", unsigned) + in EwkViewCallback.h + + * UIProcess/API/efl/ewk_view.cpp: + +2012-11-01 Anders Carlsson <andersca@apple.com> + + Reformat the annotationStyle initializer to appease update-webkit-localizable-strings. + + Rubber-stamped by Dan Bernstein. + + * WebProcess/Plugins/PDF/PDFPlugin.mm: + +2012-11-01 Alexandru Chiculita <achicu@adobe.com> + + [CSS Shaders] Move MeshBoxType out of CustomFilterOperation + https://bugs.webkit.org/show_bug.cgi?id=100782 + + Reviewed by Dean Jackson. + + Renamed the CustomFilterOperation::MeshBoxType to CustomFilterMeshBoxType. + + * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp: + (CoreIPC::::decode): + +2012-11-01 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=100917 + There should be a way to dump the scrolling tree from the layout tests + + Reviewed by Simon Fraser. + + * win/WebKit2.def: + * win/WebKit2CFLite.def: + +2012-11-01 Huang Dongsung <luxtella@company100.net> + + Coordinated Graphics: Clean up headers of Coordinated Graphics. + https://bugs.webkit.org/show_bug.cgi?id=100907 + + Reviewed by Noam Rosenthal. + + This patch performs: + 1. Remove unused methods. + 2. Change public methods to private if needed. + 3. Put virtual, OVERRIDE and explicit keywords if needed. + + * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h: + (LayerTreeCoordinatorProxy): + * UIProcess/CoordinatedGraphics/LayerTreeRenderer.h: + (LayerTreeRenderer): + * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp: + * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h: + (CoordinatedGraphicsLayer): + (WebCore::CoordinatedGraphicsLayer::fixedToViewport): + (WebCore::CoordinatedGraphicsLayer::setMaskTarget): + * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h: + (LayerTreeCoordinator): + +2012-11-01 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Add Ewk_Auth_Request API + https://bugs.webkit.org/show_bug.cgi?id=100858 + + Reviewed by Kenneth Rohde Christiansen. + + Add Ewk_Auth_Request API for the client to handle + HTTP authentication. + + * PlatformEfl.cmake: + * UIProcess/API/efl/EWebKit2.h: + * UIProcess/API/efl/EwkViewCallbacks.h: + (EwkViewCallbacks): + * UIProcess/API/efl/ewk_auth_request.cpp: Added. + (Ewk_Auth_Request::Ewk_Auth_Request): + (Ewk_Auth_Request::~Ewk_Auth_Request): + (Ewk_Auth_Request::suggestedUsername): + (Ewk_Auth_Request::realm): + (Ewk_Auth_Request::host): + (Ewk_Auth_Request::cancel): + (Ewk_Auth_Request::authenticate): + (Ewk_Auth_Request::isRetrying): + (ewk_auth_request_ref): + (ewk_auth_request_unref): + (ewk_auth_request_suggested_username_get): + (ewk_auth_request_cancel): + (ewk_auth_request_authenticate): + (ewk_auth_request_retrying_get): + (ewk_auth_request_realm_get): + (ewk_auth_request_host_get): + * UIProcess/API/efl/ewk_auth_request.h: Added. + * UIProcess/API/efl/ewk_auth_request_private.h: Added. + (WebKit): + (Ewk_Auth_Request): + (Ewk_Auth_Request::create): + * UIProcess/API/efl/ewk_view.h: + * UIProcess/API/efl/tests/test_ewk2_auth_request.cpp: Added corresponding API tests. + (serverCallback): + (onAuthenticationRequest): + (TEST_F): + (onResourceLoadResponse): + * UIProcess/efl/PageLoadClientEfl.cpp: + (WebKit::PageLoadClientEfl::didReceiveAuthenticationChallengeInFrame): + (WebKit): + (WebKit::PageLoadClientEfl::PageLoadClientEfl): + * UIProcess/efl/PageLoadClientEfl.h: + (PageLoadClientEfl): + +2012-11-01 Jocelyn Turcotte <jocelyn.turcotte@digia.com> + + Fix the Mac breakage + https://bugs.webkit.org/show_bug.cgi?id=100383 + + Reviewed by Kenneth Rohde Christiansen. + + acceleratedCompositingForFixedPositionEnabled needs to be enabled + for fixed layout to work efficiently but it's wrong to force it + to false if fixed layout isn't enabled. + + Separate hard requirements for fixed layout from rendering optimizations + and guard the later with USE(COORDINATED_GRAPHICS). + Also add an early return to make sure that ports always having a false + useFixedLayout creation parameter won't get their settings adjusted. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::setUseFixedLayout): + +2012-10-24 Jocelyn Turcotte <jocelyn.turcotte@digia.com> + + WebIconDatabase: Properly clean up on destruction + https://bugs.webkit.org/show_bug.cgi?id=100237 + + Reviewed by Brady Eidson. + + * UIProcess/WebIconDatabase.cpp: + (WebKit::WebIconDatabase::invalidate): + Make sure that IconDatabaseBase::iconDatabase won't return a dangling pointer. + +2012-11-01 Kenneth Rohde Christiansen <kenneth@webkit.org> + + [EFL] Fix event mapping for WebKit2 with coordinated graphics + https://bugs.webkit.org/show_bug.cgi?id=100956 + + Reviewed by Alexis Menard. + + Apply scale after translation. + + * UIProcess/API/efl/ewk_view.cpp: + (toWebContentTransform): + +2012-11-01 Kenneth Rohde Christiansen <kenneth@webkit.org> + + [EFL] Correct our use of the coordinated graphics + https://bugs.webkit.org/show_bug.cgi?id=100947 + + Reviewed by Alexis Menard. + + Replace the display(...) call with a regular update() on the view. + In the coordinated graphics case this updates our view using + paintToCurrentGLContext with our viewmodel matrix and clips it to + the viewport. This avoid the need to manually joining update regions. + + Unneeded update calls have also been removed and the resizing + logic has been improved. + + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::displayTimerFired): + (EwkViewImpl::update): + * UIProcess/API/efl/EwkViewImpl.h: + (WebCore): + (EwkViewImpl): + (EwkViewImpl::clearEvasGLSurface): + * UIProcess/API/efl/ewk_view.cpp: + (_ewk_view_smart_calculate): + * UIProcess/efl/PageClientImpl.cpp: + (WebKit::PageClientImpl::setViewNeedsDisplay): + * UIProcess/efl/PageViewportControllerClientEfl.cpp: + (WebKit::PageViewportControllerClientEfl::setVisibleContentsRect): + (WebKit::PageViewportControllerClientEfl::didChangeContentsSize): + (WebKit::PageViewportControllerClientEfl::didChangeVisibleContents): + * UIProcess/efl/PageViewportControllerClientEfl.h: + (PageViewportControllerClientEfl): + +2012-11-01 Jocelyn Turcotte <jocelyn.turcotte@digia.com> + + [Qt] Double clicks/taps aren't passed down to the page + https://bugs.webkit.org/show_bug.cgi?id=100949 + + Reviewed by Kenneth Rohde Christiansen. + + Since we are passing double click events as press events and that + they are preceeded by a real press event, double clicks are passed + down to the page as triple clicks. + + Ignore double click events and let WebCore::EventHandler handle it + through press and release events. + + * Shared/qt/WebEventFactoryQt.cpp: + (WebKit::webEventTypeForEvent): + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebViewPrivate::handleMouseEvent): + * UIProcess/qt/QtWebPageEventHandler.cpp: + (WebKit::QtWebPageEventHandler::handleInputEvent): + +2012-11-01 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [AC][EFL][WK2] Rename PageViewportControllerClientEfl::m_pageViewportController to m_controller + https://bugs.webkit.org/show_bug.cgi?id=100933 + + Reviewed by Kenneth Rohde Christiansen. + + PageViewportControllerClientEfl::m_pageViewportController has to be renamed to m_controller + to keep consistency with other ports. Assertinons were also added. + + * UIProcess/efl/PageViewportControllerClientEfl.cpp: + (WebKit::PageViewportControllerClientEfl::PageViewportControllerClientEfl): + (WebKit::PageViewportControllerClientEfl::updateViewportSize): + (WebKit::PageViewportControllerClientEfl::setVisibleContentsRect): + (WebKit::PageViewportControllerClientEfl::didResumeContent): + (WebKit::PageViewportControllerClientEfl::setController): + * UIProcess/efl/PageViewportControllerClientEfl.h: + (PageViewportControllerClientEfl): + +2012-11-01 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r133126. + http://trac.webkit.org/changeset/133126 + https://bugs.webkit.org/show_bug.cgi?id=100925 + + This made EFL API test break on EFL buildbots (Requested by + gyuyoung on #webkit). + + * PlatformEfl.cmake: + * UIProcess/API/efl/EWebKit2.h: + * UIProcess/API/efl/ewk_context.cpp: + (Ewk_Context::Ewk_Context): + * UIProcess/API/efl/ewk_context.h: + * UIProcess/API/efl/ewk_context_private.h: + (Ewk_Context): + * UIProcess/API/efl/ewk_security_origin.cpp: Removed. + * UIProcess/API/efl/ewk_security_origin.h: Removed. + * UIProcess/API/efl/ewk_security_origin_private.h: Removed. + * UIProcess/API/efl/ewk_storage_manager.cpp: Removed. + * UIProcess/API/efl/ewk_storage_manager.h: Removed. + * UIProcess/API/efl/ewk_storage_manager_private.h: Removed. + * UIProcess/API/efl/tests/test_ewk2_context.cpp: + * UIProcess/API/efl/tests/test_ewk2_storage_manager.cpp: Removed. + +2012-11-01 Yuni Jeong <yhnet.jung@samsung.com> + + [WK2] Add APIs to get/set encoding detector + https://bugs.webkit.org/show_bug.cgi?id=100066 + + Reviewed by Gyuyoung Kim. + + Add setting APIs for encoding dector and a unit test. + + * Shared/WebPreferencesStore.h: + (WebKit): + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesSetUsesEncodingDetector): + (WKPreferencesGetUsesEncodingDetector): + * UIProcess/API/C/WKPreferences.h: + * UIProcess/API/efl/ewk_settings.cpp: + (ewk_setting_uses_encoding_detector_set): + (ewk_setting_uses_encoding_detector_get): + * UIProcess/API/efl/ewk_settings.h: + * UIProcess/API/efl/tests/test_ewk2_settings.cpp: + (TEST_F): + +2012-10-31 Jihye Kang <jye.kang@samsung.com> + + [EFL][WK2] Add ewk_security_origin and ewk_storage_manager APIs + https://bugs.webkit.org/show_bug.cgi?id=92827 + + Reviewed by Gyuyoung Kim. + + Add ewk_security_origin APIs to get security origin. + These APIs will be used to get host, protocol and port of security + origin. + Add ewk_storage_manager to manage web storage and + ewk_storage_manager_origins_get to get origins list of web storage. + Add Unit tests for ewk_storage_manager and ewk_security_origin APIs. + + * PlatformEfl.cmake: + * UIProcess/API/efl/EWebKit2.h: + * UIProcess/API/efl/ewk_context.cpp: + (Ewk_Context::storageManager): + (ewk_context_storage_manager_get): + * UIProcess/API/efl/ewk_context.h: + * UIProcess/API/efl/ewk_context_private.h: + (Ewk_Context): + * UIProcess/API/efl/ewk_security_origin.cpp: Added. + (Ewk_Security_Origin::Ewk_Security_Origin): + (Ewk_Security_Origin::host): + (Ewk_Security_Origin::protocol): + (Ewk_Security_Origin::port): + (ewk_security_origin_ref): + (ewk_security_origin_unref): + (ewk_security_origin_host_get): + (ewk_security_origin_protocol_get): + (ewk_security_origin_port_get): + * UIProcess/API/efl/ewk_security_origin.h: Added. + * UIProcess/API/efl/ewk_security_origin_private.h: Added. + (Ewk_Security_Origin): + (Ewk_Security_Origin::create): + * UIProcess/API/efl/ewk_storage_manager.cpp: Added. + (Ewk_Storage_Manager::Ewk_Storage_Manager): + (Ewk_Storage_Manager::getStorageOrigins): + (Ewk_Storage_Manager::createOriginList): + (_Ewk_Storage_Origins_Async_Get_Context): + (_Ewk_Storage_Origins_Async_Get_Context::_Ewk_Storage_Origins_Async_Get_Context): + (getStorageOriginsCallback): + (ewk_storage_manager_origins_get): + * UIProcess/API/efl/ewk_storage_manager.h: Added. + * UIProcess/API/efl/ewk_storage_manager_private.h: Added. + (Ewk_Storage_Manager): + (Ewk_Storage_Manager::create): + * UIProcess/API/efl/tests/test_ewk2_context.cpp: + (TEST_F): + * UIProcess/API/efl/tests/test_ewk2_storage_manager.cpp: Added. + (getStorageOriginsCallback): + (TEST_F): + +2012-10-31 Alexandru Chiculita <achicu@adobe.com> + + CustomFilterOperation parameters list is not decoded correctly in CoordinatedGraphicsArgumentCoders + https://bugs.webkit.org/show_bug.cgi?id=100889 + + Reviewed by Noam Rosenthal. + + The custom filters parameters list was initialized with a specific size and then + the decoder was expected to fill it with all the decoded parameters. The decoder was + using the append command which added the paramters at the end, so it doubled the size + of the vector leaving empty spaces at the beginning of the list. Fixed it by writting + directly into the allocated space. + + No new tests, the code path is not activated yet. + + * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp: + (CoreIPC::::decode): + +2012-10-31 Sam Weinig <sam@webkit.org> + + Convert the rest of the encoders to take the encoder as a reference + https://bugs.webkit.org/show_bug.cgi?id=100821 + + Reviewed by Anders Carlsson. + + * Platform/CoreIPC/ArgumentCoders.h: + (CoreIPC::SimpleArgumentCoder::encode): + * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp: + (CoreIPC::::encode): + (CoreIPC::encodeTimingFunction): + * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.h: + * Shared/PrintInfo.cpp: + (WebKit::PrintInfo::encode): + * Shared/SessionState.cpp: + * Shared/UserMessageCoders.h: + (WebKit::UserMessageDecoder::baseDecode): + * Shared/WebCoreArgumentCoders.cpp: + (CoreIPC::::encode): + * Shared/WebCoreArgumentCoders.h: + * Shared/WebGeolocationPosition.cpp: + (WebKit::WebGeolocationPosition::Data::encode): + * Shared/WebLayerTreeInfo.cpp: + (WebKit::WebLayerInfo::encode): + * Shared/gtk/ArgumentCodersGtk.cpp: + (CoreIPC::encodeImage): + (CoreIPC::encodeDataObject): + (CoreIPC::::encode): + (CoreIPC::encodeGKeyFile): + (CoreIPC::encode): + * Shared/gtk/ArgumentCodersGtk.h: + * Shared/mac/WebCoreArgumentCodersMac.mm: + (CoreIPC::::encodePlatformData): + (CoreIPC::::encode): + * Shared/qt/ArgumentCodersQt.cpp: + (CoreIPC::::encode): + * Shared/qt/ArgumentCodersQt.h: + (CoreIPC): + * Shared/qt/WebCoreArgumentCodersQt.cpp: + (CoreIPC::::encodePlatformData): + * Shared/soup/WebCoreArgumentCodersSoup.cpp: + (CoreIPC::::encodePlatformData): + * Shared/win/WebCoreArgumentCodersWin.cpp: + (CoreIPC::::encodePlatformData): + * WebProcess/WebPage/DecoderAdapter.cpp: + (WebKit::DecoderAdapter::decodeBytes): + * WebProcess/WebPage/EncoderAdapter.cpp: + (WebKit::EncoderAdapter::encodeBytes): + +2012-10-31 Jesse van den Kieboom <jessevdk@gnome.org> + + Enable webkit2 introspection + https://bugs.webkit.org/show_bug.cgi?id=94313 + + Reviewed by Martin Robinson. + + This patch enables generation of introspection information for webkit2 + in the same was as it is done for webkit. The resulting gir and + typelib file are named WebKit2-3.0.{gir,typelib}. + + * GNUmakefile.am: + * UIProcess/API/gtk/WebKitBackForwardList.cpp: + +2012-10-31 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Add Ewk_File_Chooser_Request API + https://bugs.webkit.org/show_bug.cgi?id=100818 + + Reviewed by Kenneth Rohde Christiansen. + + Add Ewk_File_Chooser_Request API so that the client + can handle file chooser requests (e.g. Show a file + picker dialog) when the user clicks on an input + element of type "file". + + * PlatformEfl.cmake: + * UIProcess/API/efl/EWebKit2.h: + * UIProcess/API/efl/EwkViewCallbacks.h: + (EwkViewCallbacks): + * UIProcess/API/efl/ewk_file_chooser_request.cpp: Added. + (Ewk_File_Chooser_Request::Ewk_File_Chooser_Request): + (Ewk_File_Chooser_Request::~Ewk_File_Chooser_Request): + (Ewk_File_Chooser_Request::allowMultipleFiles): + (Ewk_File_Chooser_Request::acceptedMIMETypes): + (Ewk_File_Chooser_Request::cancel): + (Ewk_File_Chooser_Request::chooseFiles): + (ewk_file_chooser_request_ref): + (ewk_file_chooser_request_unref): + (ewk_file_chooser_request_allow_multiple_files_get): + (ewk_file_chooser_request_accepted_mimetypes_get): + (ewk_file_chooser_request_cancel): + (ewk_file_chooser_request_files_choose): + (ewk_file_chooser_request_file_choose): + * UIProcess/API/efl/ewk_file_chooser_request.h: Added. + * UIProcess/API/efl/ewk_file_chooser_request_private.h: Added. + (WebKit): + (Ewk_File_Chooser_Request): + (Ewk_File_Chooser_Request::create): + (Ewk_File_Chooser_Request::wasHandled): + * UIProcess/API/efl/ewk_view.h: + * UIProcess/API/efl/tests/resources/file_chooser.html: Added. + * UIProcess/API/efl/tests/test_ewk2_file_chooser_request.cpp: Added corresponding + unit tests. + (onFileChooserRequest): + (compareStrings): + (freeStringList): + (TEST_F): + * UIProcess/efl/PageUIClientEfl.cpp: + (WebKit::PageUIClientEfl::runOpenPanel): + (WebKit): + (WebKit::PageUIClientEfl::PageUIClientEfl): + * UIProcess/efl/PageUIClientEfl.h: + (PageUIClientEfl): + +2012-10-31 Noam Rosenthal <noam.rosenthal@nokia.com> + + [Texmap] Enable filter animations in GraphicsLayerAnimation + https://bugs.webkit.org/show_bug.cgi?id=100318 + + Reviewed by Kenneth Rohde Christiansen. + + Encode/decode KeyframeValues of type FilterOperations. + + * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp: + (CoreIPC::::encode): + (CoreIPC::::decode): + +2012-10-31 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2][AC] Avoid storing dirty rects in a Vector inside EwkViewImpl + https://bugs.webkit.org/show_bug.cgi?id=100736 + + Reviewed by Kenneth Rohde Christiansen. + + No longer store dirty rectangles in a temporary Vector and construct + a WebCore::Region directly from them instead. This avoid having to + iterate over the Vector in EwkViewImpl::displayTimerFired() to construct + a Region object, which should be more efficient. + + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::displayTimerFired): + (EwkViewImpl::redrawRegion): + * UIProcess/API/efl/EwkViewImpl.h: + (WebCore): + (EwkViewImpl): + +2012-10-30 Anders Carlsson <andersca@apple.com> + + Connection::Client::didReceiveInvalidMessage should take the full message name + https://bugs.webkit.org/show_bug.cgi?id=100788 + + Reviewed by Sam Weinig. + + Change Connection::Client::didReceiveInvalidMessage to take the message receiver name and message name as parameters + and make WebProcessProxy::didReceiveInvalidMessage print out the full message name. + + * NetworkProcess/NetworkConnectionToWebProcess.cpp: + (WebKit::NetworkConnectionToWebProcess::didReceiveInvalidMessage): + * NetworkProcess/NetworkConnectionToWebProcess.h: + (NetworkConnectionToWebProcess): + * NetworkProcess/NetworkProcess.cpp: + (WebKit::NetworkProcess::didReceiveInvalidMessage): + * NetworkProcess/NetworkProcess.h: + (NetworkProcess): + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::dispatchMessage): + * Platform/CoreIPC/Connection.h: + (Client): + * Platform/CoreIPC/StringReference.cpp: + (CoreIPC::StringReference::toString): + (CoreIPC): + * Platform/CoreIPC/StringReference.h: + (StringReference): + * PluginProcess/PluginProcess.cpp: + (WebKit::PluginProcess::didReceiveInvalidMessage): + * PluginProcess/PluginProcess.h: + (PluginProcess): + * PluginProcess/WebProcessConnection.cpp: + (WebKit::WebProcessConnection::didReceiveInvalidMessage): + * PluginProcess/WebProcessConnection.h: + (WebProcessConnection): + * SharedWorkerProcess/SharedWorkerProcess.cpp: + (WebKit::SharedWorkerProcess::didReceiveInvalidMessage): + * SharedWorkerProcess/SharedWorkerProcess.h: + (SharedWorkerProcess): + * UIProcess/Network/NetworkProcessProxy.cpp: + (WebKit::NetworkProcessProxy::didReceiveInvalidMessage): + * UIProcess/Network/NetworkProcessProxy.h: + (NetworkProcessProxy): + * UIProcess/Plugins/PluginProcessProxy.cpp: + (WebKit::PluginProcessProxy::didReceiveInvalidMessage): + * UIProcess/Plugins/PluginProcessProxy.h: + (PluginProcessProxy): + * UIProcess/SharedWorkers/SharedWorkerProcessProxy.cpp: + (WebKit::SharedWorkerProcessProxy::didReceiveInvalidMessage): + * UIProcess/SharedWorkers/SharedWorkerProcessProxy.h: + (SharedWorkerProcessProxy): + * UIProcess/WebConnectionToWebProcess.cpp: + (WebKit::WebConnectionToWebProcess::didReceiveInvalidMessage): + * UIProcess/WebConnectionToWebProcess.h: + (WebConnectionToWebProcess): + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::didReceiveInvalidMessage): + * UIProcess/WebProcessProxy.h: + (WebProcessProxy): + * WebProcess/Network/NetworkProcessConnection.cpp: + (WebKit::NetworkProcessConnection::didReceiveInvalidMessage): + * WebProcess/Network/NetworkProcessConnection.h: + (NetworkProcessConnection): + * WebProcess/Plugins/PluginProcessConnection.cpp: + (WebKit::PluginProcessConnection::didReceiveInvalidMessage): + * WebProcess/Plugins/PluginProcessConnection.h: + (PluginProcessConnection): + * WebProcess/WebConnectionToUIProcess.cpp: + (WebKit::WebConnectionToUIProcess::didReceiveInvalidMessage): + * WebProcess/WebConnectionToUIProcess.h: + (WebConnectionToUIProcess): + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::didReceiveInvalidMessage): + * WebProcess/WebProcess.h: + (WebProcess): + +2012-10-31 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2][AC] Use smart pointers for Evas_GL types + https://bugs.webkit.org/show_bug.cgi?id=100745 + + Reviewed by Kenneth Rohde Christiansen. + + Replace raw pointers to Evas_GL, Evas_GL_Context and + Evas_GL_Surface by smart pointers in EwkViewImpl. + + C++ wrappers were added for Evas_GL_Context and + Evas_GL_Surface in order to use OwnPtr. This is needed + because their destroy functions need the Evas_GL. + + * PlatformEfl.cmake: + * UIProcess/API/efl/EvasGLContext.cpp: Added. + (WebKit): + (WebKit::EvasGLContext::EvasGLContext): + (WebKit::EvasGLContext::~EvasGLContext): + * UIProcess/API/efl/EvasGLContext.h: Added. + (WebKit): + (EvasGLContext): + (WebKit::EvasGLContext::create): + (WebKit::EvasGLContext::context): + * UIProcess/API/efl/EvasGLSurface.cpp: Added. + (WebKit): + (WebKit::EvasGLSurface::EvasGLSurface): + (WebKit::EvasGLSurface::~EvasGLSurface): + * UIProcess/API/efl/EvasGLSurface.h: Added. + (WebKit): + (EvasGLSurface): + (WebKit::EvasGLSurface::create): + (WebKit::EvasGLSurface::surface): + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::EwkViewImpl): + (EwkViewImpl::displayTimerFired): + (EwkViewImpl::createGLSurface): + (EwkViewImpl::enterAcceleratedCompositingMode): + (EwkViewImpl::exitAcceleratedCompositingMode): + * UIProcess/API/efl/EwkViewImpl.h: + (EwkViewImpl::evasGL): + (EwkViewImpl::evasGLContext): + (EwkViewImpl::evasGLSurface): + (EwkViewImpl::resetEvasGLSurface): + (EwkViewImpl): + * UIProcess/API/efl/ewk_view.cpp: + (_ewk_view_smart_calculate): + +2012-10-31 Balazs Kelemen <kbalazs@webkit.org> + + [Qt][WK2] Fix "Unable to find a renderable master window QQuickView" warnings in tst_QQuickWebView + https://bugs.webkit.org/show_bug.cgi?id=100247 + + Reviewed by Jocelyn Turcotte. + + Make sure we have a visible window for tests that want to render. + + * UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp: + (tst_QQuickWebView::showWebView): + (tst_QQuickWebView::removeFromCanvas): + (tst_QQuickWebView::multipleWebViewWindows): + (tst_QQuickWebView::multipleWebViews): + (tst_QQuickWebView::basicRenderingSanity): + (tst_QQuickWebView::transparentWebViews): + Removed some unnecessary resize now that the window have a default size. + * UIProcess/API/qt/tests/testwindow.h: + (TestWindow): Resize the window to a default size at construction. + +2012-10-31 Thiago Marcos P. Santos <thiago.santos@intel.com> + + [EFL] WebContext::platformDefaultIconDatabasePath() should return a path to a file + https://bugs.webkit.org/show_bug.cgi?id=100679 + + Reviewed by Kenneth Rohde Christiansen. + + This patch aligns the EFL implementation with other ports. Before + that, we had an inconsistence: the return value of the getter could + not be used on the setter (the setter expects a full path, not a + directory). + + * UIProcess/API/efl/ewk_context.cpp: + (Ewk_Context::faviconDatabase): + * UIProcess/efl/WebContextEfl.cpp: + (WebKit::WebContext::platformDefaultIconDatabasePath): + +2012-10-31 Ian Vollick <vollick@chromium.org> + + Add support for text-based repaint testing + https://bugs.webkit.org/show_bug.cgi?id=100584 + + Reviewed by Simon Fraser. + + Allows tracked repaint rects to be dumped as text. + + * mac/WebKit2.order: + * win/WebKit2.def: + * win/WebKit2CFLite.def: + Exports for: + FrameView::setTracksRepaints(bool) + Frame::trackedRepaintRectsAsText() const + +2012-10-31 Sudarsana Nagineni <sudarsana.nagineni@intel.com> + + [EFL] Skip EWK2UnitTestBase.ewk_context_vibration_client_callbacks_set API test + https://bugs.webkit.org/show_bug.cgi?id=100839 + + Unreviewed, Skip EWK2UnitTestBase.ewk_context_vibration_client_callbacks_set + API test since it is failing on the bots. + + * UIProcess/API/efl/tests/test_ewk2_context.cpp: + (TEST_F): + +2012-10-31 KyungTae Kim <ktf.kim@samsung.com> + + [WK2][EFL] Assert check need to be changed in InputMethodContextEfl::InputMethodContextEfl + https://bugs.webkit.org/show_bug.cgi?id=100840 + + Reviewed by Kenneth Rohde Christiansen. + + Because 'context' is already set to 'm_context', assert check need to be done for m_context. + + * UIProcess/efl/InputMethodContextEfl.cpp: + (WebKit::InputMethodContextEfl::InputMethodContextEfl): + +2012-10-31 Kenneth Rohde Christiansen <kenneth@webkit.org> + + [WK2/EFL] Make sure all our events are transformed correctly + https://bugs.webkit.org/show_bug.cgi?id=100836 + + Reviewed by Alexis Menard. + + When moving to using the tiled backing store, we need to + transform our events before sending them to the web process. + + We needed to do that before as well, as the webkit view + doesn't have to be positioned at (0,0), but it was done in + a hacking way in the WebEvent creating. + + Now we generate two transforms, one for transforming points + to the web content, and one for transforming them into the + device screen coordinate system. + + This fixes the global position which was wrong before. + + * Shared/NativeWebMouseEvent.h: + (NativeWebMouseEvent): + * Shared/NativeWebTouchEvent.h: + (NativeWebTouchEvent): + * Shared/NativeWebWheelEvent.h: + (NativeWebWheelEvent): + * Shared/efl/NativeWebMouseEventEfl.cpp: + (WebKit::NativeWebMouseEvent::NativeWebMouseEvent): + * Shared/efl/NativeWebTouchEventEfl.cpp: + (WebKit::NativeWebTouchEvent::NativeWebTouchEvent): + * Shared/efl/NativeWebWheelEventEfl.cpp: + (WebKit::NativeWebWheelEvent::NativeWebWheelEvent): + * Shared/efl/WebEventFactory.cpp: + (WebKit::WebEventFactory::createWebMouseEvent): + (WebKit::WebEventFactory::createWebWheelEvent): + (WebKit::WebEventFactory::createWebTouchEvent): + * Shared/efl/WebEventFactory.h: + (WebEventFactory): + * UIProcess/API/efl/ewk_view.cpp: + (toDeviceScreenTransform): + (toWebContentTransform): + (_ewk_view_smart_mouse_wheel): + (_ewk_view_smart_mouse_down): + (_ewk_view_smart_mouse_up): + (_ewk_view_smart_mouse_move): + (ewk_view_feed_touch_event): + +2012-10-31 Byungwoo Lee <bw80.lee@samsung.com> + + [WK2] Change the scope of locking in CoreIPC::Connection class. + https://bugs.webkit.org/show_bug.cgi?id=98998 + + Reviewed by Laszlo Gombos. + + Release the m_incomingMessagesLock and m_outgoingMessagesLock mutexes + immediately after the protected resource is no longer modified to + prevent a possible source of a deadlock. + + The change allows the EFL port to prevent an actual dead-lock + situation with some upcoming changes. + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::sendMessage): + (CoreIPC::Connection::enqueueIncomingMessage): + +2012-10-31 Tim Horton <timothy_horton@apple.com> + + Unreviewed, fix header sorting in r132992. + + * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm: + * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm: + +2012-10-31 Tim Horton <timothy_horton@apple.com> + + Unreviewed, fix 32bit build breakage. + + * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm: + (WebKit::PDFPluginAnnotation::updateGeometry): + +2012-10-31 Tim Horton <timothy_horton@apple.com> + + Full-page PDFPlugin should support inline form editing + https://bugs.webkit.org/show_bug.cgi?id=100155 + + Reviewed by Dan Bernstein. + + Add form controls corresponding to Text and Choice PDF annotations, + allowing for single- and multi-line text input, and <select>-like input. + + Currently, forms are only implemented for full-page PDF documents. + + * Shared/mac/PDFKitImports.h: + (WebKit): Add pdfAnnotationTextWidgetClass and pdfAnnotationChoiceWidgetClass. + * Shared/mac/PDFKitImports.mm: + (WebKit::pdfAnnotationTextWidgetClass): Add pdfAnnotationTextWidgetClass. + (WebKit::pdfAnnotationChoiceWidgetClass): Add pdfAnnotationChoiceWidgetClass. + * WebKit2.xcodeproj/project.pbxproj: Add PDFLayerControllerDetails, PDFPluginTextAnnotation, PDFPluginChoiceAnnotation, + and PDFPluginAnnotation. + * WebProcess/Plugins/PDF/PDFLayerControllerDetails.h: Added. Extract PDFLayerController details category into a header. + * WebProcess/Plugins/PDF/PDFPlugin.h: + (PDFPlugin): Add m_activeAnnotation, to keep track of the active PDFPluginAnnotation, and m_annotationContainer, + the <div> that form controls are inserted into. + * WebProcess/Plugins/PDF/PDFPlugin.mm: + (-[WKPDFLayerControllerDelegate pdfLayerController:didChangeActiveAnnotation:]): Forward active annotation changes to PDFPlugin. + (WebKit::PDFPlugin::PDFPlugin): Add a <div> to the PluginDocument <body>, which will contain <input>, <select>, and <textarea> elements + corresponding to the active annotation. This div is made to fit to the body, and is "overflow: hidden" so that form elements scrolled + out of the viewport do not cause the Document to expand to be larger than the Plugin. + (WebKit::PDFPlugin::pdfDocumentDidLoad): Update PDFPlugin's notion of the scroll position immediately after the document loads, in case + the scroll position is constrained by PDFKit. + (WebKit::PDFPlugin::destroy): Tear down any forms for the active annotation. + (WebKit::PDFPlugin::geometryDidChange): Notify the current annotation that it should update its geometry when the Plugin's geometry changes. + (WebKit::PDFPlugin::setScrollOffset): Notify the current annotation that it should update its geometry when we scroll. + (WebKit::PDFPlugin::setActiveAnnotation): Commit changes to the current annotation, if there is one, then make a new PDFPluginAnnotation + corresponding to the newly active annotation, and attach it to our document. + * WebProcess/Plugins/PDF/PDFPluginAnnotation.h: Added. + (WebKit::PDFPluginAnnotation::element): Return the Element corresponding to this object. + (WebKit::PDFPluginAnnotation::annotation): Return the PDFAnnotation corresponding to this object. + (WebKit::PDFPluginAnnotation::plugin): Return the Plugin that created this object. + (WebKit::PDFPluginAnnotation::commit): Commit changes from the form to the PDFAnnotation. This is implemented in subclasses. + (WebKit::PDFPluginAnnotation::attach): Attach a PDFPluginAnnotation to its parent Element. + (WebKit::PDFPluginAnnotation::parent): Return the parent Element that we're attach()ed to. + (WebKit::PDFPluginAnnotation::pdfLayerController): Return the pdfLayerController that the PDFAnnotation comes from. + (PDFPluginAnnotationEventListener): Add an event listener to respond to "change" and "blur" events from m_element. + * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm: Added. + (WebKit::PDFPluginAnnotation::create): Create the appropriate PDFPluginAnnotation subclass (PDFPluginTextAnnotation or + PDFPluginChoiceAnnotation based on the class of the PDFAnnotation). + (WebKit::PDFPluginAnnotation::attach): Lazily create the HTML form element corresponding to this annotation. Add it to its parent + element. Add event listeners for "change" and "blur". + (WebKit::PDFPluginAnnotation::~PDFPluginAnnotation): Tear down the annotation, by removing event listeners and removing + the form element from its parent element. + (WebKit::PDFPluginAnnotation::updateGeometry): Update the size and position of the form element, given the current PDF scale and scrolling position. + (WebKit::PDFPluginAnnotation::PDFPluginAnnotationEventListener::handleEvent): If we get a blur or change event, we should remove the + form control to match the behavior of PDFKit. + * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.h: Added. + (WebKit::PDFPluginChoiceAnnotation::choiceAnnotation): Return annotation() with the appropriate cast. + * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm: Added. + (WebKit::PDFPluginChoiceAnnotation::updateGeometry): Update the font size of the choice widget given the current PDF scale. + (WebKit::PDFPluginChoiceAnnotation::commit): Save the value of the currently selected <option> into the PDFAnnotationChoiceWidget. + (WebKit::PDFPluginChoiceAnnotation::createAnnotationElement): Create a <select> element, populated with <option> elements + for the PDFAnnotationChoiceWidget's available choices. Select the correct <option> initially. + * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.h: Added. + (WebKit::PDFPluginTextAnnotation::textAnnotation): Return annotation() with the appropriate cast. + * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm: Added. + (WebKit::cssAlignmentValueForNSTextAlignment): Return the CSS alignment value for a given NSTextAlignment. + (WebKit::PDFPluginTextAnnotation::createAnnotationElement): Create a <textarea> or <input> element, depending on whether the + PDFAnnotationTextWidget supports multiline editing or not. + (WebKit::PDFPluginTextAnnotation::updateGeometry): Update the font size of the text widget given the current PDF scale. + (WebKit::PDFPluginTextAnnotation::commit): Save the current string in the form element into the PDFAnnotationTextWidget. + * WebProcess/WebPage/WebPage.cpp: + (WebKit::focusedPluginViewForFrame): Return the PluginView for a Frame only if the Plugin's element is focused. + (WebKit::WebPage::executeEditingCommand): Only forward editing commands to PluginView if the plugin itself is focused. + (WebKit::WebPage::isEditingCommandEnabled): Ditto. + (WebKit::WebPage::validateCommand): Ditto. + +2012-10-30 Joseph Pecoraro <pecoraro@apple.com> + + [Mac] Make WebKit2 Build with NETWORK_PROCESS disabled + https://bugs.webkit.org/show_bug.cgi?id=100798 + + Reviewed by David Kilzer. + + Wrap a few remaining NetworkProcess files and related code in + ENABLE(NETWORK_PROCESS) guards to avoid being compiled when disabled. + + * NetworkProcess/HostRecord.cpp: + * NetworkProcess/HostRecord.h: + * NetworkProcess/NetworkRequest.cpp: + * NetworkProcess/NetworkRequest.h: + * NetworkProcess/mac/NetworkResourceLoadSchedulerMac.mm: + * UIProcess/Network/NetworkProcessManager.cpp: + * UIProcess/Network/NetworkProcessManager.h: + Wrap files in guards. + + * UIProcess/Launcher/ProcessLauncher.h: + * UIProcess/Launcher/ProcessLauncher.cpp: + (WebKit::ProcessLauncher::processTypeAsString): + (WebKit::ProcessLauncher::getProcessTypeFromString): + Wrap NetworkProcess enum access in guards. + + * WebProcess/WebKitMain.cpp: + (WebKitMain): + Wrap NetworkProcess enum switch case in guards. + + * WebKit2Prefix.h: + Remove an extraneous close and reopen of the same guard. + +2012-10-30 Jae Hyun Park <jae.park@company100.net> + + Coordinated Graphics: Remove unused methods + https://bugs.webkit.org/show_bug.cgi?id=100799 + + Reviewed by Noam Rosenthal. + + Currently, there are several unused methods regarding Coordinated + Graphics. This patch removes those unused methods. + + * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h: + (LayerTreeCoordinatorProxy): + * UIProcess/DrawingAreaProxy.h: + +2012-10-30 Joseph Pecoraro <pecoraro@apple.com> + + [Mac] Sync up FeatureDefine Configuration Files + https://bugs.webkit.org/show_bug.cgi?id=100171 + + Reviewed by David Kilzer. + + Follow up to better coordinate with iOS feature defines. Make: + + - ENABLE_FILTERS always on + - ENABLE_INPUT_* iphonesimulator values point to the iphoneos values + + * Configurations/FeatureDefines.xcconfig: + +2012-10-30 Joseph Pecoraro <pecoraro@apple.com> + + [Mac] Sync up FeatureDefine Configuration Files + https://bugs.webkit.org/show_bug.cgi?id=100171 + + Reviewed by David Kilzer. + + Ensure an identical FeatureDefine files across all projects. Changes: + + - ENABLE_CSS_BOX_DECORATION_BREAK should be in all + - ENABLE_PDFKIT_PLUGIN should be in all + - ENABLE_RESOLUTION_MEDIA_QUERY should be in all + - ENABLE_ENCRYPTED_MEDIA should be in all + - ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING with corrected value + - Some alphabetical ordering cleanup + + * Configurations/FeatureDefines.xcconfig: + +2012-10-30 Christophe Dumez <christophe.dumez@intel.com> + + Regression(r132887): Caused segfault in a EWK2UnitTestBase.ewk_view_text_find + https://bugs.webkit.org/show_bug.cgi?id=100781 + + Reviewed by Kenneth Rohde Christiansen. + + Make sure we pass a pointer to zero instead of a NULL pointer + as parameter to the "text,found" in case the text could not + be found. This prevents crashing in + EWK2UnitTestBase.ewk_view_text_find when trying to dereference + the parameter pointer. + + * UIProcess/efl/FindClientEfl.cpp: + (WebKit::FindClientEfl::didFailToFindString): + +2012-10-30 Brady Eidson <beidson@apple.com> + + Crash in WebProcess at com.apple.WebCore: WebCore::ResourceLoader::start + <rdar://problem/12596761> and https://webkit.org/b/100792 + + Reviewed by Tim Hatcher. + + In release builds we can sometimes end up with a null ResourceLoader due to a race condition + with the WebProcess telling the NetworkProcess to remove a resource load at the very same time + the NetworkProcess is about to start that load. + + Until we can resolve that race condition an early return will be necessary. + + * WebProcess/Network/WebResourceLoadScheduler.cpp: + (WebKit::WebResourceLoadScheduler::startResourceLoad): + +2012-10-30 Jesse van den Kieboom <jessevdk@gnome.org> + + Fixed transfer annotation for default web context + https://bugs.webkit.org/show_bug.cgi?id=94314 + + Reviewed by Martin Robinson. + + Add a missing colon which prevented the transfer annotation of + webkit_web_context_get_default to be parsed correctly. + + * UIProcess/API/gtk/WebKitWebContext.cpp: + +2012-10-30 Anders Carlsson <andersca@apple.com> + + Use the message name when dispatching messages + https://bugs.webkit.org/show_bug.cgi?id=100774 + + Reviewed by Andreas Kling. + + Change the message generator to decide which function to call based on the message name instead + of the MessageID. This is yet another step towards eliminating MessageID completely. + + * Scripts/webkit2/messages.py: + (async_message_statement): + (sync_message_statement): + (generate_message_handler): + * Scripts/webkit2/messages_unittest.py: + * UIProcess/WebProcessProxy.h: + (WebKit::WebProcessProxy::send): + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::postMessage): + (WebKit::InjectedBundle::postSynchronousMessage): + +2012-10-29 Sam Weinig <sam@webkit.org> + + Switch more class to use the new << form of encode + https://bugs.webkit.org/show_bug.cgi?id=100725 + + Reviewed by Anders Carlsson. + + - Switches many uses of encoder.encode(foo) to encoder << foo. + - Switches a few places to take an ArgumentEncoder& rather than an ArgumentEncoder*. + - Switches a few places away from using encoder.encodeVariableLengthByteArray(foo) to + using encoder << CoreIPC::DataReference(foo). + + * Platform/CoreIPC/HandleMessage.h: + (CoreIPC::handleMessage): + (CoreIPC::handleMessageVariadic): + * Platform/CoreIPC/StringReference.cpp: + (CoreIPC::StringReference::encode): + (CoreIPC::StringReference::decode): + * Platform/CoreIPC/mac/MachPort.h: + (CoreIPC::MachPort::encode): + * Platform/mac/SharedMemoryMac.cpp: + (WebKit::SharedMemory::Handle::encode): + * PluginProcess/PluginCreationParameters.cpp: + (WebKit::PluginCreationParameters::encode): + * Shared/DictionaryPopupInfo.cpp: + (WebKit::DictionaryPopupInfo::encode): + * Shared/EditorState.cpp: + (WebKit::EditorState::encode): + * Shared/FontInfo.cpp: + (WebKit::FontInfo::encode): + * Shared/Network/NetworkProcessCreationParameters.cpp: + (WebKit::NetworkProcessCreationParameters::encode): + * Shared/OriginAndDatabases.cpp: + (WebKit::OriginAndDatabases::encode): + * Shared/PlatformPopupMenuData.cpp: + (WebKit::PlatformPopupMenuData::encode): + * Shared/Plugins/NPIdentifierData.cpp: + (WebKit::NPIdentifierData::encode): + * Shared/Plugins/NPVariantData.cpp: + (WebKit::NPVariantData::encode): + * Shared/Plugins/PluginProcessCreationParameters.cpp: + (WebKit::PluginProcessCreationParameters::encode): + * Shared/PrintInfo.cpp: + (WebKit::PrintInfo::encode): + * Shared/SecurityOriginData.cpp: + (WebKit::SecurityOriginData::encode): + * Shared/SessionState.cpp: + (WebKit::SessionState::encode): + * Shared/ShareableBitmap.cpp: + (WebKit::ShareableBitmap::Handle::encode): + * Shared/SharedWorkerProcessCreationParameters.cpp: + (WebKit::SharedWorkerProcessCreationParameters::encode): + * Shared/StatisticsData.cpp: + (WebKit::StatisticsData::encode): + * Shared/StringPairVector.h: + (WebKit::StringPairVector::encode): + * Shared/UpdateInfo.cpp: + (WebKit::UpdateInfo::encode): + * Shared/UserMessageCoders.h: + (WebKit::UserMessageEncoder::baseEncode): + * Shared/WebBackForwardListItem.cpp: + (WebKit::WebBackForwardListItem::encode): + * Shared/WebContextMenuItemData.cpp: + (WebKit::WebContextMenuItemData::encode): + * Shared/WebEvent.cpp: + (WebKit::WebEvent::encode): + * Shared/WebGestureEvent.cpp: + (WebKit::WebGestureEvent::encode): + * Shared/WebHitTestResult.cpp: + (WebKit::WebHitTestResult::Data::encode): + * Shared/WebKeyboardEvent.cpp: + (WebKit::WebKeyboardEvent::encode): + * Shared/WebMouseEvent.cpp: + (WebKit::WebMouseEvent::encode): + * Shared/WebNavigationDataStore.h: + (WebKit::WebNavigationDataStore::encode): + * Shared/WebPageCreationParameters.cpp: + (WebKit::WebPageCreationParameters::encode): + * Shared/WebPageGroupData.cpp: + (WebKit::WebPageGroupData::encode): + * Shared/WebPlatformTouchPoint.cpp: + (WebKit::WebPlatformTouchPoint::encode): + * Shared/WebPopupItem.cpp: + (WebKit::WebPopupItem::encode): + * Shared/WebPreferencesStore.cpp: + (WebKit::WebPreferencesStore::encode): + * Shared/WebProcessCreationParameters.cpp: + (WebKit::WebProcessCreationParameters::encode): + * Shared/WebTouchEvent.cpp: + (WebKit::WebTouchEvent::encode): + * Shared/WebWheelEvent.cpp: + (WebKit::WebWheelEvent::encode): + * Shared/cf/ArgumentCodersCF.cpp: + (CoreIPC::encode): + (CoreIPC::decode): + * Shared/cf/ArgumentCodersCF.h: + (CoreIPC): + * Shared/mac/ArgumentCodersMac.h: + (CoreIPC): + * Shared/mac/ArgumentCodersMac.mm: + (CoreIPC::encode): + * Shared/mac/AttributedString.mm: + (WebKit::AttributedString::encode): + * Shared/mac/ColorSpaceData.mm: + (WebKit::ColorSpaceData::encode): + * Shared/mac/KeychainAttribute.cpp: + (CoreIPC::encode): + * Shared/mac/KeychainAttribute.h: + (CoreIPC): + * Shared/mac/LayerTreeContextMac.mm: + (WebKit::LayerTreeContext::encode): + * Shared/mac/PlatformCertificateInfo.mm: + (WebKit::PlatformCertificateInfo::encode): + * Shared/mac/SandboxExtensionMac.mm: + (WebKit::SandboxExtension::Handle::encode): + (WebKit::SandboxExtension::Handle::decode): + (WebKit::SandboxExtension::HandleArray::encode): + (WebKit::SandboxExtension::HandleArray::decode): + * Shared/mac/SecItemRequestData.cpp: + (WebKit::SecItemRequestData::encode): + * Shared/mac/SecItemResponseData.cpp: + (WebKit::SecItemResponseData::encode): + * Shared/mac/SecKeychainItemRequestData.cpp: + (WebKit::SecKeychainItemRequestData::encode): + (WebKit::SecKeychainItemRequestData::decode): + * Shared/mac/SecKeychainItemResponseData.cpp: + (WebKit::SecKeychainItemResponseData::encode): + * Shared/mac/WebCoreArgumentCodersMac.mm: + (CoreIPC::::encodePlatformData): + * UIProcess/WebConnectionToWebProcess.cpp: + (WebKit::WebConnectionToWebProcess::encodeMessageBody): + * UIProcess/WebContextUserMessageCoders.h: + (WebKit::WebContextUserMessageEncoder::encode): + * WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h: + (WebKit::InjectedBundleUserMessageEncoder::encode): + * WebProcess/Plugins/Plugin.cpp: + (WebKit::Plugin::Parameters::encode): + * WebProcess/WebConnectionToUIProcess.cpp: + (WebKit::WebConnectionToUIProcess::encodeMessageBody): + +2012-10-29 Anders Carlsson <andersca@apple.com> + + Build WebKit as C++11 on Mac + https://bugs.webkit.org/show_bug.cgi?id=100720 + + Reviewed by Daniel Bates. + + * Configurations/Base.xcconfig: + Add CLANG_CXX_LANGUAGE_STANDARD=gnu++0x. + + * UIProcess/mac/WebCookieManagerProxyMac.mm: + (WebKit::WebCookieManagerProxy::persistHTTPCookieAcceptPolicy): + * WebProcess/Cookies/mac/WebCookieManagerMac.mm: + (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy): + Add explicit casts to NSHTTPCookieAcceptPolicy. + +2012-10-30 Sergio Villar Senin <svillar@igalia.com> + + [WK2][Qt] Enable hover and mouse events in flickable WebView + https://bugs.webkit.org/show_bug.cgi?id=100296 + + Reviewed by Kenneth Rohde Christiansen. + + Flickable WebView is now allowed to handle both hover and mouse + events. Flickable was initially meant to be the mobile interface and + was only handling touch events, but now the idea is that it will be + the WebView for both mobile and desktop environments. + + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebViewPrivate::initialize): refactored hover and mouse + event handling from children classes. + (QQuickWebViewLegacyPrivate::initialize): + (QQuickWebViewFlickablePrivate::QQuickWebViewFlickablePrivate): + +2012-10-29 Anders Carlsson <andersca@apple.com> + + String::createCFString should return a RetainPtr + https://bugs.webkit.org/show_bug.cgi?id=100419 + + Reviewed by Andreas Kling. + + Update callers of String::createCFString. + + * Platform/mac/ModuleMac.mm: + (WebKit::Module::load): + * PluginProcess/mac/PluginProcessMac.mm: + (WebKit::initializeSandbox): + * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm: + (WebKit::NetscapePluginModule::getPluginInfo): + (WebKit::NetscapePluginModule::createPluginMIMETypesPreferences): + * UIProcess/cf/WebBackForwardListCF.cpp: + (WebKit::WebBackForwardList::createCFDictionaryRepresentation): + * UIProcess/cf/WebPageProxyCF.cpp: + (WebKit::WebPageProxy::sessionStateData): + (WebKit::autosaveKey): + (WebKit::WebPageProxy::saveRecentSearches): + * WebProcess/ResourceCache/WebResourceCacheManager.cpp: + (WebKit::WebResourceCacheManager::clearCacheForOrigin): + * WebProcess/WebPage/win/WebPageWin.cpp: + (WebKit::cachedResponseForURL): + * WebProcess/win/WebProcessWin.cpp: + (WebKit::WebProcess::platformSetCacheModel): + (WebKit::WebProcess::platformInitializeWebProcess): + +2012-10-30 Kondapally Kalyan <kalyan.kondapally@intel.com> + + Regression(r132647)-Enable WebGL in EwkView. + https://bugs.webkit.org/show_bug.cgi?id=100552. + + Reviewed by Kenneth Rohde Christiansen. + + WebGL is enabled with following changeset: http://trac.webkit.org/changeset/132627. + Some changes are lost after the following changeset: http://trac.webkit.org/changeset/132647 + i.e setWebGLEnabled(true); in EwkViewImpl.cpp. + This patch re-applies the lost changes. + + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::EwkViewImpl): + +2012-10-30 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Qt] Animations jump when the page is suspended + https://bugs.webkit.org/show_bug.cgi?id=100673 + + Reviewed by Kenneth Rohde Christiansen. + + GraphicsLayerAnimations::pause() should accept time from start and not an offset. + + * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp: + (WebCore::CoordinatedGraphicsLayer::addAnimation): + (WebCore::CoordinatedGraphicsLayer::pauseAnimation): + (WebCore::CoordinatedGraphicsLayer::animationStartedTimerFired): + * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h: + (CoordinatedGraphicsLayer): + +2012-10-30 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][WK2] Fix EFL build after r132887 + https://bugs.webkit.org/show_bug.cgi?id=100748 + + Reviewed by Gyuyoung Kim. + + Fixed EFL build failure with WTF_USE_TILED_BACKING_STORE enabled caused by http://trac.webkit.org/changeset/132887. + + * UIProcess/efl/PageLoadClientEfl.cpp: + (WebKit::PageLoadClientEfl::didCommitLoadForFrame): + +2012-10-30 Max Vujovic <mvujovic@adobe.com> + + [CSS Shaders] Reject vertex shaders with custom attributes + https://bugs.webkit.org/show_bug.cgi?id=98973 + + Reviewed by Dean Jackson. + + Replace CustomFilterOperation::MeshType with CustomFilterMeshType from + CustomFilterConstants.h. + + * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp: + (CoreIPC::::encode): + Read the shader strings directly from the CustomFilterProgram instead of asking for a + CustomFilterProgramInfo object. Also, encode the meshType earlier so that decoding can + can use it to create a WebCustomFilterProgram, which now requires a meshType. + (CoreIPC::::decode): + Decode the meshType earlier to pass it to the new WebCustomFilterProgram constructor. + * Shared/CoordinatedGraphics/WebCustomFilterProgram.h: + (WebKit::WebCustomFilterProgram::create): + Add a meshType parameter to pass to the base class constructor. + (WebKit::WebCustomFilterProgram::WebCustomFilterProgram): Ditto. + +2012-10-30 Andras Becsi <andras.becsi@digia.com> + + [Qt][WK2] Remove ViewportUpdateDeferrer from PageViewportController + https://bugs.webkit.org/show_bug.cgi?id=100665 + + Reviewed by Jocelyn Turcotte. + + Since the original use case of delayed viewport updates and the issue + of infinite loop conditions between the programmatic adjustmet of the + viewport and the Qt notification signals are not present any more the + ViewportUpdateDeferrer became an unnecessary legacy and can be removed. + + * UIProcess/PageViewportController.cpp: + (WebKit::PageViewportController::PageViewportController): + (WebKit::PageViewportController::pageDidRequestScroll): + * UIProcess/PageViewportController.h: + (WebKit): + (PageViewportController): + * UIProcess/qt/PageViewportControllerClientQt.cpp: + (WebKit::PageViewportControllerClientQt::PageViewportControllerClientQt): + (WebKit::PageViewportControllerClientQt::animateContentRectVisible): + (WebKit::PageViewportControllerClientQt::flickMoveStarted): + (WebKit::PageViewportControllerClientQt::flickMoveEnded): + (WebKit::PageViewportControllerClientQt::scaleAnimationStateChanged): + (WebKit::PageViewportControllerClientQt::touchBegin): + (WebKit::PageViewportControllerClientQt::touchEnd): + (WebKit::PageViewportControllerClientQt::setContentsRectToNearestValidBounds): + (WebKit::PageViewportControllerClientQt::pinchGestureStarted): + (WebKit::PageViewportControllerClientQt::pinchGestureEnded): + (WebKit::PageViewportControllerClientQt::pinchGestureCancelled): + * UIProcess/qt/PageViewportControllerClientQt.h: + (PageViewportControllerClientQt): + +2012-10-30 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][WK2] Simplify signal emitting API in EwkViewImpl + https://bugs.webkit.org/show_bug.cgi?id=100506 + + Reviewed by Kenneth Rohde Christiansen. + + Now signal emitting API in EwkViewImpl is simplified so that + there is one EwkViewImpl::smartCallback template method + returning EwkViewCallbacks::CallBack class instance + which encapsulates Ewk_view callback info and also provide + arguments type checking. + + * UIProcess/API/efl/EwkViewCallbacks.h: Added. + (EwkViewCallbacks): + (CallBackInfo): + (EwkViewCallbacks::CallBackInfo::name): + (EwkViewCallbacks::CallBackInfo::hasArguments): + (CallBack): + (EwkViewCallbacks::CallBack::CallBack): + (EwkViewCallbacks::CallBack::call): + * UIProcess/API/efl/EwkViewImpl.cpp: + * UIProcess/API/efl/EwkViewImpl.h: + (EwkViewImpl): + (EwkViewImpl::smartCallback): + * UIProcess/efl/DownloadManagerEfl.cpp: + (WebKit::DownloadManagerEfl::decideDestinationWithSuggestedFilename): + (WebKit::DownloadManagerEfl::didFail): + (WebKit::DownloadManagerEfl::didCancel): + (WebKit::DownloadManagerEfl::didFinish): + * UIProcess/efl/FindClientEfl.cpp: + (WebKit::FindClientEfl::didFindString): + (WebKit::FindClientEfl::didFailToFindString): + * UIProcess/efl/FormClientEfl.cpp: + (WebKit::FormClientEfl::willSubmitForm): + * UIProcess/efl/PageClientImpl.cpp: + (WebKit::PageClientImpl::processDidCrash): + (WebKit::PageClientImpl::toolTipChanged): + * UIProcess/efl/PageLoadClientEfl.cpp: + (WebKit::PageLoadClientEfl::didReceiveTitleForFrame): + (WebKit::PageLoadClientEfl::didReceiveIntentForFrame): + (WebKit::PageLoadClientEfl::registerIntentServiceForFrame): + (WebKit::PageLoadClientEfl::didChangeProgress): + (WebKit::PageLoadClientEfl::didFinishLoadForFrame): + (WebKit::PageLoadClientEfl::didFailLoadWithErrorForFrame): + (WebKit::PageLoadClientEfl::didStartProvisionalLoadForFrame): + (WebKit::PageLoadClientEfl::didReceiveServerRedirectForProvisionalLoadForFrame): + (WebKit::PageLoadClientEfl::didFailProvisionalLoadWithErrorForFrame): + (WebKit::PageLoadClientEfl::didCommitLoadForFrame): + (WebKit::PageLoadClientEfl::didChangeBackForwardList): + * UIProcess/efl/PagePolicyClientEfl.cpp: + (WebKit::PagePolicyClientEfl::decidePolicyForNavigationAction): + (WebKit::PagePolicyClientEfl::decidePolicyForNewWindowAction): + * UIProcess/efl/ResourceLoadClientEfl.cpp: + (WebKit::ResourceLoadClientEfl::didInitiateLoadForResource): + (WebKit::ResourceLoadClientEfl::didSendRequestForResource): + (WebKit::ResourceLoadClientEfl::didReceiveResponseForResource): + (WebKit::ResourceLoadClientEfl::didFinishLoadForResource): + (WebKit::ResourceLoadClientEfl::didFailLoadForResource): + (WebKit::ResourceLoadClientEfl::ResourceLoadClientEfl): + (WebKit::ResourceLoadClientEfl::~ResourceLoadClientEfl): + +2012-10-30 Jocelyn Turcotte <jocelyn.turcotte@digia.com> + + Coordinated Graphics: Unrelease adopted images + https://bugs.webkit.org/show_bug.cgi?id=100671 + + Reviewed by Kenneth Rohde Christiansen. + + Reloading could cause a crash since r132640 where the directly composited + image would be re-adopted with the same key before it was properly released + in the UI process. + Cancel the release when this happens rather than creating a new image. + + * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp: + (WebKit::LayerTreeCoordinator::adoptImageBackingStore): + +2012-10-30 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Let Ecore_Evas own the cursor object + https://bugs.webkit.org/show_bug.cgi?id=100731 + + Reviewed by Kenneth Rohde Christiansen. + + Ecore_Evas takes care of calling evas_object_del() on + the cursor object when it is no longer used (e.g. when + it is replaced by another cursor object). Therefore, + we don't need to keep a RefPtr to the cursor Evas + Object as a data member of EwkViewImpl. We pass + ownership of the cursor object to Ecore_Evas. + + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::setCursor): + * UIProcess/API/efl/EwkViewImpl.h: + (EwkViewImpl): + +2012-10-30 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][WK2] Simplify getting impl from ewk_view evas object instance + https://bugs.webkit.org/show_bug.cgi?id=100505 + + Reviewed by Kenneth Rohde Christiansen. + + Macros are removed from EwkViewImpl.h. New macro added to EwkViewImpl.cpp + so that it's possible to get impl directly from ewk view. + + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::displayTimerFired): + * UIProcess/API/efl/EwkViewImpl.h: + * UIProcess/API/efl/ewk_view.cpp: + (_ewk_view_smart_focus_in): + (_ewk_view_smart_focus_out): + (mapToWebContent): + (_ewk_view_smart_mouse_wheel): + (_ewk_view_smart_mouse_down): + (_ewk_view_smart_mouse_up): + (_ewk_view_smart_mouse_move): + (_ewk_view_smart_key_down): + (_ewk_view_smart_key_up): + (_ewk_view_on_show): + (_ewk_view_on_hide): + (_ewk_view_smart_calculate): + (_ewk_view_smart_color_set): + (ewk_view_context_get): + (ewk_view_url_set): + (ewk_view_url_get): + (ewk_view_icon_url_get): + (ewk_view_reload): + (ewk_view_reload_bypass_cache): + (ewk_view_stop): + (ewk_view_settings_get): + (ewk_view_title_get): + (ewk_view_load_progress_get): + (ewk_view_scale_set): + (ewk_view_scale_get): + (ewk_view_device_pixel_ratio_set): + (ewk_view_device_pixel_ratio_get): + (ewk_view_theme_set): + (ewk_view_theme_get): + (ewk_view_back): + (ewk_view_forward): + (ewk_view_intent_deliver): + (ewk_view_back_possible): + (ewk_view_forward_possible): + (ewk_view_back_forward_list_get): + (ewk_view_html_string_load): + (ewk_view_setting_encoding_custom_get): + (ewk_view_setting_encoding_custom_set): + (ewk_view_text_find): + (ewk_view_text_find_highlight_clear): + (ewk_view_text_matches_count): + (ewk_view_mouse_events_enabled_set): + (ewk_view_mouse_events_enabled_get): + (ewk_view_feed_touch_event): + (ewk_view_touch_events_enabled_set): + (ewk_view_touch_events_enabled_get): + (ewk_view_inspector_show): + (ewk_view_inspector_close): + (ewk_view_pagination_mode_set): + (ewk_view_pagination_mode_get): + +2012-10-30 Byungwoo Lee <bw80.lee@samsung.com> + + [WK2] Remove incorrect use of preprocessor macro in API headers. + https://bugs.webkit.org/show_bug.cgi?id=100722 + + Reviewed by Gyuyoung Kim. + + Remove the preprocessor macro ENABLE(INSPECTOR) from the WKAPICast.h + and WKInspector.h. + + * UIProcess/API/C/WKAPICast.h: + (WebKit): + * UIProcess/API/C/WKInspector.cpp: + (WKInspectorGetTypeID): + (WKInspectorGetPage): + (WKInspectorIsVisible): + (WKInspectorIsFront): + (WKInspectorShow): + (WKInspectorClose): + (WKInspectorShowConsole): + (WKInspectorShowResources): + (WKInspectorShowMainResourceForFrame): + (WKInspectorIsAttached): + (WKInspectorAttach): + (WKInspectorDetach): + (WKInspectorIsDebuggingJavaScript): + (WKInspectorToggleJavaScriptDebugging): + (WKInspectorIsProfilingJavaScript): + (WKInspectorToggleJavaScriptProfiling): + (WKInspectorIsProfilingPage): + (WKInspectorTogglePageProfiling): + * UIProcess/API/C/WKInspector.h: + +2012-10-29 Sergio Villar Senin <svillar@igalia.com> + + REGRESSION(r130755): All WebKit2 unit tests are failing in WebKit2 bot + https://bugs.webkit.org/show_bug.cgi?id=98864 + + Reviewed by Martin Robinson. + + Use a dedicated directory to store WebKit2 generated resources. + + * UIProcess/API/gtk/tests/GNUmakefile.am: + * UIProcess/API/gtk/tests/TestMain.cpp: + (registerGResource): load the resource from the new directory. + +2012-10-29 Huang Dongsung <luxtella@company100.net> + + Coordinated Graphics: Delete cached ShareableSurfaces when purging backingStores. + https://bugs.webkit.org/show_bug.cgi?id=100705 + + Reviewed by Noam Rosenthal. + + LayerTreeCoordinatorProxy can be used after calling + LayerTreeCoordinatorProxy::purgeBackingStores(). So we should clear cached + ShareableSurfaces. + + * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp: + (WebKit::LayerTreeCoordinatorProxy::purgeBackingStores): + +2012-10-28 Mark Rowe <mrowe@apple.com> + + Simplify Xcode configuration settings that used to vary between OS versions. + + Reviewed by Dan Bernstein. + + * Configurations/Base.xcconfig: + * Configurations/WebKit2.xcconfig: + +2012-10-28 Mark Rowe <mrowe@apple.com> + + Remove references to unsupported OS and Xcode versions. + + Reviewed by Anders Carlsson. + + * Configurations/Base.xcconfig: + * Configurations/CompilerVersion.xcconfig: Removed. + * Configurations/DebugRelease.xcconfig: + * Configurations/Version.xcconfig: + * DerivedSources.make: + * WebKit2.xcodeproj/project.pbxproj: + +2012-10-29 Alexey Proskuryakov <ap@apple.com> + + [WK2] Add a NetworkingContext for NetworkProcess + https://bugs.webkit.org/show_bug.cgi?id=100708 + + Reviewed by Anders Carlsson. + + Each request will have a context, because these are so lightweight on Mac, and + other platforms will need ResourceHandle refactored anyway to use NetworkProcess. + + * NetworkProcess/mac/RemoteNetworkingContext.h: Added. + * NetworkProcess/mac/RemoteNetworkingContext.mm: Added. + These go mac/ subdirectory, because NetworkingContext interface is different on + each platform, as ResourceHandle needs dictate. + + * WebKit2.xcodeproj/project.pbxproj: + +2012-10-29 Michael Saboff <msaboff@apple.com> + + buildHTTPHeaders() should use a StringBuilder.appendLiteral() for separator + https://bugs.webkit.org/show_bug.cgi?id=100689 + + Reviewed by Darin Adler. + + Changed from using a String temporary for the separator to using StringBuilder.appendLiteral(": "). + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::buildHTTPHeaders): + +2012-10-29 Michael Saboff <msaboff@apple.com> + + WKStringCopyCFString() should directly use 8 bit Strings data instead of up converting + https://bugs.webkit.org/show_bug.cgi?id=100579 + + Reviewed by Oliver Hunt. + + Changed to use CFStringCreateWithBytes() for 8 bit strings using characters8() for an 8 bit argument string. + Changed the current call to characters16(). + + * Shared/API/c/cf/WKStringCF.cpp: + (WKStringCopyCFString): + +2012-10-29 Enrica Casucci <enrica@apple.com> + + Add ENABLE_USERSELECT_ALL feature flag. + https://bugs.webkit.org/show_bug.cgi?id=100559 + + Reviewed by Eric Seidel. + + * Configurations/FeatureDefines.xcconfig: + +2012-10-29 Christophe Dumez <christophe.dumez@intel.com> + + [WK2][WKTR] Enable Shadow DOM at runtime if compiled with SHADOW_DOM support + https://bugs.webkit.org/show_bug.cgi?id=100668 + + Reviewed by Kenneth Rohde Christiansen. + + Add Bundle API to enable Shadow DOM functionality. This is + now needed by WebKitTestRunner. + + * WebProcess/InjectedBundle/API/c/WKBundle.cpp: + (WKBundleSetShadowDOMEnabled): + * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::setShadowDOMEnabled): + (WebKit): + * WebProcess/InjectedBundle/InjectedBundle.h: + (InjectedBundle): + +2012-10-29 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Fix cursor change detection in EwkViewImpl::setCursor() + https://bugs.webkit.org/show_bug.cgi?id=100662 + + Reviewed by Kenneth Rohde Christiansen. + + Cursor change detection in EwkViewImpl::setCursor() relies on + addresses returned by Cursor::platformCursor(). However, the + value returned is currently assigned to a WKEinaSharedString + instead of a raw pointer. Therefore, the address is always + different and we keep recreating Evas Objects for the same + cursor. + + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::EwkViewImpl): + (EwkViewImpl::setCursor): Call smartData() after same cursor + detection since it is not needed if the cursor has not changed + and it may affect performance. + * UIProcess/API/efl/EwkViewImpl.h: + (EwkViewImpl): + +2012-10-29 Jocelyn Turcotte <jocelyn.turcotte@digia.com> + + Coordinated Graphics: Make sure that we release images immediately when purging resources + https://bugs.webkit.org/show_bug.cgi?id=100661 + + Reviewed by Noam Rosenthal. + + When we purge, we do both on the UI and web process at the same time, + both are expected to release references of the other process. + This creates problem when delaying the release of directly composited + images. + + Release them immediately in that case. + + Fixes the tst_QQuickWebView::removeFromCanvas API test. + + * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp: + (WebKit::LayerTreeCoordinator::flushPendingLayerChanges): + (WebKit::LayerTreeCoordinator::purgeReleasedImages): + (WebKit): + (WebKit::LayerTreeCoordinator::purgeBackingStores): + * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h: + (LayerTreeCoordinator): + +2012-10-29 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Avoid useless assignment in EwkViewImpl::setCustomTextEncodingName() + https://bugs.webkit.org/show_bug.cgi?id=100667 + + Reviewed by Kenneth Rohde Christiansen. + + Remove useless m_customEncoding assignment in EwkViewImpl::setCustomTextEncodingName() + since the member is anyway assigned in EwkViewImpl::customTextEncodingName(). + + Have EwkViewImpl::setCustomTextEncodingName() take a String in argument instead + of a const char* to make the API more C++ and since we don't need a const char* + to assign to m_customEncoding anymore. + + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::setCustomTextEncodingName): + * UIProcess/API/efl/EwkViewImpl.h: + (EwkViewImpl): + * UIProcess/API/efl/ewk_view.cpp: + (ewk_view_setting_encoding_custom_set): + +2012-10-29 Jocelyn Turcotte <jocelyn.turcotte@digia.com> + + [WK2] Enable delegated scrolling as soon as the FrameView is created when using fixed layout + https://bugs.webkit.org/show_bug.cgi?id=100383 + + Reviewed by Kenneth Rohde Christiansen. + + Scroll requests and PageTransitionViewportReady messages depend on + delegated scrolling being set properly on the FrameView to behave + properly. Since we were waiting for the viewport information to be + ready before setting the flag this could cause those messages to be avoided. + + This patch takes most of the flag set by setResizesToContentsUsingLayoutSize + and apply them as soon as possible in WebPage::setUseFixedLayout and + WebFrameLoaderClient::transitionToCommittedForNewPage. + + The behavior should be the same except for the following settings which are + now set outside of USE(TILED_BACKING_STORE) if we're using fixed layout: + - setAcceleratedCompositingForFixedPositionEnabled + - setFixedElementsLayoutRelativeToFrame + - setFixedPositionCreatesStackingContext + + This fixes the tst_QQuickWebView::scrollRequest auto test and improves the + reliability of the loadVisuallyCommitted signal with pages loaded from disk. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::sendViewportAttributesChanged): + (WebKit::WebPage::setUseFixedLayout): + (WebKit::WebPage::setFixedLayoutSize): + * WebProcess/WebPage/WebPage.h: + (WebPage): + +2012-10-29 Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> + + Unreviewed build fix after r132709. + + * Shared/WebMemorySampler.cpp: Include unistd.h for getpid(3). + +2012-10-28 Byungwoo Lee <bw80.lee@samsung.com> + + [WK2] Fix the incorrect use of preprocessor statement in API header. + https://bugs.webkit.org/show_bug.cgi?id=100610 + + Reviewed by Timothy Hatcher. + + Remove the preprocessor statement to check 'ENABLE_INSPECTOR' feature + from the WKPage.h. + + * UIProcess/API/C/WKPage.cpp: + (WKPageGetInspector): + * UIProcess/API/C/WKPage.h: + +2012-10-28 Yael Aharon <yael.aharon@intel.com> + + [EFL][WK2][AC] Viewport size does not change when the window size changes + https://bugs.webkit.org/show_bug.cgi?id=100573 + + Reviewed by Kenneth Rohde Christiansen. + + The viewport size is set when we create the window the first time + and does not change automatically afterwards. When we change the window size, + we need to explicitly change the viewport size as well. + + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::createGLSurface): + +2012-10-27 Noam Rosenthal <noam.rosenthal@nokia.com> + + Unreviewed build fix for breakage to minimal bot caused by r132742. + + * WebProcess/WebPage/LayerTreeHost.h: + (LayerTreeHost): + Added appropriate ENABLE(REQUEST_ANIMATION_FRAME) flag. + +2012-10-27 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r132740. + http://trac.webkit.org/changeset/132740 + https://bugs.webkit.org/show_bug.cgi?id=100603 + + "Causing many crashes" (Requested by weinig on #webkit). + + * UIProcess/Downloads/DownloadProxy.cpp: + (WebKit::DownloadProxy::DownloadProxy): + (WebKit::DownloadProxy::invalidate): + (WebKit): + * UIProcess/Downloads/DownloadProxy.h: + (DownloadProxy): + * UIProcess/WebContext.cpp: + (WebKit::WebContext::createDownloadProxy): + (WebKit::WebContext::downloadFinished): + (WebKit::WebContext::didReceiveMessage): + (WebKit::WebContext::didReceiveSyncMessage): + * UIProcess/WebContext.h: + (WebKit): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + (WebKit::WebPageProxy::~WebPageProxy): + (WebKit::WebPageProxy::didReceiveMessage): + (WebKit::WebPageProxy::didReceiveSyncMessage): + * UIProcess/WebPageProxy.h: + (CoreIPC): + (WebPageProxy): + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::didReceiveMessage): + (WebKit::WebProcessProxy::didReceiveSyncMessage): + * UIProcess/WebProcessProxy.h: + (WebProcessProxy): + * WebProcess/WebPage/WebPageGroupProxy.cpp: + (WebKit::WebPageGroupProxy::~WebPageGroupProxy): + (WebKit): + (WebKit::WebPageGroupProxy::didReceiveMessage): + (WebKit::WebPageGroupProxy::WebPageGroupProxy): + * WebProcess/WebPage/WebPageGroupProxy.h: + (CoreIPC): + (WebPageGroupProxy): + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::didReceiveSyncMessage): + (WebKit::WebProcess::didReceiveMessage): + +2012-10-27 Noam Rosenthal <noam.rosenthal@nokia.com> + + Coordinated Graphics: Animation jerkiness when rAF is enabled + https://bugs.webkit.org/show_bug.cgi?id=100536 + + Reviewed by Kenneth Rohde Christiansen. + + The jerkiness comes from the fact that we schedule animations excessively; That's because + the previous patch broke requestAnimationFrame behavior during CSS animations, since the + frame returns right away instead of waiting till the previous frame is actually rendered. + + This patch makes sure that when animations are scheduled, they're only serviced after the + UI process has actually painted the previous frame. We do so by sending a + RequestAnimationFrame message to the UI process, which responds with AnimationFrameReady + after the UI process paints. + + New test: fast/animations/request-animation-frame-too-rapid.html + Tests that we don't receive an unreasonably high number of callbacks from + requestAnimationFrame (> 1000FPS). + + * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp: + (WebKit): + (WebKit::LayerTreeCoordinatorProxy::requestAnimationFrame): + (WebKit::LayerTreeCoordinatorProxy::animationFrameReady): + * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h: + (LayerTreeCoordinatorProxy): + * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in: + * UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp: + (WebKit::LayerTreeRenderer::LayerTreeRenderer): + (WebKit::LayerTreeRenderer::paintToCurrentGLContext): + (WebKit): + (WebKit::LayerTreeRenderer::animationFrameReady): + (WebKit::LayerTreeRenderer::requestAnimationFrame): + * UIProcess/CoordinatedGraphics/LayerTreeRenderer.h: + (LayerTreeRenderer): + * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp: + (WebKit): + (WebKit::LayerTreeCoordinator::scheduleAnimation): + (WebKit::LayerTreeCoordinator::animationFrameReady): + * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h: + (LayerTreeCoordinator): + * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.messages.in: + +2012-10-27 Sam Weinig <sam@webkit.org> + + Yet more MessageReceivering + https://bugs.webkit.org/show_bug.cgi?id=100325 + + Reviewed by Anders Carlsson. + + Make DownloadProxy, WebPageProxy, and WebPageGroupProxy MessageReceivers. + + * UIProcess/Downloads/DownloadProxy.cpp: + (WebKit::DownloadProxy::DownloadProxy): + (WebKit::DownloadProxy::invalidate): + (WebKit::DownloadProxy::didReceiveMessage): + (WebKit::DownloadProxy::didReceiveSyncMessage): + * UIProcess/Downloads/DownloadProxy.h: + (DownloadProxy): + Make a MessageReceiver. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::WebContext): + (WebKit::WebContext::addMessageReceiver): + (WebKit::WebContext::removeMessageReceiver): + (WebKit::WebContext::didReceiveMessage): + (WebKit::WebContext::didReceiveSyncMessage): + * UIProcess/WebContext.h: + Add additional MessageReceiverMap forwards, and stop dealing with DownloadProxy explicitly. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + (WebKit::WebPageProxy::~WebPageProxy): + (WebKit::WebPageProxy::didReceiveMessage): + (WebKit::WebPageProxy::didReceiveSyncMessage): + * UIProcess/WebPageProxy.h: + Make a MessageReceiver, but keep sub objects using didReceiveMessage for now (like WebPage). + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::addMessageReceiver): + (WebKit::WebProcessProxy::removeMessageReceiver): + (WebKit::WebProcessProxy::didReceiveMessage): + (WebKit::WebProcessProxy::didReceiveSyncMessage): + * UIProcess/WebProcessProxy.h: + Give WebProcessProxy a MessageReceiverMap and all the appropriate forwarding methods. + + * WebProcess/WebPage/WebPageGroupProxy.cpp: + (WebKit::WebPageGroupProxy::WebPageGroupProxy): + (WebKit::WebPageGroupProxy::~WebPageGroupProxy): + (WebKit::WebPageGroupProxy::didReceiveMessage): + * WebProcess/WebPage/WebPageGroupProxy.h: + (WebKit::WebPageGroupProxy::isVisibleToHistoryClient): + (WebPageGroupProxy): + Make a MessageReceiver and register/unregister with the WebProcess. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::didReceiveSyncMessage): + Remove extraneous return statement. + (WebKit::WebProcess::didReceiveMessage): + Stop handling WebPageGroupProxy special. + +2012-10-27 Sam Weinig <sam@webkit.org> + + Completely roll out https://bugs.webkit.org/show_bug.cgi?id=99251 (r131686) + + It has caused too many crashes. + + * UIProcess/API/mac/PageClientImpl.mm: + * UIProcess/API/mac/WKView.mm: + * UIProcess/API/mac/WKViewInternal.h: + * UIProcess/API/mac/WKViewPrivate.h: + * UIProcess/mac/CorrectionPanel.mm: + * UIProcess/mac/WKFullScreenWindowController.mm: + * UIProcess/mac/WebFullScreenManagerProxyMac.mm: + +2012-10-27 Michael Saboff <msaboff@apple.com> + + buildHTTPHeaders() should use a StringBuilder instead of a Vector<UChar> + https://bugs.webkit.org/show_bug.cgi?id=100580 + + Reviewed by Oliver Hunt. + + Replaced Vector<UChar> with StringBuilder in the HTTP header construction function buildHTTPHeaders. + This eliminates 8 -> 16 bit up conversion of the strings involved. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::buildHTTPHeaders): + +2012-10-27 Dan Bernstein <mitz@apple.com> + + REAL_PLATFORM_NAME build setting is no longer needed + https://bugs.webkit.org/show_bug.cgi?id=100587 + + Reviewed by Mark Rowe. + + Removed the definition of REAL_PLATFORM_NAME and replaced references to it with references + to PLATFORM_NAME. + + * Configurations/Base.xcconfig: + * Configurations/BaseTarget.xcconfig: + * Configurations/CompilerVersion.xcconfig: + * Configurations/FeatureDefines.xcconfig: + * Configurations/WebKit2.xcconfig: + +2012-10-26 Brady Eidson <beidson@apple.com> + + Have NetworkProcess manage resource load scheduling. + https://bugs.webkit.org/show_bug.cgi?id=100479 + + Reviewed by Alexey Proskuryakov. + + Implement a ResourceLoadScheduler that models the same behavior as WebCore::ResourceLoadScheduler. + + The WebProcess scheduler acts as a marshall to the NetworkProcess scheduler via CoreIPC messaging. + + Besides MainResourceLoads which are started directly in the WebProcess, all other loads are now + started only when the NetworkProcess tells them to start. + + Build-system and messaging related stuff: + * DerivedSources.make: + * Platform/CoreIPC/MessageID.h: + * WebKit2.xcodeproj/project.pbxproj: + + Add a new Network logging channel. + * Platform/Logging.cpp: + (WebKit::getChannelFromName): + * Platform/Logging.h: + + Modeled after ResourceLoadScheduler::HostInformation but more specifically geared towards what NetworkProcess needs to track: + * NetworkProcess/HostRecord.cpp: Added. + (WebKit::HostRecord::HostRecord): + (WebKit::HostRecord::~HostRecord): + (WebKit::HostRecord::schedule): + (WebKit::HostRecord::addLoadInProgress): + (WebKit::HostRecord::remove): + (WebKit::HostRecord::hasRequests): + (WebKit::HostRecord::limitRequests): + * NetworkProcess/HostRecord.h: + (WebKit::HostRecord::name): + (WebKit::HostRecord::requestsPending): + + Gateway messaging from the WebResourceLoadScheduler to the NetworkResourceLoadScheduler: + * NetworkProcess/NetworkConnectionToWebProcess.cpp: + (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess): + (WebKit::NetworkConnectionToWebProcess::~NetworkConnectionToWebProcess): + (WebKit::NetworkConnectionToWebProcess::registerObserver): + (WebKit::NetworkConnectionToWebProcess::unregisterObserver): + (WebKit::NetworkConnectionToWebProcess::didReceiveMessage): + (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage): + (WebKit::NetworkConnectionToWebProcess::didClose): + (WebKit::NetworkConnectionToWebProcess::scheduleNetworkRequest): + (WebKit::NetworkConnectionToWebProcess::addLoadInProgress): + (WebKit::NetworkConnectionToWebProcess::removeLoadIdentifier): + (WebKit::NetworkConnectionToWebProcess::crossOriginRedirectReceived): + (WebKit::NetworkConnectionToWebProcess::servePendingRequests): + (WebKit::NetworkConnectionToWebProcess::suspendPendingRequests): + (WebKit::NetworkConnectionToWebProcess::resumePendingRequests): + (WebKit::NetworkConnectionToWebProcess::setSerialLoadingEnabled): + * NetworkProcess/NetworkConnectionToWebProcess.h: + (NetworkConnectionToWebProcessObserver): Add an observer interface so arbitrary objects can be notified if + a Network->WebProcess connection closes. + (WebKit::NetworkConnectionToWebProcessObserver::~NetworkConnectionToWebProcessObserver): + (WebKit::NetworkConnectionToWebProcess::isSerialLoadingEnabled): + * NetworkProcess/NetworkConnectionToWebProcess.messages.in: + + Represents a request, ResourceLoadIdentifier, and connection that all correspond to the same pending NetworkLoad: + * NetworkProcess/NetworkRequest.cpp: + (WebKit::NetworkRequest::NetworkRequest): + (WebKit::NetworkRequest::~NetworkRequest): + (WebKit::NetworkRequest::connectionToWebProcessDidClose): Using the NetworkConnectionToWebProcessObserver interface, + if the connection closes then clear out the connection pointer for this request that is now irrelevant. + * NetworkProcess/NetworkRequest.h: + (WebKit::NetworkRequest::create): + (WebKit::NetworkRequest::identifier): + (WebKit::NetworkRequest::connectionToWebProcess): + + Manages connection-per-host scheduling with the same structure as WebCore::ResourceLoadScheduling but also with IPC: + * NetworkProcess/NetworkResourceLoadScheduler.cpp: Added. + (WebKit::NetworkResourceLoadScheduler::NetworkResourceLoadScheduler): + (WebKit::NetworkResourceLoadScheduler::scheduleServePendingRequests): + (WebKit::NetworkResourceLoadScheduler::requestTimerFired): + (WebKit::NetworkResourceLoadScheduler::scheduleNetworkRequest): + (WebKit::NetworkResourceLoadScheduler::addLoadInProgress): + (WebKit::NetworkResourceLoadScheduler::hostForURL): + (WebKit::NetworkResourceLoadScheduler::removeLoadIdentifier): + (WebKit::NetworkResourceLoadScheduler::crossOriginRedirectReceived): + (WebKit::NetworkResourceLoadScheduler::servePendingRequests): + (WebKit::NetworkResourceLoadScheduler::servePendingRequestsForHost): Serve as many requests for the host as we should, + skipping the NetworkRequests who have lost their connection to their WebProcess. + (WebKit::NetworkResourceLoadScheduler::suspendPendingRequests): + (WebKit::NetworkResourceLoadScheduler::resumePendingRequests): + * NetworkProcess/NetworkResourceLoadScheduler.h: Added. + * NetworkProcess/mac/NetworkResourceLoadSchedulerMac.mm: Added. + (WebKit::NetworkResourceLoadScheduler::platformInitializeMaximumHTTPConnectionCountPerHost): + + * NetworkProcess/NetworkProcess.h: + (WebKit::NetworkProcess::networkResourceLoadScheduler): Add a scheduler global to the NetworkProcess. + + A thin derivation of WebCore::ResourceLoadScheduler, most of what WebResourceLoadScheduler does is handle IPC to the NetworkProcess: + * WebProcess/Network/WebResourceLoadScheduler.cpp: + (WebKit::WebResourceLoadScheduler::WebResourceLoadScheduler): + (WebKit::WebResourceLoadScheduler::scheduleSubresourceLoad): + (WebKit::WebResourceLoadScheduler::schedulePluginStreamLoad): + (WebKit::WebResourceLoadScheduler::scheduleLoad): + (WebKit::WebResourceLoadScheduler::addMainResourceLoad): + (WebKit::WebResourceLoadScheduler::remove): + (WebKit::WebResourceLoadScheduler::crossOriginRedirectReceived): + (WebKit::WebResourceLoadScheduler::servePendingRequests): + (WebKit::WebResourceLoadScheduler::suspendPendingRequests): + (WebKit::WebResourceLoadScheduler::resumePendingRequests): + (WebKit::WebResourceLoadScheduler::setSerialLoadingEnabled): + (WebKit::WebResourceLoadScheduler::startResourceLoad): + * WebProcess/Network/WebResourceLoadScheduler.h: + + Add the ability for the NetworkProcess to message back to the WebProcess telling it to start a resource load: + * WebProcess/Network/NetworkProcessConnection.cpp: + (WebKit::NetworkProcessConnection::didReceiveMessage): + (WebKit::NetworkProcessConnection::didReceiveSyncMessage): + (WebKit::NetworkProcessConnection::startResourceLoad): + * WebProcess/Network/NetworkProcessConnection.h: + * WebProcess/Network/NetworkProcessConnection.messages.in: + + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + (WebKit::WebPlatformStrategies::resourceLoadScheduler): Only return the WebResourceLoadScheduler if NetworkProcess is enabled. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::ensureNetworkProcessConnection): Actually keep the NetworkProcessConnection around in a member variable. + (WebKit::WebProcess::networkConnection): + * WebProcess/WebProcess.h: + (WebKit::WebProcess::usesNetworkProcess): Expose this for platform strategies sake. + +2012-10-26 Brady Eidson <beidson@apple.com> + + Crash in WebProces at WebCore::ResourceLoadScheduler::crossOriginRedirectReceived + 78 + https://bugs.webkit.org/show_bug.cgi?id=100554 + + Reviewed by Alexey Proskuryakov. + + For now, just have WebPlatformStrategies return the same default resourceLoadScheduler that + WebCore knows about. + + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + (WebKit::WebPlatformStrategies::resourceLoadScheduler): + +2012-10-26 Anders Carlsson <andersca@apple.com> + + Crash when making NPRuntime calls with a null NPP pointer + https://bugs.webkit.org/show_bug.cgi?id=100569 + <rdar://problem/11726426> + <rdar://problem/12352836> + + Reviewed by Darin Adler. + + Finally bite the bullet and remove the assertion from NetscapePlugin::fromNPP. The WebKit1 equivalent of this + function used to return the plug-in currently being initialized in NPP_New, but we've never done that in WebKit2 + and it has never been necessary. The crashes fixed here are not from calls underneath NPP_New so fixing it wouldn't + do us any good anyway. + + Also, make the PluginDestructionProtector handle a null plug-in gracefully. + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::PluginDestructionProtector::PluginDestructionProtector): + (PluginDestructionProtector): + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::fromNPP): + +2012-10-26 Stephanie Lewis <slewis@apple.com> + + Add pids to WebMemorySampleFiles. + https://bugs.webkit.org/show_bug.cgi?id=100449. + + Reviewed by Tim Horton. + + Make it easier to associate WebMemorySamples with a process. Add the pid to the filename and header. + + * Shared/WebMemorySampler.cpp: + (WebKit::WebMemorySampler::initializeTimers): Update notification. + (WebKit::WebMemorySampler::stop): Update notification. + (WebKit::WebMemorySampler::writeHeaders): dump pid in the header. + * UIProcess/WebContext.cpp: + (WebKit::WebContext::processDidFinishLaunching): append pid to filename. + +2012-10-26 Yael Aharon <yael.aharon@intel.com> + + [EFL][WK2][AC] Build fix after r132647. + https://bugs.webkit.org/show_bug.cgi?id=100540 + + Reviewed by Kenneth Rohde Christiansen. + + AC enabled build is broken after the latest refactoring of EFL WK2. + + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::EwkViewImpl): + (EwkViewImpl::displayTimerFired): + (EwkViewImpl::informLoadCommitted): + (EwkViewImpl::createGLSurface): + (EwkViewImpl::enterAcceleratedCompositingMode): + (EwkViewImpl::exitAcceleratedCompositingMode): + (EwkViewImpl::informContentsSizeChange): + * UIProcess/API/efl/EwkViewImpl.h: + (EwkViewImpl): + (EwkViewImpl::pageViewportControllerClient): + (EwkViewImpl::pageViewportController): + (EwkViewImpl::evasGl): + (EwkViewImpl::evasGlContext): + (EwkViewImpl::evasGlSurface): + (EwkViewImpl::resetEvasGlSurface): + * UIProcess/API/efl/ewk_view.cpp: + (mapToWebContent): + (_ewk_view_smart_calculate): + +2012-10-26 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Get rid of C'ism in text checker API + https://bugs.webkit.org/show_bug.cgi?id=100513 + + Reviewed by Kenneth Rohde Christiansen. + + Make Ewk_Text_Checker a C++ class and move the + WebKitTextChecker code to this new class. This + gets rid of the C'ism in the text checker code + and make it consistent with other Ewk classes. + + * PlatformEfl.cmake: + * UIProcess/API/efl/ewk_context.cpp: + (Ewk_Context::Ewk_Context): + * UIProcess/API/efl/ewk_settings.cpp: + (spellCheckingLanguagesSetUpdate): + (ewk_settings_continuous_spell_checking_enabled_set): + (ewk_settings_spell_checking_available_languages_get): + (ewk_settings_spell_checking_languages_get): + * UIProcess/API/efl/ewk_text_checker.cpp: + (ClientCallbacks): + (textCheckerEnchant): + (clientCallbacks): + (isContinuousSpellCheckingEnabled): + (setContinuousSpellCheckingEnabled): + (uniqueSpellDocumentTag): + (closeSpellDocumentWithTag): + (checkSpellingOfString): + (guessesForWord): + (learnWord): + (ignoreWord): + (Ewk_Text_Checker): + (Ewk_Text_Checker::availableSpellCheckingLanguages): + (Ewk_Text_Checker::updateSpellCheckingLanguages): + (Ewk_Text_Checker::loadedSpellCheckingLanguages): + (Ewk_Text_Checker::initialize): + * UIProcess/API/efl/ewk_text_checker_private.h: + (Ewk_Text_Checker): + * UIProcess/efl/WebKitTextChecker.cpp: Removed. + * UIProcess/efl/WebKitTextChecker.h: Removed. + +2012-10-26 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][WK2] Clean up construction/destruction code in Ewk_view + https://bugs.webkit.org/show_bug.cgi?id=100232 + + Reviewed by Kenneth Rohde Christiansen. + + Simplified a lot of initialization and destruction code of Ewk_view and EwkViewImpl + put all the impl stuff to its constructor and destructor, also made EwkViewImpl member + variables private. + + * UIProcess/API/efl/EwkViewImpl.cpp: + (pageViewMap): + (EwkViewImpl::addToPageViewMap): + (EwkViewImpl::removeFromPageViewMap): + (EwkViewImpl::viewFromPageViewMap): + (EwkViewImpl::EwkViewImpl): + (EwkViewImpl::~EwkViewImpl): + (EwkViewImpl::wkPage): + (EwkViewImpl::title): + (EwkViewImpl::setThemePath): + (EwkViewImpl::customTextEncodingName): + (EwkViewImpl::setCustomTextEncodingName): + (EwkViewImpl::informIconChange): + (EwkViewImpl::informWebProcessCrashed): + (EwkViewImpl::updateTextInputState): + (EwkViewImpl::informURLChange): + (EwkViewImpl::onFaviconChanged): + * UIProcess/API/efl/EwkViewImpl.h: + (WebKit): + (EwkViewImpl): + (EwkViewImpl::view): + (EwkViewImpl::page): + (EwkViewImpl::ewkContext): + (EwkViewImpl::backForwardList): + * UIProcess/API/efl/ewk_settings.cpp: + (Ewk_Settings::preferences): + * UIProcess/API/efl/ewk_view.cpp: + (_ewk_view_smart_focus_in): + (_ewk_view_smart_focus_out): + (_ewk_view_smart_mouse_wheel): + (_ewk_view_smart_mouse_down): + (_ewk_view_smart_mouse_up): + (_ewk_view_smart_mouse_move): + (_ewk_view_smart_key_down): + (_ewk_view_smart_key_up): + (_ewk_view_on_show): + (_ewk_view_on_hide): + (_ewk_view_smart_add): + (_ewk_view_smart_del): + (_ewk_view_smart_calculate): + (_ewk_view_smart_color_set): + (createEwkViewSmartClass): + (createEwkView): + (ewk_view_base_add): + (ewk_view_smart_add): + (ewk_view_add_with_context): + (ewk_view_url_set): + (ewk_view_reload): + (ewk_view_reload_bypass_cache): + (ewk_view_stop): + (ewk_view_load_progress_get): + (ewk_view_scale_set): + (ewk_view_scale_get): + (ewk_view_device_pixel_ratio_set): + (ewk_view_device_pixel_ratio_get): + (ewk_view_back): + (ewk_view_forward): + (ewk_view_intent_deliver): + (ewk_view_back_possible): + (ewk_view_forward_possible): + (ewk_view_back_forward_list_get): + (ewk_view_html_string_load): + (ewk_view_text_find): + (ewk_view_text_find_highlight_clear): + (ewk_view_text_matches_count): + (ewk_view_feed_touch_event): + (ewk_view_inspector_show): + (ewk_view_inspector_close): + (ewk_view_pagination_mode_set): + (ewk_view_pagination_mode_get): + +2012-10-26 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Initialize Ewk_Context class members in initialization list + https://bugs.webkit.org/show_bug.cgi?id=100503 + + Reviewed by Kenneth Rohde Christiansen. + + Move Ewk_Context class members initialization from the + constructor body to the initialization list for + efficiency. + + * UIProcess/API/efl/ewk_context.cpp: + (Ewk_Context::Ewk_Context): + +2012-10-26 Jocelyn Turcotte <jocelyn.turcotte@digia.com> + + LayerTreeCoordinator: Make sure that dependent layers are deleted before their directly composited image + https://bugs.webkit.org/show_bug.cgi?id=100495 + + Reviewed by Kenneth Rohde Christiansen. + + Since r128980 layers removals are delayed until we flush the layer tree. + This causes a crash if such a layer had a directly composited image since + the image is now deleted while the layer is still active in the UI process + and tries to access a deleted backing store. + + Fix it by delaying the directly composited image removal as well. + + Fixes a crash in tst_QQuickWebView::basicRenderingSanity since showWebView is + called first and loads direct-image-compositing.html. + + * UIProcess/CoordinatedGraphics/LayerTreeRenderer.h: + (LayerTreeRenderer): Remove unused variable. + * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp: + (WebKit::LayerTreeCoordinator::flushPendingLayerChanges): + (WebKit::LayerTreeCoordinator::releaseImageBackingStore): + * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h: + (LayerTreeCoordinator): + +2012-10-26 Regina Chung <heejin.r.chung@samsung.com> + + [EFL][WK2] Enable WebGL + https://bugs.webkit.org/show_bug.cgi?id=97652 + + Reviewed by Gyuyoung Kim. + + Set WebGLEnabled to true when WebGL is enabled. + + * UIProcess/API/efl/ewk_view.cpp: + (_ewk_view_initialize): + +2012-10-26 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Add Ewk_Color_Picker API + https://bugs.webkit.org/show_bug.cgi?id=100472 + + Reviewed by Kenneth Rohde Christiansen. + + Move the color picker code out of EwkViewImpl and into + a new Ewk_Color_Picker class to avoid cluttering the + view code. + + * PlatformEfl.cmake: + * UIProcess/API/efl/EWebKit2.h: + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::requestColorPicker): + (EwkViewImpl::dismissColorPicker): + * UIProcess/API/efl/EwkViewImpl.h: + (EwkViewImpl): + * UIProcess/API/efl/ewk_color_picker.cpp: Added. + (Ewk_Color_Picker::Ewk_Color_Picker): + (Ewk_Color_Picker::setColor): + (Ewk_Color_Picker::color): + (ewk_color_picker_color_set): + (ewk_color_picker_color_get): + * UIProcess/API/efl/ewk_color_picker.h: Added. + * UIProcess/API/efl/ewk_color_picker_private.h: Added. + (Ewk_Color_Picker): + (Ewk_Color_Picker::create): + * UIProcess/API/efl/ewk_view.cpp: + * UIProcess/API/efl/ewk_view.h: + * UIProcess/API/efl/tests/test_ewk2_color_picker.cpp: Added. + (onColorPickerDone): + (setColorPickerColor): + (showColorPicker): + (hideColorPicker): + (hideColorPickerByRemovingElement): + (TEST_F): + * UIProcess/API/efl/tests/test_ewk2_view.cpp: + * UIProcess/efl/PageUIClientEfl.cpp: + (WebKit::PageUIClientEfl::showColorPicker): + +2012-10-26 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r132601. + http://trac.webkit.org/changeset/132601 + https://bugs.webkit.org/show_bug.cgi?id=100494 + + It broke the Qt build (Requested by Ossy on #webkit). + + * UIProcess/API/efl/ewk_view.cpp: + (_ewk_view_initialize): + +2012-10-26 Regina Chung <heejin.r.chung@samsung.com> + + [EFL][WK2] Enable WebGL + https://bugs.webkit.org/show_bug.cgi?id=97652 + + Reviewed by Gyuyoung Kim. + + Set WebGLEnabled to true when WebGL is enabled. + + * UIProcess/API/efl/ewk_view.cpp: + (_ewk_view_initialize): + +2012-10-26 Thiago Marcos P. Santos <thiago.santos@intel.com> + + Add feature flags for CSS Device Adaptation + https://bugs.webkit.org/show_bug.cgi?id=95960 + + Reviewed by Kenneth Rohde Christiansen. + + * Configurations/FeatureDefines.xcconfig: + +2012-10-26 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Move input method code out of EwkViewImpl + https://bugs.webkit.org/show_bug.cgi?id=100468 + + Reviewed by Kenneth Rohde Christiansen. + + Move input method code out of EwkViewImpl and into + a new InputMethodContextEfl class to avoid cluttering + the view code. + + * PlatformEfl.cmake: + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::EwkViewImpl): + (EwkViewImpl::inputMethodContext): + * UIProcess/API/efl/EwkViewImpl.h: + (WebKit): + (EwkViewImpl): + * UIProcess/API/efl/ewk_view.cpp: + (_ewk_view_smart_mouse_up): + (_ewk_view_smart_key_down): + * UIProcess/efl/InputMethodContextEfl.cpp: Added. + (WebKit): + (WebKit::InputMethodContextEfl::InputMethodContextEfl): + (WebKit::InputMethodContextEfl::~InputMethodContextEfl): + (WebKit::InputMethodContextEfl::onIMFInputSequenceComplete): + (WebKit::InputMethodContextEfl::onIMFPreeditSequenceChanged): + (WebKit::InputMethodContextEfl::createIMFContext): + (WebKit::InputMethodContextEfl::handleMouseUpEvent): + (WebKit::InputMethodContextEfl::handleKeyDownEvent): + (WebKit::InputMethodContextEfl::updateTextInputState): + * UIProcess/efl/InputMethodContextEfl.h: Added. + (WebKit): + (InputMethodContextEfl): + (WebKit::InputMethodContextEfl::create): + * UIProcess/efl/PageClientImpl.cpp: + (WebKit::PageClientImpl::updateTextInputState): + +2012-10-26 Jaehun Lim <ljaehun.lim@samsung.com> + + Implement {get,set}FloatValueForKey + https://bugs.webkit.org/show_bug.cgi?id=100452 + + Reviewed by Anders Carlsson. + + Implement missing functions in WebPreferencesStore. + + * Shared/WebPreferencesStore.cpp: + (WebKit::WebPreferencesStore::setFloatValueForKey): + (WebKit): + (WebKit::WebPreferencesStore::getFloatValueForKey): + +2012-10-25 Byungwoo Lee <bw80.lee@samsung.com> + + [WK2] Use per destination ID message receivers for DownloadProxy. + https://bugs.webkit.org/show_bug.cgi?id=100342 + + Reviewed by Anders Carlsson. + + Per destination ID message receivers were proposed in r132386. + IPC messages of DownloadProxy use download ID for destination ID, + so the messages should be handled by the messsage receiver that was + newly proposed. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::WebContext): + (WebKit::WebContext::createDownloadProxy): + (WebKit::WebContext::downloadFinished): + (WebKit::WebContext::addMessageReceiver): + (WebKit): + (WebKit::WebContext::removeMessageReceiver): + * UIProcess/WebContext.h: + (WebContext): + +2012-10-25 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Add Ewk_Popup_Menu API + https://bugs.webkit.org/show_bug.cgi?id=100404 + + Reviewed by Kenneth Rohde Christiansen. + + Add new Ewk_Popup_Menu API to complete the existing + Ewk_Popup_Menu_Item one. This way, we can move the + popup menu code out of Ewk_View. + + * PlatformEfl.cmake: + * UIProcess/API/efl/EWebKit2.h: + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::EwkViewImpl): + (EwkViewImpl::~EwkViewImpl): + (EwkViewImpl::requestPopupMenu): + (EwkViewImpl::closePopupMenu): + * UIProcess/API/efl/EwkViewImpl.h: + (EwkViewImpl): + * UIProcess/API/efl/ewk_popup_menu.cpp: Added. + (Ewk_Popup_Menu::Ewk_Popup_Menu): + (Ewk_Popup_Menu::~Ewk_Popup_Menu): + (Ewk_Popup_Menu::close): + (Ewk_Popup_Menu::items): + (Ewk_Popup_Menu::selectedIndex): + (Ewk_Popup_Menu::setSelectedIndex): + (ewk_popup_menu_close): + (ewk_popup_menu_selected_index_set): + (ewk_popup_menu_selected_index_get): + (ewk_popup_menu_items_get): + * UIProcess/API/efl/ewk_popup_menu.h: Added. + * UIProcess/API/efl/ewk_popup_menu_private.h: Copied from Source/WebKit2/UIProcess/efl/WebPopupMenuProxyEfl.cpp. + (WebKit): + (Ewk_Popup_Menu): + (Ewk_Popup_Menu::create): + * UIProcess/API/efl/ewk_view.cpp: + * UIProcess/API/efl/ewk_view.h: + * UIProcess/API/efl/tests/test_ewk2_popup_menu.cpp: Added. + (checkBasicPopupMenuItem): + (selectItemAfterDelayed): + (showPopupMenu): + (TEST_F): + * UIProcess/API/efl/tests/test_ewk2_view.cpp: + * UIProcess/efl/WebPopupMenuProxyEfl.cpp: + (WebKit::WebPopupMenuProxyEfl::hidePopupMenu): + +2012-10-25 Jocelyn Turcotte <jocelyn.turcotte@digia.com> + + [Qt] Close the IconDatabase before the WebContext gets destroyed + https://bugs.webkit.org/show_bug.cgi?id=100389 + + Reviewed by Alexis Menard. + + The WebContext normally gets destroyed 60 seconds after the last page is + closed and will take down the WebIconDatabase with itself if nothing + holds a reference to it at this moment. + We need to close the IconDatabase explicitely before this happens + to terminate it cleanly and avoid leaking its thread. + + * UIProcess/qt/QtWebIconDatabaseClient.cpp: + (WebKit::QtWebIconDatabaseClient::~QtWebIconDatabaseClient): + +2012-10-25 Dominik Röttsches <dominik.rottsches@intel.com> + + Conditionalize XHR timeout support + https://bugs.webkit.org/show_bug.cgi?id=100356 + + Reviewed by Adam Barth. + + Adding XHR_TIMEOUT feature to conditionalize this on ports without network backend support. + Defaults to ON on Mac since the Mac NSUrlConnection based backend has setTimeoutInterval support. + + * Configurations/FeatureDefines.xcconfig: + +2012-10-25 Tim Horton <timothy_horton@apple.com> + + Only full-page PDFPlugins should purport to handle page scale changes + https://bugs.webkit.org/show_bug.cgi?id=99635 + + Reviewed by Sam Weinig. + + PDFPlugin should only handle page scale factor changes itself if it's in the main frame. + Subframe PDFs will act like images, zooming with the page. + + * WebProcess/Plugins/PDF/PDFPlugin.h: + (PDFPlugin): Move implementation of handlesPageScaleFactor() to PDFPlugin.mm. + * WebProcess/Plugins/PDF/PDFPlugin.mm: + (WebKit::PDFPlugin::pdfDocumentDidLoad): Only copy PDFLayerController's default autoscale magnification to PluginView's + notion of the current scale factor if we're supposed to be handling page scale factor changes. + (WebKit::PDFPlugin::geometryDidChange): Only update PDFLayerController's magnification from the page scale factor + if we're supposed to be handling page scale factor changes. + (WebKit::PDFPlugin::handlesPageScaleFactor): We should only handle page scale factor changes if we're in the main frame. + +2012-10-25 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Move non-API classes out of UIProcess/API/efl + https://bugs.webkit.org/show_bug.cgi?id=100391 + + Reviewed by Kenneth Rohde Christiansen. + + Move non-API classes from UIProcess/API/efl to + UIProcess/efl for clarity. + + * PlatformEfl.cmake: + * UIProcess/efl/BatteryProvider.cpp: Renamed from Source/WebKit2/UIProcess/API/efl/BatteryProvider.cpp. + (toBatteryProvider): + (startUpdatingCallback): + (stopUpdatingCallback): + (BatteryProvider::~BatteryProvider): + (BatteryProvider::create): + (BatteryProvider::BatteryProvider): + (BatteryProvider::startUpdating): + (BatteryProvider::stopUpdating): + (BatteryProvider::didChangeBatteryStatus): + * UIProcess/efl/BatteryProvider.h: Renamed from Source/WebKit2/UIProcess/API/efl/BatteryProvider.h. + (WebKit): + (BatteryProvider): + * UIProcess/efl/NetworkInfoProvider.cpp: Renamed from Source/WebKit2/UIProcess/API/efl/NetworkInfoProvider.cpp. + (toNetworkInfoProvider): + (startUpdatingCallback): + (stopUpdatingCallback): + (getBandwidthCallback): + (isMeteredCallback): + (NetworkInfoProvider::create): + (NetworkInfoProvider::NetworkInfoProvider): + (NetworkInfoProvider::~NetworkInfoProvider): + (NetworkInfoProvider::bandwidth): + (NetworkInfoProvider::metered): + (NetworkInfoProvider::startUpdating): + (NetworkInfoProvider::stopUpdating): + * UIProcess/efl/NetworkInfoProvider.h: Renamed from Source/WebKit2/UIProcess/API/efl/NetworkInfoProvider.h. + (WebKit): + (NetworkInfoProvider): + * UIProcess/efl/PageClientImpl.cpp: Renamed from Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp. + (WebKit): + (WebKit::PageClientImpl::PageClientImpl): + (WebKit::PageClientImpl::~PageClientImpl): + (WebKit::PageClientImpl::viewImpl): + (WebKit::PageClientImpl::createDrawingAreaProxy): + (WebKit::PageClientImpl::setViewNeedsDisplay): + (WebKit::PageClientImpl::displayView): + (WebKit::PageClientImpl::scrollView): + (WebKit::PageClientImpl::viewSize): + (WebKit::PageClientImpl::isViewWindowActive): + (WebKit::PageClientImpl::isViewFocused): + (WebKit::PageClientImpl::isViewVisible): + (WebKit::PageClientImpl::isViewInWindow): + (WebKit::PageClientImpl::processDidCrash): + (WebKit::PageClientImpl::didRelaunchProcess): + (WebKit::PageClientImpl::pageClosed): + (WebKit::PageClientImpl::toolTipChanged): + (WebKit::PageClientImpl::setCursor): + (WebKit::PageClientImpl::setCursorHiddenUntilMouseMoves): + (WebKit::PageClientImpl::didChangeViewportProperties): + (WebKit::PageClientImpl::registerEditCommand): + (WebKit::PageClientImpl::clearAllEditCommands): + (WebKit::PageClientImpl::canUndoRedo): + (WebKit::PageClientImpl::executeUndoRedo): + (WebKit::PageClientImpl::convertToDeviceSpace): + (WebKit::PageClientImpl::convertToUserSpace): + (WebKit::PageClientImpl::screenToWindow): + (WebKit::PageClientImpl::windowToScreen): + (WebKit::PageClientImpl::doneWithKeyEvent): + (WebKit::PageClientImpl::doneWithTouchEvent): + (WebKit::PageClientImpl::createPopupMenuProxy): + (WebKit::PageClientImpl::createContextMenuProxy): + (WebKit::PageClientImpl::createColorChooserProxy): + (WebKit::PageClientImpl::setFindIndicator): + (WebKit::PageClientImpl::enterAcceleratedCompositingMode): + (WebKit::PageClientImpl::exitAcceleratedCompositingMode): + (WebKit::PageClientImpl::updateAcceleratedCompositingMode): + (WebKit::PageClientImpl::didChangeScrollbarsForMainFrame): + (WebKit::PageClientImpl::didCommitLoadForMainFrame): + (WebKit::PageClientImpl::didFinishLoadingDataForCustomRepresentation): + (WebKit::PageClientImpl::customRepresentationZoomFactor): + (WebKit::PageClientImpl::setCustomRepresentationZoomFactor): + (WebKit::PageClientImpl::flashBackingStoreUpdates): + (WebKit::PageClientImpl::findStringInCustomRepresentation): + (WebKit::PageClientImpl::countStringMatchesInCustomRepresentation): + (WebKit::PageClientImpl::updateTextInputState): + (WebKit::PageClientImpl::handleDownloadRequest): + (WebKit::PageClientImpl::pageDidRequestScroll): + (WebKit::PageClientImpl::didChangeContentsSize): + (WebKit::PageClientImpl::didRenderFrame): + (WebKit::PageClientImpl::pageTransitionViewportReady): + * UIProcess/efl/PageClientImpl.h: Renamed from Source/WebKit2/UIProcess/API/efl/PageClientImpl.h. + (WebKit): + (PageClientImpl): + (WebKit::PageClientImpl::create): + (WebKit::PageClientImpl::setPageViewportController): + * UIProcess/efl/PageViewportControllerClientEfl.cpp: Renamed from Source/WebKit2/UIProcess/API/efl/PageViewportControllerClientEfl.cpp. + (WebKit): + (WebKit::PageViewportControllerClientEfl::PageViewportControllerClientEfl): + (WebKit::PageViewportControllerClientEfl::~PageViewportControllerClientEfl): + (WebKit::PageViewportControllerClientEfl::drawingArea): + (WebKit::PageViewportControllerClientEfl::setRendererActive): + (WebKit::PageViewportControllerClientEfl::display): + (WebKit::PageViewportControllerClientEfl::updateViewportSize): + (WebKit::PageViewportControllerClientEfl::setVisibleContentsRect): + (WebKit::PageViewportControllerClientEfl::didChangeContentsSize): + (WebKit::PageViewportControllerClientEfl::setViewportPosition): + (WebKit::PageViewportControllerClientEfl::setContentsScale): + (WebKit::PageViewportControllerClientEfl::didResumeContent): + (WebKit::PageViewportControllerClientEfl::didChangeVisibleContents): + (WebKit::PageViewportControllerClientEfl::didChangeViewportAttributes): + (WebKit::PageViewportControllerClientEfl::setController): + * UIProcess/efl/PageViewportControllerClientEfl.h: Renamed from Source/WebKit2/UIProcess/API/efl/PageViewportControllerClientEfl.h. + (WebKit): + (PageViewportControllerClientEfl): + (WebKit::PageViewportControllerClientEfl::create): + (WebKit::PageViewportControllerClientEfl::viewSize): + (WebKit::PageViewportControllerClientEfl::scaleFactor): + (WebKit::PageViewportControllerClientEfl::scrollPosition): + * UIProcess/efl/VibrationProvider.cpp: Renamed from Source/WebKit2/UIProcess/API/efl/VibrationProvider.cpp. + (Ewk_Vibration_Client): + (Ewk_Vibration_Client::Ewk_Vibration_Client): + (toVibrationProvider): + (vibrateCallback): + (cancelVibrationCallback): + (VibrationProvider::create): + (VibrationProvider::VibrationProvider): + (VibrationProvider::~VibrationProvider): + (VibrationProvider::vibrate): + (VibrationProvider::cancelVibration): + (VibrationProvider::setVibrationClientCallbacks): + * UIProcess/efl/VibrationProvider.h: Renamed from Source/WebKit2/UIProcess/API/efl/VibrationProvider.h. + (WebKit): + (VibrationProvider): + * UIProcess/efl/WebKitTextChecker.cpp: Renamed from Source/WebKit2/UIProcess/API/efl/WebKitTextChecker.cpp. + (WebKit): + (WebKit::isContinuousSpellCheckingEnabled): + (WebKit::setContinuousSpellCheckingEnabled): + (WebKit::uniqueSpellDocumentTag): + (WebKit::closeSpellDocumentWithTag): + (WebKit::checkSpellingOfString): + (WebKit::guessesForWord): + (WebKit::learnWord): + (WebKit::ignoreWord): + (WebKit::availableSpellCheckingLanguages): + (WebKit::updateSpellCheckingLanguages): + (WebKit::loadedSpellCheckingLanguages): + * UIProcess/efl/WebKitTextChecker.h: Renamed from Source/WebKit2/UIProcess/API/efl/WebKitTextChecker.h. + (WebKit): + +2012-10-25 Brady Eidson <beidson@apple.com> + + Allow LoaderStrategy to override the ResourceLoadScheduler + https://bugs.webkit.org/show_bug.cgi?id=100355 + + Reviewed by Anders Carlsson. + + Add a WebKit2 subclass of ResourceLoadScheduler that currently adds no new functionality: + * WebProcess/Network/WebResourceLoadScheduler.cpp: + (WebKit::WebResourceLoadScheduler::~WebResourceLoadScheduler): + * WebProcess/Network/WebResourceLoadScheduler.h: + + WebProcess hangs on to the default shared WebResourceLoadScheduler: + * WebProcess/WebProcess.h: + (WebKit::WebProcess::webResourceLoadScheduler): + + If the NetworkProcess is enabled, return the new WebResourceLoadScheduler: + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + (WebKit::WebPlatformStrategies::resourceLoadScheduler): + * WebProcess/WebCoreSupport/WebPlatformStrategies.h: + + * WebKit2.xcodeproj/project.pbxproj: + +2012-10-25 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Remove some C'ism from EwkView + https://bugs.webkit.org/show_bug.cgi?id=100370 + + Reviewed by Kenneth Rohde Christiansen. + + Remove a lot of C'ism from EwkView: + - Make more members private and add C++ methods to + EwkViewImpl for the public C API to use + - Use smart pointers when possible instead of raw + ones + - Use C++ naming conventions for callback functions + and define them as static methods in EwkViewImpl. + + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::onIMFInputSequenceComplete): + (EwkViewImpl::onIMFPreeditSequenceChanged): + (EwkViewImpl::createIMFContext): + (EwkViewImpl::EwkViewImpl): + (EwkViewImpl::~EwkViewImpl): + (EwkViewImpl::setCursor): + (EwkViewImpl::setColorPickerColor): + (EwkViewImpl::isFocused): + (EwkViewImpl::isVisible): + (EwkViewImpl::title): + (EwkViewImpl::inputMethodContext): + (EwkViewImpl::themePath): + (EwkViewImpl::setThemePath): + (EwkViewImpl::customTextEncodingName): + (EwkViewImpl::setCustomTextEncodingName): + (EwkViewImpl::setMouseEventsEnabled): + (EwkViewImpl::setTouchEventsEnabled): + (EwkViewImpl::informIconChange): + (EwkViewImpl::requestColorPicker): + (EwkViewImpl::dismissColorPicker): + (EwkViewImpl::updateTextInputState): + (EwkViewImpl::informURLChange): + (EwkViewImpl::onMouseDown): + (EwkViewImpl::onMouseUp): + (EwkViewImpl::onMouseMove): + (EwkViewImpl::feedTouchEvents): + (EwkViewImpl::onTouchDown): + (EwkViewImpl::onTouchUp): + (EwkViewImpl::onTouchMove): + * UIProcess/API/efl/EwkViewImpl.h: + (WebCore): + (EwkViewImpl::ewkContext): + (EwkViewImpl::settings): + (EwkViewImpl): + (EwkViewImpl::url): + (EwkViewImpl::faviconURL): + (EwkViewImpl::mouseEventsEnabled): + (EwkViewImpl::touchEventsEnabled): + * UIProcess/API/efl/PageClientImpl.cpp: + (WebKit::PageClientImpl::isViewFocused): + (WebKit::PageClientImpl::isViewVisible): + (WebKit::PageClientImpl::didRelaunchProcess): + (WebKit::PageClientImpl::handleDownloadRequest): + * UIProcess/API/efl/ewk_settings_private.h: + (Ewk_Settings::create): + (Ewk_Settings::Ewk_Settings): + (Ewk_Settings): + * UIProcess/API/efl/ewk_view.cpp: + (_ewk_view_smart_mouse_up): + (_ewk_view_smart_key_down): + (_ewk_view_smart_add): + (ewk_view_context_get): + (ewk_view_url_get): + (ewk_view_icon_url_get): + (ewk_view_settings_get): + (ewk_view_title_get): + (ewk_view_theme_set): + (ewk_view_theme_get): + (ewk_view_setting_encoding_custom_get): + (ewk_view_setting_encoding_custom_set): + (ewk_view_mouse_events_enabled_set): + (ewk_view_mouse_events_enabled_get): + (ewk_view_color_picker_color_set): + (ewk_view_touch_events_enabled_set): + (ewk_view_touch_events_enabled_get): + * UIProcess/efl/WebInspectorProxyEfl.cpp: + (WebKit::WebInspectorProxy::platformCreateInspectorPage): + +2012-10-25 Anders Carlsson <andersca@apple.com> + + Assertion failure trying to dispatch notification messages + https://bugs.webkit.org/show_bug.cgi?id=100387 + <rdar://problem/12573195> + + Reviewed by Jessie Berlin. + + Pass a zero destination ID when sending WebNotificationManagerProxy messages; they are not + used by the UI process and since the WebNotificationManagerProxy message receiver is global + passing a non-zero destination ID would cause the aforementioned assertion failure. + + * WebProcess/Notifications/WebNotificationManager.cpp: + (WebKit::WebNotificationManager::cancel): + (WebKit::WebNotificationManager::clearNotifications): + (WebKit::WebNotificationManager::didDestroyNotification): + +2012-10-25 Alexey Proskuryakov <ap@apple.com> + + REGRESSION (r131686): Crashes in NSToolTipManager + https://bugs.webkit.org/show_bug.cgi?id=99792 + + Now that NSToolTip related parts of this change have been rolled out, roll out + the initial crash fix, too. We have no direct evidence that it's to blame, but it + doesn't serve any specific purpose any more. + + * UIProcess/API/mac/WKView.mm: (-[WKView viewDidMoveToWindow]): + +2012-10-25 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Memory leak in _ewk_view_preedit_changed() + https://bugs.webkit.org/show_bug.cgi?id=100380 + + Reviewed by Antonio Gomes. + + Fix memory leak in _ewk_view_preedit_changed(). The buffer + returned by ecore_imf_context_preedit_string_get() is never + freed. + + * UIProcess/API/efl/EwkViewImpl.cpp: + (_ewk_view_preedit_changed): + +2012-10-25 Yael Aharon <yael.aharon@intel.com> + + [EFL][WK2][AC] Regression(132392) infinite loop when displaying certain animations. + https://bugs.webkit.org/show_bug.cgi?id=100288 + + Reviewed by Kenneth Rohde Christiansen. + + When PageClientImpl::setViewNeedsDisplay is called, start a 0 length timer. + That breaks the synchronous loop we were experiencing when ewk_view_display + was called directly. + + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::EwkViewImpl): + (EwkViewImpl::displayTimerFired): + (EwkViewImpl::redrawRegion): + * UIProcess/API/efl/EwkViewImpl.h: + (EwkViewImpl): + +2012-10-25 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + Add setMediaTypeOverride to window.internals.settings + https://bugs.webkit.org/show_bug.cgi?id=100249 + + Reviewed by Kenneth Rohde Christiansen. + + Exported WebCore::Settings::setMediaTypeOverride(WTF::String const&) for WIN port. + + * win/WebKit2.def: + +2012-10-25 KyungTae Kim <ktf.kim@samsung.com> + + [WK2][EFL] Add ewk_view_pagination_mode_set/get() APIs + https://bugs.webkit.org/show_bug.cgi?id=100213 + + Reviewed by Gyuyoung Kim. + + Add ewk_view_pagination_mode_set/get() APIs for paginated display. + + * UIProcess/API/efl/ewk_view.cpp: + (ewk_view_pagination_mode_set): + (ewk_view_pagination_mode_get): + * UIProcess/API/efl/ewk_view.h: + * UIProcess/API/efl/tests/test_ewk2_view.cpp: + (TEST_F): + +2012-10-25 Sudarsana Nagineni <sudarsana.nagineni@intel.com> + + [EFL][AC] Fix build break when AC is enabled + https://bugs.webkit.org/show_bug.cgi?id=100367 + + Unreviewed build fix after r132405. + + * UIProcess/API/efl/PageViewportControllerClientEfl.cpp: + (WebKit::PageViewportControllerClientEfl::PageViewportControllerClientEfl): + +2012-10-25 Byungwoo Lee <bw80.lee@samsung.com> + + [EFL][WK2] Add missing namespace. + https://bugs.webkit.org/show_bug.cgi?id=100251 + + Reviewed by Kenneth Rohde Christiansen. + + Add 'WebKit' namespace for BatteryProvider, NetworkInfoProvider and + VibrationProvider. + + * UIProcess/API/efl/BatteryProvider.h: + (WebKit): + * UIProcess/API/efl/NetworkInfoProvider.cpp: + * UIProcess/API/efl/NetworkInfoProvider.h: + (WebKit): + * UIProcess/API/efl/VibrationProvider.cpp: + * UIProcess/API/efl/VibrationProvider.h: + (WebKit): + * UIProcess/API/efl/ewk_context_private.h: + (WebKit): + (Ewk_Context): + +2012-10-25 Jocelyn Turcotte <jocelyn.turcotte@digia.com> + + [Qt] Detach WebContext's clients from QtWebContext + https://bugs.webkit.org/show_bug.cgi?id=100224 + + Reviewed by Simon Hausmann. + + The lifetime of WebContext isn't bound to QtWebContext and we wouldn't + keep a reference to our WebContext and would create a new one if a new + QQuickWebView/QtWebContext was created after we destroyed our QtWebContext. + This would cause a new WebContext and a new web process and somehow the + new WebContext could pick the IPC messages from the old WebProcess + and this would cause the new download client to receive messages about + downloads he doesn't know about and crash. + + We assumed in the past that we would need multiple WebContext to allow + multiple web processes but this assumption doesn't hold anymore with + the work on ProcessModelMultipleSecondaryProcesses. + This patch enforces the use of a single WebContext by: + - Holding a single instance of QtWebIconDatabaseClient and QtDownloadManager + statically in QtWebContext + - Removing the context ID from QWebIconImageProvider's URLs + - Using QtWebContext as a temporary wrapper handle on WebContext to + initialize the WebContext's clients and allow us creating the first web page + + platformInvalidateContext is used to clean up static global instances + when the WebContext is getting destroyed. + + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebViewPrivate::handleDownloadRequest): + * UIProcess/API/qt/qwebiconimageprovider.cpp: + (QWebIconImageProvider::iconURLForPageURLInContext): + (QWebIconImageProvider::requestImage): + * UIProcess/qt/QtWebContext.cpp: + (WebKit): + (WebKit::QtWebContext::QtWebContext): + (WebKit::QtWebContext::~QtWebContext): + (WebKit::QtWebContext::create): + (WebKit::QtWebContext::defaultContext): + (WebKit::QtWebContext::downloadManager): + (WebKit::QtWebContext::iconDatabase): + (WebKit::QtWebContext::invalidateContext): + * UIProcess/qt/QtWebContext.h: + (QtWebContext): + * UIProcess/qt/QtWebIconDatabaseClient.cpp: + (WebKit::QtWebIconDatabaseClient::QtWebIconDatabaseClient): + * UIProcess/qt/QtWebIconDatabaseClient.h: + (WebKit): + (QtWebIconDatabaseClient): + * UIProcess/qt/WebContextQt.cpp: + (WebKit::WebContext::platformInvalidateContext): + +2012-10-25 Jocelyn Turcotte <jocelyn.turcotte@digia.com> + + [Qt] Make the context injected bundle client static + https://bugs.webkit.org/show_bug.cgi?id=100223 + + Reviewed by Kenneth Rohde Christiansen. + + It doesn't need any data from QtWebContext. + + * UIProcess/qt/QtWebContext.cpp: + (WebKit::didReceiveMessageFromInjectedBundle): + (WebKit): + (WebKit::initializeContextInjectedBundleClient): + (WebKit::QtWebContext::defaultContext): + * UIProcess/qt/QtWebContext.h: + (QtWebContext): + +2012-10-25 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Get rid of Ewk_View private C API (Part 2) + https://bugs.webkit.org/show_bug.cgi?id=100331 + + Reviewed by Kenneth Rohde Christiansen. + + Convert most of the remaining Ewk_View private C API + into C++ methods in EwkViewImpl class. Only one private + C function remains but it will be taken care of in a + later patch to clean up the view construction code. + + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::addToPageViewMap): + (EwkViewImpl::removeFromPageViewMap): + (EwkViewImpl::viewFromPageViewMap): + (EwkViewImpl::fromEvasObject): + (EwkViewImpl::informLoadFinished): + (EwkViewImpl::informProvisionalLoadRedirect): + (EwkViewImpl::informProvisionalLoadStarted): + (EwkViewImpl::informWebProcessCrashed): + (EwkViewImpl::informContentsSizeChange): + (EwkViewImpl::requestPopupMenu): + (EwkViewImpl::requestJSAlertPopup): + (EwkViewImpl::requestJSConfirmPopup): + (EwkViewImpl::requestJSPromptPopup): + (EwkViewImpl::informDatabaseQuotaReached): + (EwkViewImpl::updateTextInputState): + (EwkViewImpl::informURLChange): + (EwkViewImpl::createNewPage): + (EwkViewImpl::closePage): + * UIProcess/API/efl/EwkViewImpl.h: + (WebKit): + (EwkViewImpl): + * UIProcess/API/efl/PageClientImpl.cpp: + (WebKit::PageClientImpl::processDidCrash): + (WebKit::PageClientImpl::createPopupMenuProxy): + (WebKit::PageClientImpl::updateTextInputState): + (WebKit::PageClientImpl::didChangeContentsSize): + * UIProcess/API/efl/ewk_view.cpp: + (_ewk_view_smart_del): + (_ewk_view_initialize): + (ewk_view_url_set): + (ewk_view_reload): + (ewk_view_reload_bypass_cache): + (ewk_view_html_string_load): + * UIProcess/API/efl/ewk_view_private.h: + * UIProcess/efl/ContextHistoryClientEfl.cpp: + (WebKit::ContextHistoryClientEfl::didNavigateWithNavigationData): + (WebKit::ContextHistoryClientEfl::didPerformClientRedirect): + (WebKit::ContextHistoryClientEfl::didPerformServerRedirect): + (WebKit::ContextHistoryClientEfl::didUpdateHistoryTitle): + * UIProcess/efl/FindClientEfl.cpp: + * UIProcess/efl/FormClientEfl.cpp: + * UIProcess/efl/PageLoadClientEfl.cpp: + (WebKit::PageLoadClientEfl::didSameDocumentNavigationForFrame): + * UIProcess/efl/PageLoadClientEfl.h: + * UIProcess/efl/PagePolicyClientEfl.cpp: + * UIProcess/efl/PagePolicyClientEfl.h: + * UIProcess/efl/PageUIClientEfl.cpp: + (WebKit::PageUIClientEfl::closePage): + (WebKit::PageUIClientEfl::createNewPage): + (WebKit::PageUIClientEfl::runJavaScriptAlert): + (WebKit::PageUIClientEfl::runJavaScriptConfirm): + (WebKit::PageUIClientEfl::runJavaScriptPrompt): + (WebKit::PageUIClientEfl::exceededDatabaseQuota): + * UIProcess/efl/PageUIClientEfl.h: + * UIProcess/efl/ResourceLoadClientEfl.h: + * UIProcess/efl/WebPopupMenuProxyEfl.cpp: + (WebKit::WebPopupMenuProxyEfl::WebPopupMenuProxyEfl): + (WebKit::WebPopupMenuProxyEfl::showPopupMenu): + (WebKit::WebPopupMenuProxyEfl::hidePopupMenu): + * UIProcess/efl/WebPopupMenuProxyEfl.h: + (WebKit::WebPopupMenuProxyEfl::create): + (WebPopupMenuProxyEfl): + +2012-10-24 Joone Hur <joone.hur@intel.com> + + [EFL][AC] Unreviewed, fix build break when AC is enabled + + Fix build break after r132405. + + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::enterAcceleratedCompositingMode): + * UIProcess/API/efl/PageViewportControllerClientEfl.cpp: + (WebKit::PageViewportControllerClientEfl::didChangeContentsSize): + (WebKit::PageViewportControllerClientEfl::didChangeVisibleContents): + * UIProcess/API/efl/ewk_view.cpp: + (_ewk_view_smart_calculate): + +2012-10-24 Anders Carlsson <andersca@apple.com> + + Make it a compile error to send a sync message as async (and vice versa) + https://bugs.webkit.org/show_bug.cgi?id=100285 + + Reviewed by Sam Weinig. + + Add an "isSync" boolean to each generated message struct and add compile asserts to the message senders. + + * Platform/CoreIPC/Connection.h: + (CoreIPC::Connection::send): + (CoreIPC::Connection::sendSync): + * Platform/CoreIPC/MessageSender.h: + (CoreIPC::MessageSender::send): + (CoreIPC::MessageSender::sendSync): + * Scripts/webkit2/messages.py: + (message_to_struct_declaration): + * Scripts/webkit2/messages_unittest.py: + * UIProcess/WebProcessProxy.h: + (WebKit::WebProcessProxy::send): + (WebKit::WebProcessProxy::sendSync): + +2012-10-24 Kiran Muppala <cmuppala@apple.com> + + Disable auto termination of WebKit2 processes on mac + https://bugs.webkit.org/show_bug.cgi?id=100176 + + Reviewed by Alexey Proskuryakov. + + Disable WebKit2 auto termination by taking corresponding assertion + until UI process is enhanced to determine when it is safe to enable it. + + * NetworkProcess/mac/NetworkProcessMainMac.mm: + (WebKit::NetworkProcessMain): + * PluginProcess/mac/PluginProcessMainMac.mm: + (WebKit::PluginProcessMain): + * SharedWorkerProcess/mac/SharedWorkerProcessMainMac.mm: + (WebKit::SharedWorkerProcessMain): + * WebProcess/mac/WebProcessInitialization.mm: + (WebKit::InitializeWebProcess): + +2012-10-24 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Get rid of Ewk_View private C API (Part 1) + https://bugs.webkit.org/show_bug.cgi?id=100230 + + Reviewed by Kenneth Rohde Christiansen. + + Remove part of the Ewk_View private C API and replace + it by C++ methods in EwkViewImpl class. Eventually, + all the private C functions will be removed but it + will be done in several patches. + + * UIProcess/API/C/efl/WKView.cpp: + (WKViewGetPage): + * UIProcess/API/efl/EwkViewImpl.cpp: + (_ewk_view_commit): + (_ewk_view_preedit_changed): + (EwkViewImpl::EwkViewImpl): + (EwkViewImpl::smartData): + (EwkViewImpl::fromEvasObject): + (EwkViewImpl::wkPage): + (EwkViewImpl::setCursor): + (EwkViewImpl::redrawRegion): + (EwkViewImpl::informDownloadJobCancelled): + (EwkViewImpl::informDownloadJobFailed): + (EwkViewImpl::informDownloadJobFinished): + (EwkViewImpl::informDownloadJobRequested): + (EwkViewImpl::informNewFormSubmissionRequest): + (EwkViewImpl::enterFullScreen): + (EwkViewImpl::exitFullScreen): + (EwkViewImpl::setImageData): + (EwkViewImpl::informLoadError): + (EwkViewImpl::informLoadFinished): + (EwkViewImpl::informLoadProgress): + (EwkViewImpl::informProvisionalLoadFailed): + (EwkViewImpl::informLoadCommitted): + (EwkViewImpl::informProvisionalLoadRedirect): + (EwkViewImpl::informProvisionalLoadStarted): + (EwkViewImpl::informNavigationPolicyDecision): + (EwkViewImpl::informNewWindowPolicyDecision): + (EwkViewImpl::informResourceLoadStarted): + (EwkViewImpl::informResourceLoadResponse): + (EwkViewImpl::informResourceLoadFailed): + (EwkViewImpl::informResourceLoadFinished): + (EwkViewImpl::informResourceRequestSent): + (EwkViewImpl::informTitleChange): + (EwkViewImpl::informTooltipTextChange): + (EwkViewImpl::informTextFound): + (EwkViewImpl::size): + (EwkViewImpl::informIconChange): + (EwkViewImpl::informIntentRequest): + (EwkViewImpl::informIntentServiceRegistration): + (EwkViewImpl::createGLSurface): + (EwkViewImpl::enterAcceleratedCompositingMode): + (EwkViewImpl::exitAcceleratedCompositingMode): + (EwkViewImpl::requestColorPicker): + (EwkViewImpl::dismissColorPicker): + (EwkViewImpl::informBackForwardListChange): + * UIProcess/API/efl/EwkViewImpl.h: + (WebCore): + (EwkViewImpl): + (EwkViewImpl::view): + (EwkViewImpl::page): + * UIProcess/API/efl/PageClientImpl.cpp: + (WebKit::PageClientImpl::PageClientImpl): + (WebKit::PageClientImpl::viewImpl): + (WebKit): + (WebKit::PageClientImpl::createDrawingAreaProxy): + (WebKit::PageClientImpl::setViewNeedsDisplay): + (WebKit::PageClientImpl::viewSize): + (WebKit::PageClientImpl::isViewFocused): + (WebKit::PageClientImpl::isViewVisible): + (WebKit::PageClientImpl::processDidCrash): + (WebKit::PageClientImpl::didRelaunchProcess): + (WebKit::PageClientImpl::toolTipChanged): + (WebKit::PageClientImpl::setCursor): + (WebKit::PageClientImpl::createPopupMenuProxy): + (WebKit::PageClientImpl::enterAcceleratedCompositingMode): + (WebKit::PageClientImpl::exitAcceleratedCompositingMode): + (WebKit::PageClientImpl::updateTextInputState): + (WebKit::PageClientImpl::handleDownloadRequest): + (WebKit::PageClientImpl::didChangeContentsSize): + * UIProcess/API/efl/PageClientImpl.h: + (WebKit::PageClientImpl::create): + (PageClientImpl): + * UIProcess/API/efl/PageViewportControllerClientEfl.cpp: + (WebKit::PageViewportControllerClientEfl::PageViewportControllerClientEfl): + (WebKit::PageViewportControllerClientEfl::drawingArea): + (WebKit::PageViewportControllerClientEfl::updateViewportSize): + (WebKit::PageViewportControllerClientEfl::didChangeContentsSize): + (WebKit::PageViewportControllerClientEfl::didChangeVisibleContents): + * UIProcess/API/efl/PageViewportControllerClientEfl.h: + (WebKit::PageViewportControllerClientEfl::create): + (PageViewportControllerClientEfl): + * UIProcess/API/efl/ewk_download_job.cpp: + (Ewk_Download_Job::Ewk_Download_Job): + (Ewk_Download_Job::viewImpl): + * UIProcess/API/efl/ewk_download_job_private.h: + (Ewk_Download_Job::create): + (Ewk_Download_Job): + * UIProcess/API/efl/ewk_view.cpp: + (pageViewMap): + (addToPageViewMap): + (removeFromPageViewMap): + (_ewk_view_on_favicon_changed): + (_ewk_view_smart_focus_in): + (_ewk_view_smart_focus_out): + (mapToWebContent): + (_ewk_view_smart_mouse_wheel): + (_ewk_view_smart_mouse_down): + (_ewk_view_smart_mouse_up): + (_ewk_view_smart_mouse_move): + (_ewk_view_smart_key_down): + (_ewk_view_smart_key_up): + (_ewk_view_on_show): + (_ewk_view_on_hide): + (_ewk_view_impl_del): + (_ewk_view_smart_del): + (_ewk_view_smart_calculate): + (_ewk_view_smart_color_set): + (_ewk_view_initialize): + (_ewk_view_add_with_smart): + (ewk_view_context_get): + (ewk_view_url_update): + (ewk_view_url_set): + (ewk_view_url_get): + (ewk_view_icon_url_get): + (ewk_view_reload): + (ewk_view_reload_bypass_cache): + (ewk_view_stop): + (ewk_view_settings_get): + (ewk_view_title_get): + (ewk_view_text_input_state_update): + (ewk_view_load_progress_get): + (ewk_view_scale_set): + (ewk_view_scale_get): + (ewk_view_device_pixel_ratio_set): + (ewk_view_device_pixel_ratio_get): + (ewk_view_theme_set): + (ewk_view_theme_get): + (ewk_view_back): + (ewk_view_forward): + (ewk_view_intent_deliver): + (ewk_view_back_possible): + (ewk_view_forward_possible): + (ewk_view_back_forward_list_get): + (ewk_view_html_string_load): + (ewk_view_setting_encoding_custom_get): + (ewk_view_setting_encoding_custom_set): + (ewk_view_page_create): + (ewk_view_text_find): + (ewk_view_text_find_highlight_clear): + (ewk_view_text_matches_count): + (ewk_view_contents_size_changed): + (ewk_view_popup_menu_request): + (ewk_view_popup_menu_close): + (ewk_view_popup_menu_select): + (ewk_view_mouse_events_enabled_set): + (ewk_view_mouse_events_enabled_get): + (ewk_view_webprocess_crashed): + (ewk_view_color_picker_color_set): + (ewk_view_feed_touch_event): + (ewk_view_touch_events_enabled_set): + (ewk_view_touch_events_enabled_get): + (ewk_view_inspector_show): + (ewk_view_inspector_close): + * UIProcess/API/efl/ewk_view_private.h: + * UIProcess/cairo/BackingStoreCairo.cpp: + (WebKit::BackingStore::incorporateUpdate): + * UIProcess/efl/DownloadManagerEfl.cpp: + (WebKit::DownloadManagerEfl::decideDestinationWithSuggestedFilename): + (WebKit::DownloadManagerEfl::didFail): + (WebKit::DownloadManagerEfl::didCancel): + (WebKit::DownloadManagerEfl::didFinish): + (WebKit::DownloadManagerEfl::registerDownload): + * UIProcess/efl/DownloadManagerEfl.h: + (DownloadManagerEfl): + * UIProcess/efl/FindClientEfl.cpp: + (WebKit::FindClientEfl::didFindString): + (WebKit::FindClientEfl::didFailToFindString): + (WebKit::FindClientEfl::FindClientEfl): + * UIProcess/efl/FindClientEfl.h: + (WebKit::FindClientEfl::create): + (FindClientEfl): + * UIProcess/efl/FormClientEfl.cpp: + (WebKit::FormClientEfl::willSubmitForm): + (WebKit::FormClientEfl::FormClientEfl): + * UIProcess/efl/FormClientEfl.h: + (WebKit::FormClientEfl::create): + (FormClientEfl): + * UIProcess/efl/PageLoadClientEfl.cpp: + (WebKit::PageLoadClientEfl::didReceiveTitleForFrame): + (WebKit::PageLoadClientEfl::didReceiveIntentForFrame): + (WebKit::PageLoadClientEfl::registerIntentServiceForFrame): + (WebKit::PageLoadClientEfl::didChangeProgress): + (WebKit::PageLoadClientEfl::didFinishLoadForFrame): + (WebKit::PageLoadClientEfl::didFailLoadWithErrorForFrame): + (WebKit::PageLoadClientEfl::didStartProvisionalLoadForFrame): + (WebKit::PageLoadClientEfl::didReceiveServerRedirectForProvisionalLoadForFrame): + (WebKit::PageLoadClientEfl::didFailProvisionalLoadWithErrorForFrame): + (WebKit::PageLoadClientEfl::didCommitLoadForFrame): + (WebKit::PageLoadClientEfl::didChangeBackForwardList): + (WebKit::PageLoadClientEfl::didSameDocumentNavigationForFrame): + (WebKit::PageLoadClientEfl::PageLoadClientEfl): + * UIProcess/efl/PageLoadClientEfl.h: + (WebKit::PageLoadClientEfl::create): + (PageLoadClientEfl): + (WebKit::PageLoadClientEfl::viewImpl): + * UIProcess/efl/PagePolicyClientEfl.cpp: + (WebKit::PagePolicyClientEfl::decidePolicyForNavigationAction): + (WebKit::PagePolicyClientEfl::decidePolicyForNewWindowAction): + (WebKit::PagePolicyClientEfl::PagePolicyClientEfl): + * UIProcess/efl/PagePolicyClientEfl.h: + (WebKit::PagePolicyClientEfl::create): + (PagePolicyClientEfl): + * UIProcess/efl/PageUIClientEfl.cpp: + (WebKit::PageUIClientEfl::closePage): + (WebKit::PageUIClientEfl::createNewPage): + (WebKit::PageUIClientEfl::runJavaScriptAlert): + (WebKit::PageUIClientEfl::runJavaScriptConfirm): + (WebKit::PageUIClientEfl::runJavaScriptPrompt): + (WebKit::PageUIClientEfl::showColorPicker): + (WebKit::PageUIClientEfl::hideColorPicker): + (WebKit::PageUIClientEfl::exceededDatabaseQuota): + (WebKit::PageUIClientEfl::focus): + (WebKit::PageUIClientEfl::unfocus): + (WebKit::PageUIClientEfl::takeFocus): + (WebKit::PageUIClientEfl::getWindowFrame): + (WebKit::PageUIClientEfl::setWindowFrame): + (WebKit::PageUIClientEfl::PageUIClientEfl): + * UIProcess/efl/PageUIClientEfl.h: + (WebKit::PageUIClientEfl::create): + (PageUIClientEfl): + * UIProcess/efl/ResourceLoadClientEfl.cpp: + (WebKit::ResourceLoadClientEfl::didInitiateLoadForResource): + (WebKit::ResourceLoadClientEfl::didSendRequestForResource): + (WebKit::ResourceLoadClientEfl::didReceiveResponseForResource): + (WebKit::ResourceLoadClientEfl::didFinishLoadForResource): + (WebKit::ResourceLoadClientEfl::didFailLoadForResource): + (WebKit::ResourceLoadClientEfl::ResourceLoadClientEfl): + (WebKit::ResourceLoadClientEfl::~ResourceLoadClientEfl): + * UIProcess/efl/ResourceLoadClientEfl.h: + (WebKit::ResourceLoadClientEfl::create): + (ResourceLoadClientEfl): + * UIProcess/efl/WebFullScreenManagerProxyEfl.cpp: + (WebKit::WebFullScreenManagerProxy::enterFullScreen): + (WebKit::WebFullScreenManagerProxy::exitFullScreen): + * UIProcess/efl/WebInspectorProxyEfl.cpp: + (WebKit::WebInspectorProxy::platformCreateInspectorPage): + * UIProcess/efl/WebPageProxyEfl.cpp: + (WebKit::WebPageProxy::viewWidget): + +2012-10-24 Brady Eidson <beidson@apple.com> + + Add a strategy for loader customization. + https://bugs.webkit.org/show_bug.cgi?id=100278 + + Reviewed by Alexey Proskuryakov. + + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + (WebKit::WebPlatformStrategies::createLoaderStrategy): + * WebProcess/WebCoreSupport/WebPlatformStrategies.h: + (WebPlatformStrategies): + +2012-10-24 No'am Rosenthal <noam.rosenthal@nokia.com> + + Coordinated Graphics: Enable threaded/IPC animations + https://bugs.webkit.org/show_bug.cgi?id=93146 + + Reviewed by Caio Marcelo de Oliveira Filho. + + In some cases there are pending changes in the layers, but no actual changes to the frame. + In that case we should unlock the animations. + + * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp: + (WebKit::LayerTreeCoordinator::flushPendingLayerChanges): + +2012-10-24 Noam Rosenthal <noam.rosenthal@nokia.com> + + [Qt-on-Mac] GraphicsSurfaces should not create a global IOSurface handle + https://bugs.webkit.org/show_bug.cgi?id=89885 + + Reviewed by Kenneth Rohde Christiansen. + + Use mach_port instead of global tokens for IOSurfaces. + Global IOSurfaces are accessible from other processes, while mach_ports can only be shared + directly via IPC. + + * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp: + (CoreIPC::::encode): + (CoreIPC::::decode): + +2012-10-24 Anders Carlsson <andersca@apple.com> + + Add per destination ID message receivers + https://bugs.webkit.org/show_bug.cgi?id=100276 + + Reviewed by Andreas Kling. + + Extend MessageReceiverMap to handle adding message receivers for a given destinationID/receiver name pair. + Use this to make every WebPage object a message receiver. + + * Platform/CoreIPC/MessageReceiverMap.cpp: + (CoreIPC::MessageReceiverMap::addMessageReceiver): + (CoreIPC): + (CoreIPC::MessageReceiverMap::removeMessageReceiver): + (CoreIPC::MessageReceiverMap::invalidate): + (CoreIPC::MessageReceiverMap::dispatchMessage): + (CoreIPC::MessageReceiverMap::dispatchSyncMessage): + * Platform/CoreIPC/MessageReceiverMap.h: + (MessageReceiverMap): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + (WebKit::WebPage::~WebPage): + * WebProcess/WebPage/WebPage.h: + (WebPage): + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::addMessageReceiver): + (WebKit): + (WebKit::WebProcess::removeMessageReceiver): + (WebKit::WebProcess::didReceiveSyncMessage): + (WebKit::WebProcess::didReceiveMessage): + * WebProcess/WebProcess.h: + (WebProcess): + +2012-10-24 Timothy Hatcher <timothy@apple.com> + + Make the Inspector WKView/WebView become the first responder when bringToFront is called. + + https://bugs.webkit.org/show_bug.cgi?id=100209 + + Reviewed by Joseph Pecoraro. + + * UIProcess/mac/WebInspectorProxyMac.mm: + (WebKit::WebInspectorProxy::platformBringToFront): Make the Inspector WKView become the first responder. + +2012-10-23 Alexey Proskuryakov <ap@apple.com> + + Add a strategy for shared workers + https://bugs.webkit.org/show_bug.cgi?id=100165 + + Reviewed by Brady Eidson. + + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + (WebKit::WebPlatformStrategies::createPasteboardStrategy): + (WebKit::WebPlatformStrategies::createSharedWorkerStrategy): + (WebKit::WebPlatformStrategies::createVisitedLinkStrategy): + * WebProcess/WebCoreSupport/WebPlatformStrategies.h: + +2012-10-23 Sam Weinig <sam@webkit.org> + + Move a few more WebProcess sub-objects to be MessageReceivers + https://bugs.webkit.org/show_bug.cgi?id=100186 + + Reviewed by Anders Carlsson. + + * WebProcess/Battery/WebBatteryManager.cpp: + (WebKit::WebBatteryManager::WebBatteryManager): + * WebProcess/Battery/WebBatteryManager.h: + (WebBatteryManager): + * WebProcess/IconDatabase/WebIconDatabaseProxy.cpp: + (WebKit::WebIconDatabaseProxy::WebIconDatabaseProxy): + (WebKit): + * WebProcess/IconDatabase/WebIconDatabaseProxy.h: + (WebIconDatabaseProxy): + * WebProcess/NetworkInfo/WebNetworkInfoManager.cpp: + (WebKit::WebNetworkInfoManager::WebNetworkInfoManager): + * WebProcess/NetworkInfo/WebNetworkInfoManager.h: + (WebNetworkInfoManager): + * WebProcess/Notifications/WebNotificationManager.cpp: + (WebKit::WebNotificationManager::WebNotificationManager): + * WebProcess/Notifications/WebNotificationManager.h: + (WebNotificationManager): + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::didReceiveMessage): + * WebProcess/soup/WebSoupRequestManager.cpp: + (WebKit::WebSoupRequestManager::WebSoupRequestManager): + * WebProcess/soup/WebSoupRequestManager.h: + (WebSoupRequestManager): + +2012-10-23 Anders Carlsson <andersca@apple.com> + + encode should take an ArgumentEncoder reference + https://bugs.webkit.org/show_bug.cgi?id=100183 + + Reviewed by Jessie Berlin. + + * Platform/CoreIPC/ArgumentCoder.h: + (CoreIPC::ArgumentCoder::encode): + * Platform/CoreIPC/Arguments.h: + (CoreIPC::Arguments0::encode): + (CoreIPC::Arguments1::encode): + (CoreIPC::Arguments2::encode): + (CoreIPC::Arguments3::encode): + (CoreIPC::Arguments4::encode): + (CoreIPC::Arguments5::encode): + (CoreIPC::Arguments6::encode): + (CoreIPC::Arguments7::encode): + (CoreIPC::Arguments8::encode): + (CoreIPC::Arguments10::encode): + * Platform/CoreIPC/Attachment.cpp: + (CoreIPC::Attachment::encode): + * Platform/CoreIPC/Attachment.h: + (Attachment): + * Platform/CoreIPC/DataReference.cpp: + (CoreIPC::DataReference::encode): + * Platform/CoreIPC/DataReference.h: + (DataReference): + * Platform/CoreIPC/StringReference.cpp: + (CoreIPC::StringReference::encode): + * Platform/CoreIPC/StringReference.h: + (StringReference): + * Platform/CoreIPC/mac/MachPort.h: + (CoreIPC::MachPort::encode): + * Platform/SharedMemory.h: + (Handle): + * Platform/mac/SharedMemoryMac.cpp: + (WebKit::SharedMemory::Handle::encode): + * PluginProcess/PluginCreationParameters.cpp: + (WebKit::PluginCreationParameters::encode): + * PluginProcess/PluginCreationParameters.h: + (PluginCreationParameters): + * Shared/DictionaryPopupInfo.cpp: + (WebKit::DictionaryPopupInfo::encode): + * Shared/DictionaryPopupInfo.h: + (DictionaryPopupInfo): + * Shared/EditorState.cpp: + (WebKit::EditorState::encode): + * Shared/EditorState.h: + (EditorState): + * Shared/FontInfo.cpp: + (WebKit::FontInfo::encode): + * Shared/FontInfo.h: + (FontInfo): + * Shared/LayerTreeContext.h: + (LayerTreeContext): + * Shared/Network/NetworkProcessCreationParameters.cpp: + (WebKit::NetworkProcessCreationParameters::encode): + * Shared/Network/NetworkProcessCreationParameters.h: + (NetworkProcessCreationParameters): + * Shared/OriginAndDatabases.cpp: + (WebKit::OriginAndDatabases::encode): + * Shared/OriginAndDatabases.h: + (OriginAndDatabases): + * Shared/PlatformPopupMenuData.cpp: + (WebKit::PlatformPopupMenuData::encode): + * Shared/PlatformPopupMenuData.h: + (PlatformPopupMenuData): + * Shared/Plugins/NPIdentifierData.cpp: + (WebKit::NPIdentifierData::encode): + * Shared/Plugins/NPIdentifierData.h: + (NPIdentifierData): + * Shared/Plugins/NPVariantData.cpp: + (WebKit::NPVariantData::encode): + * Shared/Plugins/NPVariantData.h: + (NPVariantData): + * Shared/Plugins/PluginProcessCreationParameters.cpp: + (WebKit::PluginProcessCreationParameters::encode): + * Shared/Plugins/PluginProcessCreationParameters.h: + (PluginProcessCreationParameters): + * Shared/PrintInfo.cpp: + (WebKit::PrintInfo::encode): + * Shared/PrintInfo.h: + (PrintInfo): + * Shared/SandboxExtension.h: + (Handle): + (HandleArray): + * Shared/SecurityOriginData.cpp: + (WebKit::SecurityOriginData::encode): + * Shared/SecurityOriginData.h: + (SecurityOriginData): + * Shared/SessionState.cpp: + (WebKit::SessionState::encode): + * Shared/SessionState.h: + (SessionState): + * Shared/ShareableBitmap.cpp: + (WebKit::ShareableBitmap::Handle::encode): + * Shared/ShareableBitmap.h: + (Handle): + * Shared/SharedWorkerProcessCreationParameters.cpp: + (WebKit::SharedWorkerProcessCreationParameters::encode): + * Shared/SharedWorkerProcessCreationParameters.h: + (SharedWorkerProcessCreationParameters): + * Shared/StatisticsData.cpp: + (WebKit::StatisticsData::encode): + * Shared/StatisticsData.h: + (StatisticsData): + * Shared/StringPairVector.h: + (WebKit::StringPairVector::encode): + * Shared/UpdateInfo.cpp: + (WebKit::UpdateInfo::encode): + * Shared/UpdateInfo.h: + (UpdateInfo): + * Shared/UserMessageCoders.h: + (WebKit::UserMessageEncoder::baseEncode): + * Shared/WebContextMenuItemData.cpp: + (WebKit::WebContextMenuItemData::encode): + * Shared/WebContextMenuItemData.h: + (WebContextMenuItemData): + * Shared/WebEvent.cpp: + (WebKit::WebEvent::encode): + * Shared/WebEvent.h: + (WebEvent): + (WebMouseEvent): + (WebWheelEvent): + (WebKeyboardEvent): + (WebGestureEvent): + (WebPlatformTouchPoint): + (WebTouchEvent): + * Shared/WebGeolocationPosition.cpp: + (WebKit::WebGeolocationPosition::Data::encode): + * Shared/WebGeolocationPosition.h: + (Data): + * Shared/WebGestureEvent.cpp: + (WebKit::WebGestureEvent::encode): + * Shared/WebHitTestResult.cpp: + (WebKit::WebHitTestResult::Data::encode): + * Shared/WebHitTestResult.h: + (Data): + * Shared/WebKeyboardEvent.cpp: + (WebKit::WebKeyboardEvent::encode): + * Shared/WebMouseEvent.cpp: + (WebKit::WebMouseEvent::encode): + * Shared/WebNavigationDataStore.h: + (WebKit::WebNavigationDataStore::encode): + * Shared/WebPageCreationParameters.cpp: + (WebKit::WebPageCreationParameters::encode): + * Shared/WebPageCreationParameters.h: + (WebPageCreationParameters): + * Shared/WebPageGroupData.cpp: + (WebKit::WebPageGroupData::encode): + * Shared/WebPageGroupData.h: + (WebPageGroupData): + * Shared/WebPopupItem.cpp: + (WebKit::WebPopupItem::encode): + * Shared/WebPopupItem.h: + * Shared/WebPreferencesStore.cpp: + (WebKit::WebPreferencesStore::encode): + * Shared/WebPreferencesStore.h: + (WebPreferencesStore): + * Shared/WebProcessCreationParameters.cpp: + (WebKit::WebProcessCreationParameters::encode): + * Shared/WebProcessCreationParameters.h: + (WebProcessCreationParameters): + * Shared/WebWheelEvent.cpp: + (WebKit::WebWheelEvent::encode): + * Shared/mac/AttributedString.h: + (AttributedString): + * Shared/mac/AttributedString.mm: + (WebKit::AttributedString::encode): + * Shared/mac/ColorSpaceData.h: + (ColorSpaceData): + * Shared/mac/ColorSpaceData.mm: + (WebKit::ColorSpaceData::encode): + * Shared/mac/LayerTreeContextMac.mm: + (WebKit::LayerTreeContext::encode): + * Shared/mac/PlatformCertificateInfo.h: + (PlatformCertificateInfo): + * Shared/mac/PlatformCertificateInfo.mm: + (WebKit::PlatformCertificateInfo::encode): + * Shared/mac/SandboxExtensionMac.mm: + (WebKit::SandboxExtension::Handle::encode): + (WebKit::SandboxExtension::HandleArray::encode): + * Shared/mac/SecItemRequestData.cpp: + (WebKit::SecItemRequestData::encode): + * Shared/mac/SecItemRequestData.h: + * Shared/mac/SecItemResponseData.cpp: + (WebKit::SecItemResponseData::encode): + * Shared/mac/SecItemResponseData.h: + (SecItemResponseData): + * Shared/mac/SecKeychainItemRequestData.cpp: + (WebKit::SecKeychainItemRequestData::encode): + * Shared/mac/SecKeychainItemRequestData.h: + * Shared/mac/SecKeychainItemResponseData.cpp: + (WebKit::SecKeychainItemResponseData::encode): + * Shared/mac/SecKeychainItemResponseData.h: + (SecKeychainItemResponseData): + * UIProcess/WebContextUserMessageCoders.h: + (WebKit::WebContextUserMessageEncoder::encode): + * WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h: + (WebKit::InjectedBundleUserMessageEncoder::encode): + * WebProcess/Plugins/Plugin.cpp: + (WebKit::Plugin::Parameters::encode): + * WebProcess/Plugins/Plugin.h: + (Parameters): + +2012-10-24 Jocelyn Turcotte <jocelyn.turcotte@digia.com> + + [Qt] Move the QQuickWebViewExperimental pointer to QQuickWebViewPrivate + https://bugs.webkit.org/show_bug.cgi?id=100253 + + Reviewed by Kenneth Rohde Christiansen. + + We'll need to avoid placing data in QQuickWebView to preserve + its binary compatibility once it's public. + Also make the QQuickWebViewExperimental constructor private. + + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebViewPrivate::QQuickWebViewPrivate): + (QQuickWebViewExperimental::QQuickWebViewExperimental): + (QQuickWebView::QQuickWebView): + (QQuickWebView::experimental): + * UIProcess/API/qt/qquickwebview_p.h: + * UIProcess/API/qt/qquickwebview_p_p.h: + (QQuickWebViewPrivate): + +2012-10-24 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][WK2] Ewk_Settings refactoring + https://bugs.webkit.org/show_bug.cgi?id=100233 + + Reviewed by Kenneth Rohde Christiansen. + + Ewk_Settings private implementation is now C++ class which allows direct internal + access to WebKit::WebPreferences. + + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::EwkViewImpl): + * UIProcess/API/efl/ewk_settings.cpp: + (Ewk_Settings::preferences): + (ewk_settings_fullscreen_enabled_set): + (ewk_settings_fullscreen_enabled_get): + (ewk_settings_javascript_enabled_set): + (ewk_settings_javascript_enabled_get): + (ewk_settings_loads_images_automatically_set): + (ewk_settings_loads_images_automatically_get): + (ewk_settings_developer_extras_enabled_set): + (ewk_settings_developer_extras_enabled_get): + (ewk_settings_file_access_from_file_urls_allowed_set): + (ewk_settings_file_access_from_file_urls_allowed_get): + (ewk_settings_frame_flattening_enabled_set): + (ewk_settings_frame_flattening_enabled_get): + (ewk_settings_dns_prefetching_enabled_set): + (ewk_settings_dns_prefetching_enabled_get): + * UIProcess/API/efl/ewk_settings_private.h: + (WebKit): + (Ewk_Settings): + (Ewk_Settings::Ewk_Settings): + * UIProcess/API/efl/ewk_view.cpp: + (_ewk_view_initialize): + +2012-10-24 Sudarsana Nagineni <sudarsana.nagineni@intel.com> + + [EFL][AC] Fix build break when AC is enabled + https://bugs.webkit.org/show_bug.cgi?id=100245 + + Reviewed by Kenneth Rohde Christiansen. + + Fix build break after r132337. + + * UIProcess/API/efl/EwkViewImpl.h: + * UIProcess/API/efl/ewk_view.cpp: + +2012-10-24 Thiago Marcos P. Santos <thiago.santos@intel.com> + + [EFL] run-webkit-tests writes garbage on stderr when running on Xvfb + https://bugs.webkit.org/show_bug.cgi?id=100243 + + Reviewed by Kenneth Rohde Christiansen. + + These errors generate noise on the reports and in some cases, like when + running perf tests, makes the test fail. By using Xext, we can add a + dummy handler to ignore these errors. + + * PlatformEfl.cmake: + * WebProcess/efl/WebProcessMainEfl.cpp: + (dummyExtensionErrorHandler): + (WebKit::WebProcessMainEfl): + +2012-10-24 Eric Carlson <eric.carlson@apple.com> + + Allow ports to override text track rendering style + https://bugs.webkit.org/show_bug.cgi?id=97800 + <rdar://problem/12044964> + + Reviewed by Maciej Stachowiak. + + * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: + (InitWebCoreSystemInterface): Initialize new WKSI function pointers. + +2012-10-24 Allan Sandfeld Jensen <allan.jensen@digia.com> + + [Qt] Expose useful WebCore::Settings + https://bugs.webkit.org/show_bug.cgi?id=100239 + + Reviewed by Kenneth Rohde Christiansen. + + Expose the two settings CaretBrowsingEnabled and NotificationsEnabled. + + * UIProcess/API/qt/qwebpreferences.cpp: + (QWebPreferencesPrivate::testAttribute): + (QWebPreferencesPrivate::setAttribute): + (QWebPreferences::caretBrowsingEnabled): + (QWebPreferences::setCaretBrowsingEnabled): + (QWebPreferences::notificationsEnabled): + (QWebPreferences::setNotificationsEnabled): + * UIProcess/API/qt/qwebpreferences_p.h: + * UIProcess/API/qt/qwebpreferences_p_p.h: + +2012-10-24 Zeno Albisser <zeno@webkit.org> + + Implement GraphicsSurface for Windows. + https://bugs.webkit.org/show_bug.cgi?id=98147 + + Add encode and decode implementation for GraphicsSurfaceToken on Windows. + + Reviewed by Kenneth Rohde Christiansen. + + * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp: + (CoreIPC::::encode): + (CoreIPC::::decode): + +2012-10-24 Sudarsana Nagineni <sudarsana.nagineni@intel.com> + + [EFL][WK2] ASSERTION FAILED: edje(): could not paint native HTML part due to missing theme + https://bugs.webkit.org/show_bug.cgi?id=100227 + + Reviewed by Kenneth Rohde Christiansen. + + Browser crashes on loading any page due to missing theme after + the web process has crashed and recovered. + + This patch reset the theme when the web process is recovered to + avoid a crash. + + * UIProcess/API/efl/PageClientImpl.cpp: + (WebKit::PageClientImpl::didRelaunchProcess): + +2012-10-24 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r132333. + http://trac.webkit.org/changeset/132333 + https://bugs.webkit.org/show_bug.cgi?id=100234 + + Crashes many tests on the EFL-WK2 bot. (Requested by rakuco on + #webkit). + + * Target.pri: + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::updateTextCheckerState): + +2012-10-24 Christophe Dumez <christophe.dumez@intel.com> and Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][WK2] Move Ewk_View_Private_Data out of ewk_view.cpp + https://bugs.webkit.org/show_bug.cgi?id=100228 + + Reviewed by Gyuyoung Kim. + + Move Ewk_View_Private_Data out of ewk_view.cpp and + rename it to EwkViewImpl. This is a first step towards + getting rid of C'ism in Ewk_View. + + In a future, we will make EwkViewImpl a proper C++ + class and get rid of the private ewk_view C API so + that WebKit code interacts with EwkViewImpl instead + of Evas_Object. + + * PlatformEfl.cmake: + * UIProcess/API/efl/EwkViewImpl.cpp: Added. + (_ewk_view_commit): + (_ewk_view_preedit_changed): + (_ewk_view_imf_context_destroy): + (_ewk_view_imf_context_create): + (EwkViewImpl::EwkViewImpl): + (EwkViewImpl::~EwkViewImpl): + * UIProcess/API/efl/EwkViewImpl.h: Added. + (WebKit): + (EwkViewImpl): + * UIProcess/API/efl/ewk_view.cpp: + (_ewk_view_priv_del): + (_ewk_view_smart_add): + * UIProcess/API/efl/ewk_view.h: + +2012-10-24 Ryuan Choi <ryuan.choi@gmail.com> + + [EFL][WK2] Crash when passing NULL instead of ewk_view instance + https://bugs.webkit.org/show_bug.cgi?id=100078 + + Reviewed by Gyuyoung Kim. + + Although applications should pass valid ewk_view to call ewk_view_XXX, + ewk_view_XXX should not be crashed. + + * UIProcess/API/efl/ewk_view.cpp: + Checked null and early exited from EWK_VIEW_TYPE_CHECK if error occured. + * UIProcess/API/efl/tests/test_ewk2_view.cpp: Added test case. + (TEST_F): + +2012-10-24 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Make find and form clients C++ classes + https://bugs.webkit.org/show_bug.cgi?id=100199 + + Reviewed by Kenneth Rohde Christiansen. + + Make form and find client C++ classes to move away + from C'ism in WK2 EFL port. The new classes have been + moved up to UIProcess/efl instead of UIProcess/API/efl + since it is not part of the public API. + + * PlatformEfl.cmake: + * UIProcess/API/efl/ewk_view.cpp: + (Ewk_View_Private_Data): + (_ewk_view_initialize): + * UIProcess/efl/FindClientEfl.cpp: Renamed from Source/WebKit2/UIProcess/API/efl/ewk_view_find_client.cpp. + (WebKit): + (WebKit::toFindClientEfl): + (WebKit::FindClientEfl::didFindString): + (WebKit::FindClientEfl::didFailToFindString): + (WebKit::FindClientEfl::FindClientEfl): + * UIProcess/efl/FindClientEfl.h: Renamed from Source/WebKit2/UIProcess/API/efl/ewk_view_find_client_private.h. + (WebKit): + (FindClientEfl): + (WebKit::FindClientEfl::create): + * UIProcess/efl/FormClientEfl.cpp: Renamed from Source/WebKit2/UIProcess/API/efl/ewk_view_form_client.cpp. + (WebKit): + (WebKit::toFormClientEfl): + (WebKit::FormClientEfl::willSubmitForm): + (WebKit::FormClientEfl::FormClientEfl): + * UIProcess/efl/FormClientEfl.h: Renamed from Source/WebKit2/UIProcess/API/efl/ewk_view_form_client_private.h. + (WebKit): + (FormClientEfl): + (WebKit::FormClientEfl::create): + +2012-10-24 Grzegorz Czajkowski <g.czajkowski@samsung.com> + + [EFL] WebKitTestRunner needs to turn on 'setContinuousSpellCheckingEnabled' + https://bugs.webkit.org/show_bug.cgi?id=93611 + + Reviewed by Hajime Morita. + + When WebKitTestRunner turns on the spelling feature with the resetStateToConsistentValues() method, + it happens that the WebProcess is still not launched (although it is already created). + In this case, isValid() method returns false. + + This fix sends a message to the WebProcess messages queue, and the message + will be handled once the WebProcess is ready. + + * Target.pri: + Adds missing files to compile spellcheking feature for WebKit2-Qt + to use WebKit C API from WKTextChecker.h. + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::updateTextCheckerState): + Uses canSendMessage() method instead of isValid() to check whether the message to + the WebProcess can be sent. + +2012-10-24 Yael Aharon <yael.aharon@intel.com> + + [EFL][WK2][AC] Black screen in web inspector window with AC on + https://bugs.webkit.org/show_bug.cgi?id=100168 + + Reviewed by Kenneth Rohde Christiansen. + + When ACCELERATED_COMPOSITING flag is turned on, and using X11, + pass "opengl_x11" engine name to ecore_evas_new when creating a + web inspector window. It is guaranteed to be available, because + we wouldn't be able to create a main window if it wasn't. + + (WebKit::WebInspectorProxy::platformCreateInspectorPage): + +2012-10-24 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][WK2] Make History client a C++ class + https://bugs.webkit.org/show_bug.cgi?id=100104 + + Reviewed by Kenneth Rohde Christiansen. + + Created ContextHistoryClientEfl class to encapsulate history client code for EFL. + + * PlatformEfl.cmake: + * UIProcess/API/efl/ewk_context.cpp: + (Ewk_Context::Ewk_Context): + (ewk_context_history_callbacks_set): + * UIProcess/API/efl/ewk_context_history_client.cpp: Removed. + * UIProcess/API/efl/ewk_context_history_client_private.h: Removed. + * UIProcess/API/efl/ewk_context_private.h: + (WebKit): + (Ewk_Context): + * UIProcess/efl/ContextHistoryClientEfl.cpp: Added. + (WebKit): + (WebKit::toContextHistoryClientEfl): + (WebKit::ContextHistoryClientEfl::didNavigateWithNavigationData): + (WebKit::ContextHistoryClientEfl::didPerformClientRedirect): + (WebKit::ContextHistoryClientEfl::didPerformServerRedirect): + (WebKit::ContextHistoryClientEfl::didUpdateHistoryTitle): + (WebKit::ContextHistoryClientEfl::populateVisitedLinks): + (WebKit::ContextHistoryClientEfl::ContextHistoryClientEfl): + (WebKit::ContextHistoryClientEfl::setCallbacks): + * UIProcess/efl/ContextHistoryClientEfl.h: Added. + (WebKit): + (ContextHistoryClientEfl): + (WebKit::ContextHistoryClientEfl::create): + +2012-10-23 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Add API to get the WebKitWebView associated to a WebKitDownload to WebKit2 GTK+ + https://bugs.webkit.org/show_bug.cgi?id=99836 + + Reviewed by Martin Robinson. + + Add webkit_download_get_web_view() to get the WebKitWebView that + initiated the download and webkit_web_view_download_uri() to start + a new download associated to a WebKitWebView. + + * UIProcess/API/gtk/PageClientImpl.cpp: + (WebKit::PageClientImpl::handleDownloadRequest): Call + webkitWebViewBaseHandleDownloadRequest(). + * UIProcess/API/gtk/PageClientImpl.h: + (PageClientImpl): Add handleDownloadRequest(). + * UIProcess/API/gtk/WebKitDownload.cpp: + (webkitDownloadSetWebView): Set the WebKitWebView associated to + the download. + (webkit_download_get_web_view): Public method to get the + WebKitWebView associated to the download. + * UIProcess/API/gtk/WebKitDownload.h: + * UIProcess/API/gtk/WebKitDownloadPrivate.h: + * UIProcess/API/gtk/WebKitWebContext.cpp: + (webkit_web_context_download_uri): Use the new helper + webkitWebContextStartDownload(). + (webkitWebContextStartDownload): Helper function to start a new + download that is also used by WebKitWebView. + * UIProcess/API/gtk/WebKitWebContextPrivate.h: + * UIProcess/API/gtk/WebKitWebView.cpp: + (webkitWebViewHandleDownloadRequest): Call + webkitDownloadSetWebView() to associate the download with the + WebKitWebView. + (webkitWebViewConstructed): Set a download request handler. + (webkit_web_view_download_uri): Public method to start a new + download associated to the web view. + * UIProcess/API/gtk/WebKitWebView.h: + * UIProcess/API/gtk/WebKitWebViewBase.cpp: + (webkitWebViewBaseSetDownloadRequestHandler): Set a function + pointer to be called when a new download is request for the web + view. + (webkitWebViewBaseHandleDownloadRequest): Call the download + request handler if any. + * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: + * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbols. + * UIProcess/API/gtk/tests/TestDownloads.cpp: + (testDownloadLocalFile): + (testDownloadLocalFileError): + (testDownloadRemoteFile): + (testDownloadRemoteFileError): + (testWebViewDownloadURI): + (testPolicyResponseDownload): + (beforeAll): + * UIProcess/PageClient.h: + (PageClient): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::receivedPolicyDecision): + (WebKit): + * UIProcess/WebPageProxy.h: + (WebPageProxy): + +2012-10-23 Dan Bernstein <mitz@apple.com> + + WebKit2 part of <rdar://problem/2966974> [mac] Kerning and ligatures are not enabled by default + https://bugs.webkit.org/show_bug.cgi?id=100188 + + Reviewed by Sam Weinig. + + * UIProcess/mac/WebContextMac.mm: + (WebKit::registerUserDefaultsIfNeeded): Added. Registers a value of YES for the + WebKitKerningAndLigaturesEnabledByDefault user default if it has not been registered yet. + (WebKit::WebContext::platformInitializeWebProcess): Added a call to + registerUserDefaultsIfNeeded, and changed to refer to the defaults key by name. + +2012-10-23 No'am Rosenthal <noam.rosenthal@nokia.com> + + Coordinated Graphics: Enable threaded/IPC animations + https://bugs.webkit.org/show_bug.cgi?id=93146 + + Unreviewed build fix, some function names changed between review and landing. + + * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp: + (CoreIPC::encodeTimingFunction): + (CoreIPC::decodeTimingFunction): + (CoreIPC::::encode): + * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.h: + (WebCore): + +2012-10-23 Sam Weinig <sam@webkit.org> + + Stop using NSHomeDirectory() to get the home directory, it doesn't always return what we want + https://bugs.webkit.org/show_bug.cgi?id=100180 + + Reviewed by Anders Carlsson. + + NSHomeDirectory() doesn't return the real home directory if the host process + is App Sandboxed, so drop down and use getpwuid_r instead. + + * WebProcess/mac/WebProcessMac.mm: + (WebKit::appendReadwriteSandboxDirectory): + There is no reason anymore to try to create the directory. + + (WebKit::WebProcess::initializeSandbox): + Switch to getpwuid_r. + +2012-10-23 Martin Robinson <mrobinson@igalia.com> + + [GTK][Soup] Implement the default authentication dialog via WebCoreSupport + https://bugs.webkit.org/show_bug.cgi?id=99351 + + Reviewed by Carlos Garcia Campos. + + Instead of using a custom SoupSessionFeature to show the authentication + dialog, show it using the corresponding WebCore message. + + * GNUmakefile.list.am: Removed the SoupSessionFeature files. + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit): Only use the default dispatchDidReceiveAuthenticationChallenge + for non-GTK+ ports. + * WebProcess/WebCoreSupport/gtk/WebFrameLoaderClientGtk.cpp: Added. + (WebKit::WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge): Added + a GTK+-specific implementation that shows the GtkAuthenticationDialog. + * WebProcess/gtk/WebAuthDialog.cpp: Removed. + * WebProcess/gtk/WebAuthDialog.h: Removed. + * WebProcess/gtk/WebProcessMainGtk.cpp: + (WebKit::WebProcessMainGtk): Don't install the custom session feature. + +2012-10-23 Anders Carlsson <andersca@apple.com> + + Remove deprecatedSend + https://bugs.webkit.org/show_bug.cgi?id=100127 + + Reviewed by Andreas Kling. + + deprecatedSend is no longer used anywhere, remove it. + + * Platform/CoreIPC/Connection.h: + (Connection): + * UIProcess/WebProcessProxy.h: + (WebProcessProxy): + +2012-10-23 Andy Estes <aestes@apple.com> + + [WebKit2 API] Add properties to get textRects from a WKDOMRange or WKDOMNode + https://bugs.webkit.org/show_bug.cgi?id=100162 + + Reviewed by Sam Weinig. + + * WebProcess/InjectedBundle/API/mac/WKDOMInternals.h: + * WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm: + (WebKit::toNSArray): Added a helper function to convert a Vector of IntRects to an NSArray. + * WebProcess/InjectedBundle/API/mac/WKDOMNode.h: + * WebProcess/InjectedBundle/API/mac/WKDOMNode.mm: + (-[WKDOMNode textRects]): + * WebProcess/InjectedBundle/API/mac/WKDOMRange.h: + * WebProcess/InjectedBundle/API/mac/WKDOMRange.mm: + (-[WKDOMRange textRects]): + +2012-10-23 No'am Rosenthal <noam.rosenthal@nokia.com> + + Coordinated Graphics: Enable threaded/IPC animations + https://bugs.webkit.org/show_bug.cgi?id=93146 + + Reviewed by Kenneth Rohde Christiansen. + + Re-enable UI-process animations for Coordinated-Graphics/TextureMapper. + - Added an argument coder for GraphicsLayerAnimations. + - Allow LayerTreeCoordinator to manage the animations per layer with the proxy, + as opposed to applying the animation values in the web process as before. + - LayerTreeRenderer now calls updateViewport() after painting when an animation is active. + + To overcome the problem we've had in the past with synchronizing UI-side and web-side + animations, we now lock the animations in the UI process when a frame starts rendering, + and unlock it when the frame finishes rendering, or if after the layout there is no visible + changes pending on the screen. + + * Scripts/webkit2/messages.py: + (headers_for_type): + * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp: + (CoreIPC): + (CoreIPC::encodeTimingFunction): + (CoreIPC::decodeTimingFunction): + (CoreIPC::::encode): + (CoreIPC::::decode): + * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.h: + (WebCore): + Added argument coders for GraphicsLayerAnimations. + + * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp: + (WebKit::LayerTreeCoordinatorProxy::setLayerAnimations): + (WebKit::LayerTreeCoordinatorProxy::setAnimationsLocked): + * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h: + (LayerTreeCoordinatorProxy): + * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in: + Added an option to sync the layer's animations, and also to lock/unlock animations. + + * UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp: + (WebKit::LayerTreeRenderer::LayerTreeRenderer): + (WebKit::LayerTreeRenderer::paintToCurrentGLContext): + Sync animations if they're not locked, and call updateViewport() if we have animations. + + (WebKit::LayerTreeRenderer::flushLayerChanges): + (WebKit::LayerTreeRenderer::setLayerAnimations): + (WebKit::LayerTreeRenderer::setAnimationsLocked): + + * UIProcess/CoordinatedGraphics/LayerTreeRenderer.h: + (LayerTreeRenderer): + * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp: + (WebCore::CoordinatedGraphicsLayer::didChangeAnimations): + (WebCore::CoordinatedGraphicsLayer::setShouldUpdateVisibleRect): + (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer): + (WebCore::CoordinatedGraphicsLayer::syncLayerState): + (WebCore::CoordinatedGraphicsLayer::syncAnimations): + (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly): + (WebCore::CoordinatedGraphicsLayer::addAnimation): + (WebCore::CoordinatedGraphicsLayer::pauseAnimation): + (WebCore::CoordinatedGraphicsLayer::removeAnimation): + (WebCore::CoordinatedGraphicsLayer::animationStartedTimerFired): + (WebCore): + Pass the animation info to the UI process instead of applying it in the web process. + + (WebCore::CoordinatedGraphicsLayer::hasPendingVisibleChanges): + Compute whether a layer tree might have sync issues or flickers if rendered while + background animations are ongoing. + + (WebCore::CoordinatedGraphicsLayer::computeTransformedVisibleRect): + (WebCore::CoordinatedGraphicsLayer::selfOrAncestorHaveNonAffineTransforms): + Don't allow progressive tiling for layers with animations. + + * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h: + (WebCore): + (CoordinatedGraphicsLayerClient): + (CoordinatedGraphicsLayer): + * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp: + (WebKit::LayerTreeCoordinator::LayerTreeCoordinator): + (WebKit::LayerTreeCoordinator::lockAnimations): + (WebKit): + (WebKit::LayerTreeCoordinator::unlockAnimations): + (WebKit::LayerTreeCoordinator::performScheduledLayerFlush): + (WebKit::LayerTreeCoordinator::setLayerAnimations): + * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h: + (LayerTreeCoordinator): + +2012-10-23 Allan Sandfeld Jensen <allan.jensen@digia.com> + + [Qt][WK2] Add preference for enabling scroll animators + https://bugs.webkit.org/show_bug.cgi?id=100124 + + Reviewed by Jocelyn Turcotte. + + Expose the ScollAnimatorEnabled setting in QWebPreferences. + + * UIProcess/API/qt/qwebpreferences.cpp: + (QWebPreferencesPrivate::testAttribute): + (QWebPreferencesPrivate::setAttribute): + (QWebPreferences::scrollAnimatorEnabled): + (QWebPreferences::setScrollAnimatorEnabled): + * UIProcess/API/qt/qwebpreferences_p.h: + * UIProcess/API/qt/qwebpreferences_p_p.h: + +2012-10-23 Yael Aharon <yael.aharon@intel.com> + + [EFL][WK2] Use the port independent PageViewportController + https://bugs.webkit.org/show_bug.cgi?id=99850 + + Reviewed by Kenneth Rohde Christiansen. + + Take PageViewportController into use, and rely on it to calculate + scroll position and zoom level. + With this patch, we can do intra page navigation and use the scrollwheel + to scroll, when WTF_USE_TILED_BACKING_STORE and all related flags are enabled. + + * CMakeLists.txt: + * UIProcess/API/efl/PageClientImpl.cpp: + (WebKit::PageClientImpl::didChangeViewportProperties): + (WebKit::PageClientImpl::pageDidRequestScroll): + (WebKit::PageClientImpl::didChangeContentsSize): + (WebKit): + (WebKit::PageClientImpl::didRenderFrame): + (WebKit::PageClientImpl::pageTransitionViewportReady): + * UIProcess/API/efl/PageClientImpl.h: + (WebKit): + (PageClientImpl): + (WebKit::PageClientImpl::setPageViewportController): + * UIProcess/API/efl/PageViewportControllerClientEfl.cpp: + (WebKit::PageViewportControllerClientEfl::PageViewportControllerClientEfl): + (WebKit::PageViewportControllerClientEfl::display): + (WebKit::PageViewportControllerClientEfl::updateViewportSize): + (WebKit::PageViewportControllerClientEfl::setVisibleContentsRect): + (WebKit::PageViewportControllerClientEfl::didChangeContentsSize): + (WebKit::PageViewportControllerClientEfl::setViewportPosition): + (WebKit::PageViewportControllerClientEfl::setContentsScale): + (WebKit::PageViewportControllerClientEfl::didResumeContent): + (WebKit::PageViewportControllerClientEfl::didChangeVisibleContents): + (WebKit::PageViewportControllerClientEfl::setController): + * UIProcess/API/efl/PageViewportControllerClientEfl.h: + (WebKit::PageViewportControllerClientEfl::scaleFactor): + (WebKit::PageViewportControllerClientEfl::scrollPosition): + (PageViewportControllerClientEfl): + * UIProcess/API/efl/ewk_view.cpp: + (Ewk_View_Private_Data): + (mapToWebContent): + (_ewk_view_smart_mouse_wheel): + (_ewk_view_smart_mouse_down): + (_ewk_view_smart_mouse_up): + (_ewk_view_smart_mouse_move): + (_ewk_view_initialize): + (ewk_view_load_committed): + (ewk_view_feed_touch_event): + * UIProcess/API/efl/ewk_view_private.h: + * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp: + (WebKit::LayerTreeCoordinatorProxy::didRenderFrame): + * UIProcess/PageClient.h: + (PageClient): + * UIProcess/PageViewportController.cpp: + * UIProcess/PageViewportController.h: + * UIProcess/WebPageProxy.cpp: + (WebKit): + (WebKit::WebPageProxy::pageTransitionViewportReady): + (WebKit::WebPageProxy::didRenderFrame): + * UIProcess/WebPageProxy.h: + (WebPageProxy): + * UIProcess/WebPageProxy.messages.in: + * UIProcess/efl/PageLoadClientEfl.cpp: + (WebKit): + (WebKit::PageLoadClientEfl::didCommitLoadForFrame): + (WebKit::PageLoadClientEfl::PageLoadClientEfl): + * UIProcess/efl/PageLoadClientEfl.h: + (PageLoadClientEfl): + * UIProcess/qt/WebPageProxyQt.cpp: + (WebKit): + (WebKit::WebPageProxy::setUserScripts): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::didCompletePageTransition): + +2012-10-16 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Add support for resolution media query + https://bugs.webkit.org/show_bug.cgi?id=99077 + + Reviewed by Antti Koivisto. + + * win/WebKit2.def: + + Add exports for the WebCore::Settings setting. + + * Configurations/FeatureDefines.xcconfig: + + Add support for the RESOLUTION_MEDIA_QUERY feature flag. + +2012-10-23 Allan Sandfeld Jensen <allan.jensen@digia.com> + + [Qt] Port QWebPreferences to C++ + https://bugs.webkit.org/show_bug.cgi?id=100121 + + Reviewed by Kenneth Rohde Christiansen. + + Port all the WebPreference calls to using the direct API instead of going through + the auto-generated C API. + + * UIProcess/API/qt/qwebpreferences.cpp: + (QWebPreferencesPrivate::testAttribute): + (QWebPreferencesPrivate::setAttribute): + (QWebPreferencesPrivate::setFontFamily): + (QWebPreferencesPrivate::fontFamily): + (QWebPreferencesPrivate::setFontSize): + (QWebPreferencesPrivate::fontSize): + (QWebPreferencesPrivate::preferences): + * UIProcess/API/qt/qwebpreferences_p_p.h: + +2012-10-23 Eunmi Lee <eunmi15.lee@samsung.com> + + [EFL][WK2] Convert WebEvent's timestamp from millisecond to second. + https://bugs.webkit.org/show_bug.cgi?id=100101 + + Reviewed by Kenneth Rohde Christiansen. + + Convert timestamp to second to create WebEvent from Evas event because + the unit of timestamp from Evas Event is millisecond, but the unit of + timestamp for WebEvent is second. + + * Shared/efl/WebEventFactory.cpp: + (WebKit::convertMillisecondToSecond): + (WebKit): + (WebKit::WebEventFactory::createWebMouseEvent): + (WebKit::WebEventFactory::createWebWheelEvent): + (WebKit::WebEventFactory::createWebKeyboardEvent): + +2012-10-23 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Make request manager client a C++ class + https://bugs.webkit.org/show_bug.cgi?id=100093 + + Reviewed by Kenneth Rohde Christiansen. + + Make EFL's request manager client a C++ class and + move URL scheme handling code to it. The new + RequestManagerClientEfl is now in UIProcess/efl + instead of UIProcess/API/efl since it is not + part of the public API. + + * PlatformEfl.cmake: + * UIProcess/API/efl/ewk_context.cpp: + (Ewk_Context::Ewk_Context): + (Ewk_Context::requestManager): + (ewk_context_url_scheme_register): + * UIProcess/API/efl/ewk_context_private.h: + (WebKit): + (Ewk_Context): + * UIProcess/efl/RequestManagerClientEfl.cpp: Renamed from Source/WebKit2/UIProcess/API/efl/ewk_context_request_manager_client.cpp. + (WebKit): + (Ewk_Url_Scheme_Handler): + (WebKit::Ewk_Url_Scheme_Handler::Ewk_Url_Scheme_Handler): + (WebKit::toRequestManagerClientEfl): + (WebKit::RequestManagerClientEfl::didReceiveURIRequest): + (WebKit::RequestManagerClientEfl::RequestManagerClientEfl): + (WebKit::RequestManagerClientEfl::~RequestManagerClientEfl): + (WebKit::RequestManagerClientEfl::registerURLSchemeHandler): + * UIProcess/efl/RequestManagerClientEfl.h: Renamed from Source/WebKit2/UIProcess/API/efl/ewk_context_request_manager_client_private.h. + (WebKit): + (RequestManagerClientEfl): + (WebKit::RequestManagerClientEfl::create): + +2012-10-23 Alexander Shalamov <alexander.shalamov@intel.com> + + [EFL][WK2] ecore_x should be initialised in WebProcess to avoid re-initialization by PlatformScreenEfl utilities and systemBeep() function + https://bugs.webkit.org/show_bug.cgi?id=100110 + + Reviewed by Kenneth Rohde Christiansen. + + PlatformScreenEfl functions and systemBeep() depend on ecore_x functionality, therefore, + ecore_x should be initialized when web process starts to avoid re-initialization. + + * WebProcess/efl/WebProcessMainEfl.cpp: + (WebKit::WebProcessMainEfl): Initialized ecore_x module. + +2012-10-23 Ryuan Choi <ryuan.choi@samsung.com> + + [EFL][WK2] Add support for IMF composition + https://bugs.webkit.org/show_bug.cgi?id=89552 + + Reviewed by Gyuyoung Kim. + + Implemented basic IMF support. + + * PlatformEfl.cmake: + * Shared/NativeWebKeyboardEvent.h: + (NativeWebKeyboardEvent): + (WebKit::NativeWebKeyboardEvent::isFiltered): + Added to determine whether current keyboard event is compositing. + * Shared/efl/NativeWebKeyboardEventEfl.cpp: + (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent): + * UIProcess/API/efl/PageClientImpl.cpp: + (WebKit::PageClientImpl::updateTextInputState): + Added to change input state. + * UIProcess/API/efl/PageClientImpl.h: + (PageClientImpl): + * UIProcess/API/efl/ewk_main.cpp: + (ewk_init): Called ecore_imf_init. + (ewk_shutdown): Called ecore_imf_shutdown. + * UIProcess/API/efl/ewk_view.cpp: + (_Ewk_View_Private_Data): + (_Ewk_View_Private_Data::_Ewk_View_Private_Data): + (_Ewk_View_Private_Data::~_Ewk_View_Private_Data): + (_ewk_view_smart_key_down): Modified to send keyboard event to IMF. + (_ewk_view_smart_mouse_up): Modified to reset input method context. + (_ewk_view_preedit_changed): Added to send composition string. + (_ewk_view_commit): Added to send a message that composition is finished. + (_ewk_view_imf_context_create): Added to create Ecore_IMF_Context. + (_ewk_view_imf_context_destroy): Added to destroy Ecore_IMF_Context. + (ewk_view_text_input_state_update): Added to update input state. + * UIProcess/API/efl/ewk_view_private.h: + * UIProcess/PageClient.h: Moved updateTextInputState() to share with EFL port. + (PageClient): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::editorStateChanged): + Added PLATFORM(EFL) to call updateTextInputState() + * UIProcess/WebPageProxy.h: + (WebPageProxy): + * UIProcess/WebPageProxy.messages.in: + Added HandleInputMethodKeydown message to determine whether keydown is handled. + * UIProcess/efl/WebPageProxyEfl.cpp: + (WebKit::WebPageProxy::handleInputMethodKeydown): + Added to check whether input method handled keydown. + (WebKit::WebPageProxy::confirmComposition): Added to support composition. + (WebKit::WebPageProxy::setComposition): Ditto. + (WebKit::WebPageProxy::cancelComposition): Ditto. + * WebProcess/WebCoreSupport/efl/WebEditorClientEfl.cpp: + (WebKit::WebEditorClient::handleInputMethodKeydown): + Added to check whether input method handled keydown. + * WebProcess/WebPage/WebPage.h: + (WebPage): + * WebProcess/WebPage/WebPage.messages.in: Added messages to support composition. + * WebProcess/WebPage/efl/WebPageEfl.cpp: + (WebKit::targetFrameForEditing): Referenced from QT port to get focused frame. + (WebKit::WebPage::confirmComposition): Added to support composition. + (WebKit::WebPage::setComposition): Ditto. + (WebKit::WebPage::cancelComposition): Ditto. + +2012-10-23 Jussi Kukkonen <jussi.kukkonen@intel.com> + + [EFL] Make plugin process debugging easier (PLUGIN_PROCESS_COMMAND_PREFIX) + https://bugs.webkit.org/show_bug.cgi?id=99297 + + Reviewed by Kenneth Rohde Christiansen. + + Add support for PLUGIN_PROCESS_COMMAND_PREFIX environment variable, to allow easier + plugin debugging with e.g.: + $ PLUGIN_PROCESS_COMMAND_PREFIX="xterm gdb --args" MiniBrowser + + * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp: + (WebKit::PluginProcessProxy::platformInitializeLaunchOptions): + (WebKit): + +2012-10-23 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][WK2] Make Policy client a C++ class + https://bugs.webkit.org/show_bug.cgi?id=100089 + + Reviewed by Kenneth Rohde Christiansen. + + Make page policy client a C++ class and remove it from API folder. + + * PlatformEfl.cmake: + * UIProcess/API/efl/ewk_view.cpp: + (Ewk_View_Private_Data): + (_ewk_view_initialize): + * UIProcess/efl/PagePolicyClientEfl.cpp: Renamed from Source/WebKit2/UIProcess/API/efl/ewk_view_policy_client.cpp. + (WebKit): + (WebKit::toPagePolicyClientEfl): + (WebKit::PagePolicyClientEfl::decidePolicyForNavigationAction): + (WebKit::PagePolicyClientEfl::decidePolicyForNewWindowAction): + (WebKit::PagePolicyClientEfl::decidePolicyForResponseCallback): + (WebKit::PagePolicyClientEfl::PagePolicyClientEfl): + * UIProcess/efl/PagePolicyClientEfl.h: Renamed from Source/WebKit2/UIProcess/API/efl/ewk_view_policy_client_private.h. + (WebKit): + (PagePolicyClientEfl): + (WebKit::PagePolicyClientEfl::create): + (WebKit::PagePolicyClientEfl::view): + +2012-10-23 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][WK2] Make UI client a C++ class + https://bugs.webkit.org/show_bug.cgi?id=100099 + + Reviewed by Gyuyoung Kim. + + Made page UI client a C++ class and removed it from API directory. + + * PlatformEfl.cmake: + * UIProcess/API/efl/ewk_view.cpp: + (Ewk_View_Private_Data): + (_ewk_view_initialize): + * UIProcess/API/efl/ewk_view_ui_client.cpp: Removed. + * UIProcess/API/efl/ewk_view_ui_client_private.h: Removed. + * UIProcess/efl/PageUIClientEfl.cpp: Added. + (WebKit): + (WebKit::toPageUIClientEfl): + (WebKit::PageUIClientEfl::closePage): + (WebKit::PageUIClientEfl::createNewPage): + (WebKit::PageUIClientEfl::runJavaScriptAlert): + (WebKit::PageUIClientEfl::runJavaScriptConfirm): + (WebKit::PageUIClientEfl::runJavaScriptPrompt): + (WebKit::PageUIClientEfl::showColorPicker): + (WebKit::PageUIClientEfl::hideColorPicker): + (WebKit::PageUIClientEfl::exceededDatabaseQuota): + (WebKit::PageUIClientEfl::focus): + (WebKit::PageUIClientEfl::unfocus): + (WebKit::PageUIClientEfl::takeFocus): + (WebKit::PageUIClientEfl::getWindowFrame): + (WebKit::PageUIClientEfl::setWindowFrame): + (WebKit::PageUIClientEfl::PageUIClientEfl): + * UIProcess/efl/PageUIClientEfl.h: Added. + (WebKit): + (PageUIClientEfl): + (WebKit::PageUIClientEfl::create): + +2012-10-23 Andreas Kling <kling@webkit.org> + + [WK2] REGRESSION(r132169): It broke all plugin related test. + <http://webkit.org/b/100094> + + Unreviewed test fix, make the CoreIPC encode/decode functions for CString match again. + + * Platform/CoreIPC/ArgumentCoders.cpp: + (CoreIPC::::encode): + +2012-10-23 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Make a download client a C++ class + https://bugs.webkit.org/show_bug.cgi?id=100005 + + Reviewed by Kenneth Rohde Christiansen. + + Make EFL's Download client a C++ class and move + the id <-> download mapping from Ewk_Context to + DownloadManagerEfl. + + The Download client was also moved to + UIProcess/efl/ instead of UIProcess/API/efl/ + since it is not part of the public API. + + * PlatformEfl.cmake: + * UIProcess/API/efl/PageClientImpl.cpp: + (WebKit::PageClientImpl::handleDownloadRequest): + * UIProcess/API/efl/ewk_context.cpp: + (Ewk_Context::Ewk_Context): + (Ewk_Context::downloadManager): + * UIProcess/API/efl/ewk_context_download_client_private.h: Removed. + * UIProcess/API/efl/ewk_context_private.h: + (Ewk_Context): + * UIProcess/API/efl/ewk_download_job_private.h: + * UIProcess/efl/DownloadManagerEfl.cpp: Renamed from Source/WebKit2/UIProcess/API/efl/ewk_context_download_client.cpp. + (WebKit): + (WebKit::toDownloadManagerEfl): + (WebKit::DownloadManagerEfl::decideDestinationWithSuggestedFilename): + (WebKit::DownloadManagerEfl::didReceiveResponse): + (WebKit::DownloadManagerEfl::didCreateDestination): + (WebKit::DownloadManagerEfl::didReceiveData): + (WebKit::DownloadManagerEfl::didFail): + (WebKit::DownloadManagerEfl::didCancel): + (WebKit::DownloadManagerEfl::didFinish): + (WebKit::DownloadManagerEfl::DownloadManagerEfl): + (WebKit::DownloadManagerEfl::registerDownload): + (WebKit::DownloadManagerEfl::downloadJob): + (WebKit::DownloadManagerEfl::unregisterDownloadJob): + * UIProcess/efl/DownloadManagerEfl.h: Added. + (WebKit): + (DownloadManagerEfl): + (WebKit::DownloadManagerEfl::create): + 2012-10-23 Andras Becsi <andras.becsi@digia.com> Remove devicePixelRatio from ViewportAttributes diff --git a/Source/WebKit2/Configurations/Base.xcconfig b/Source/WebKit2/Configurations/Base.xcconfig index ab4fec7fb..360574206 100644 --- a/Source/WebKit2/Configurations/Base.xcconfig +++ b/Source/WebKit2/Configurations/Base.xcconfig @@ -21,11 +21,8 @@ // (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 "CompilerVersion.xcconfig" - -COMPILER_SPECIFIC_WARNING_CFLAGS = $(COMPILER_SPECIFIC_WARNING_CFLAGS_$(TARGET_GCC_VERSION)); -COMPILER_SPECIFIC_WARNING_CFLAGS_LLVM_COMPILER = -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare; - +CLANG_CXX_LANGUAGE_STANDARD = gnu++0x; +CLANG_CXX_LIBRARY = libc++; CLANG_WARN_CXX0X_EXTENSIONS = NO; DEBUG_INFORMATION_FORMAT = dwarf-with-dsym; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -44,6 +41,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_SYMBOLS_PRIVATE_EXTERN = YES; GCC_THREADSAFE_STATICS = NO; GCC_TREAT_WARNINGS_AS_ERRORS = YES; +GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; @@ -56,23 +54,11 @@ OTHER_MIGFLAGS = -F$(BUILT_PRODUCTS_DIR); PREBINDING = NO; VALID_ARCHS = i386 x86_64; // FIXME: <rdar://problem/5070292> WebKit should build with -Wshorten-64-to-32 -WARNING_CFLAGS = -Wall -Wextra -Wchar-subscripts -Wextra-tokens -Wformat-security -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wno-unused-parameter -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings $(COMPILER_SPECIFIC_WARNING_CFLAGS); +WARNING_CFLAGS = -Wall -Wextra -Wchar-subscripts -Wextra-tokens -Wformat-security -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wno-unused-parameter -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare; // Prevent C++ standard library operator new, delete and their related exception types from being exported as weak symbols. OTHER_LDFLAGS = -Wl,-unexported_symbol -Wl,__ZTISt9bad_alloc -Wl,-unexported_symbol -Wl,__ZTISt9exception -Wl,-unexported_symbol -Wl,__ZTSSt9bad_alloc -Wl,-unexported_symbol -Wl,__ZTSSt9exception -Wl,-unexported_symbol -Wl,__ZdlPvS_ -Wl,-unexported_symbol -Wl,__ZnwmPv -Wl,-unexported_symbol -Wl,__Znwm; -CLANG_CXX_LIBRARY = $(CLANG_CXX_LIBRARY_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -CLANG_CXX_LIBRARY_1060 = libstdc++; -CLANG_CXX_LIBRARY_1070 = libc++; -CLANG_CXX_LIBRARY_1080 = libc++; -CLANG_CXX_LIBRARY_1090 = libc++; - -REAL_PLATFORM_NAME = $(REAL_PLATFORM_NAME_$(PLATFORM_NAME)); -REAL_PLATFORM_NAME_ = $(REAL_PLATFORM_NAME_macosx); -REAL_PLATFORM_NAME_iphoneos = iphoneos; -REAL_PLATFORM_NAME_iphonesimulator = iphonesimulator; -REAL_PLATFORM_NAME_macosx = macosx; - TARGET_MAC_OS_X_VERSION_MAJOR = $(MAC_OS_X_VERSION_MAJOR); @@ -98,7 +84,6 @@ DEAD_CODE_STRIPPING = YES; SECTORDER_FLAGS = -Wl,-order_file,mac/WebKit2.order; TARGETING_SAME_OS_X_VERSION = $(TARGETING_SAME_OS_X_VERSION_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -TARGETING_SAME_OS_X_VERSION_1060_1060 = YES; TARGETING_SAME_OS_X_VERSION_1070_1070 = YES; TARGETING_SAME_OS_X_VERSION_1080_1080 = YES; TARGETING_SAME_OS_X_VERSION_1090_1090 = YES; diff --git a/Source/WebKit2/Configurations/BaseTarget.xcconfig b/Source/WebKit2/Configurations/BaseTarget.xcconfig index 6a8b8bd63..bf0870363 100644 --- a/Source/WebKit2/Configurations/BaseTarget.xcconfig +++ b/Source/WebKit2/Configurations/BaseTarget.xcconfig @@ -29,16 +29,16 @@ GCC_PREFIX_HEADER = WebKit2Prefix.h; GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) $(FEATURE_DEFINES) FRAMEWORK_NAME=WebKit2 HEADER_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR)/usr/local/include $(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders $(WEBCORE_PRIVATE_HEADERS_DIR)/icu $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2 $(HEADER_SEARCH_PATHS); -NORMAL_WEBKIT2_FRAMEWORKS_DIR = $(NORMAL_WEBKIT2_FRAMEWORKS_DIR_$(REAL_PLATFORM_NAME)); +NORMAL_WEBKIT2_FRAMEWORKS_DIR = $(NORMAL_WEBKIT2_FRAMEWORKS_DIR_$(PLATFORM_NAME)); NORMAL_WEBKIT2_FRAMEWORKS_DIR_macosx = $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks; -WEBKIT2_FRAMEWORKS_DIR = $(WEBKIT2_FRAMEWORKS_DIR_$(REAL_PLATFORM_NAME)); +WEBKIT2_FRAMEWORKS_DIR = $(WEBKIT2_FRAMEWORKS_DIR_$(PLATFORM_NAME)); WEBKIT2_FRAMEWORKS_DIR_macosx = $(WEBKIT2_FRAMEWORKS_DIR_macosx_USE_STAGING_INSTALL_PATH_$(USE_STAGING_INSTALL_PATH)); WEBKIT2_FRAMEWORKS_DIR_macosx_USE_STAGING_INSTALL_PATH_ = $(WEBKIT2_FRAMEWORKS_DIR_macosx_USE_STAGING_INSTALL_PATH_NO); WEBKIT2_FRAMEWORKS_DIR_macosx_USE_STAGING_INSTALL_PATH_NO = $(NORMAL_WEBKIT2_FRAMEWORKS_DIR); WEBKIT2_FRAMEWORKS_DIR_macosx_USE_STAGING_INSTALL_PATH_YES = $(SYSTEM_LIBRARY_DIR)/StagedFrameworks/Safari; -UMBRELLA_FRAMEWORKS_DIR = $(UMBRELLA_FRAMEWORKS_DIR_$(REAL_PLATFORM_NAME)_$(CONFIGURATION)); +UMBRELLA_FRAMEWORKS_DIR = $(UMBRELLA_FRAMEWORKS_DIR_$(PLATFORM_NAME)_$(CONFIGURATION)); UMBRELLA_FRAMEWORKS_DIR_macosx_Release = $(UMBRELLA_FRAMEWORKS_DIR_engineering); UMBRELLA_FRAMEWORKS_DIR_macosx_Debug = $(UMBRELLA_FRAMEWORKS_DIR_engineering); UMBRELLA_FRAMEWORKS_DIR_macosx_Production = $(UMBRELLA_FRAMEWORKS_DIR_macosx_Production_USE_STAGING_INSTALL_PATH_$(USE_STAGING_INSTALL_PATH)); diff --git a/Source/WebKit2/Configurations/CompilerVersion.xcconfig b/Source/WebKit2/Configurations/CompilerVersion.xcconfig deleted file mode 100644 index a8c7f75a0..000000000 --- a/Source/WebKit2/Configurations/CompilerVersion.xcconfig +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (C) 2009, 2010, 2011 Apple Inc. 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. ``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 -// 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. - -IS_XCODE_0400 = $(IS_XCODE_0400_$(XCODE_VERSION_MINOR)); -IS_XCODE_0400_0400 = YES; - -IS_XCODE_0400_OR_0410 = $(IS_XCODE_0400_OR_0410_$(XCODE_VERSION_MINOR)); -IS_XCODE_0400_OR_0410_0400 = YES; -IS_XCODE_0400_OR_0410_0410 = YES; - -// The version of the LLVM Compiler in Xcode 4.0 and earlier have difficulty compiling our code. -LLVM_COMPILER_UNSUITABLE_FOR_DEBUG_BUILDS = $(LLVM_COMPILER_UNSUITABLE_FOR_DEBUG_BUILDS_$(XCODE_VERSION_MAJOR)); -LLVM_COMPILER_UNSUITABLE_FOR_DEBUG_BUILDS_0300 = YES; -LLVM_COMPILER_UNSUITABLE_FOR_DEBUG_BUILDS_0400 = $(LLVM_COMPILER_UNSUITABLE_FOR_DEBUG_BUILDS_IS_XCODE_0400_$(IS_XCODE_0400)); -LLVM_COMPILER_UNSUITABLE_FOR_DEBUG_BUILDS_IS_XCODE_0400_YES = YES; - -// The version of the LLVM Compiler in Xcode 4.1 and earlier do not generate fast enough code. -LLVM_COMPILER_UNSUITABLE_FOR_OPTIMIZED_BUILDS = $(LLVM_COMPILER_UNSUITABLE_FOR_OPTIMIZED_BUILDS_$(XCODE_VERSION_MAJOR)); -LLVM_COMPILER_UNSUITABLE_FOR_OPTIMIZED_BUILDS_0300 = YES; -LLVM_COMPILER_UNSUITABLE_FOR_OPTIMIZED_BUILDS_0400 = $(LLVM_COMPILER_UNSUITABLE_FOR_OPTIMIZED_BUILDS_IS_XCODE_0400_OR_0410_$(IS_XCODE_0400_OR_0410)); -LLVM_COMPILER_UNSUITABLE_FOR_OPTIMIZED_BUILDS_IS_XCODE_0400_OR_0410_YES = YES; - -LLVM_COMPILER_SUITABLE_FOR_DEBUG_BUILDS = $(LLVM_COMPILER_SUITABLE_FOR_DEBUG_BUILDS_$(LLVM_COMPILER_UNSUITABLE_FOR_DEBUG_BUILDS)); -LLVM_COMPILER_SUITABLE_FOR_DEBUG_BUILDS_ = YES; -LLVM_COMPILER_SUITABLE_FOR_DEBUG_BUILDS_YES = NO; - -LLVM_COMPILER_SUITABLE_FOR_OPTIMIZED_BUILDS = $(LLVM_COMPILER_SUITABLE_FOR_OPTIMIZED_BUILDS_$(LLVM_COMPILER_UNSUITABLE_FOR_OPTIMIZED_BUILDS)); -LLVM_COMPILER_SUITABLE_FOR_OPTIMIZED_BUILDS_ = YES; -LLVM_COMPILER_SUITABLE_FOR_OPTIMIZED_BUILDS_YES = NO; - - -// Use GCC 4.2 with Xcode 3.1, which includes GCC 4.2 but defaults to GCC 4.0. -// Note that Xcode versions as new as 3.1.2 use XCODE_VERSION_ACTUAL for the minor version -// number. Newer versions of Xcode use XCODE_VERSION_MINOR for the minor version, and -// XCODE_VERSION_ACTUAL for the full version number. -TARGET_GCC_VERSION = $(TARGET_GCC_VERSION_$(REAL_PLATFORM_NAME)); -TARGET_GCC_VERSION_iphoneos = LLVM_GCC_42; -TARGET_GCC_VERSION_iphonesimulator = GCC_42; -TARGET_GCC_VERSION_macosx = $(TARGET_GCC_VERSION_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); - -TARGET_GCC_VERSION_macosx_1050 = $(TARGET_GCC_VERSION_macosx_1050_$(XCODE_VERSION_MINOR)); -TARGET_GCC_VERSION_macosx_1050_ = $(TARGET_GCC_VERSION_macosx_1050_$(XCODE_VERSION_ACTUAL)); -TARGET_GCC_VERSION_macosx_1050_0310 = GCC_42; -TARGET_GCC_VERSION_macosx_1050_0320 = GCC_42; - -TARGET_GCC_VERSION_macosx_1060 = $(TARGET_GCC_VERSION_macosx_1060_AND_1070_$(CONFIGURATION)); -TARGET_GCC_VERSION_macosx_1070 = $(TARGET_GCC_VERSION_macosx_1060_AND_1070_$(CONFIGURATION)); -TARGET_GCC_VERSION_macosx_1060_AND_1070_Debug = $(TARGET_GCC_VERSION_macosx_USE_LLVM_COMPILER_$(LLVM_COMPILER_SUITABLE_FOR_DEBUG_BUILDS)); -TARGET_GCC_VERSION_macosx_1060_AND_1070_Release = $(TARGET_GCC_VERSION_macosx_USE_LLVM_COMPILER_$(LLVM_COMPILER_SUITABLE_FOR_OPTIMIZED_BUILDS)); -TARGET_GCC_VERSION_macosx_1060_AND_1070_Production = $(TARGET_GCC_VERSION_macosx_USE_LLVM_COMPILER_$(LLVM_COMPILER_SUITABLE_FOR_OPTIMIZED_BUILDS)); -TARGET_GCC_VERSION_macosx_1060_NON_LLVM_FALLBACK = GCC_42; -TARGET_GCC_VERSION_macosx_1070_NON_LLVM_FALLBACK = LLVM_GCC_42; - -TARGET_GCC_VERSION_macosx_USE_LLVM_COMPILER_YES = LLVM_COMPILER; -TARGET_GCC_VERSION_macosx_USE_LLVM_COMPILER_NO = $(TARGET_GCC_VERSION_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)_NON_LLVM_FALLBACK); - -TARGET_GCC_VERSION_macosx_1080 = LLVM_COMPILER; -TARGET_GCC_VERSION_macosx_1090 = LLVM_COMPILER; - -GCC_VERSION = $(GCC_VERSION_$(TARGET_GCC_VERSION)); -GCC_VERSION_GCC_40 = 4.0; -GCC_VERSION_GCC_42 = 4.2; -GCC_VERSION_LLVM_GCC_42 = com.apple.compilers.llvmgcc42; -GCC_VERSION_LLVM_COMPILER = com.apple.compilers.llvm.clang.1_0; diff --git a/Source/WebKit2/Configurations/DebugRelease.xcconfig b/Source/WebKit2/Configurations/DebugRelease.xcconfig index e5d40bff4..c8e72f360 100644 --- a/Source/WebKit2/Configurations/DebugRelease.xcconfig +++ b/Source/WebKit2/Configurations/DebugRelease.xcconfig @@ -28,8 +28,6 @@ ARCHS = $(ARCHS_STANDARD_32_64_BIT); ONLY_ACTIVE_ARCH = YES; MACOSX_DEPLOYMENT_TARGET = $(MACOSX_DEPLOYMENT_TARGET_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -MACOSX_DEPLOYMENT_TARGET_1050 = 10.5; -MACOSX_DEPLOYMENT_TARGET_1060 = 10.6; MACOSX_DEPLOYMENT_TARGET_1070 = 10.7; MACOSX_DEPLOYMENT_TARGET_1080 = 10.8; MACOSX_DEPLOYMENT_TARGET_1090 = 10.9; @@ -40,8 +38,6 @@ DEBUG_INFORMATION_FORMAT = dwarf; SECTORDER_FLAGS = ; WEBKIT_SYSTEM_INTERFACE_LIBRARY = $(WEBKIT_SYSTEM_INTERFACE_LIBRARY_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -WEBKIT_SYSTEM_INTERFACE_LIBRARY_1050 = WebKitSystemInterfaceLeopard; -WEBKIT_SYSTEM_INTERFACE_LIBRARY_1060 = WebKitSystemInterfaceSnowLeopard; WEBKIT_SYSTEM_INTERFACE_LIBRARY_1070 = WebKitSystemInterfaceLion; WEBKIT_SYSTEM_INTERFACE_LIBRARY_1080 = WebKitSystemInterfaceMountainLion; WEBKIT_SYSTEM_INTERFACE_LIBRARY_1090 = WebKitSystemInterfaceMountainLion; diff --git a/Source/WebKit2/Configurations/FeatureDefines.xcconfig b/Source/WebKit2/Configurations/FeatureDefines.xcconfig index ce0af8680..a4f8ca0c0 100644 --- a/Source/WebKit2/Configurations/FeatureDefines.xcconfig +++ b/Source/WebKit2/Configurations/FeatureDefines.xcconfig @@ -39,6 +39,7 @@ ENABLE_CHANNEL_MESSAGING = ENABLE_CHANNEL_MESSAGING; ENABLE_CSP_NEXT = ; ENABLE_CSS_BOX_DECORATION_BREAK = ENABLE_CSS_BOX_DECORATION_BREAK; ENABLE_CSS_COMPOSITING = ENABLE_CSS_COMPOSITING; +ENABLE_CSS_DEVICE_ADAPTATION = ; ENABLE_CSS_EXCLUSIONS = ENABLE_CSS_EXCLUSIONS; ENABLE_CSS_FILTERS = ENABLE_CSS_FILTERS; ENABLE_CSS_HIERARCHIES = ; @@ -51,7 +52,7 @@ ENABLE_CSS_VARIABLES = ; ENABLE_CSS3_CONDITIONAL_RULES = ; ENABLE_CSS3_TEXT = ; ENABLE_CUSTOM_SCHEME_HANDLER = ; -ENABLE_DASHBOARD_SUPPORT = $(ENABLE_DASHBOARD_SUPPORT_$(REAL_PLATFORM_NAME)); +ENABLE_DASHBOARD_SUPPORT = $(ENABLE_DASHBOARD_SUPPORT_$(PLATFORM_NAME)); ENABLE_DASHBOARD_SUPPORT_macosx = ENABLE_DASHBOARD_SUPPORT; ENABLE_DATALIST_ELEMENT = ; ENABLE_DATA_TRANSFER_ITEMS = ; @@ -60,42 +61,46 @@ ENABLE_DEVICE_ORIENTATION = ; ENABLE_DIALOG_ELEMENT = ; ENABLE_DIRECTORY_UPLOAD = ; ENABLE_DRAGGABLE_REGION = ; +ENABLE_ENCRYPTED_MEDIA = $(ENABLE_ENCRYPTED_MEDIA_$(PLATFORM_NAME)); +ENABLE_ENCRYPTED_MEDIA_macosx = $(ENABLE_ENCRYPTED_MEDIA_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +ENABLE_ENCRYPTED_MEDIA_macosx_1070 = ; +ENABLE_ENCRYPTED_MEDIA_macosx_1080 = ; +ENABLE_ENCRYPTED_MEDIA_macosx_1090 = ENABLE_ENCRYPTED_MEDIA; ENABLE_FILE_SYSTEM = ; -ENABLE_FILTERS = $(ENABLE_FILTERS_$(REAL_PLATFORM_NAME)); -ENABLE_FILTERS_macosx = ENABLE_FILTERS; +ENABLE_FILTERS = ENABLE_FILTERS; ENABLE_FULLSCREEN_API = ENABLE_FULLSCREEN_API; ENABLE_GAMEPAD = ; ENABLE_GEOLOCATION = ENABLE_GEOLOCATION; -ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING = $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING_$(REAL_PLATFORM_NAME)); +ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING = $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING_$(PLATFORM_NAME)); ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING_macosx = ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING; ENABLE_HIGH_DPI_CANVAS = ENABLE_HIGH_DPI_CANVAS; -ENABLE_ICONDATABASE = $(ENABLE_ICONDATABASE_$(REAL_PLATFORM_NAME)); +ENABLE_ICONDATABASE = $(ENABLE_ICONDATABASE_$(PLATFORM_NAME)); ENABLE_ICONDATABASE_macosx = ENABLE_ICONDATABASE; ENABLE_IFRAME_SEAMLESS = ENABLE_IFRAME_SEAMLESS; ENABLE_INDEXED_DATABASE = ; ENABLE_INPUT_SPEECH = ; ENABLE_INPUT_TYPE_COLOR = ; -ENABLE_INPUT_TYPE_DATE = $(ENABLE_INPUT_TYPE_DATE_$(REAL_PLATFORM_NAME)); +ENABLE_INPUT_TYPE_DATE = $(ENABLE_INPUT_TYPE_DATE_$(PLATFORM_NAME)); ENABLE_INPUT_TYPE_DATE_iphoneos = ENABLE_INPUT_TYPE_DATE; -ENABLE_INPUT_TYPE_DATE_iphonesimulator = ENABLE_INPUT_TYPE_DATE; -ENABLE_INPUT_TYPE_DATETIME = $(ENABLE_INPUT_TYPE_DATETIME_$(REAL_PLATFORM_NAME)); +ENABLE_INPUT_TYPE_DATE_iphonesimulator = $(ENABLE_INPUT_TYPE_DATE_iphoneos); +ENABLE_INPUT_TYPE_DATETIME = $(ENABLE_INPUT_TYPE_DATETIME_$(PLATFORM_NAME)); ENABLE_INPUT_TYPE_DATETIME_iphoneos = ENABLE_INPUT_TYPE_DATETIME; -ENABLE_INPUT_TYPE_DATETIME_iphonesimulator = ENABLE_INPUT_TYPE_DATETIME; -ENABLE_INPUT_TYPE_DATETIMELOCAL = $(ENABLE_INPUT_TYPE_DATETIMELOCAL_$(REAL_PLATFORM_NAME)); +ENABLE_INPUT_TYPE_DATETIME_iphonesimulator = $(ENABLE_INPUT_TYPE_DATETIME_iphoneos); +ENABLE_INPUT_TYPE_DATETIMELOCAL = $(ENABLE_INPUT_TYPE_DATETIMELOCAL_$(PLATFORM_NAME)); ENABLE_INPUT_TYPE_DATETIMELOCAL_iphoneos = ENABLE_INPUT_TYPE_DATETIMELOCAL; -ENABLE_INPUT_TYPE_DATETIMELOCAL_iphonesimulator = ENABLE_INPUT_TYPE_DATETIMELOCAL; -ENABLE_INPUT_TYPE_MONTH = $(ENABLE_INPUT_TYPE_MONTH_$(REAL_PLATFORM_NAME)); +ENABLE_INPUT_TYPE_DATETIMELOCAL_iphonesimulator = $(ENABLE_INPUT_TYPE_DATETIMELOCAL_iphoneos); +ENABLE_INPUT_TYPE_MONTH = $(ENABLE_INPUT_TYPE_MONTH_$(PLATFORM_NAME)); ENABLE_INPUT_TYPE_MONTH_iphoneos = ENABLE_INPUT_TYPE_MONTH; -ENABLE_INPUT_TYPE_MONTH_iphonesimulator = ENABLE_INPUT_TYPE_MONTH; -ENABLE_INPUT_TYPE_TIME = $(ENABLE_INPUT_TYPE_TIME_$(REAL_PLATFORM_NAME)); +ENABLE_INPUT_TYPE_MONTH_iphonesimulator = $(ENABLE_INPUT_TYPE_MONTH_iphoneos); +ENABLE_INPUT_TYPE_TIME = $(ENABLE_INPUT_TYPE_TIME_$(PLATFORM_NAME)); ENABLE_INPUT_TYPE_TIME_iphoneos = ENABLE_INPUT_TYPE_TIME; -ENABLE_INPUT_TYPE_TIME_iphonesimulator = ENABLE_INPUT_TYPE_TIME; -ENABLE_INPUT_TYPE_WEEK = $(ENABLE_INPUT_TYPE_WEEK_$(REAL_PLATFORM_NAME)); +ENABLE_INPUT_TYPE_TIME_iphonesimulator = $(ENABLE_INPUT_TYPE_TIME_iphoneos); +ENABLE_INPUT_TYPE_WEEK = $(ENABLE_INPUT_TYPE_WEEK_$(PLATFORM_NAME)); ENABLE_INPUT_TYPE_WEEK_iphoneos = ENABLE_INPUT_TYPE_WEEK; -ENABLE_INPUT_TYPE_WEEK_iphonesimulator = ENABLE_INPUT_TYPE_WEEK; +ENABLE_INPUT_TYPE_WEEK_iphonesimulator = $(ENABLE_INPUT_TYPE_WEEK_iphoneos); ENABLE_JAVASCRIPT_DEBUGGER = ENABLE_JAVASCRIPT_DEBUGGER; ENABLE_LEGACY_CSS_VENDOR_PREFIXES = ENABLE_LEGACY_CSS_VENDOR_PREFIXES; -ENABLE_LEGACY_NOTIFICATIONS = $(ENABLE_LEGACY_NOTIFICATIONS_$(REAL_PLATFORM_NAME)); +ENABLE_LEGACY_NOTIFICATIONS = $(ENABLE_LEGACY_NOTIFICATIONS_$(PLATFORM_NAME)); ENABLE_LEGACY_NOTIFICATIONS_macosx = $(ENABLE_LEGACY_NOTIFICATIONS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); ENABLE_LEGACY_NOTIFICATIONS_macosx_1070 = ; ENABLE_LEGACY_NOTIFICATIONS_macosx_1080 = ENABLE_LEGACY_NOTIFICATIONS; @@ -112,13 +117,13 @@ ENABLE_MHTML = ; ENABLE_MICRODATA = ; ENABLE_MUTATION_OBSERVERS = ENABLE_MUTATION_OBSERVERS; ENABLE_NAVIGATOR_CONTENT_UTILS = ; -ENABLE_NOTIFICATIONS = $(ENABLE_NOTIFICATIONS_$(REAL_PLATFORM_NAME)); +ENABLE_NOTIFICATIONS = $(ENABLE_NOTIFICATIONS_$(PLATFORM_NAME)); ENABLE_NOTIFICATIONS_macosx = $(ENABLE_NOTIFICATIONS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); ENABLE_NOTIFICATIONS_macosx_1070 = ; ENABLE_NOTIFICATIONS_macosx_1080 = ENABLE_NOTIFICATIONS; ENABLE_NOTIFICATIONS_macosx_1090 = ENABLE_NOTIFICATIONS; ENABLE_PAGE_VISIBILITY_API = ; -ENABLE_PDFKIT_PLUGIN = $(ENABLE_PDFKIT_PLUGIN_$(REAL_PLATFORM_NAME)); +ENABLE_PDFKIT_PLUGIN = $(ENABLE_PDFKIT_PLUGIN_$(PLATFORM_NAME)); ENABLE_PDFKIT_PLUGIN_macosx = $(ENABLE_PDFKIT_PLUGIN_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); ENABLE_PDFKIT_PLUGIN_macosx_1070 = ; ENABLE_PDFKIT_PLUGIN_macosx_1080 = ; @@ -126,27 +131,30 @@ ENABLE_PDFKIT_PLUGIN_macosx_1090 = ENABLE_PDFKIT_PLUGIN; ENABLE_PROGRESS_ELEMENT = ENABLE_PROGRESS_ELEMENT; ENABLE_QUOTA = ; ENABLE_REQUEST_ANIMATION_FRAME = ENABLE_REQUEST_ANIMATION_FRAME; +ENABLE_RESOLUTION_MEDIA_QUERY = ; ENABLE_SCRIPTED_SPEECH = ; ENABLE_SHADOW_DOM = ; ENABLE_SHARED_WORKERS = ENABLE_SHARED_WORKERS; ENABLE_SQL_DATABASE = ENABLE_SQL_DATABASE; ENABLE_STYLE_SCOPED = ; +ENABLE_SUBPIXEL_LAYOUT = ENABLE_SUBPIXEL_LAYOUT; ENABLE_SVG = ENABLE_SVG; -ENABLE_SVG_DOM_OBJC_BINDINGS = $(ENABLE_SVG_DOM_OBJC_BINDINGS_$(REAL_PLATFORM_NAME)); +ENABLE_SVG_DOM_OBJC_BINDINGS = $(ENABLE_SVG_DOM_OBJC_BINDINGS_$(PLATFORM_NAME)); ENABLE_SVG_DOM_OBJC_BINDINGS_macosx = ENABLE_SVG_DOM_OBJC_BINDINGS; ENABLE_SVG_FONTS = ENABLE_SVG_FONTS; ENABLE_TEXT_AUTOSIZING = ; ENABLE_TEXT_NOTIFICATIONS_ONLY = ENABLE_TEXT_NOTIFICATIONS_ONLY; ENABLE_TOUCH_ICON_LOADING = ; -ENABLE_UNDO_MANAGER = ; +ENABLE_USERSELECT_ALL = ENABLE_USERSELECT_ALL; ENABLE_VIDEO = ENABLE_VIDEO; -ENABLE_VIDEO_TRACK = $(ENABLE_VIDEO_TRACK_$(REAL_PLATFORM_NAME)); +ENABLE_VIDEO_TRACK = $(ENABLE_VIDEO_TRACK_$(PLATFORM_NAME)); ENABLE_VIDEO_TRACK_macosx = ENABLE_VIDEO_TRACK; ENABLE_WEBGL = ENABLE_WEBGL; ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO; ENABLE_WEB_SOCKETS = ENABLE_WEB_SOCKETS; ENABLE_WEB_TIMING = ; ENABLE_WORKERS = ENABLE_WORKERS; +ENABLE_XHR_TIMEOUT = ENABLE_XHR_TIMEOUT; 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_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_HIERARCHIES) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_CONDITIONAL_RULES) $(ENABLE_CSS3_TEXT) $(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_DRAGGABLE_REGION) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(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) $(LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(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_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_HIERARCHIES) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_CONDITIONAL_RULES) $(ENABLE_CSS3_TEXT) $(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_DRAGGABLE_REGION) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(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_LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SUBPIXEL_LAYOUT) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_USERSELECT_ALL) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XHR_TIMEOUT) $(ENABLE_XSLT); diff --git a/Source/WebKit2/Configurations/Version.xcconfig b/Source/WebKit2/Configurations/Version.xcconfig index 92bebd83a..c2328d04b 100644 --- a/Source/WebKit2/Configurations/Version.xcconfig +++ b/Source/WebKit2/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 537; -MINOR_VERSION = 16; +MINOR_VERSION = 18; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); @@ -32,8 +32,6 @@ SHORT_VERSION_STRING = $(SHORT_VERSION_STRING_$(CONFIGURATION)) // The system version prefix is based on the current system version. SYSTEM_VERSION_PREFIX = $(SYSTEM_VERSION_PREFIX_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -SYSTEM_VERSION_PREFIX_1050 = 5; -SYSTEM_VERSION_PREFIX_1060 = 6; SYSTEM_VERSION_PREFIX_1070 = 7; SYSTEM_VERSION_PREFIX_1080 = 8; SYSTEM_VERSION_PREFIX_1090 = 9; diff --git a/Source/WebKit2/Configurations/WebKit2.xcconfig b/Source/WebKit2/Configurations/WebKit2.xcconfig index 752b3c5b7..3e4588c62 100644 --- a/Source/WebKit2/Configurations/WebKit2.xcconfig +++ b/Source/WebKit2/Configurations/WebKit2.xcconfig @@ -31,8 +31,5 @@ DYLIB_INSTALL_NAME_BASE = $(NORMAL_WEBKIT2_FRAMEWORKS_DIR); FRAMEWORK_AND_LIBRARY_LDFLAGS = -framework ApplicationServices -framework Carbon -framework Cocoa -framework CoreServices -framework IOKit -framework JavaScriptCore -licucore -framework QuartzCore -framework Security -framework WebCore; -OTHER_LDFLAGS = $(OTHER_LDFLAGS_$(REAL_PLATFORM_NAME)) $(OTHER_LDFLAGS); -OTHER_LDFLAGS_macosx = $(OTHER_LDFLAGS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)) $(FRAMEWORK_AND_LIBRARY_LDFLAGS); -OTHER_LDFLAGS_macosx_1070 = -Xlinker -objc_gc_compaction; -OTHER_LDFLAGS_macosx_1080 = $(OTHER_LDFLAGS_macosx_1070); -OTHER_LDFLAGS_macosx_1090 = $(OTHER_LDFLAGS_macosx_1070); +OTHER_LDFLAGS = $(OTHER_LDFLAGS_$(PLATFORM_NAME)) $(OTHER_LDFLAGS); +OTHER_LDFLAGS_macosx = $(FRAMEWORK_AND_LIBRARY_LDFLAGS); diff --git a/Source/WebKit2/DerivedSources.make b/Source/WebKit2/DerivedSources.make index 35976969c..03d7269d7 100644 --- a/Source/WebKit2/DerivedSources.make +++ b/Source/WebKit2/DerivedSources.make @@ -36,6 +36,7 @@ VPATH = \ $(WebKit2)/WebProcess/IconDatabase \ $(WebKit2)/WebProcess/KeyValueStorage \ $(WebKit2)/WebProcess/MediaCache \ + $(WebKit2)/WebProcess/Network \ $(WebKit2)/WebProcess/Notifications \ $(WebKit2)/WebProcess/Plugins \ $(WebKit2)/WebProcess/ResourceCache \ @@ -57,6 +58,7 @@ MESSAGE_RECEIVERS = \ DownloadProxy \ EventDispatcher \ NetworkProcess \ + NetworkProcessConnection \ NetworkProcessProxy \ NPObjectMessageReceiver \ PluginControllerProxy \ @@ -129,12 +131,7 @@ ifeq ($(OS),MACOS) FRAMEWORK_FLAGS = $(shell echo $(BUILT_PRODUCTS_DIR) $(FRAMEWORK_SEARCH_PATHS) | perl -e 'print "-F " . join(" -F ", split(" ", <>));') HEADER_FLAGS = $(shell echo $(BUILT_PRODUCTS_DIR) $(HEADER_SEARCH_PATHS) | perl -e 'print "-I" . join(" -I", split(" ", <>));') - -ifeq ($(TARGET_GCC_VERSION),LLVM_COMPILER) - TEXT_PREPROCESSOR_FLAGS=-E -P -x c -traditional -w -else - TEXT_PREPROCESSOR_FLAGS=-E -P -x c -std=c89 -endif +TEXT_PREPROCESSOR_FLAGS=-E -P -x c -traditional -w ifneq ($(SDKROOT),) SDK_FLAGS=-isysroot $(SDKROOT) diff --git a/Source/WebKit2/GNUmakefile.am b/Source/WebKit2/GNUmakefile.am index f956d0edd..0bbfeae8e 100644 --- a/Source/WebKit2/GNUmakefile.am +++ b/Source/WebKit2/GNUmakefile.am @@ -175,6 +175,7 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LIB $(GTK_LIBS) \ $(GTK_UNIX_PRINTING_LIBS) \ $(JPEG_LIBS) \ + $(LIBSECRET_LIBS) \ $(LIBSOUP_LIBS) \ $(LIBXML_LIBS) \ $(LIBXSLT_LIBS) \ @@ -203,6 +204,55 @@ if ENABLE_WEBKIT2 pkgconfig_DATA += Source/WebKit2/webkit2gtk-@WEBKITGTK_API_VERSION@.pc endif +if ENABLE_INTROSPECTION + +WebKit2-@WEBKITGTK_API_VERSION@.gir: $(G_IR_SCANNER) libwebkit2gtk-@WEBKITGTK_API_MAJOR_VERSION@.@WEBKITGTK_API_MINOR_VERSION@.la + $(AM_V_GEN)$(G_IR_SCANNER) -v --warn-all \ + --symbol-prefix=webkit \ + --identifier-prefix=WebKit \ + --namespace=WebKit2 \ + --nsversion=@WEBKITGTK_API_VERSION@ \ + --include=GObject-2.0 \ + --include=Gtk-3.0 \ + --include=Soup-2.4 \ + --library=webkit2gtk-@WEBKITGTK_API_VERSION@ \ + --library=javascriptcoregtk-@WEBKITGTK_API_VERSION@ \ + --libtool="$(LIBTOOL)" \ + --pkg=gobject-2.0 \ + --pkg=gtk+-@GTK_API_VERSION@ \ + --pkg=libsoup-2.4 \ + --pkg-export=webkit2gtk-@WEBKITGTK_API_VERSION@ \ + --output=$@ \ + --add-include-path=$(WebKit2) \ + --add-include-path=$(top_builddir) \ + --c-include="webkit2/webkit2.h" \ + -I$(srcdir)/Source \ + -I$(WebKit2) \ + -I$(GENSOURCES) \ + -I$(GENSOURCES_WEBKIT2) \ + -I$(top_builddir)/Source/WebKit2/UIProcess/API/gtk \ + -I$(top_srcdir)/Source/JavaScriptCore/ForwardingHeaders \ + -I$(top_srcdir) \ + -I$(GENSOURCES_WEBKIT2)/webkit2gtk/include \ + -I$(GENSOURCES_WEBKIT2)/webkit2gtk \ + -DWEBKIT2_COMPILATION \ + $(GENSOURCES_WEBKIT2)/webkit2gtk/webkit2/WebKitEnumTypes.h \ + $(webkit2gtk_h_api) \ + $(WebKit2)/UIProcess/API/gtk/*.cpp + +gir2dir = $(datadir)/gir-1.0 +gir2_DATA = WebKit2-@WEBKITGTK_API_VERSION@.gir + +typelibs2dir = $(libdir)/girepository-1.0 +typelibs2_DATA = WebKit2-@WEBKITGTK_API_VERSION@.typelib + +WebKit2-@WEBKITGTK_API_VERSION@.typelib: WebKit2-@WEBKITGTK_API_VERSION@.gir $(G_IR_COMPILER) + $(AM_V_GEN)$(G_IR_COMPILER) --includedir $(WebKit2) --includedir $(top_builddir) $< -o $@ + +CLEANFILES += WebKit2-@WEBKITGTK_API_VERSION@.gir WebKit2-@WEBKITGTK_API_VERSION@.typelib + +endif + # WebKit2 specific variables forwarding_headers := $(GENSOURCES_WEBKIT2)/include generate-webkit2-forwarding-headers: $(WebKit2)/Scripts/generate-forwarding-headers.pl $(libWebKit2_la_SOURCES) @@ -409,6 +459,7 @@ libWebCoreGtk2_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(GSTREAMER_CFLAGS) \ $(GTK2_CFLAGS) \ + $(LIBSECRET_CFLAGS) \ $(LIBSOUP_CFLAGS) \ $(LIBXML_CFLAGS) \ $(LIBXSLT_CFLAGS) \ diff --git a/Source/WebKit2/GNUmakefile.list.am b/Source/WebKit2/GNUmakefile.list.am index 416cf26c5..9d47b768d 100644 --- a/Source/WebKit2/GNUmakefile.list.am +++ b/Source/WebKit2/GNUmakefile.list.am @@ -965,8 +965,6 @@ webkit2_sources += \ Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.h \ Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp \ Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.h \ - Source/WebKit2/WebProcess/gtk/WebAuthDialog.cpp \ - Source/WebKit2/WebProcess/gtk/WebAuthDialog.h \ Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp \ Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.h \ Source/WebKit2/WebProcess/IconDatabase/WebIconDatabaseProxy.cpp \ @@ -1106,6 +1104,7 @@ webkit2_sources += \ Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp \ Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp \ Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebErrorsGtk.cpp \ + Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebFrameLoaderClientGtk.cpp \ Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebPopupMenuGtk.cpp \ Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp \ Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h \ diff --git a/Source/WebKit2/NetworkProcess/HostRecord.cpp b/Source/WebKit2/NetworkProcess/HostRecord.cpp new file mode 100644 index 000000000..32ba59638 --- /dev/null +++ b/Source/WebKit2/NetworkProcess/HostRecord.cpp @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2012 Apple Inc. 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 "HostRecord.h" + +#include "Logging.h" +#include "NetworkConnectionToWebProcess.h" +#include "NetworkProcess.h" +#include "NetworkRequest.h" +#include "NetworkResourceLoadScheduler.h" + +#if ENABLE(NETWORK_PROCESS) + +using namespace WebCore; + +namespace WebKit { + +HostRecord::HostRecord(const String& name, int maxRequestsInFlight) + : m_name(name) + , m_maxRequestsInFlight(maxRequestsInFlight) +{ +} + +HostRecord::~HostRecord() +{ +#ifndef NDEBUG + ASSERT(m_requestsLoading.isEmpty()); + for (unsigned p = 0; p <= ResourceLoadPriorityHighest; p++) + ASSERT(m_requestsPending[p].isEmpty()); +#endif +} + +void HostRecord::schedule(PassRefPtr<NetworkRequest> record, ResourceLoadPriority priority) +{ + m_requestsPending[priority].append(record); +} + +void HostRecord::addLoadInProgress(ResourceLoadIdentifier identifier) +{ + m_requestsLoading.add(identifier); +} + +void HostRecord::remove(ResourceLoadIdentifier identifier) +{ + if (m_requestsLoading.contains(identifier)) { + m_requestsLoading.remove(identifier); + return; + } + + for (int priority = ResourceLoadPriorityHighest; priority >= ResourceLoadPriorityLowest; --priority) { + RequestQueue::iterator end = m_requestsPending[priority].end(); + for (RequestQueue::iterator it = m_requestsPending[priority].begin(); it != end; ++it) { + if (it->get()->identifier() == identifier) { + m_requestsPending[priority].remove(it); + return; + } + } + } +} + +bool HostRecord::hasRequests() const +{ + if (!m_requestsLoading.isEmpty()) + return true; + + for (unsigned p = 0; p <= ResourceLoadPriorityHighest; p++) { + if (!m_requestsPending[p].isEmpty()) + return true; + } + + return false; +} + +bool HostRecord::limitRequests(ResourceLoadPriority priority, bool serialLoadingEnabled) const +{ + if (priority == ResourceLoadPriorityVeryLow && !m_requestsLoading.isEmpty()) + return true; + + return m_requestsLoading.size() >= (serialLoadingEnabled ? 1 : m_maxRequestsInFlight); +} + +} // namespace WebKit + +#endif // ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/NetworkProcess/HostRecord.h b/Source/WebKit2/NetworkProcess/HostRecord.h new file mode 100644 index 000000000..bed5df522 --- /dev/null +++ b/Source/WebKit2/NetworkProcess/HostRecord.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2012 Apple Inc. 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 HostRecord_h +#define HostRecord_h + +#if ENABLE(NETWORK_PROCESS) + +#include <WebCore/ResourceRequest.h> +#include <wtf/Deque.h> +#include <wtf/HashSet.h> +#include <wtf/text/WTFString.h> + +namespace WebKit { + +class NetworkRequest; +typedef uint64_t ResourceLoadIdentifier; + +class HostRecord { + WTF_MAKE_NONCOPYABLE(HostRecord); WTF_MAKE_FAST_ALLOCATED; +public: + HostRecord(const String& name, int maxRequestsInFlight); + ~HostRecord(); + + const String& name() const { return m_name; } + void schedule(PassRefPtr<NetworkRequest>, WebCore::ResourceLoadPriority = WebCore::ResourceLoadPriorityVeryLow); + void addLoadInProgress(ResourceLoadIdentifier); + void remove(ResourceLoadIdentifier); + bool hasRequests() const; + bool limitRequests(WebCore::ResourceLoadPriority, bool serialLoadingEnabled) const; + + typedef Deque<RefPtr<NetworkRequest> > RequestQueue; + RequestQueue& requestsPending(WebCore::ResourceLoadPriority priority) { return m_requestsPending[priority]; } + +private: + RequestQueue m_requestsPending[WebCore::ResourceLoadPriorityHighest + 1]; + typedef HashSet<ResourceLoadIdentifier> RequestIdentifierMap; + RequestIdentifierMap m_requestsLoading; + + const String m_name; + int m_maxRequestsInFlight; +}; + +} // namespace WebKit + +#endif // ENABLE(NETWORK_PROCESS) + +#endif // #ifndef HostRecord_h diff --git a/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp b/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp index 1fdce180b..f9bd5af55 100644 --- a/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp +++ b/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp @@ -28,6 +28,7 @@ #include "ConnectionStack.h" #include "NetworkProcess.h" +#include <WebCore/ResourceRequest.h> #include <WebCore/RunLoop.h> #if ENABLE(NETWORK_PROCESS) @@ -42,6 +43,7 @@ PassRefPtr<NetworkConnectionToWebProcess> NetworkConnectionToWebProcess::create( } NetworkConnectionToWebProcess::NetworkConnectionToWebProcess(CoreIPC::Connection::Identifier connectionIdentifier) + : m_serialLoadingEnabled(false) { m_connection = CoreIPC::Connection::createServerConnection(connectionIdentifier, this, RunLoop::main()); m_connection->setOnlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage(true); @@ -51,22 +53,36 @@ NetworkConnectionToWebProcess::NetworkConnectionToWebProcess(CoreIPC::Connection NetworkConnectionToWebProcess::~NetworkConnectionToWebProcess() { ASSERT(!m_connection); + ASSERT(m_observers.isEmpty()); } -void NetworkConnectionToWebProcess::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder) +void NetworkConnectionToWebProcess::registerObserver(NetworkConnectionToWebProcessObserver* observer) { - ConnectionStack::CurrentConnectionPusher currentConnection(ConnectionStack::shared(), connection); + ASSERT(!m_observers.contains(observer)); + m_observers.add(observer); +} +void NetworkConnectionToWebProcess::unregisterObserver(NetworkConnectionToWebProcessObserver* observer) +{ + ASSERT(m_observers.contains(observer)); + m_observers.remove(observer); +} + +void NetworkConnectionToWebProcess::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder) +{ if (messageID.is<CoreIPC::MessageClassNetworkConnectionToWebProcess>()) { didReceiveNetworkConnectionToWebProcessMessage(connection, messageID, decoder); return; } - ASSERT_NOT_REACHED(); } -void NetworkConnectionToWebProcess::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& arguments, OwnPtr<CoreIPC::MessageEncoder>& reply) +void NetworkConnectionToWebProcess::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder, OwnPtr<CoreIPC::MessageEncoder>& reply) { + if (messageID.is<CoreIPC::MessageClassNetworkConnectionToWebProcess>()) { + didReceiveSyncNetworkConnectionToWebProcessMessage(connection, messageID, decoder, reply); + return; + } ASSERT_NOT_REACHED(); } @@ -77,16 +93,59 @@ void NetworkConnectionToWebProcess::didClose(CoreIPC::Connection*) NetworkProcess::shared().removeNetworkConnectionToWebProcess(this); + Vector<NetworkConnectionToWebProcessObserver*> observers; + copyToVector(m_observers, observers); + for (size_t i = 0; i < observers.size(); ++i) + observers[i]->connectionToWebProcessDidClose(this); + + // FIXME (NetworkProcess): We might consider actively clearing out all requests for this connection. + // But that might not be necessary as the observer mechanism used above is much more direct. + m_connection = 0; } -void NetworkConnectionToWebProcess::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID) +void NetworkConnectionToWebProcess::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference, CoreIPC::StringReference) +{ +} + +void NetworkConnectionToWebProcess::scheduleNetworkRequest(const ResourceRequest& request, uint32_t resourceLoadPriority, ResourceLoadIdentifier& resourceLoadIdentifier) +{ + resourceLoadIdentifier = NetworkProcess::shared().networkResourceLoadScheduler().scheduleNetworkRequest(request, static_cast<ResourceLoadPriority>(resourceLoadPriority), this); +} + +void NetworkConnectionToWebProcess::addLoadInProgress(const WebCore::KURL& url, ResourceLoadIdentifier& identifier) +{ + identifier = NetworkProcess::shared().networkResourceLoadScheduler().addLoadInProgress(url); +} + +void NetworkConnectionToWebProcess::removeLoadIdentifier(ResourceLoadIdentifier identifier) +{ + NetworkProcess::shared().networkResourceLoadScheduler().removeLoadIdentifier(identifier); +} + +void NetworkConnectionToWebProcess::crossOriginRedirectReceived(ResourceLoadIdentifier identifier, const KURL& redirectURL) +{ + NetworkProcess::shared().networkResourceLoadScheduler().crossOriginRedirectReceived(identifier, redirectURL); +} + +void NetworkConnectionToWebProcess::servePendingRequests(uint32_t resourceLoadPriority) +{ + NetworkProcess::shared().networkResourceLoadScheduler().servePendingRequests(static_cast<ResourceLoadPriority>(resourceLoadPriority)); +} + +void NetworkConnectionToWebProcess::suspendPendingRequests() +{ + NetworkProcess::shared().networkResourceLoadScheduler().suspendPendingRequests(); +} + +void NetworkConnectionToWebProcess::resumePendingRequests() { + NetworkProcess::shared().networkResourceLoadScheduler().resumePendingRequests(); } -void NetworkConnectionToWebProcess::didReceiveNetworkConnectionToWebProcessMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) +void NetworkConnectionToWebProcess::setSerialLoadingEnabled(bool enabled) { - // Empty for now - There are no messages to handle. + m_serialLoadingEnabled = enabled; } } // namespace WebKit diff --git a/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h b/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h index 635136094..23ee9846e 100644 --- a/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h +++ b/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h @@ -30,17 +30,36 @@ #include "Connection.h" #include "NetworkConnectionToWebProcessMessages.h" +#include <WebCore/ResourceLoadPriority.h> #include <wtf/HashSet.h> #include <wtf/RefCounted.h> +namespace WebCore { +class ResourceRequest; +} + namespace WebKit { +class NetworkConnectionToWebProcess; +typedef uint64_t ResourceLoadIdentifier; + +class NetworkConnectionToWebProcessObserver { +public: + virtual ~NetworkConnectionToWebProcessObserver() { } + virtual void connectionToWebProcessDidClose(NetworkConnectionToWebProcess*) = 0; +}; + class NetworkConnectionToWebProcess : public RefCounted<NetworkConnectionToWebProcess>, CoreIPC::Connection::Client { public: static PassRefPtr<NetworkConnectionToWebProcess> create(CoreIPC::Connection::Identifier); virtual ~NetworkConnectionToWebProcess(); CoreIPC::Connection* connection() const { return m_connection.get(); } + + void registerObserver(NetworkConnectionToWebProcessObserver*); + void unregisterObserver(NetworkConnectionToWebProcessObserver*); + + bool isSerialLoadingEnabled() const { return m_serialLoadingEnabled; } private: NetworkConnectionToWebProcess(CoreIPC::Connection::Identifier); @@ -49,12 +68,26 @@ private: virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&, OwnPtr<CoreIPC::MessageEncoder>&); virtual void didClose(CoreIPC::Connection*); - virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID); + virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName); // Message handlers. void didReceiveNetworkConnectionToWebProcessMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); - + void didReceiveSyncNetworkConnectionToWebProcessMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&, OwnPtr<CoreIPC::MessageEncoder>&); + + void scheduleNetworkRequest(const WebCore::ResourceRequest&, uint32_t resourceLoadPriority, ResourceLoadIdentifier&); + void addLoadInProgress(const WebCore::KURL&, ResourceLoadIdentifier&); + void removeLoadIdentifier(ResourceLoadIdentifier); + void crossOriginRedirectReceived(ResourceLoadIdentifier, const WebCore::KURL& redirectURL); + void servePendingRequests(uint32_t resourceLoadPriority); + void suspendPendingRequests(); + void resumePendingRequests(); + void setSerialLoadingEnabled(bool); + RefPtr<CoreIPC::Connection> m_connection; + + HashSet<NetworkConnectionToWebProcessObserver*> m_observers; + + bool m_serialLoadingEnabled; }; } // namespace WebKit diff --git a/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in b/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in index a1047c83a..df785a1b6 100644 --- a/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in +++ b/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in @@ -24,6 +24,24 @@ messages -> NetworkConnectionToWebProcess { + // FIXME (NetworkProcess): At least some of these synchronous messages are synchronous due to the requirement + // that we synchronously get an identifier for new ResourceLoaders as they are created. + // There's possible ResourceLoader identifier refactoring that can remove that requirement. + // We might also have the NetworkProcess divvy up identifiers in blocks to each WebProcess beforehand. + ScheduleNetworkRequest(WebCore::ResourceRequest request, uint32_t resourceLoadPriority) -> (uint64_t resourceLoadIdentifier) + AddLoadInProgress(WebCore::KURL url) -> (uint64_t resourceLoadIdentifier) + RemoveLoadIdentifier(uint64_t resourceLoadIdentifier) + + // It's possible that we will be able to do away with this message and have the NetworkProcess + // manage it internally. + crossOriginRedirectReceived(uint64_t resourceLoadIdentifier, WebCore::KURL redirectURL) -> () + + ServePendingRequests(uint32_t resourceLoadPriority) + + SuspendPendingRequests() -> () + ResumePendingRequests() -> () + + SetSerialLoadingEnabled(bool enabled) -> () } #endif // ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/NetworkProcess/NetworkProcess.cpp b/Source/WebKit2/NetworkProcess/NetworkProcess.cpp index 5be2e9b21..634333559 100644 --- a/Source/WebKit2/NetworkProcess/NetworkProcess.cpp +++ b/Source/WebKit2/NetworkProcess/NetworkProcess.cpp @@ -87,7 +87,7 @@ void NetworkProcess::didClose(CoreIPC::Connection*) RunLoop::current()->stop(); } -void NetworkProcess::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID) +void NetworkProcess::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference, CoreIPC::StringReference) { RunLoop::current()->stop(); } diff --git a/Source/WebKit2/NetworkProcess/NetworkProcess.h b/Source/WebKit2/NetworkProcess/NetworkProcess.h index 5828e1f5e..66a1185e9 100644 --- a/Source/WebKit2/NetworkProcess/NetworkProcess.h +++ b/Source/WebKit2/NetworkProcess/NetworkProcess.h @@ -29,6 +29,7 @@ #if ENABLE(NETWORK_PROCESS) #include "ChildProcess.h" +#include "NetworkResourceLoadScheduler.h" #include <wtf/Forward.h> namespace WebCore { @@ -49,6 +50,8 @@ public: void removeNetworkConnectionToWebProcess(NetworkConnectionToWebProcess*); + NetworkResourceLoadScheduler& networkResourceLoadScheduler() { return m_networkResourceLoadScheduler; } + private: NetworkProcess(); ~NetworkProcess(); @@ -61,7 +64,7 @@ private: // CoreIPC::Connection::Client virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); virtual void didClose(CoreIPC::Connection*); - virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID); + virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName); virtual void syncMessageSendTimedOut(CoreIPC::Connection*); // Message Handlers @@ -75,6 +78,7 @@ private: // Connections to WebProcesses. Vector<RefPtr<NetworkConnectionToWebProcess> > m_webProcessConnections; + NetworkResourceLoadScheduler m_networkResourceLoadScheduler; }; } // namespace WebKit diff --git a/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in b/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in index 029536a34..d243bd44f 100644 --- a/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in +++ b/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in @@ -28,6 +28,10 @@ messages -> NetworkProcess { # Creates a connection for communication with a WebProcess CreateNetworkConnectionToWebProcess() + +#if PLATFORM(MAC) + SetApplicationIsOccluded(bool flag) +#endif } #endif // ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/NetworkProcess/NetworkRequest.cpp b/Source/WebKit2/NetworkProcess/NetworkRequest.cpp new file mode 100644 index 000000000..79e74cf19 --- /dev/null +++ b/Source/WebKit2/NetworkProcess/NetworkRequest.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2012 Apple Inc. 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 "NetworkRequest.h" + +#if ENABLE(NETWORK_PROCESS) + +#include "NetworkConnectionToWebProcess.h" + +namespace WebKit { + +NetworkRequest::NetworkRequest(const WebCore::ResourceRequest& request, ResourceLoadIdentifier identifier, NetworkConnectionToWebProcess* connection) + : m_request(request) + , m_identifier(identifier) + , m_connection(connection) +{ + connection->registerObserver(this); +} + +NetworkRequest::~NetworkRequest() +{ + if (m_connection) + m_connection->unregisterObserver(this); +} + +void NetworkRequest::connectionToWebProcessDidClose(NetworkConnectionToWebProcess* connection) +{ + ASSERT_ARG(connection, connection == m_connection.get()); + m_connection->unregisterObserver(this); + m_connection = 0; +} + +} // namespace WebKit + +#endif // ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/NetworkProcess/NetworkRequest.h b/Source/WebKit2/NetworkProcess/NetworkRequest.h new file mode 100644 index 000000000..683e832c2 --- /dev/null +++ b/Source/WebKit2/NetworkProcess/NetworkRequest.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2012 Apple Inc. 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 NetworkRequest_h +#define NetworkRequest_h + +#if ENABLE(NETWORK_PROCESS) + +#include "NetworkConnectionToWebProcess.h" +#include <WebCore/ResourceRequest.h> + +namespace WebKit { + +typedef uint64_t ResourceLoadIdentifier; + +class NetworkRequest : public RefCounted<NetworkRequest>, public NetworkConnectionToWebProcessObserver { +public: + static RefPtr<NetworkRequest> create(const WebCore::ResourceRequest& request, ResourceLoadIdentifier identifier, NetworkConnectionToWebProcess* connection) + { + return adoptRef(new NetworkRequest(request, identifier, connection)); + } + + ~NetworkRequest(); + + void connectionToWebProcessDidClose(NetworkConnectionToWebProcess*); + + ResourceLoadIdentifier identifier() { return m_identifier; } + + NetworkConnectionToWebProcess* connectionToWebProcess() { return m_connection.get(); } + +private: + NetworkRequest(const WebCore::ResourceRequest&, ResourceLoadIdentifier, NetworkConnectionToWebProcess*); + + WebCore::ResourceRequest m_request; + ResourceLoadIdentifier m_identifier; + + RefPtr<NetworkConnectionToWebProcess> m_connection; +}; + +} // namespace WebKit + +#endif // ENABLE(NETWORK_PROCESS) + +#endif // NetworkRequest_h diff --git a/Source/WebKit2/NetworkProcess/NetworkResourceLoadScheduler.cpp b/Source/WebKit2/NetworkProcess/NetworkResourceLoadScheduler.cpp new file mode 100644 index 000000000..ccc3d76b9 --- /dev/null +++ b/Source/WebKit2/NetworkProcess/NetworkResourceLoadScheduler.cpp @@ -0,0 +1,205 @@ +#include "config.h" +#include "NetworkResourceLoadScheduler.h" + +#include "HostRecord.h" +#include "Logging.h" +#include "NetworkConnectionToWebProcess.h" +#include "NetworkProcessconnectionMessages.h" +#include "NetworkRequest.h" +#include <wtf/text/CString.h> + +#if ENABLE(NETWORK_PROCESS) + +using namespace WebCore; + +namespace WebKit { + +static const unsigned maxRequestsInFlightForNonHTTPProtocols = 20; +static unsigned maxRequestsInFlightPerHost; +static ResourceLoadIdentifier s_currentResourceLoadIdentifier; + +NetworkResourceLoadScheduler::NetworkResourceLoadScheduler() + : m_nonHTTPProtocolHost(new HostRecord(String(), maxRequestsInFlightForNonHTTPProtocols)) + , m_requestTimer(this, &NetworkResourceLoadScheduler::requestTimerFired) + +{ + maxRequestsInFlightPerHost = platformInitializeMaximumHTTPConnectionCountPerHost(); +} + +void NetworkResourceLoadScheduler::scheduleServePendingRequests() +{ + if (!m_requestTimer.isActive()) + m_requestTimer.startOneShot(0); +} + +void NetworkResourceLoadScheduler::requestTimerFired(WebCore::Timer<NetworkResourceLoadScheduler>*) +{ + servePendingRequests(); +} + +ResourceLoadIdentifier NetworkResourceLoadScheduler::scheduleNetworkRequest(const ResourceRequest& request, ResourceLoadPriority priority, NetworkConnectionToWebProcess* connection) +{ + ResourceLoadIdentifier identifier = ++s_currentResourceLoadIdentifier; + + LOG(Network, "(NetworkProcess) NetworkResourceLoadScheduler::scheduleNetworkRequest resource %llu '%s'", identifier, request.url().string().utf8().data()); + + HostRecord* host = hostForURL(request.url(), CreateIfNotFound); + bool hadRequests = host->hasRequests(); + host->schedule(NetworkRequest::create(request, identifier, connection), priority); + m_identifiers.add(identifier, host); + + if (priority > ResourceLoadPriorityLow || !request.url().protocolIsInHTTPFamily() || (priority == ResourceLoadPriorityLow && !hadRequests)) { + // Try to request important resources immediately. + servePendingRequestsForHost(host, priority); + return identifier; + } + + // Handle asynchronously so early low priority requests don't get scheduled before later high priority ones. + scheduleServePendingRequests(); + return identifier; +} + +ResourceLoadIdentifier NetworkResourceLoadScheduler::addLoadInProgress(const WebCore::KURL& url) +{ + ResourceLoadIdentifier identifier = ++s_currentResourceLoadIdentifier; + + LOG(Network, "(NetworkProcess) NetworkResourceLoadScheduler::addLoadInProgress resource %llu with url '%s'", identifier, url.string().utf8().data()); + + HostRecord* host = hostForURL(url, CreateIfNotFound); + host->addLoadInProgress(identifier); + m_identifiers.add(identifier, host); + + return identifier; +} + +HostRecord* NetworkResourceLoadScheduler::hostForURL(const WebCore::KURL& url, CreateHostPolicy createHostPolicy) +{ + if (!url.protocolIsInHTTPFamily()) + return m_nonHTTPProtocolHost; + + m_hosts.checkConsistency(); + String hostName = url.host(); + HostRecord* host = m_hosts.get(hostName); + if (!host && createHostPolicy == CreateIfNotFound) { + host = new HostRecord(hostName, maxRequestsInFlightPerHost); + m_hosts.add(hostName, host); + } + + return host; +} + +void NetworkResourceLoadScheduler::removeLoadIdentifier(ResourceLoadIdentifier identifier) +{ + ASSERT(identifier); + + LOG(Network, "(NetworkProcess) NetworkResourceLoadScheduler::removeLoadIdentifier removing load identifier %llu", identifier); + + HostRecord* host = m_identifiers.take(identifier); + ASSERT(host); + if (host) + host->remove(identifier); + + scheduleServePendingRequests(); +} + +void NetworkResourceLoadScheduler::crossOriginRedirectReceived(ResourceLoadIdentifier identifier, const WebCore::KURL& redirectURL) +{ + LOG(Network, "(NetworkProcess) NetworkResourceLoadScheduler::crossOriginRedirectReceived resource %llu redirected to '%s'", identifier, redirectURL.string().utf8().data()); + + HostRecord* oldHost = m_identifiers.get(identifier); + HostRecord* newHost = hostForURL(redirectURL, CreateIfNotFound); + ASSERT(oldHost); + + if (oldHost->name() == newHost->name()) + return; + + newHost->addLoadInProgress(identifier); + m_identifiers.set(identifier, newHost); + + oldHost->remove(identifier); +} + +void NetworkResourceLoadScheduler::servePendingRequests(ResourceLoadPriority minimumPriority) +{ + if (m_suspendPendingRequestsCount) + return; + + LOG(Network, "(NetworkProcess) NetworkResourceLoadScheduler::servePendingRequests Serving requests for up to %i hosts", m_hosts.size()); + + m_requestTimer.stop(); + + servePendingRequestsForHost(m_nonHTTPProtocolHost, minimumPriority); + + m_hosts.checkConsistency(); + Vector<HostRecord*> hostsToServe; + copyValuesToVector(m_hosts, hostsToServe); + + size_t size = hostsToServe.size(); + for (size_t i = 0; i < size; ++i) { + HostRecord* host = hostsToServe[i]; + if (host->hasRequests()) + servePendingRequestsForHost(host, minimumPriority); + else + delete m_hosts.take(host->name()); + } +} + +void NetworkResourceLoadScheduler::servePendingRequestsForHost(HostRecord* host, ResourceLoadPriority minimumPriority) +{ + LOG(Network, "NetworkResourceLoadScheduler::servePendingRequests Host name='%s'", host->name().utf8().data()); + + for (int priority = ResourceLoadPriorityHighest; priority >= minimumPriority; --priority) { + HostRecord::RequestQueue& requestsPending = host->requestsPending(ResourceLoadPriority(priority)); + + while (!requestsPending.isEmpty()) { + RefPtr<NetworkRequest> request = requestsPending.first(); + + // This request might be from WebProcess we've lost our connection to. + // If so we should just skip it. + if (!request->connectionToWebProcess()) { + requestsPending.removeFirst(); + continue; + } + + // For named hosts - which are only http(s) hosts - we should always enforce the connection limit. + // For non-named hosts - everything but http(s) - we should only enforce the limit if the document + // isn't done parsing and we don't know all stylesheets yet. + + // FIXME (NetworkProcess): The above comment about document parsing and stylesheets is a holdover + // from the WebCore::ResourceLoadScheduler. + // The behavior described was at one time important for WebCore's single threadedness. + // It's possible that we don't care about it with the NetworkProcess. + // We should either decide it's not important and change the above comment, or decide it is + // still important and somehow account for it. + + bool shouldLimitRequests = !host->name().isNull(); + if (shouldLimitRequests && host->limitRequests(ResourceLoadPriority(priority), request->connectionToWebProcess()->isSerialLoadingEnabled())) + return; + + requestsPending.removeFirst(); + host->addLoadInProgress(request->identifier()); + + request->connectionToWebProcess()->connection()->send(Messages::NetworkProcessConnection::StartResourceLoad(request->identifier()), 0); + } + } +} + +void NetworkResourceLoadScheduler::suspendPendingRequests() +{ + ++m_suspendPendingRequestsCount; +} + +void NetworkResourceLoadScheduler::resumePendingRequests() +{ + ASSERT(m_suspendPendingRequestsCount); + --m_suspendPendingRequestsCount; + if (m_suspendPendingRequestsCount) + return; + + if (!m_hosts.isEmpty() || m_nonHTTPProtocolHost->hasRequests()) + scheduleServePendingRequests(); +} + +} // namespace WebKit + +#endif // ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/NetworkProcess/NetworkResourceLoadScheduler.h b/Source/WebKit2/NetworkProcess/NetworkResourceLoadScheduler.h new file mode 100644 index 000000000..a16a38847 --- /dev/null +++ b/Source/WebKit2/NetworkProcess/NetworkResourceLoadScheduler.h @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2012 Apple Inc. 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 NetworkResourceLoadScheduler_h +#define NetworkResourceLoadScheduler_h + +#include <WebCore/ResourceRequest.h> +#include <WebCore/Timer.h> + +#if ENABLE(NETWORK_PROCESS) + +namespace WebKit { + +class HostRecord; +class NetworkConnectionToWebProcess; +typedef uint64_t ResourceLoadIdentifier; + +class NetworkResourceLoadScheduler { + WTF_MAKE_NONCOPYABLE(NetworkResourceLoadScheduler); WTF_MAKE_FAST_ALLOCATED; + +public: + NetworkResourceLoadScheduler(); + + // Adds the request to the queue for its host and create a unique identifier for it. + ResourceLoadIdentifier scheduleNetworkRequest(const WebCore::ResourceRequest&, WebCore::ResourceLoadPriority, NetworkConnectionToWebProcess*); + + // Creates a unique identifier for an already-in-progress load. + ResourceLoadIdentifier addLoadInProgress(const WebCore::KURL&); + + // Called by the WebProcess when a ResourceLoader is being cleaned up. + void removeLoadIdentifier(ResourceLoadIdentifier); + + void crossOriginRedirectReceived(ResourceLoadIdentifier, const WebCore::KURL& redirectURL); + void servePendingRequests(WebCore::ResourceLoadPriority = WebCore::ResourceLoadPriorityVeryLow); + void suspendPendingRequests(); + void resumePendingRequests(); + +private: + enum CreateHostPolicy { + CreateIfNotFound, + FindOnly + }; + + HostRecord* hostForURL(const WebCore::KURL&, CreateHostPolicy = FindOnly); + + void scheduleServePendingRequests(); + void requestTimerFired(WebCore::Timer<NetworkResourceLoadScheduler>*); + + void servePendingRequestsForHost(HostRecord*, WebCore::ResourceLoadPriority); + + unsigned platformInitializeMaximumHTTPConnectionCountPerHost(); + + typedef HashMap<String, HostRecord*, StringHash> HostMap; + HostMap m_hosts; + + typedef HashMap<ResourceLoadIdentifier, HostRecord*> IdentifierHostMap; + IdentifierHostMap m_identifiers; + + HostRecord* m_nonHTTPProtocolHost; + + unsigned m_suspendPendingRequestsCount; + bool m_isSerialLoadingEnabled; + + WebCore::Timer<NetworkResourceLoadScheduler> m_requestTimer; +}; + +} // namespace WebKit + +#endif // ENABLE(NETWORK_PROCESS) + +#endif // NetworkResourceLoadScheduler_h diff --git a/Source/WebKit2/NetworkProcess/mac/NetworkProcessMainMac.mm b/Source/WebKit2/NetworkProcess/mac/NetworkProcessMainMac.mm index 537126f66..c56f80a2a 100644 --- a/Source/WebKit2/NetworkProcess/mac/NetworkProcessMainMac.mm +++ b/Source/WebKit2/NetworkProcess/mac/NetworkProcessMainMac.mm @@ -33,6 +33,7 @@ #import "NetworkProcess.h" #import <WebCore/RunLoop.h> #import <WebKitSystemInterface.h> +#import <WebSystemInterface.h> #import <mach/mach_error.h> #import <runtime/InitializeThreading.h> #import <servers/bootstrap.h> @@ -78,7 +79,7 @@ int NetworkProcessMain(const CommandLine& commandLine) signal(SIGSEGV, _exit); #endif - + InitWebCoreSystemInterface(); JSC::initializeThreading(); WTF::initializeMainThread(); RunLoop::initializeMainRunLoop(); diff --git a/Source/WebKit2/NetworkProcess/mac/NetworkResourceLoadSchedulerMac.mm b/Source/WebKit2/NetworkProcess/mac/NetworkResourceLoadSchedulerMac.mm new file mode 100644 index 000000000..14b3657b9 --- /dev/null +++ b/Source/WebKit2/NetworkProcess/mac/NetworkResourceLoadSchedulerMac.mm @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2012 Apple Inc. 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. + */ + +#import "config.h" +#import "NetworkResourceLoadScheduler.h" + +#import <WebCore/ResourceRequest.h> +#import <WebCore/ResourceRequestCFNet.h> +#import <WebCore/WebCoreSystemInterface.h> +#import <WebKitSystemInterface.h> + +#if ENABLE(NETWORK_PROCESS) + +using namespace WebCore; + +namespace WebKit { + +unsigned NetworkResourceLoadScheduler::platformInitializeMaximumHTTPConnectionCountPerHost() +{ + wkInitializeMaximumHTTPConnectionCountPerHost = WKInitializeMaximumHTTPConnectionCountPerHost; + wkSetHTTPPipeliningMaximumPriority = WKSetHTTPPipeliningMaximumPriority; + wkSetHTTPPipeliningMinimumFastLanePriority = WKSetHTTPPipeliningMinimumFastLanePriority; + + static const unsigned preferredConnectionCount = 6; + static const unsigned unlimitedConnectionCount = 10000; + + // Always set the connection count per host, even when pipelining. + unsigned maximumHTTPConnectionCountPerHost = wkInitializeMaximumHTTPConnectionCountPerHost(preferredConnectionCount); + + Boolean keyExistsAndHasValidFormat = false; + Boolean prefValue = CFPreferencesGetAppBooleanValue(CFSTR("WebKitEnableHTTPPipelining"), kCFPreferencesCurrentApplication, &keyExistsAndHasValidFormat); + + if (keyExistsAndHasValidFormat) + ResourceRequest::setHTTPPipeliningEnabled(prefValue); + + if (ResourceRequest::httpPipeliningEnabled()) { + wkSetHTTPPipeliningMaximumPriority(toHTTPPipeliningPriority(ResourceLoadPriorityHighest)); + wkSetHTTPPipeliningMinimumFastLanePriority(toHTTPPipeliningPriority(ResourceLoadPriorityMedium)); + + // When pipelining do not rate-limit requests sent from WebCore since CFNetwork handles that. + return unlimitedConnectionCount; + } + + return maximumHTTPConnectionCountPerHost; +} + +} // namespace WebKit + +#endif // ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/NetworkProcess/mac/RemoteNetworkingContext.h b/Source/WebKit2/NetworkProcess/mac/RemoteNetworkingContext.h new file mode 100644 index 000000000..2c1827861 --- /dev/null +++ b/Source/WebKit2/NetworkProcess/mac/RemoteNetworkingContext.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2012 Apple Inc. 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 RemoteNetworkingContext_h +#define RemoteNetworkingContext_h + +#include <WebCore/NetworkingContext.h> + +namespace WebKit { + +class RemoteNetworkingContext : public WebCore::NetworkingContext { +public: + static PassRefPtr<RemoteNetworkingContext> create(bool needsSiteSpecificQuirks, bool localFileContentSniffingEnabled) + { + return adoptRef(new RemoteNetworkingContext(needsSiteSpecificQuirks, localFileContentSniffingEnabled)); + } + virtual ~RemoteNetworkingContext(); + +private: + RemoteNetworkingContext(bool needsSiteSpecificQuirks, bool localFileContentSniffingEnabled); + + virtual bool isValid() const OVERRIDE; + + virtual bool needsSiteSpecificQuirks() const OVERRIDE; + virtual bool localFileContentSniffingEnabled() const OVERRIDE; + virtual NSOperationQueue *scheduledOperationQueue() const OVERRIDE; + virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) const OVERRIDE; + + bool m_needsSiteSpecificQuirks; + bool m_localFileContentSniffingEnabled; +}; + +} + +#endif // RemoteNetworkingContext_h diff --git a/Source/WebKit2/NetworkProcess/mac/RemoteNetworkingContext.mm b/Source/WebKit2/NetworkProcess/mac/RemoteNetworkingContext.mm new file mode 100644 index 000000000..7b29773cf --- /dev/null +++ b/Source/WebKit2/NetworkProcess/mac/RemoteNetworkingContext.mm @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2012 Apple Inc. 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. + */ + +#import "config.h" +#import "RemoteNetworkingContext.h" + +#import "WebCore/ResourceError.h" +#import "WebErrors.h" + +using namespace WebCore; + +namespace WebKit { + +RemoteNetworkingContext::RemoteNetworkingContext(bool needsSiteSpecificQuirks, bool localFileContentSniffingEnabled) + : m_needsSiteSpecificQuirks(needsSiteSpecificQuirks) + , m_localFileContentSniffingEnabled(localFileContentSniffingEnabled) +{ +} + +RemoteNetworkingContext::~RemoteNetworkingContext() +{ +} + +bool RemoteNetworkingContext::isValid() const +{ + return true; +} + +bool RemoteNetworkingContext::needsSiteSpecificQuirks() const +{ + return m_needsSiteSpecificQuirks; +} + +bool RemoteNetworkingContext::localFileContentSniffingEnabled() const +{ + return m_localFileContentSniffingEnabled; +} + +NSOperationQueue *RemoteNetworkingContext::scheduledOperationQueue() const +{ + static NSOperationQueue *queue; + if (!queue) { + queue = [[NSOperationQueue alloc] init]; + // Default concurrent operation count depends on current system workload, but delegate methods are mostly idling in IPC, so we can run as many as needed. + [queue setMaxConcurrentOperationCount:NSIntegerMax]; + } + return queue; +} + +ResourceError RemoteNetworkingContext::blockedError(const ResourceRequest& request) const +{ + return WebKit::blockedError(request); +} + +} diff --git a/Source/WebKit2/Platform/CoreIPC/ArgumentCoder.h b/Source/WebKit2/Platform/CoreIPC/ArgumentCoder.h index bd15f516c..4baab9fe4 100644 --- a/Source/WebKit2/Platform/CoreIPC/ArgumentCoder.h +++ b/Source/WebKit2/Platform/CoreIPC/ArgumentCoder.h @@ -34,7 +34,7 @@ class ArgumentDecoder; class ArgumentEncoder; template<typename T> struct ArgumentCoder { - static void encode(ArgumentEncoder* encoder, const T& t) + static void encode(ArgumentEncoder& encoder, const T& t) { t.encode(encoder); } diff --git a/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.cpp b/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.cpp index 7153c2748..0f25af9c0 100644 --- a/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.cpp +++ b/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.cpp @@ -56,7 +56,8 @@ void ArgumentCoder<CString>::encode(ArgumentEncoder& encoder, const CString& str } uint32_t length = string.length(); - encoder << length << CoreIPC::DataReference(reinterpret_cast<const uint8_t*>(string.data()), length); + encoder << length; + encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(string.data()), length, 1); } bool ArgumentCoder<CString>::decode(ArgumentDecoder* decoder, CString& result) diff --git a/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.h b/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.h index 339cd2d1e..3b184f888 100644 --- a/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.h +++ b/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.h @@ -38,9 +38,9 @@ namespace CoreIPC { // An argument coder works on POD types template<typename T> struct SimpleArgumentCoder { - static void encode(ArgumentEncoder* encoder, const T& t) + static void encode(ArgumentEncoder& encoder, const T& t) { - encoder->encodeFixedLengthData(reinterpret_cast<const uint8_t*>(&t), sizeof(T), __alignof(T)); + encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(&t), sizeof(T), __alignof(T)); } static bool decode(ArgumentDecoder* decoder, T& t) @@ -50,10 +50,9 @@ template<typename T> struct SimpleArgumentCoder { }; template<typename T, typename U> struct ArgumentCoder<std::pair<T, U> > { - static void encode(ArgumentEncoder* encoder, const std::pair<T, U>& pair) + static void encode(ArgumentEncoder& encoder, const std::pair<T, U>& pair) { - encoder->encode(pair.first); - encoder->encode(pair.second); + encoder << pair.first << pair.second; } static bool decode(ArgumentDecoder* decoder, std::pair<T, U>& pair) @@ -73,10 +72,9 @@ template<typename T, typename U> struct ArgumentCoder<std::pair<T, U> > { }; template<typename KeyType, typename ValueType> struct ArgumentCoder<WTF::KeyValuePair<KeyType, ValueType> > { - static void encode(ArgumentEncoder* encoder, const WTF::KeyValuePair<KeyType, ValueType>& pair) + static void encode(ArgumentEncoder& encoder, const WTF::KeyValuePair<KeyType, ValueType>& pair) { - encoder->encode(pair.key); - encoder->encode(pair.value); + encoder << pair.key << pair.value; } static bool decode(ArgumentDecoder* decoder, WTF::KeyValuePair<KeyType, ValueType>& pair) @@ -98,11 +96,11 @@ template<typename KeyType, typename ValueType> struct ArgumentCoder<WTF::KeyValu template<bool fixedSizeElements, typename T> struct VectorArgumentCoder; template<typename T> struct VectorArgumentCoder<false, T> { - static void encode(ArgumentEncoder* encoder, const Vector<T>& vector) + static void encode(ArgumentEncoder& encoder, const Vector<T>& vector) { - encoder->encode(static_cast<uint64_t>(vector.size())); + encoder << static_cast<uint64_t>(vector.size()); for (size_t i = 0; i < vector.size(); ++i) - encoder->encode(vector[i]); + encoder << vector[i]; } static bool decode(ArgumentDecoder* decoder, Vector<T>& vector) @@ -127,10 +125,10 @@ template<typename T> struct VectorArgumentCoder<false, T> { }; template<typename T> struct VectorArgumentCoder<true, T> { - static void encode(ArgumentEncoder* encoder, const Vector<T>& vector) + static void encode(ArgumentEncoder& encoder, const Vector<T>& vector) { - encoder->encode(static_cast<uint64_t>(vector.size())); - encoder->encodeFixedLengthData(reinterpret_cast<const uint8_t*>(vector.data()), vector.size() * sizeof(T), __alignof(T)); + encoder << static_cast<uint64_t>(vector.size()); + encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(vector.data()), vector.size() * sizeof(T), __alignof(T)); } static bool decode(ArgumentDecoder* decoder, Vector<T>& vector) @@ -162,11 +160,11 @@ template<typename T> struct ArgumentCoder<Vector<T> > : VectorArgumentCoder<WTF: template<typename KeyArg, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg> struct ArgumentCoder<HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> > { typedef HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> HashMapType; - static void encode(ArgumentEncoder* encoder, const HashMapType& hashMap) + static void encode(ArgumentEncoder& encoder, const HashMapType& hashMap) { - encoder->encode(static_cast<uint64_t>(hashMap.size())); + encoder << static_cast<uint64_t>(hashMap.size()); for (typename HashMapType::const_iterator it = hashMap.begin(), end = hashMap.end(); it != end; ++it) - encoder->encode(*it); + encoder << *it; } static bool decode(ArgumentDecoder* decoder, HashMapType& hashMap) diff --git a/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.cpp b/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.cpp index 9d7ff3bcb..681858008 100644 --- a/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.cpp +++ b/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.cpp @@ -47,7 +47,7 @@ ArgumentDecoder::ArgumentDecoder(const uint8_t* buffer, size_t bufferSize, Deque ArgumentDecoder::~ArgumentDecoder() { ASSERT(m_allocatedBase); - fastFree(m_allocatedBase); + free(m_allocatedBase); #if !USE(UNIX_DOMAIN_SOCKETS) // FIXME: We need to dispose of the mach ports in cases of failure. #else @@ -70,7 +70,7 @@ void ArgumentDecoder::initialize(const uint8_t* buffer, size_t bufferSize) { // This is the largest primitive type we expect to unpack from the message. const size_t expectedAlignment = sizeof(uint64_t); - m_allocatedBase = static_cast<uint8_t*>(fastMalloc(bufferSize + expectedAlignment)); + m_allocatedBase = static_cast<uint8_t*>(malloc(bufferSize + expectedAlignment)); m_buffer = roundUpToAlignment(m_allocatedBase, expectedAlignment); ASSERT(!(reinterpret_cast<uintptr_t>(m_buffer) % expectedAlignment)); diff --git a/Source/WebKit2/Platform/CoreIPC/Arguments.h b/Source/WebKit2/Platform/CoreIPC/Arguments.h index 1d4c5dc4e..7ed94d8b9 100644 --- a/Source/WebKit2/Platform/CoreIPC/Arguments.h +++ b/Source/WebKit2/Platform/CoreIPC/Arguments.h @@ -35,7 +35,7 @@ namespace CoreIPC { struct Arguments0 { typedef Arguments0 ValueType; - void encode(ArgumentEncoder*) const + void encode(ArgumentEncoder&) const { } @@ -57,9 +57,9 @@ template<typename T1> struct Arguments1 { { } - void encode(ArgumentEncoder* encoder) const + void encode(ArgumentEncoder& encoder) const { - encoder->encode(argument1); + encoder.encode(argument1); } static bool decode(ArgumentDecoder* decoder, Arguments1& result) @@ -84,10 +84,10 @@ template<typename T1, typename T2> struct Arguments2 : Arguments1<T1> { { } - void encode(ArgumentEncoder* encoder) const + void encode(ArgumentEncoder& encoder) const { Arguments1<T1>::encode(encoder); - encoder->encode(argument2); + encoder.encode(argument2); } static bool decode(ArgumentDecoder* decoder, Arguments2& result) @@ -116,10 +116,10 @@ template<typename T1, typename T2, typename T3> struct Arguments3 : Arguments2<T { } - void encode(ArgumentEncoder* encoder) const + void encode(ArgumentEncoder& encoder) const { Arguments2<T1, T2>::encode(encoder); - encoder->encode(argument3); + encoder.encode(argument3); } static bool decode(ArgumentDecoder* decoder, Arguments3& result) @@ -149,10 +149,10 @@ template<typename T1, typename T2, typename T3, typename T4> struct Arguments4 : { } - void encode(ArgumentEncoder* encoder) const + void encode(ArgumentEncoder& encoder) const { Arguments3<T1, T2, T3>::encode(encoder); - encoder->encode(argument4); + encoder.encode(argument4); } static bool decode(ArgumentDecoder* decoder, Arguments4& result) @@ -183,10 +183,10 @@ template<typename T1, typename T2, typename T3, typename T4, typename T5> struct { } - void encode(ArgumentEncoder* encoder) const + void encode(ArgumentEncoder& encoder) const { Arguments4<T1, T2, T3, T4>::encode(encoder); - encoder->encode(argument5); + encoder.encode(argument5); } static bool decode(ArgumentDecoder* decoder, Arguments5& result) @@ -218,10 +218,10 @@ template<typename T1, typename T2, typename T3, typename T4, typename T5, typena { } - void encode(ArgumentEncoder* encoder) const + void encode(ArgumentEncoder& encoder) const { Arguments5<T1, T2, T3, T4, T5>::encode(encoder); - encoder->encode(argument6); + encoder.encode(argument6); } static bool decode(ArgumentDecoder* decoder, Arguments6& result) @@ -254,10 +254,10 @@ template<typename T1, typename T2, typename T3, typename T4, typename T5, typena { } - void encode(ArgumentEncoder* encoder) const + void encode(ArgumentEncoder& encoder) const { Arguments6<T1, T2, T3, T4, T5, T6>::encode(encoder); - encoder->encode(argument7); + encoder.encode(argument7); } static bool decode(ArgumentDecoder* decoder, Arguments7& result) @@ -289,10 +289,10 @@ template<typename T1, typename T2, typename T3, typename T4, typename T5, typena { } - void encode(ArgumentEncoder* encoder) const + void encode(ArgumentEncoder& encoder) const { Arguments7<T1, T2, T3, T4, T5, T6, T7>::encode(encoder); - encoder->encode(argument8); + encoder.encode(argument8); } static bool decode(ArgumentDecoder* decoder, Arguments8& result) @@ -327,11 +327,11 @@ template<typename T1, typename T2, typename T3, typename T4, typename T5, typena { } - void encode(ArgumentEncoder* encoder) const + void encode(ArgumentEncoder& encoder) const { Arguments8<T1, T2, T3, T4, T5, T6, T7, T8>::encode(encoder); - encoder->encode(argument9); - encoder->encode(argument10); + encoder.encode(argument9); + encoder.encode(argument10); } static bool decode(ArgumentDecoder* decoder, Arguments10& result) diff --git a/Source/WebKit2/Platform/CoreIPC/Attachment.cpp b/Source/WebKit2/Platform/CoreIPC/Attachment.cpp index d6952ae46..8f4774858 100644 --- a/Source/WebKit2/Platform/CoreIPC/Attachment.cpp +++ b/Source/WebKit2/Platform/CoreIPC/Attachment.cpp @@ -59,9 +59,9 @@ void Attachment::release() } #endif -void Attachment::encode(ArgumentEncoder* encoder) const +void Attachment::encode(ArgumentEncoder& encoder) const { - encoder->addAttachment(*this); + encoder.addAttachment(*this); } bool Attachment::decode(ArgumentDecoder* decoder, Attachment& attachment) diff --git a/Source/WebKit2/Platform/CoreIPC/Attachment.h b/Source/WebKit2/Platform/CoreIPC/Attachment.h index 05ab90793..dd26b3a76 100644 --- a/Source/WebKit2/Platform/CoreIPC/Attachment.h +++ b/Source/WebKit2/Platform/CoreIPC/Attachment.h @@ -82,7 +82,7 @@ public: void dispose(); #endif - void encode(ArgumentEncoder*) const; + void encode(ArgumentEncoder&) const; static bool decode(ArgumentDecoder*, Attachment&); private: diff --git a/Source/WebKit2/Platform/CoreIPC/Connection.cpp b/Source/WebKit2/Platform/CoreIPC/Connection.cpp index 934583417..f0220a0ff 100644 --- a/Source/WebKit2/Platform/CoreIPC/Connection.cpp +++ b/Source/WebKit2/Platform/CoreIPC/Connection.cpp @@ -304,8 +304,10 @@ bool Connection::sendMessage(MessageID messageID, PassOwnPtr<MessageEncoder> enc || m_inDispatchMessageMarkedDispatchWhenWaitingForSyncReplyCount)) messageID = messageID.messageIDWithAddedFlags(MessageID::DispatchMessageWhenWaitingForSyncReply); - MutexLocker locker(m_outgoingMessagesLock); - m_outgoingMessages.append(OutgoingMessage(messageID, encoder)); + { + MutexLocker locker(m_outgoingMessagesLock); + m_outgoingMessages.append(OutgoingMessage(messageID, encoder)); + } // FIXME: We should add a boolean flag so we don't call this when work has already been scheduled. m_connectionQueue.dispatch(WTF::bind(&Connection::sendOutgoingMessages, this)); @@ -648,8 +650,10 @@ void Connection::didFailToSendSyncMessage() void Connection::enqueueIncomingMessage(IncomingMessage& incomingMessage) { - MutexLocker locker(m_incomingMessagesLock); - m_incomingMessages.append(incomingMessage); + { + MutexLocker locker(m_incomingMessagesLock); + m_incomingMessages.append(incomingMessage); + } m_clientRunLoop->dispatch(WTF::bind(&Connection::dispatchOneMessage, this)); } @@ -688,7 +692,7 @@ void Connection::dispatchMessage(IncomingMessage& message) m_inDispatchMessageMarkedDispatchWhenWaitingForSyncReplyCount--; if (m_didReceiveInvalidMessage && m_client) - m_client->didReceiveInvalidMessage(this, message.messageID()); + m_client->didReceiveInvalidMessage(this, arguments->messageReceiverName(), arguments->messageName()); m_didReceiveInvalidMessage = oldDidReceiveInvalidMessage; } diff --git a/Source/WebKit2/Platform/CoreIPC/Connection.h b/Source/WebKit2/Platform/CoreIPC/Connection.h index 4a7a3a818..0af465036 100644 --- a/Source/WebKit2/Platform/CoreIPC/Connection.h +++ b/Source/WebKit2/Platform/CoreIPC/Connection.h @@ -88,7 +88,7 @@ public: class Client : public MessageReceiver { public: virtual void didClose(Connection*) = 0; - virtual void didReceiveInvalidMessage(Connection*, MessageID) = 0; + virtual void didReceiveInvalidMessage(Connection*, StringReference messageReceiverName, StringReference messageName) = 0; #if PLATFORM(WIN) virtual Vector<HWND> windowsToReceiveSentMessagesWhileWaitingForSyncReply() = 0; @@ -190,11 +190,6 @@ public: PassOwnPtr<MessageDecoder> sendSyncMessage(MessageID, uint64_t syncRequestID, PassOwnPtr<MessageEncoder>, double timeout, unsigned syncSendFlags = 0); bool sendSyncReply(PassOwnPtr<MessageEncoder>); - // FIXME: These variants of send, sendSync and waitFor are all deprecated. - // All clients should move to the overloads that take a message type. - template<typename E, typename T> bool deprecatedSend(E messageID, uint64_t destinationID, const T& arguments); - template<typename E, typename T, typename U> bool deprecatedSendSync(E messageID, uint64_t destinationID, const T& arguments, const U& reply, double timeout = NoTimeout); - void wakeUpRunLoop(); void incrementDispatchMessageMarkedDispatchWhenWaitingForSyncReplyCount() { ++m_inDispatchMessageMarkedDispatchWhenWaitingForSyncReplyCount; } @@ -402,6 +397,8 @@ private: template<typename T> bool Connection::send(const T& message, uint64_t destinationID, unsigned messageSendFlags) { + COMPILE_ASSERT(!T::isSync, AsyncMessageExpected); + OwnPtr<MessageEncoder> encoder = MessageEncoder::create(T::receiverName(), T::name(), destinationID); encoder->encode(message); @@ -410,6 +407,8 @@ template<typename T> bool Connection::send(const T& message, uint64_t destinatio template<typename T> bool Connection::sendSync(const T& message, const typename T::Reply& reply, uint64_t destinationID, double timeout, unsigned syncSendFlags) { + COMPILE_ASSERT(T::isSync, SyncMessageExpected); + uint64_t syncRequestID = 0; OwnPtr<MessageEncoder> encoder = createSyncMessageEncoder(T::receiverName(), T::name(), destinationID, syncRequestID); @@ -436,35 +435,6 @@ template<typename T> bool Connection::waitForAndDispatchImmediately(uint64_t des return true; } -// These three member functions are all deprecated. - -template<typename E, typename T, typename U> -inline bool Connection::deprecatedSendSync(E messageID, uint64_t destinationID, const T& arguments, const U& reply, double timeout) -{ - uint64_t syncRequestID = 0; - OwnPtr<MessageEncoder> encoder = createSyncMessageEncoder(CoreIPC::MessageKindTraits<E>::messageReceiverName(), "", destinationID, syncRequestID); - - // Encode the input arguments. - encoder->encode(arguments); - - // Now send the message and wait for a reply. - OwnPtr<MessageDecoder> replyDecoder = sendSyncMessage(MessageID(messageID), syncRequestID, encoder.release(), timeout); - if (!replyDecoder) - return false; - - // Decode the reply. - return replyDecoder->decode(const_cast<U&>(reply)); -} - -template<typename E, typename T> -bool Connection::deprecatedSend(E messageID, uint64_t destinationID, const T& arguments) -{ - OwnPtr<MessageEncoder> encoder = MessageEncoder::create(CoreIPC::MessageKindTraits<E>::messageReceiverName(), "", destinationID); - encoder->encode(arguments); - - return sendMessage(MessageID(messageID), encoder.release()); -} - } // namespace CoreIPC #endif // Connection_h diff --git a/Source/WebKit2/Platform/CoreIPC/DataReference.cpp b/Source/WebKit2/Platform/CoreIPC/DataReference.cpp index 0798c3e0e..a1449862c 100644 --- a/Source/WebKit2/Platform/CoreIPC/DataReference.cpp +++ b/Source/WebKit2/Platform/CoreIPC/DataReference.cpp @@ -31,9 +31,9 @@ namespace CoreIPC { -void DataReference::encode(ArgumentEncoder* encoder) const +void DataReference::encode(ArgumentEncoder& encoder) const { - encoder->encodeVariableLengthByteArray(*this); + encoder.encodeVariableLengthByteArray(*this); } bool DataReference::decode(ArgumentDecoder* decoder, DataReference& dataReference) diff --git a/Source/WebKit2/Platform/CoreIPC/DataReference.h b/Source/WebKit2/Platform/CoreIPC/DataReference.h index 5ed0443c3..a0ce8c319 100644 --- a/Source/WebKit2/Platform/CoreIPC/DataReference.h +++ b/Source/WebKit2/Platform/CoreIPC/DataReference.h @@ -72,7 +72,7 @@ public: return result; } - void encode(ArgumentEncoder* encoder) const; + void encode(ArgumentEncoder&) const; static bool decode(ArgumentDecoder* decoder, DataReference& dataReference); private: diff --git a/Source/WebKit2/Platform/CoreIPC/HandleMessage.h b/Source/WebKit2/Platform/CoreIPC/HandleMessage.h index 77401c12a..f3934c4d5 100644 --- a/Source/WebKit2/Platform/CoreIPC/HandleMessage.h +++ b/Source/WebKit2/Platform/CoreIPC/HandleMessage.h @@ -331,7 +331,7 @@ void handleMessage(MessageDecoder& decoder, MessageEncoder& replyEncoder, C* obj typename T::Reply::ValueType replyArguments; callMemberFunction(arguments, replyArguments, object, function); - replyEncoder.encode(replyArguments); + replyEncoder << replyArguments; } template<typename T, typename C, typename MF> @@ -361,7 +361,7 @@ void handleMessageVariadic(MessageDecoder& decoder, MessageEncoder& replyEncoder typename T::Reply::ValueType replyArguments; callMemberFunction(arguments, decoder, replyArguments, object, function); - replyEncoder.encode(replyArguments); + replyEncoder << replyArguments; } template<typename T, typename C, typename MF> diff --git a/Source/WebKit2/Platform/CoreIPC/MessageID.h b/Source/WebKit2/Platform/CoreIPC/MessageID.h index a89e64f5c..dd3fcb0c9 100644 --- a/Source/WebKit2/Platform/CoreIPC/MessageID.h +++ b/Source/WebKit2/Platform/CoreIPC/MessageID.h @@ -115,6 +115,9 @@ enum MessageClass { // Messages sent by the web process to the network process. MessageClassNetworkConnectionToWebProcess, + // Messages sent by the network process to a web process. + MessageClassNetworkProcessConnection, + #if ENABLE(SHARED_WORKER_PROCESS) // Messages sent by the UI process to the shared worker process. MessageClassSharedWorkerProcess, diff --git a/Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.cpp b/Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.cpp index f123b3dda..06dfbc74e 100644 --- a/Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.cpp +++ b/Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.cpp @@ -45,14 +45,44 @@ void MessageReceiverMap::addMessageReceiver(StringReference messageReceiverName, m_globalMessageReceivers.set(messageReceiverName, messageReceiver); } +void MessageReceiverMap::addMessageReceiver(StringReference messageReceiverName, uint64_t destinationID, MessageReceiver* messageReceiver) +{ + ASSERT(!m_messageReceivers.contains(std::make_pair(messageReceiverName, destinationID))); + ASSERT(!m_globalMessageReceivers.contains(messageReceiverName)); + + m_messageReceivers.set(std::make_pair(messageReceiverName, destinationID), messageReceiver); +} + +void MessageReceiverMap::removeMessageReceiver(StringReference messageReceiverName) +{ + ASSERT(m_globalMessageReceivers.contains(messageReceiverName)); + + m_globalMessageReceivers.remove(messageReceiverName); +} + +void MessageReceiverMap::removeMessageReceiver(StringReference messageReceiverName, uint64_t destinationID) +{ + ASSERT(m_messageReceivers.contains(std::make_pair(messageReceiverName, destinationID))); + + m_messageReceivers.remove(std::make_pair(messageReceiverName, destinationID)); +} + void MessageReceiverMap::invalidate() { m_globalMessageReceivers.clear(); + m_messageReceivers.clear(); } bool MessageReceiverMap::dispatchMessage(Connection* connection, MessageID messageID, MessageDecoder& decoder) { if (MessageReceiver* messageReceiver = m_globalMessageReceivers.get(decoder.messageReceiverName())) { + ASSERT(!decoder.destinationID()); + + messageReceiver->didReceiveMessage(connection, messageID, decoder); + return true; + } + + if (MessageReceiver* messageReceiver = m_messageReceivers.get(std::make_pair(decoder.messageReceiverName(), decoder.destinationID()))) { messageReceiver->didReceiveMessage(connection, messageID, decoder); return true; } @@ -63,6 +93,13 @@ bool MessageReceiverMap::dispatchMessage(Connection* connection, MessageID messa bool MessageReceiverMap::dispatchSyncMessage(Connection* connection, MessageID messageID, MessageDecoder& decoder, OwnPtr<MessageEncoder>& replyEncoder) { if (MessageReceiver* messageReceiver = m_globalMessageReceivers.get(decoder.messageReceiverName())) { + ASSERT(!decoder.destinationID()); + + messageReceiver->didReceiveSyncMessage(connection, messageID, decoder, replyEncoder); + return true; + } + + if (MessageReceiver* messageReceiver = m_messageReceivers.get(std::make_pair(decoder.messageReceiverName(), decoder.destinationID()))) { messageReceiver->didReceiveSyncMessage(connection, messageID, decoder, replyEncoder); return true; } diff --git a/Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.h b/Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.h index 3844ef1b5..0be40ebe9 100644 --- a/Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.h +++ b/Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.h @@ -44,6 +44,10 @@ public: ~MessageReceiverMap(); void addMessageReceiver(StringReference messageReceiverName, MessageReceiver*); + void addMessageReceiver(StringReference messageReceiverName, uint64_t destinationID, MessageReceiver*); + + void removeMessageReceiver(StringReference messageReceiverName); + void removeMessageReceiver(StringReference messageReceiverName, uint64_t destinationID); void invalidate(); @@ -53,6 +57,8 @@ public: private: // Message receivers that don't require a destination ID. HashMap<StringReference, MessageReceiver*> m_globalMessageReceivers; + + HashMap<std::pair<StringReference, uint64_t>, MessageReceiver*> m_messageReceivers; }; }; diff --git a/Source/WebKit2/Platform/CoreIPC/MessageSender.h b/Source/WebKit2/Platform/CoreIPC/MessageSender.h index d806d2b73..b47c8193f 100644 --- a/Source/WebKit2/Platform/CoreIPC/MessageSender.h +++ b/Source/WebKit2/Platform/CoreIPC/MessageSender.h @@ -40,6 +40,7 @@ public: template<typename U> bool send(const U& message, uint64_t destinationID) { + COMPILE_ASSERT(!U::isSync, AsyncMessageExpected); OwnPtr<MessageEncoder> encoder = MessageEncoder::create(U::receiverName(), U::name(), destinationID); encoder->encode(message); @@ -56,6 +57,7 @@ public: template<typename U> bool sendSync(const U& message, const typename U::Reply& reply, double timeout = Connection::NoTimeout) { + COMPILE_ASSERT(U::isSync, SyncMessageExpected); return sendSync(message, reply, static_cast<T*>(this)->destinationID(), timeout); } diff --git a/Source/WebKit2/Platform/CoreIPC/StringReference.cpp b/Source/WebKit2/Platform/CoreIPC/StringReference.cpp index 56e8c1a37..d466f3fbd 100644 --- a/Source/WebKit2/Platform/CoreIPC/StringReference.cpp +++ b/Source/WebKit2/Platform/CoreIPC/StringReference.cpp @@ -30,18 +30,24 @@ #include "ArgumentEncoder.h" #include "DataReference.h" #include <wtf/StringHasher.h> +#include <wtf/text/CString.h> namespace CoreIPC { -void StringReference::encode(ArgumentEncoder* encoder) const +CString StringReference::toString() const { - encoder->encodeVariableLengthByteArray(DataReference(reinterpret_cast<const uint8_t*>(m_data), m_size)); + return WTF::CString(m_data, m_size); +} + +void StringReference::encode(ArgumentEncoder& encoder) const +{ + encoder << DataReference(reinterpret_cast<const uint8_t*>(m_data), m_size); } bool StringReference::decode(ArgumentDecoder* decoder, StringReference& result) { DataReference dataReference; - if (!decoder->decodeVariableLengthByteArray(dataReference)) + if (!decoder->decode(dataReference)) return false; result.m_data = reinterpret_cast<const char*>(dataReference.data()); diff --git a/Source/WebKit2/Platform/CoreIPC/StringReference.h b/Source/WebKit2/Platform/CoreIPC/StringReference.h index ed482e53f..47235c1c9 100644 --- a/Source/WebKit2/Platform/CoreIPC/StringReference.h +++ b/Source/WebKit2/Platform/CoreIPC/StringReference.h @@ -26,6 +26,7 @@ #ifndef StringReference_h #define StringReference_h +#include <wtf/Forward.h> #include <wtf/HashTraits.h> namespace CoreIPC { @@ -59,12 +60,14 @@ public: size_t size() const { return m_size; } const char* data() const { return m_data; } + CString toString() const; + friend bool operator==(const StringReference& a, const StringReference& b) { return a.m_size == b.m_size && !memcmp(a.m_data, b.m_data, a.m_size); } - void encode(ArgumentEncoder*) const; + void encode(ArgumentEncoder&) const; static bool decode(ArgumentDecoder*, StringReference&); struct Hash { diff --git a/Source/WebKit2/Platform/CoreIPC/mac/MachPort.h b/Source/WebKit2/Platform/CoreIPC/mac/MachPort.h index ecce16e74..fa4474e05 100644 --- a/Source/WebKit2/Platform/CoreIPC/mac/MachPort.h +++ b/Source/WebKit2/Platform/CoreIPC/mac/MachPort.h @@ -46,9 +46,9 @@ public: { } - void encode(ArgumentEncoder* encoder) const + void encode(ArgumentEncoder& encoder) const { - encoder->encode(Attachment(m_port, m_disposition)); + encoder << Attachment(m_port, m_disposition); } static bool decode(ArgumentDecoder* decoder, MachPort& p) diff --git a/Source/WebKit2/Platform/Logging.cpp b/Source/WebKit2/Platform/Logging.cpp index df98e724e..6cd04b99a 100644 --- a/Source/WebKit2/Platform/Logging.cpp +++ b/Source/WebKit2/Platform/Logging.cpp @@ -38,6 +38,7 @@ WTFLogChannel LogView = { 0x00000008, "WebKit2LogLevel", WTFLogChannelOf WTFLogChannel LogIconDatabase = { 0x00000010, "WebKit2LogLevel", WTFLogChannelOff }; WTFLogChannel LogKeyHandling = { 0x00000020, "WebKit2LogLevel", WTFLogChannelOff }; WTFLogChannel LogPlugins = { 0x00000040, "WebKit2LogLevel", WTFLogChannelOff }; +WTFLogChannel LogNetwork = { 0x00000080, "WebKit2LogLevel", WTFLogChannelOff }; #if !PLATFORM(MAC) && !PLATFORM(GTK) && !PLATFORM(QT) && !PLATFORM(EFL) void initializeLogChannel(WTFLogChannel* channel) @@ -73,6 +74,9 @@ WTFLogChannel* getChannelFromName(const String& channelName) if (equalIgnoringCase(channelName, String("Plugins"))) return &LogPlugins; + if (equalIgnoringCase(channelName, String("Network"))) + return &LogNetwork; + return 0; } #endif diff --git a/Source/WebKit2/Platform/Logging.h b/Source/WebKit2/Platform/Logging.h index 603686f3d..ca998c2b8 100644 --- a/Source/WebKit2/Platform/Logging.h +++ b/Source/WebKit2/Platform/Logging.h @@ -44,6 +44,7 @@ extern WTFLogChannel LogPlugins; extern WTFLogChannel LogSessionState; extern WTFLogChannel LogTextInput; extern WTFLogChannel LogView; +extern WTFLogChannel LogNetwork; void initializeLogChannel(WTFLogChannel*); void initializeLogChannelsIfNecessary(void); diff --git a/Source/WebKit2/Platform/SharedMemory.h b/Source/WebKit2/Platform/SharedMemory.h index 0d56bacc6..46d032a51 100644 --- a/Source/WebKit2/Platform/SharedMemory.h +++ b/Source/WebKit2/Platform/SharedMemory.h @@ -57,7 +57,7 @@ public: bool isNull() const; - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, Handle&); #if USE(UNIX_DOMAIN_SOCKETS) diff --git a/Source/WebKit2/Platform/WorkQueue.h b/Source/WebKit2/Platform/WorkQueue.h index 6a5c756b3..b7813481d 100644 --- a/Source/WebKit2/Platform/WorkQueue.h +++ b/Source/WebKit2/Platform/WorkQueue.h @@ -206,6 +206,8 @@ private: int m_maxFileDescriptor; int m_readFromPipeDescriptor; int m_writeToPipeDescriptor; + Mutex m_writeToPipeDescriptorLock; + bool m_threadLoop; Vector<Function<void()> > m_workItemQueue; diff --git a/Source/WebKit2/Platform/efl/WorkQueueEfl.cpp b/Source/WebKit2/Platform/efl/WorkQueueEfl.cpp index 6c505b41c..06daf68b8 100644 --- a/Source/WebKit2/Platform/efl/WorkQueueEfl.cpp +++ b/Source/WebKit2/Platform/efl/WorkQueueEfl.cpp @@ -68,18 +68,20 @@ void WorkQueue::platformInvalidate() void WorkQueue::performWork() { - m_workItemQueueLock.lock(); - - while (!m_workItemQueue.isEmpty()) { + while (true) { Vector<Function<void()> > workItemQueue; - m_workItemQueue.swap(workItemQueue); - m_workItemQueueLock.unlock(); + { + MutexLocker locker(m_workItemQueueLock); + if (m_workItemQueue.isEmpty()) + return; + + m_workItemQueue.swap(workItemQueue); + } + for (size_t i = 0; i < workItemQueue.size(); ++i) workItemQueue[i](); - m_workItemQueueLock.lock(); } - m_workItemQueueLock.unlock(); } void WorkQueue::performFileDescriptorWork() @@ -125,6 +127,7 @@ void WorkQueue::insertTimerWorkItem(PassOwnPtr<TimerWorkItem> item) size_t position = 0; + MutexLocker locker(m_timerWorkItemsLock); // m_timerWorkItems should be ordered by expire time. for (; position < m_timerWorkItems.size(); ++position) if (item->expireTime() < m_timerWorkItems[position]->expireTime()) @@ -135,19 +138,19 @@ void WorkQueue::insertTimerWorkItem(PassOwnPtr<TimerWorkItem> item) void WorkQueue::performTimerWork() { - // Protects m_timerWorkItems. - m_timerWorkItemsLock.lock(); + Vector<OwnPtr<TimerWorkItem> > timerWorkItems; - if (m_timerWorkItems.isEmpty()) { - m_timerWorkItemsLock.unlock(); - return; + { + // Protects m_timerWorkItems. + MutexLocker locker(m_timerWorkItemsLock); + if (m_timerWorkItems.isEmpty()) + return; + + // Copies all the timer work items in m_timerWorkItems to local vector. + m_timerWorkItems.swap(timerWorkItems); } double current = currentTime(); - Vector<OwnPtr<TimerWorkItem> > timerWorkItems; - - // Copies all the timer work items in m_timerWorkItems to local vector. - m_timerWorkItems.swap(timerWorkItems); for (size_t i = 0; i < timerWorkItems.size(); ++i) { if (!timerWorkItems[i]->expired(current)) { @@ -158,18 +161,13 @@ void WorkQueue::performTimerWork() } // If a timer work item expired, dispatch the function of the work item. - // Before dispatching, m_timerWorkItemsLock should unlock for preventing deadlock, - // because it can be accessed inside the function of the timer work item dispatched. - m_timerWorkItemsLock.unlock(); timerWorkItems[i]->dispatch(); - m_timerWorkItemsLock.lock(); } - - m_timerWorkItemsLock.unlock(); } void WorkQueue::sendMessageToThread(const char* message) { + MutexLocker locker(m_writeToPipeDescriptorLock); if (write(m_writeToPipeDescriptor, message, threadMessageSize) == -1) LOG_ERROR("Failed to wake up WorkQueue Thread"); } @@ -212,8 +210,11 @@ void WorkQueue::unregisterSocketEventHandler(int fileDescriptor) void WorkQueue::dispatch(const Function<void()>& function) { - MutexLocker locker(m_workItemQueueLock); - m_workItemQueue.append(function); + { + MutexLocker locker(m_workItemQueueLock); + m_workItemQueue.append(function); + } + sendMessageToThread(wakupThreadMessage); } @@ -222,7 +223,6 @@ void WorkQueue::dispatchAfterDelay(const Function<void()>& function, double dela if (delay < 0) return; - MutexLocker locker(m_timerWorkItemsLock); OwnPtr<TimerWorkItem> timerWorkItem = TimerWorkItem::create(function, currentTime() + delay); if (!timerWorkItem) return; diff --git a/Source/WebKit2/Platform/gtk/SharedMemoryGtk.cpp b/Source/WebKit2/Platform/gtk/SharedMemoryGtk.cpp index faccf103e..9354306c2 100644 --- a/Source/WebKit2/Platform/gtk/SharedMemoryGtk.cpp +++ b/Source/WebKit2/Platform/gtk/SharedMemoryGtk.cpp @@ -41,7 +41,7 @@ SharedMemory::Handle::~Handle() notImplemented(); } -void SharedMemory::Handle::encode(CoreIPC::ArgumentEncoder* encoder) const +void SharedMemory::Handle::encode(CoreIPC::ArgumentEncoder& encoder) const { notImplemented(); } diff --git a/Source/WebKit2/Platform/mac/ModuleMac.mm b/Source/WebKit2/Platform/mac/ModuleMac.mm index 4a35b6a2d..368753151 100644 --- a/Source/WebKit2/Platform/mac/ModuleMac.mm +++ b/Source/WebKit2/Platform/mac/ModuleMac.mm @@ -30,12 +30,11 @@ namespace WebKit { bool Module::load() { - RetainPtr<CFStringRef> bundlePath(AdoptCF, m_path.createCFString()); - RetainPtr<CFURLRef> bundleURL(AdoptCF, CFURLCreateWithFileSystemPath(kCFAllocatorDefault, bundlePath.get(), kCFURLPOSIXPathStyle, FALSE)); + RetainPtr<CFURLRef> bundleURL = adoptCF(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, m_path.createCFString().get(), kCFURLPOSIXPathStyle, FALSE)); if (!bundleURL) return false; - RetainPtr<CFBundleRef> bundle(AdoptCF, CFBundleCreate(kCFAllocatorDefault, bundleURL.get())); + RetainPtr<CFBundleRef> bundle = adoptCF(CFBundleCreate(kCFAllocatorDefault, bundleURL.get())); if (!bundle) return false; diff --git a/Source/WebKit2/Platform/mac/SharedMemoryMac.cpp b/Source/WebKit2/Platform/mac/SharedMemoryMac.cpp index 4019a8d85..62ed297f4 100644 --- a/Source/WebKit2/Platform/mac/SharedMemoryMac.cpp +++ b/Source/WebKit2/Platform/mac/SharedMemoryMac.cpp @@ -55,10 +55,10 @@ bool SharedMemory::Handle::isNull() const return !m_port; } -void SharedMemory::Handle::encode(CoreIPC::ArgumentEncoder* encoder) const +void SharedMemory::Handle::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(static_cast<uint64_t>(m_size)); - encoder->encode(CoreIPC::MachPort(m_port, MACH_MSG_TYPE_MOVE_SEND)); + encoder << static_cast<uint64_t>(m_size); + encoder << CoreIPC::MachPort(m_port, MACH_MSG_TYPE_MOVE_SEND); m_port = MACH_PORT_NULL; } diff --git a/Source/WebKit2/Platform/unix/SharedMemoryUnix.cpp b/Source/WebKit2/Platform/unix/SharedMemoryUnix.cpp index c432d3301..f565b76ec 100644 --- a/Source/WebKit2/Platform/unix/SharedMemoryUnix.cpp +++ b/Source/WebKit2/Platform/unix/SharedMemoryUnix.cpp @@ -63,9 +63,9 @@ bool SharedMemory::Handle::isNull() const return m_fileDescriptor == -1; } -void SharedMemory::Handle::encode(CoreIPC::ArgumentEncoder* encoder) const +void SharedMemory::Handle::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(releaseToAttachment()); + encoder.encode(releaseToAttachment()); } bool SharedMemory::Handle::decode(CoreIPC::ArgumentDecoder* decoder, Handle& handle) diff --git a/Source/WebKit2/Platform/win/SharedMemoryWin.cpp b/Source/WebKit2/Platform/win/SharedMemoryWin.cpp index 2aa28f8c0..f59dba504 100644 --- a/Source/WebKit2/Platform/win/SharedMemoryWin.cpp +++ b/Source/WebKit2/Platform/win/SharedMemoryWin.cpp @@ -51,18 +51,18 @@ bool SharedMemory::Handle::isNull() const return !m_handle; } -void SharedMemory::Handle::encode(CoreIPC::ArgumentEncoder* encoder) const +void SharedMemory::Handle::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(static_cast<uint64_t>(m_size)); + encoder.encode(static_cast<uint64_t>(m_size)); // Hand off ownership of our HANDLE to the receiving process. It will close it for us. // FIXME: If the receiving process crashes before it receives the memory, the memory will be // leaked. See <http://webkit.org/b/47502>. - encoder->encode(reinterpret_cast<uint64_t>(m_handle)); + encoder.encode(reinterpret_cast<uint64_t>(m_handle)); m_handle = 0; // Send along our PID so that the receiving process can duplicate the HANDLE for its own use. - encoder->encode(static_cast<uint32_t>(::GetCurrentProcessId())); + encoder.encode(static_cast<uint32_t>(::GetCurrentProcessId())); } static bool getDuplicatedHandle(HANDLE sourceHandle, DWORD sourcePID, HANDLE& duplicatedHandle) diff --git a/Source/WebKit2/PlatformEfl.cmake b/Source/WebKit2/PlatformEfl.cmake index 3b062ae11..0d74a4494 100644 --- a/Source/WebKit2/PlatformEfl.cmake +++ b/Source/WebKit2/PlatformEfl.cmake @@ -41,46 +41,59 @@ LIST(APPEND WebKit2_SOURCES UIProcess/API/C/soup/WKContextSoup.cpp UIProcess/API/C/soup/WKSoupRequestManager.cpp - UIProcess/API/efl/BatteryProvider.cpp - UIProcess/API/efl/PageViewportControllerClientEfl.cpp - UIProcess/API/efl/NetworkInfoProvider.cpp - UIProcess/API/efl/PageClientImpl.cpp - UIProcess/API/efl/VibrationProvider.cpp - UIProcess/API/efl/WebKitTextChecker.cpp + UIProcess/API/efl/EwkViewImpl.cpp + UIProcess/API/efl/EvasGLContext.cpp + UIProcess/API/efl/EvasGLSurface.cpp + UIProcess/API/efl/ewk_auth_request.cpp UIProcess/API/efl/ewk_back_forward_list.cpp UIProcess/API/efl/ewk_back_forward_list_item.cpp + UIProcess/API/efl/ewk_color_picker.cpp UIProcess/API/efl/ewk_context.cpp - UIProcess/API/efl/ewk_context_download_client.cpp - UIProcess/API/efl/ewk_context_history_client.cpp - UIProcess/API/efl/ewk_context_request_manager_client.cpp UIProcess/API/efl/ewk_cookie_manager.cpp + UIProcess/API/efl/ewk_database_manager.cpp UIProcess/API/efl/ewk_download_job.cpp UIProcess/API/efl/ewk_error.cpp UIProcess/API/efl/ewk_favicon_database.cpp + UIProcess/API/efl/ewk_file_chooser_request.cpp UIProcess/API/efl/ewk_form_submission_request.cpp UIProcess/API/efl/ewk_intent.cpp UIProcess/API/efl/ewk_intent_service.cpp UIProcess/API/efl/ewk_main.cpp UIProcess/API/efl/ewk_navigation_data.cpp UIProcess/API/efl/ewk_navigation_policy_decision.cpp + UIProcess/API/efl/ewk_object.cpp + UIProcess/API/efl/ewk_popup_menu.cpp UIProcess/API/efl/ewk_popup_menu_item.cpp UIProcess/API/efl/ewk_resource.cpp + UIProcess/API/efl/ewk_security_origin.cpp UIProcess/API/efl/ewk_settings.cpp + UIProcess/API/efl/ewk_storage_manager.cpp UIProcess/API/efl/ewk_text_checker.cpp UIProcess/API/efl/ewk_url_request.cpp UIProcess/API/efl/ewk_url_response.cpp UIProcess/API/efl/ewk_url_scheme_request.cpp UIProcess/API/efl/ewk_view.cpp - UIProcess/API/efl/ewk_view_find_client.cpp - UIProcess/API/efl/ewk_view_form_client.cpp - UIProcess/API/efl/ewk_view_policy_client.cpp - UIProcess/API/efl/ewk_view_ui_client.cpp UIProcess/cairo/BackingStoreCairo.cpp + UIProcess/efl/BatteryProvider.cpp + UIProcess/efl/ContextHistoryClientEfl.cpp + UIProcess/efl/DownloadManagerEfl.cpp + UIProcess/efl/FindClientEfl.cpp + UIProcess/efl/FormClientEfl.cpp + UIProcess/efl/InputMethodContextEfl.cpp + UIProcess/efl/NetworkInfoProvider.cpp + UIProcess/efl/PageClientBase.cpp + UIProcess/efl/PageClientLegacyImpl.cpp + UIProcess/efl/PageClientDefaultImpl.cpp UIProcess/efl/PageLoadClientEfl.cpp + UIProcess/efl/PagePolicyClientEfl.cpp + UIProcess/efl/PageUIClientEfl.cpp + UIProcess/efl/PageViewportControllerClientEfl.cpp + UIProcess/efl/RequestManagerClientEfl.cpp UIProcess/efl/ResourceLoadClientEfl.cpp UIProcess/efl/TextCheckerEfl.cpp + UIProcess/efl/VibrationProvider.cpp UIProcess/efl/WebContextEfl.cpp UIProcess/efl/WebFullScreenManagerProxyEfl.cpp UIProcess/efl/WebInspectorProxyEfl.cpp @@ -192,8 +205,8 @@ LIST(APPEND WebKit2_LIBRARIES ${OPENGL_LIBRARIES} ${SQLITE_LIBRARIES} ${FONTCONFIG_LIBRARIES} - ${PNG_LIBRARY} - ${JPEG_LIBRARY} + ${PNG_LIBRARIES} + ${JPEG_LIBRARIES} ${CMAKE_DL_LIBS} ${GLIB_LIBRARIES} ${GLIB_GIO_LIBRARIES} @@ -207,7 +220,7 @@ LIST (APPEND WebProcess_SOURCES LIST (APPEND WebProcess_LIBRARIES ${CAIRO_LIBRARIES} - ${ECORE_X_LIBRARIES} + ${ECORE_IMF_LIBRARIES} ${EDJE_LIBRARIES} ${EFLDEPS_LIBRARIES} ${EVAS_LIBRARIES} @@ -217,6 +230,12 @@ LIST (APPEND WebProcess_LIBRARIES ${SQLITE_LIBRARIES} ) +IF (ENABLE_ECORE_X) + LIST(APPEND WebProcess_LIBRARIES + ${ECORE_X_LIBRARIES} + ${X11_Xext_LIB}) +ENDIF () + ADD_CUSTOM_TARGET(forwarding-headerEfl COMMAND ${PERL_EXECUTABLE} ${WEBKIT2_DIR}/Scripts/generate-forwarding-headers.pl ${WEBKIT2_DIR} ${DERIVED_SOURCES_WEBKIT2_DIR}/include efl ) @@ -230,22 +249,30 @@ SET(ForwardingNetworkHeaders_NAME forwarding-headerSoup) CONFIGURE_FILE(efl/ewebkit2.pc.in ${CMAKE_BINARY_DIR}/WebKit2/efl/ewebkit2.pc @ONLY) SET (EWebKit2_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/EWebKit2.h" + "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_auth_request.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_back_forward_list.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_back_forward_list_item.h" + "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_color_picker.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_database_manager.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_download_job.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_error.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_favicon_database.h" + "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_file_chooser_request.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_form_submission_request.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_main.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_navigation_data.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_navigation_policy_decision.h" + "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_object.h" + "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_popup_menu.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_popup_menu_item.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_resource.h" + "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_security_origin.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_settings.h" + "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_storage_manager.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_text_checker.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_touch.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_url_request.h" @@ -330,16 +357,23 @@ TARGET_LINK_LIBRARIES(ewk2UnitTestUtils ${EWK2UnitTests_LIBRARIES}) # The "ewk" on the test name needs to be suffixed with "2", otherwise it # will clash with tests from the WebKit 1 test suite. SET(EWK2UnitTests_BINARIES + test_ewk2_auth_request test_ewk2_back_forward_list + test_ewk2_color_picker test_ewk2_context test_ewk2_context_history_callbacks test_ewk2_cookie_manager + test_ewk2_database_manager test_ewk2_download_job test_ewk2_eina_shared_string test_ewk2_favicon_database - test_ewk2_refptr_evas_object + test_ewk2_file_chooser_request test_ewk2_intents + test_ewk2_object + test_ewk2_popup_menu + test_ewk2_refptr_evas_object test_ewk2_settings + test_ewk2_storage_manager test_ewk2_text_checker test_ewk2_view ) diff --git a/Source/WebKit2/PluginProcess/PluginCreationParameters.cpp b/Source/WebKit2/PluginProcess/PluginCreationParameters.cpp index bc2e9929c..15650fae6 100644 --- a/Source/WebKit2/PluginProcess/PluginCreationParameters.cpp +++ b/Source/WebKit2/PluginProcess/PluginCreationParameters.cpp @@ -45,19 +45,19 @@ PluginCreationParameters::PluginCreationParameters() { } -void PluginCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) const +void PluginCreationParameters::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(pluginInstanceID); - encoder->encode(windowNPObjectID); - encoder->encode(parameters); - encoder->encode(userAgent); - encoder->encode(contentsScaleFactor); - encoder->encode(isPrivateBrowsingEnabled); - encoder->encode(asynchronousCreationIncomplete); - encoder->encode(artificialPluginInitializationDelayEnabled); + encoder << pluginInstanceID; + encoder << windowNPObjectID; + encoder << parameters; + encoder << userAgent; + encoder << contentsScaleFactor; + encoder << isPrivateBrowsingEnabled; + encoder << asynchronousCreationIncomplete; + encoder << artificialPluginInitializationDelayEnabled; #if USE(ACCELERATED_COMPOSITING) - encoder->encode(isAcceleratedCompositingEnabled); + encoder << isAcceleratedCompositingEnabled; #endif } diff --git a/Source/WebKit2/PluginProcess/PluginCreationParameters.h b/Source/WebKit2/PluginProcess/PluginCreationParameters.h index 6f05bdaab..1387f140e 100644 --- a/Source/WebKit2/PluginProcess/PluginCreationParameters.h +++ b/Source/WebKit2/PluginProcess/PluginCreationParameters.h @@ -40,7 +40,7 @@ namespace WebKit { struct PluginCreationParameters { PluginCreationParameters(); - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, PluginCreationParameters&); // The unique ID of this plug-in instance. diff --git a/Source/WebKit2/PluginProcess/PluginProcess.cpp b/Source/WebKit2/PluginProcess/PluginProcess.cpp index 03c6f00b9..7b45c09fb 100644 --- a/Source/WebKit2/PluginProcess/PluginProcess.cpp +++ b/Source/WebKit2/PluginProcess/PluginProcess.cpp @@ -146,7 +146,7 @@ void PluginProcess::didClose(CoreIPC::Connection*) RunLoop::current()->stop(); } -void PluginProcess::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID) +void PluginProcess::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference, CoreIPC::StringReference) { } diff --git a/Source/WebKit2/PluginProcess/PluginProcess.h b/Source/WebKit2/PluginProcess/PluginProcess.h index 0d855429d..d60c94b92 100644 --- a/Source/WebKit2/PluginProcess/PluginProcess.h +++ b/Source/WebKit2/PluginProcess/PluginProcess.h @@ -76,7 +76,7 @@ private: // CoreIPC::Connection::Client virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE; virtual void didClose(CoreIPC::Connection*) OVERRIDE; - virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID) OVERRIDE; + virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName) OVERRIDE; // Message handlers. void didReceivePluginProcessMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); diff --git a/Source/WebKit2/PluginProcess/PluginProcess.messages.in b/Source/WebKit2/PluginProcess/PluginProcess.messages.in index e4ef45072..41226b14d 100644 --- a/Source/WebKit2/PluginProcess/PluginProcess.messages.in +++ b/Source/WebKit2/PluginProcess/PluginProcess.messages.in @@ -38,6 +38,10 @@ messages -> PluginProcess { # Asks the plug-in to clear data for the given sites. The plug-in process sends back # a DidClearSiteData message when done. ClearSiteData(Vector<WTF::String> sites, uint64_t flags, uint64_t maxAgeInSeconds, uint64_t callbackID) + +#if PLATFORM(MAC) + SetApplicationIsOccluded(bool flag); +#endif } #endif diff --git a/Source/WebKit2/PluginProcess/WebProcessConnection.cpp b/Source/WebKit2/PluginProcess/WebProcessConnection.cpp index 21a867038..ef574e6eb 100644 --- a/Source/WebKit2/PluginProcess/WebProcessConnection.cpp +++ b/Source/WebKit2/PluginProcess/WebProcessConnection.cpp @@ -188,7 +188,7 @@ void WebProcessConnection::destroyPlugin(uint64_t pluginInstanceID, bool asynchr destroyPluginControllerProxy(pluginControllerProxy); } -void WebProcessConnection::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID) +void WebProcessConnection::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference, CoreIPC::StringReference) { // FIXME: Implement. } diff --git a/Source/WebKit2/PluginProcess/WebProcessConnection.h b/Source/WebKit2/PluginProcess/WebProcessConnection.h index 8a15c9c2b..aba4c5742 100644 --- a/Source/WebKit2/PluginProcess/WebProcessConnection.h +++ b/Source/WebKit2/PluginProcess/WebProcessConnection.h @@ -65,7 +65,7 @@ private: virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE; virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&, OwnPtr<CoreIPC::MessageEncoder>&) OVERRIDE; virtual void didClose(CoreIPC::Connection*); - virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID); + virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName); // Message handlers. void didReceiveWebProcessConnectionMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); diff --git a/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm b/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm index de7d5831f..671f20d6d 100644 --- a/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm +++ b/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm @@ -279,8 +279,7 @@ static void initializeSandbox(const String& pluginPath, const String& sandboxPro if (sandboxProfileDirectoryPath.isEmpty()) return; - RetainPtr<CFStringRef> cfPluginPath = adoptCF(pluginPath.createCFString()); - RetainPtr<CFURLRef> pluginURL = adoptCF(CFURLCreateWithFileSystemPath(0, cfPluginPath.get(), kCFURLPOSIXPathStyle, false)); + RetainPtr<CFURLRef> pluginURL = adoptCF(CFURLCreateWithFileSystemPath(0, pluginPath.createCFString().get(), kCFURLPOSIXPathStyle, false)); if (!pluginURL) return; @@ -292,8 +291,7 @@ static void initializeSandbox(const String& pluginPath, const String& sandboxPro if (!bundleIdentifier) return; - RetainPtr<CFStringRef> cfSandboxProfileDirectoryPath = adoptCF(sandboxProfileDirectoryPath.createCFString()); - RetainPtr<CFURLRef> sandboxProfileDirectory = adoptCF(CFURLCreateWithFileSystemPath(0, cfSandboxProfileDirectoryPath.get(), kCFURLPOSIXPathStyle, TRUE)); + RetainPtr<CFURLRef> sandboxProfileDirectory = adoptCF(CFURLCreateWithFileSystemPath(0, sandboxProfileDirectoryPath.createCFString().get(), kCFURLPOSIXPathStyle, TRUE)); RetainPtr<CFStringRef> sandboxFileName = CFStringCreateWithFormat(0, 0, CFSTR("%@.sb"), bundleIdentifier); RetainPtr<CFURLRef> sandboxURL = adoptCF(CFURLCreateWithFileSystemPathRelativeToBase(0, sandboxFileName.get(), kCFURLPOSIXPathStyle, FALSE, sandboxProfileDirectory.get())); diff --git a/Source/WebKit2/Scripts/webkit2/messages.py b/Source/WebKit2/Scripts/webkit2/messages.py index f1cd50389..69a9e352e 100644 --- a/Source/WebKit2/Scripts/webkit2/messages.py +++ b/Source/WebKit2/Scripts/webkit2/messages.py @@ -131,6 +131,7 @@ def message_to_struct_declaration(message): result.append(' static const Kind messageID = %s;\n' % message.id()) result.append(' static CoreIPC::StringReference receiverName() { return messageReceiverName(); }\n') result.append(' static CoreIPC::StringReference name() { return CoreIPC::StringReference("%s"); }\n' % message.name) + result.append(' static const bool isSync = %s;\n' % ('false', 'true')[message.reply_parameters != None]) result.append('\n') if message.reply_parameters != None: if message.has_attribute(DELAYED_ATTRIBUTE): @@ -317,7 +318,7 @@ def handler_function(receiver, message): return '%s::%s' % (receiver.name, message.name[0].lower() + message.name[1:]) -def async_case_statement(receiver, message): +def async_message_statement(receiver, message): dispatch_function_args = ['decoder', 'this', '&%s' % handler_function(receiver, message)] dispatch_function = 'handleMessage' if message.has_attribute(VARIADIC_ATTRIBUTE): @@ -327,16 +328,16 @@ def async_case_statement(receiver, message): dispatch_function_args.insert(0, 'connection') result = [] - result.append(' case Messages::%s::%s:\n' % (receiver.name, message.id())) - + result.append(' if (decoder.messageName() == Messages::%s::%s::name()) {\n' % (receiver.name, message.name)) result.append(' CoreIPC::%s<Messages::%s::%s>(%s);\n' % (dispatch_function, receiver.name, message.name, ', '.join(dispatch_function_args))) if message.has_attribute(DISPATCH_ON_CONNECTION_QUEUE_ATTRIBUTE): result.append(' didHandleMessage = true;\n') result.append(' return;\n') + result.append(' }\n') return surround_in_condition(''.join(result), message.condition) -def sync_case_statement(receiver, message): +def sync_message_statement(receiver, message): dispatch_function = 'handleMessage' if message.has_attribute(DELAYED_ATTRIBUTE): dispatch_function += 'Delayed' @@ -344,10 +345,10 @@ def sync_case_statement(receiver, message): dispatch_function += 'Variadic' result = [] - result.append(' case Messages::%s::%s:\n' % (receiver.name, message.id())) + result.append(' if (decoder.messageName() == Messages::%s::%s::name()) {\n' % (receiver.name, message.name)) result.append(' CoreIPC::%s<Messages::%s::%s>(%sdecoder, %sreplyEncoder, this, &%s);\n' % (dispatch_function, receiver.name, message.name, 'connection, ' if message.has_attribute(DELAYED_ATTRIBUTE) else '', '' if message.has_attribute(DELAYED_ATTRIBUTE) else '*', handler_function(receiver, message))) result.append(' return;\n') - + result.append(' }\n') return surround_in_condition(''.join(result), message.condition) @@ -387,6 +388,7 @@ def headers_for_type(type): 'WTF::String': ['<wtf/text/WTFString.h>'], 'WebCore::CompositionUnderline': ['<WebCore/Editor.h>'], 'WebCore::GrammarDetail': ['<WebCore/TextCheckerClient.h>'], + 'WebCore::GraphicsLayerAnimations': ['<WebCore/GraphicsLayerAnimation.h>'], 'WebCore::KeyframeValueList': ['<WebCore/GraphicsLayer.h>'], 'WebCore::KeypressCommand': ['<WebCore/KeyboardEvent.h>'], 'WebCore::FileChooserSettings': ['<WebCore/FileChooser.h>'], @@ -545,42 +547,30 @@ def generate_message_handler(file): async_messages.append(message) if async_dispatch_on_connection_queue_messages: - result.append('void %s::didReceive%sMessageOnConnectionWorkQueue(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder, bool& didHandleMessage)\n' % (receiver.name, receiver.name)) + result.append('void %s::didReceive%sMessageOnConnectionWorkQueue(CoreIPC::Connection* connection, CoreIPC::MessageID, CoreIPC::MessageDecoder& decoder, bool& didHandleMessage)\n' % (receiver.name, receiver.name)) result.append('{\n') result.append('#if COMPILER(MSVC)\n') result.append('#pragma warning(push)\n') result.append('#pragma warning(disable: 4065)\n') result.append('#endif\n') - result.append(' switch (messageID.get<Messages::%s::Kind>()) {\n' % receiver.name) - result += [async_case_statement(receiver, message) for message in async_dispatch_on_connection_queue_messages] - result.append(' default:\n') - result.append(' return;\n') - result.append(' }\n') + result += [async_message_statement(receiver, message) for message in async_dispatch_on_connection_queue_messages] result.append('#if COMPILER(MSVC)\n') result.append('#pragma warning(pop)\n') result.append('#endif\n') result.append('}\n\n') if async_messages: - result.append('void %s::didReceive%sMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder)\n' % (receiver.name, receiver.name)) + result.append('void %s::didReceive%sMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder& decoder)\n' % (receiver.name, receiver.name)) result.append('{\n') - result.append(' switch (messageID.get<Messages::%s::Kind>()) {\n' % receiver.name) - result += [async_case_statement(receiver, message) for message in async_messages] - result.append(' default:\n') - result.append(' break;\n') - result.append(' }\n\n') + result += [async_message_statement(receiver, message) for message in async_messages] result.append(' ASSERT_NOT_REACHED();\n') result.append('}\n') if sync_messages: result.append('\n') - result.append('void %s::didReceiveSync%sMessage(CoreIPC::Connection*%s, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder, OwnPtr<CoreIPC::MessageEncoder>& replyEncoder)\n' % (receiver.name, receiver.name, ' connection' if sync_delayed_messages else '')) + result.append('void %s::didReceiveSync%sMessage(CoreIPC::Connection*%s, CoreIPC::MessageID, CoreIPC::MessageDecoder& decoder, OwnPtr<CoreIPC::MessageEncoder>& replyEncoder)\n' % (receiver.name, receiver.name, ' connection' if sync_delayed_messages else '')) result.append('{\n') - result.append(' switch (messageID.get<Messages::%s::Kind>()) {\n' % receiver.name) - result += [sync_case_statement(receiver, message) for message in sync_messages] - result.append(' default:\n') - result.append(' break;\n') - result.append(' }\n\n') + result += [sync_message_statement(receiver, message) for message in sync_messages] result.append(' ASSERT_NOT_REACHED();\n') result.append('}\n') diff --git a/Source/WebKit2/Scripts/webkit2/messages_unittest.py b/Source/WebKit2/Scripts/webkit2/messages_unittest.py index f4fa1eee8..6b1ebfd2f 100644 --- a/Source/WebKit2/Scripts/webkit2/messages_unittest.py +++ b/Source/WebKit2/Scripts/webkit2/messages_unittest.py @@ -382,6 +382,7 @@ struct LoadURL : CoreIPC::Arguments1<const WTF::String&> { static const Kind messageID = LoadURLID; static CoreIPC::StringReference receiverName() { return messageReceiverName(); } static CoreIPC::StringReference name() { return CoreIPC::StringReference("LoadURL"); } + static const bool isSync = false; typedef CoreIPC::Arguments1<const WTF::String&> DecodeType; explicit LoadURL(const WTF::String& url) @@ -395,6 +396,7 @@ struct TouchEvent : CoreIPC::Arguments1<const WebKit::WebTouchEvent&> { static const Kind messageID = TouchEventID; static CoreIPC::StringReference receiverName() { return messageReceiverName(); } static CoreIPC::StringReference name() { return CoreIPC::StringReference("TouchEvent"); } + static const bool isSync = false; typedef CoreIPC::Arguments1<const WebKit::WebTouchEvent&> DecodeType; explicit TouchEvent(const WebKit::WebTouchEvent& event) @@ -408,6 +410,7 @@ struct DidReceivePolicyDecision : CoreIPC::Arguments3<uint64_t, uint64_t, uint32 static const Kind messageID = DidReceivePolicyDecisionID; static CoreIPC::StringReference receiverName() { return messageReceiverName(); } static CoreIPC::StringReference name() { return CoreIPC::StringReference("DidReceivePolicyDecision"); } + static const bool isSync = false; typedef CoreIPC::Arguments3<uint64_t, uint64_t, uint32_t> DecodeType; DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction) @@ -420,6 +423,7 @@ struct Close : CoreIPC::Arguments0 { static const Kind messageID = CloseID; static CoreIPC::StringReference receiverName() { return messageReceiverName(); } static CoreIPC::StringReference name() { return CoreIPC::StringReference("Close"); } + static const bool isSync = false; typedef CoreIPC::Arguments0 DecodeType; }; @@ -428,6 +432,7 @@ struct PreferencesDidChange : CoreIPC::Arguments1<const WebKit::WebPreferencesSt static const Kind messageID = PreferencesDidChangeID; static CoreIPC::StringReference receiverName() { return messageReceiverName(); } static CoreIPC::StringReference name() { return CoreIPC::StringReference("PreferencesDidChange"); } + static const bool isSync = false; typedef CoreIPC::Arguments1<const WebKit::WebPreferencesStore&> DecodeType; explicit PreferencesDidChange(const WebKit::WebPreferencesStore& store) @@ -440,6 +445,7 @@ struct SendDoubleAndFloat : CoreIPC::Arguments2<double, float> { static const Kind messageID = SendDoubleAndFloatID; static CoreIPC::StringReference receiverName() { return messageReceiverName(); } static CoreIPC::StringReference name() { return CoreIPC::StringReference("SendDoubleAndFloat"); } + static const bool isSync = false; typedef CoreIPC::Arguments2<double, float> DecodeType; SendDoubleAndFloat(double d, float f) @@ -452,6 +458,7 @@ struct SendInts : CoreIPC::Arguments2<const Vector<uint64_t>&, const Vector<Vect static const Kind messageID = SendIntsID; static CoreIPC::StringReference receiverName() { return messageReceiverName(); } static CoreIPC::StringReference name() { return CoreIPC::StringReference("SendInts"); } + static const bool isSync = false; typedef CoreIPC::Arguments2<const Vector<uint64_t>&, const Vector<Vector<uint64_t> >&> DecodeType; SendInts(const Vector<uint64_t>& ints, const Vector<Vector<uint64_t> >& intVectors) @@ -464,6 +471,7 @@ struct CreatePlugin : CoreIPC::Arguments2<uint64_t, const WebKit::Plugin::Parame static const Kind messageID = CreatePluginID; static CoreIPC::StringReference receiverName() { return messageReceiverName(); } static CoreIPC::StringReference name() { return CoreIPC::StringReference("CreatePlugin"); } + static const bool isSync = true; typedef CoreIPC::Arguments1<bool&> Reply; typedef CoreIPC::Arguments2<uint64_t, const WebKit::Plugin::Parameters&> DecodeType; @@ -477,6 +485,7 @@ struct RunJavaScriptAlert : CoreIPC::Arguments2<uint64_t, const WTF::String&> { static const Kind messageID = RunJavaScriptAlertID; static CoreIPC::StringReference receiverName() { return messageReceiverName(); } static CoreIPC::StringReference name() { return CoreIPC::StringReference("RunJavaScriptAlert"); } + static const bool isSync = true; typedef CoreIPC::Arguments0 Reply; typedef CoreIPC::Arguments2<uint64_t, const WTF::String&> DecodeType; @@ -490,6 +499,7 @@ struct GetPlugins : CoreIPC::Arguments1<bool> { static const Kind messageID = GetPluginsID; static CoreIPC::StringReference receiverName() { return messageReceiverName(); } static CoreIPC::StringReference name() { return CoreIPC::StringReference("GetPlugins"); } + static const bool isSync = true; typedef CoreIPC::Arguments1<Vector<WebCore::PluginInfo>&> Reply; typedef CoreIPC::Arguments1<bool> DecodeType; @@ -503,6 +513,7 @@ struct GetPluginProcessConnection : CoreIPC::Arguments1<const WTF::String&> { static const Kind messageID = GetPluginProcessConnectionID; static CoreIPC::StringReference receiverName() { return messageReceiverName(); } static CoreIPC::StringReference name() { return CoreIPC::StringReference("GetPluginProcessConnection"); } + static const bool isSync = true; struct DelayedReply : public ThreadSafeRefCounted<DelayedReply> { DelayedReply(PassRefPtr<CoreIPC::Connection>, PassOwnPtr<CoreIPC::MessageEncoder>); @@ -527,6 +538,7 @@ struct TestMultipleAttributes : CoreIPC::Arguments0 { static const Kind messageID = TestMultipleAttributesID; static CoreIPC::StringReference receiverName() { return messageReceiverName(); } static CoreIPC::StringReference name() { return CoreIPC::StringReference("TestMultipleAttributes"); } + static const bool isSync = true; struct DelayedReply : public ThreadSafeRefCounted<DelayedReply> { DelayedReply(PassRefPtr<CoreIPC::Connection>, PassOwnPtr<CoreIPC::MessageEncoder>); @@ -547,6 +559,7 @@ struct TestConnectionQueue : CoreIPC::Arguments1<uint64_t> { static const Kind messageID = TestConnectionQueueID; static CoreIPC::StringReference receiverName() { return messageReceiverName(); } static CoreIPC::StringReference name() { return CoreIPC::StringReference("TestConnectionQueue"); } + static const bool isSync = false; typedef CoreIPC::Arguments1<uint64_t> DecodeType; explicit TestConnectionQueue(uint64_t pluginID) @@ -559,6 +572,7 @@ struct TestParameterAttributes : CoreIPC::Arguments3<uint64_t, double, double> { static const Kind messageID = TestParameterAttributesID; static CoreIPC::StringReference receiverName() { return messageReceiverName(); } static CoreIPC::StringReference name() { return CoreIPC::StringReference("TestParameterAttributes"); } + static const bool isSync = false; typedef CoreIPC::Arguments3<uint64_t, double, double> DecodeType; TestParameterAttributes(uint64_t foo, double bar, double baz) @@ -572,6 +586,7 @@ struct DidCreateWebProcessConnection : CoreIPC::Arguments1<const CoreIPC::MachPo static const Kind messageID = DidCreateWebProcessConnectionID; static CoreIPC::StringReference receiverName() { return messageReceiverName(); } static CoreIPC::StringReference name() { return CoreIPC::StringReference("DidCreateWebProcessConnection"); } + static const bool isSync = false; typedef CoreIPC::Arguments1<const CoreIPC::MachPort&> DecodeType; explicit DidCreateWebProcessConnection(const CoreIPC::MachPort& connectionIdentifier) @@ -586,6 +601,7 @@ struct InterpretKeyEvent : CoreIPC::Arguments1<uint32_t> { static const Kind messageID = InterpretKeyEventID; static CoreIPC::StringReference receiverName() { return messageReceiverName(); } static CoreIPC::StringReference name() { return CoreIPC::StringReference("InterpretKeyEvent"); } + static const bool isSync = true; typedef CoreIPC::Arguments1<Vector<WebCore::KeypressCommand>&> Reply; typedef CoreIPC::Arguments1<uint32_t> DecodeType; @@ -601,6 +617,7 @@ struct DeprecatedOperation : CoreIPC::Arguments1<const CoreIPC::DummyType&> { static const Kind messageID = DeprecatedOperationID; static CoreIPC::StringReference receiverName() { return messageReceiverName(); } static CoreIPC::StringReference name() { return CoreIPC::StringReference("DeprecatedOperation"); } + static const bool isSync = false; typedef CoreIPC::Arguments1<const CoreIPC::DummyType&> DecodeType; explicit DeprecatedOperation(const CoreIPC::DummyType& dummy) @@ -615,6 +632,7 @@ struct ExperimentalOperation : CoreIPC::Arguments1<const CoreIPC::DummyType&> { static const Kind messageID = ExperimentalOperationID; static CoreIPC::StringReference receiverName() { return messageReceiverName(); } static CoreIPC::StringReference name() { return CoreIPC::StringReference("ExperimentalOperation"); } + static const bool isSync = false; typedef CoreIPC::Arguments1<const CoreIPC::DummyType&> DecodeType; explicit ExperimentalOperation(const CoreIPC::DummyType& dummy) @@ -743,97 +761,99 @@ bool TestMultipleAttributes::DelayedReply::send() namespace WebKit { -void WebPage::didReceiveWebPageMessageOnConnectionWorkQueue(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder, bool& didHandleMessage) +void WebPage::didReceiveWebPageMessageOnConnectionWorkQueue(CoreIPC::Connection* connection, CoreIPC::MessageID, CoreIPC::MessageDecoder& decoder, bool& didHandleMessage) { #if COMPILER(MSVC) #pragma warning(push) #pragma warning(disable: 4065) #endif - switch (messageID.get<Messages::WebPage::Kind>()) { - case Messages::WebPage::TestConnectionQueueID: + if (decoder.messageName() == Messages::WebPage::TestConnectionQueue::name()) { CoreIPC::handleMessageOnConnectionQueue<Messages::WebPage::TestConnectionQueue>(connection, decoder, this, &WebPage::testConnectionQueue); didHandleMessage = true; return; - default: - return; } #if COMPILER(MSVC) #pragma warning(pop) #endif } -void WebPage::didReceiveWebPageMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder) +void WebPage::didReceiveWebPageMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder& decoder) { - switch (messageID.get<Messages::WebPage::Kind>()) { - case Messages::WebPage::LoadURLID: + if (decoder.messageName() == Messages::WebPage::LoadURL::name()) { CoreIPC::handleMessage<Messages::WebPage::LoadURL>(decoder, this, &WebPage::loadURL); return; + } #if ENABLE(TOUCH_EVENTS) - case Messages::WebPage::TouchEventID: + if (decoder.messageName() == Messages::WebPage::TouchEvent::name()) { CoreIPC::handleMessage<Messages::WebPage::TouchEvent>(decoder, this, &WebPage::touchEvent); return; + } #endif - case Messages::WebPage::DidReceivePolicyDecisionID: + if (decoder.messageName() == Messages::WebPage::DidReceivePolicyDecision::name()) { CoreIPC::handleMessage<Messages::WebPage::DidReceivePolicyDecision>(decoder, this, &WebPage::didReceivePolicyDecision); return; - case Messages::WebPage::CloseID: + } + if (decoder.messageName() == Messages::WebPage::Close::name()) { CoreIPC::handleMessage<Messages::WebPage::Close>(decoder, this, &WebPage::close); return; - case Messages::WebPage::PreferencesDidChangeID: + } + if (decoder.messageName() == Messages::WebPage::PreferencesDidChange::name()) { CoreIPC::handleMessage<Messages::WebPage::PreferencesDidChange>(decoder, this, &WebPage::preferencesDidChange); return; - case Messages::WebPage::SendDoubleAndFloatID: + } + if (decoder.messageName() == Messages::WebPage::SendDoubleAndFloat::name()) { CoreIPC::handleMessage<Messages::WebPage::SendDoubleAndFloat>(decoder, this, &WebPage::sendDoubleAndFloat); return; - case Messages::WebPage::SendIntsID: + } + if (decoder.messageName() == Messages::WebPage::SendInts::name()) { CoreIPC::handleMessage<Messages::WebPage::SendInts>(decoder, this, &WebPage::sendInts); return; - case Messages::WebPage::TestParameterAttributesID: + } + if (decoder.messageName() == Messages::WebPage::TestParameterAttributes::name()) { CoreIPC::handleMessage<Messages::WebPage::TestParameterAttributes>(decoder, this, &WebPage::testParameterAttributes); return; + } #if PLATFORM(MAC) - case Messages::WebPage::DidCreateWebProcessConnectionID: + if (decoder.messageName() == Messages::WebPage::DidCreateWebProcessConnection::name()) { CoreIPC::handleMessage<Messages::WebPage::DidCreateWebProcessConnection>(decoder, this, &WebPage::didCreateWebProcessConnection); return; + } #endif #if ENABLE(DEPRECATED_FEATURE) - case Messages::WebPage::DeprecatedOperationID: + if (decoder.messageName() == Messages::WebPage::DeprecatedOperation::name()) { CoreIPC::handleMessage<Messages::WebPage::DeprecatedOperation>(decoder, this, &WebPage::deprecatedOperation); return; + } #endif #if ENABLE(EXPERIMENTAL_FEATURE) - case Messages::WebPage::ExperimentalOperationID: + if (decoder.messageName() == Messages::WebPage::ExperimentalOperation::name()) { CoreIPC::handleMessage<Messages::WebPage::ExperimentalOperation>(decoder, this, &WebPage::experimentalOperation); return; -#endif - default: - break; } - +#endif ASSERT_NOT_REACHED(); } -void WebPage::didReceiveSyncWebPageMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder, OwnPtr<CoreIPC::MessageEncoder>& replyEncoder) +void WebPage::didReceiveSyncWebPageMessage(CoreIPC::Connection* connection, CoreIPC::MessageID, CoreIPC::MessageDecoder& decoder, OwnPtr<CoreIPC::MessageEncoder>& replyEncoder) { - switch (messageID.get<Messages::WebPage::Kind>()) { - case Messages::WebPage::CreatePluginID: + if (decoder.messageName() == Messages::WebPage::CreatePlugin::name()) { CoreIPC::handleMessage<Messages::WebPage::CreatePlugin>(decoder, *replyEncoder, this, &WebPage::createPlugin); return; - case Messages::WebPage::RunJavaScriptAlertID: + } + if (decoder.messageName() == Messages::WebPage::RunJavaScriptAlert::name()) { CoreIPC::handleMessage<Messages::WebPage::RunJavaScriptAlert>(decoder, *replyEncoder, this, &WebPage::runJavaScriptAlert); return; - case Messages::WebPage::GetPluginProcessConnectionID: + } + if (decoder.messageName() == Messages::WebPage::GetPluginProcessConnection::name()) { CoreIPC::handleMessageDelayed<Messages::WebPage::GetPluginProcessConnection>(connection, decoder, replyEncoder, this, &WebPage::getPluginProcessConnection); return; + } #if PLATFORM(MAC) - case Messages::WebPage::InterpretKeyEventID: + if (decoder.messageName() == Messages::WebPage::InterpretKeyEvent::name()) { CoreIPC::handleMessage<Messages::WebPage::InterpretKeyEvent>(decoder, *replyEncoder, this, &WebPage::interpretKeyEvent); return; -#endif - default: - break; } - +#endif ASSERT_NOT_REACHED(); } diff --git a/Source/WebKit2/Shared/API/c/WKSharedAPICast.h b/Source/WebKit2/Shared/API/c/WKSharedAPICast.h index ff9a50fe3..380cd25c2 100644 --- a/Source/WebKit2/Shared/API/c/WKSharedAPICast.h +++ b/Source/WebKit2/Shared/API/c/WKSharedAPICast.h @@ -39,6 +39,7 @@ #include "WebEvent.h" #include "WebFindOptions.h" #include "WebNumber.h" +#include "WebSecurityOrigin.h" #include "WebString.h" #include "WebURL.h" #include "WebURLRequest.h" @@ -48,6 +49,7 @@ #include <WebCore/FrameLoaderTypes.h> #include <WebCore/IntRect.h> #include <WebCore/LayoutMilestones.h> +#include <WebCore/SecurityOrigin.h> #include <WebCore/UserContentTypes.h> #include <WebCore/UserScriptTypes.h> #include <wtf/TypeTraits.h> @@ -197,6 +199,13 @@ inline ProxyingRefPtr<WebURLResponse> toAPI(const WebCore::ResourceResponse& res return ProxyingRefPtr<WebURLResponse>(WebURLResponse::create(response)); } +inline WKSecurityOriginRef toCopiedAPI(WebCore::SecurityOrigin* origin) +{ + if (!origin) + return 0; + return toAPI(WebSecurityOrigin::create(origin).leakRef()); +} + /* Geometry conversions */ inline WebCore::FloatRect toFloatRect(const WKRect& wkRect) diff --git a/Source/WebKit2/Shared/API/c/cf/WKStringCF.cpp b/Source/WebKit2/Shared/API/c/cf/WKStringCF.cpp index 9a49e5ad4..f5ab62908 100644 --- a/Source/WebKit2/Shared/API/c/cf/WKStringCF.cpp +++ b/Source/WebKit2/Shared/API/c/cf/WKStringCF.cpp @@ -44,5 +44,7 @@ CFStringRef WKStringCopyCFString(CFAllocatorRef allocatorRef, WKStringRef string // NOTE: This does not use StringImpl::createCFString() since that function // expects to be called on the thread running WebCore. - return CFStringCreateWithCharacters(allocatorRef, reinterpret_cast<const UniChar*>(toImpl(stringRef)->string().characters()), toImpl(stringRef)->string().length()); + if (toImpl(stringRef)->string().is8Bit()) + return CFStringCreateWithBytes(allocatorRef, reinterpret_cast<const UInt8*>(toImpl(stringRef)->string().characters8()), toImpl(stringRef)->string().length(), kCFStringEncodingISOLatin1, true); + return CFStringCreateWithCharacters(allocatorRef, reinterpret_cast<const UniChar*>(toImpl(stringRef)->string().characters16()), toImpl(stringRef)->string().length()); } diff --git a/Source/WebKit2/Shared/ChildProcess.cpp b/Source/WebKit2/Shared/ChildProcess.cpp index b65eebe2c..344d54c91 100644 --- a/Source/WebKit2/Shared/ChildProcess.cpp +++ b/Source/WebKit2/Shared/ChildProcess.cpp @@ -60,9 +60,15 @@ ChildProcess::ChildProcess() : m_terminationTimeout(0) , m_terminationCounter(0) , m_terminationTimer(RunLoop::main(), this, &ChildProcess::terminationTimerFired) +#if PLATFORM(MAC) + , m_applicationIsOccluded(false) +#endif { // FIXME: The termination timer should not be scheduled on the main run loop. // It won't work with the threaded mode, but it's not really useful anyway as is. +#if PLATFORM(MAC) + disableProcessSuppression(processSuppressionVisibleApplicationReason); +#endif } ChildProcess::~ChildProcess() diff --git a/Source/WebKit2/Shared/ChildProcess.h b/Source/WebKit2/Shared/ChildProcess.h index 9ec1a50d9..4428a40ab 100644 --- a/Source/WebKit2/Shared/ChildProcess.h +++ b/Source/WebKit2/Shared/ChildProcess.h @@ -29,6 +29,10 @@ #include "Connection.h" #include <WebCore/RunLoop.h> +#if PLATFORM(MAC) +OBJC_CLASS NSString; +#endif + namespace WebKit { class ChildProcess : protected CoreIPC::Connection::Client { @@ -57,6 +61,11 @@ public: ChildProcess& m_childProcess; }; +#if PLATFORM(MAC) + bool applicationIsOccluded() const { return m_applicationIsOccluded; } + void setApplicationIsOccluded(bool); +#endif + static void didCloseOnConnectionWorkQueue(WorkQueue&, CoreIPC::Connection*); protected: @@ -71,6 +80,13 @@ private: virtual bool shouldTerminate() = 0; virtual void terminate(); +#if PLATFORM(MAC) + void disableProcessSuppression(NSString *reason); + void enableProcessSuppression(NSString *reason); + + static NSString * const processSuppressionVisibleApplicationReason; +#endif + // The timeout, in seconds, before this process will be terminated if termination // has been enabled. If the timeout is 0 seconds, the process will be terminated immediately. double m_terminationTimeout; @@ -80,6 +96,10 @@ private: unsigned m_terminationCounter; WebCore::RunLoop::Timer<ChildProcess> m_terminationTimer; + +#if PLATFORM(MAC) + bool m_applicationIsOccluded; +#endif }; } // namespace WebKit diff --git a/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp b/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp index a237288b4..0ffe40659 100644 --- a/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp +++ b/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp @@ -33,9 +33,19 @@ #include <WebCore/Animation.h> #include <WebCore/Color.h> #include <WebCore/FloatPoint3D.h> +#include <WebCore/GraphicsLayerAnimation.h> +#include <WebCore/IdentityTransformOperation.h> #include <WebCore/IntPoint.h> #include <WebCore/Length.h> +#include <WebCore/Matrix3DTransformOperation.h> +#include <WebCore/MatrixTransformOperation.h> +#include <WebCore/PerspectiveTransformOperation.h> +#include <WebCore/RotateTransformOperation.h> +#include <WebCore/ScaleTransformOperation.h> +#include <WebCore/SkewTransformOperation.h> +#include <WebCore/TimingFunction.h> #include <WebCore/TransformationMatrix.h> +#include <WebCore/TranslateTransformOperation.h> #if ENABLE(CSS_FILTERS) #include <WebCore/FilterOperations.h> @@ -44,20 +54,14 @@ #if ENABLE(CSS_SHADERS) #include "WebCustomFilterProgram.h" #include <WebCore/CustomFilterArrayParameter.h> +#include <WebCore/CustomFilterConstants.h> #include <WebCore/CustomFilterNumberParameter.h> #include <WebCore/CustomFilterOperation.h> #include <WebCore/CustomFilterProgram.h> #include <WebCore/CustomFilterTransformParameter.h> -#include <WebCore/IdentityTransformOperation.h> -#include <WebCore/Matrix3DTransformOperation.h> -#include <WebCore/MatrixTransformOperation.h> -#include <WebCore/PerspectiveTransformOperation.h> -#include <WebCore/RotateTransformOperation.h> -#include <WebCore/ScaleTransformOperation.h> -#include <WebCore/SkewTransformOperation.h> -#include <WebCore/TranslateTransformOperation.h> #endif + #if USE(GRAPHICS_SURFACE) #include <WebCore/GraphicsSurface.h> #endif @@ -69,7 +73,7 @@ using namespace WebKit; namespace CoreIPC { -void ArgumentCoder<FloatPoint3D>::encode(ArgumentEncoder* encoder, const FloatPoint3D& floatPoint3D) +void ArgumentCoder<FloatPoint3D>::encode(ArgumentEncoder& encoder, const FloatPoint3D& floatPoint3D) { SimpleArgumentCoder<FloatPoint3D>::encode(encoder, floatPoint3D); } @@ -79,7 +83,7 @@ bool ArgumentCoder<FloatPoint3D>::decode(ArgumentDecoder* decoder, FloatPoint3D& return SimpleArgumentCoder<FloatPoint3D>::decode(decoder, floatPoint3D); } -void ArgumentCoder<Length>::encode(ArgumentEncoder* encoder, const Length& length) +void ArgumentCoder<Length>::encode(ArgumentEncoder& encoder, const Length& length) { SimpleArgumentCoder<Length>::encode(encoder, length); } @@ -89,7 +93,7 @@ bool ArgumentCoder<Length>::decode(ArgumentDecoder* decoder, Length& length) return SimpleArgumentCoder<Length>::decode(decoder, length); } -void ArgumentCoder<TransformationMatrix>::encode(ArgumentEncoder* encoder, const TransformationMatrix& transformationMatrix) +void ArgumentCoder<TransformationMatrix>::encode(ArgumentEncoder& encoder, const TransformationMatrix& transformationMatrix) { SimpleArgumentCoder<TransformationMatrix>::encode(encoder, transformationMatrix); } @@ -100,25 +104,25 @@ bool ArgumentCoder<TransformationMatrix>::decode(ArgumentDecoder* decoder, Trans } #if ENABLE(CSS_FILTERS) -void ArgumentCoder<WebCore::FilterOperations>::encode(ArgumentEncoder* encoder, const WebCore::FilterOperations& filters) +void ArgumentCoder<WebCore::FilterOperations>::encode(ArgumentEncoder& encoder, const WebCore::FilterOperations& filters) { - encoder->encode(static_cast<uint32_t>(filters.size())); + encoder << static_cast<uint32_t>(filters.size()); for (size_t i = 0; i < filters.size(); ++i) { const FilterOperation* filter = filters.at(i); FilterOperation::OperationType type = filter->getOperationType(); - encoder->encodeEnum(type); + encoder.encodeEnum(type); switch (type) { case FilterOperation::GRAYSCALE: case FilterOperation::SEPIA: case FilterOperation::SATURATE: case FilterOperation::HUE_ROTATE: - encoder->encode(static_cast<double>(static_cast<const BasicColorMatrixFilterOperation*>(filter)->amount())); + encoder << static_cast<double>(static_cast<const BasicColorMatrixFilterOperation*>(filter)->amount()); break; case FilterOperation::INVERT: case FilterOperation::BRIGHTNESS: case FilterOperation::CONTRAST: case FilterOperation::OPACITY: - encoder->encode(static_cast<double>(static_cast<const BasicComponentTransferFilterOperation*>(filter)->amount())); + encoder << static_cast<double>(static_cast<const BasicComponentTransferFilterOperation*>(filter)->amount()); break; case FilterOperation::BLUR: ArgumentCoder<Length>::encode(encoder, static_cast<const BlurFilterOperation*>(filter)->stdDeviation()); @@ -126,7 +130,7 @@ void ArgumentCoder<WebCore::FilterOperations>::encode(ArgumentEncoder* encoder, case FilterOperation::DROP_SHADOW: { const DropShadowFilterOperation* shadow = static_cast<const DropShadowFilterOperation*>(filter); ArgumentCoder<IntPoint>::encode(encoder, shadow->location()); - encoder->encode(static_cast<int32_t>(shadow->stdDeviation())); + encoder << static_cast<int32_t>(shadow->stdDeviation()); ArgumentCoder<Color>::encode(encoder, shadow->color()); break; } @@ -137,34 +141,34 @@ void ArgumentCoder<WebCore::FilterOperations>::encode(ArgumentEncoder* encoder, ASSERT(customOperation->program()); RefPtr<CustomFilterProgram> program = customOperation->program(); ASSERT(program->isLoaded()); - CustomFilterProgramInfo programInfo = program->programInfo(); - encoder->encode(programInfo.vertexShaderString()); - encoder->encode(programInfo.fragmentShaderString()); - encoder->encodeEnum(program->programType()); - CustomFilterProgramMixSettings mixSettings = programInfo.mixSettings(); - encoder->encodeEnum(mixSettings.blendMode); - encoder->encodeEnum(mixSettings.compositeOperator); + encoder << program->vertexShaderString(); + encoder << program->fragmentShaderString(); + encoder.encodeEnum(program->programType()); + CustomFilterProgramMixSettings mixSettings = program->mixSettings(); + encoder.encodeEnum(mixSettings.blendMode); + encoder.encodeEnum(mixSettings.compositeOperator); + encoder.encodeEnum(program->meshType()); CustomFilterParameterList parameters = customOperation->parameters(); - encoder->encode(static_cast<uint32_t>(parameters.size())); + encoder << static_cast<uint32_t>(parameters.size()); for (size_t i = 0; i < parameters.size(); ++i) { RefPtr<CustomFilterParameter> parameter = parameters[i]; - encoder->encode(parameter->name()); - encoder->encodeEnum(parameter->parameterType()); + encoder << parameter->name(); + encoder.encodeEnum(parameter->parameterType()); switch (parameter->parameterType()) { case CustomFilterParameter::ARRAY: { CustomFilterArrayParameter* arrayParameter = static_cast<CustomFilterArrayParameter*>(parameter.get()); - encoder->encode(static_cast<uint32_t>(arrayParameter->size())); + encoder << static_cast<uint32_t>(arrayParameter->size()); for (size_t j = 0; j < arrayParameter->size(); ++j) - encoder->encode(arrayParameter->valueAt(j)); + encoder << arrayParameter->valueAt(j); break; } case CustomFilterParameter::NUMBER: { CustomFilterNumberParameter* nubmerParameter = static_cast<CustomFilterNumberParameter*>(parameter.get()); - encoder->encode(static_cast<uint32_t>(nubmerParameter->size())); + encoder << static_cast<uint32_t>(nubmerParameter->size()); for (size_t j = 0; j < nubmerParameter->size(); ++j) - encoder->encode(nubmerParameter->valueAt(j)); + encoder << nubmerParameter->valueAt(j); break; } case CustomFilterParameter::TRANSFORM: { @@ -175,10 +179,9 @@ void ArgumentCoder<WebCore::FilterOperations>::encode(ArgumentEncoder* encoder, } } - encoder->encode(customOperation->meshRows()); - encoder->encode(customOperation->meshColumns()); - encoder->encodeEnum(customOperation->meshBoxType()); - encoder->encodeEnum(customOperation->meshType()); + encoder << customOperation->meshRows(); + encoder << customOperation->meshColumns(); + encoder.encodeEnum(customOperation->meshBoxType()); break; } #endif @@ -249,6 +252,7 @@ bool ArgumentCoder<WebCore::FilterOperations>::decode(ArgumentDecoder* decoder, String fragmentShaderString; CustomFilterProgramType programType; CustomFilterProgramMixSettings mixSettings; + CustomFilterMeshType meshType; if (!decoder->decode(vertexShaderString)) return false; if (!decoder->decode(fragmentShaderString)) @@ -259,7 +263,9 @@ bool ArgumentCoder<WebCore::FilterOperations>::decode(ArgumentDecoder* decoder, return false; if (!decoder->decodeEnum(mixSettings.compositeOperator)) return false; - RefPtr<CustomFilterProgram> program = WebCustomFilterProgram::create(vertexShaderString, fragmentShaderString, programType, mixSettings); + if (!decoder->decodeEnum(meshType)) + return false; + RefPtr<CustomFilterProgram> program = WebCustomFilterProgram::create(vertexShaderString, fragmentShaderString, programType, mixSettings, meshType); uint32_t parametersSize; if (!decoder->decodeUInt32(parametersSize)) @@ -277,7 +283,6 @@ bool ArgumentCoder<WebCore::FilterOperations>::decode(ArgumentDecoder* decoder, switch (parameterType) { case CustomFilterParameter::ARRAY: { RefPtr<CustomFilterArrayParameter> arrayParameter = CustomFilterArrayParameter::create(name); - parameters.append(arrayParameter); uint32_t arrayParameterSize; if (!decoder->decodeUInt32(arrayParameterSize)) return false; @@ -287,11 +292,11 @@ bool ArgumentCoder<WebCore::FilterOperations>::decode(ArgumentDecoder* decoder, return false; arrayParameter->addValue(arrayParameterValue); } + parameters[i] = arrayParameter.release(); break; } case CustomFilterParameter::NUMBER: { RefPtr<CustomFilterNumberParameter> numberParameter = CustomFilterNumberParameter::create(name); - parameters.append(numberParameter); uint32_t numberParameterSize; if (!decoder->decodeUInt32(numberParameterSize)) return false; @@ -301,15 +306,16 @@ bool ArgumentCoder<WebCore::FilterOperations>::decode(ArgumentDecoder* decoder, return false; numberParameter->addValue(numberParameterValue); } + parameters[i] = numberParameter.release(); break; } case CustomFilterParameter::TRANSFORM: { RefPtr<CustomFilterTransformParameter> transformParameter = CustomFilterTransformParameter::create(name); - parameters.append(transformParameter); TransformOperations operations; if (!ArgumentCoder<TransformOperations>::decode(decoder, operations)) return false; transformParameter->setOperations(operations); + parameters[i] = transformParameter.release(); break; } } @@ -317,16 +323,13 @@ bool ArgumentCoder<WebCore::FilterOperations>::decode(ArgumentDecoder* decoder, unsigned meshRows; unsigned meshColumns; - CustomFilterOperation::MeshBoxType meshBoxType; - CustomFilterOperation::MeshType meshType; + CustomFilterMeshBoxType meshBoxType; if (!decoder->decode(meshRows)) return false; if (!decoder->decode(meshColumns)) return false; if (!decoder->decodeEnum(meshBoxType)) return false; - if (!decoder->decodeEnum(meshType)) - return false; filter = CustomFilterOperation::create(program, parameters, meshRows, meshColumns, meshBoxType, meshType); break; @@ -344,13 +347,12 @@ bool ArgumentCoder<WebCore::FilterOperations>::decode(ArgumentDecoder* decoder, } #endif -#if ENABLE(CSS_SHADERS) -void ArgumentCoder<TransformOperations>::encode(ArgumentEncoder* encoder, const TransformOperations& transformOperations) +void ArgumentCoder<TransformOperations>::encode(ArgumentEncoder& encoder, const TransformOperations& transformOperations) { - encoder->encode(static_cast<uint32_t>(transformOperations.size())); + encoder << static_cast<uint32_t>(transformOperations.size()); for (size_t i = 0; i < transformOperations.size(); ++i) { const TransformOperation* operation = transformOperations.at(i); - encoder->encodeEnum(operation->getOperationType()); + encoder.encodeEnum(operation->getOperationType()); switch (operation->getOperationType()) { case TransformOperation::SCALE_X: @@ -358,9 +360,9 @@ void ArgumentCoder<TransformOperations>::encode(ArgumentEncoder* encoder, const case TransformOperation::SCALE: case TransformOperation::SCALE_Z: case TransformOperation::SCALE_3D: - encoder->encode(static_cast<const ScaleTransformOperation*>(operation)->x()); - encoder->encode(static_cast<const ScaleTransformOperation*>(operation)->y()); - encoder->encode(static_cast<const ScaleTransformOperation*>(operation)->z()); + encoder << static_cast<const ScaleTransformOperation*>(operation)->x(); + encoder << static_cast<const ScaleTransformOperation*>(operation)->y(); + encoder << static_cast<const ScaleTransformOperation*>(operation)->z(); break; case TransformOperation::TRANSLATE_X: case TransformOperation::TRANSLATE_Y: @@ -375,16 +377,16 @@ void ArgumentCoder<TransformOperations>::encode(ArgumentEncoder* encoder, const case TransformOperation::ROTATE_X: case TransformOperation::ROTATE_Y: case TransformOperation::ROTATE_3D: - encoder->encode(static_cast<const RotateTransformOperation*>(operation)->x()); - encoder->encode(static_cast<const RotateTransformOperation*>(operation)->y()); - encoder->encode(static_cast<const RotateTransformOperation*>(operation)->z()); - encoder->encode(static_cast<const RotateTransformOperation*>(operation)->angle()); + encoder << static_cast<const RotateTransformOperation*>(operation)->x(); + encoder << static_cast<const RotateTransformOperation*>(operation)->y(); + encoder << static_cast<const RotateTransformOperation*>(operation)->z(); + encoder << static_cast<const RotateTransformOperation*>(operation)->angle(); break; case TransformOperation::SKEW_X: case TransformOperation::SKEW_Y: case TransformOperation::SKEW: - encoder->encode(static_cast<const SkewTransformOperation*>(operation)->angleX()); - encoder->encode(static_cast<const SkewTransformOperation*>(operation)->angleY()); + encoder << static_cast<const SkewTransformOperation*>(operation)->angleX(); + encoder << static_cast<const SkewTransformOperation*>(operation)->angleY(); break; case TransformOperation::MATRIX: ArgumentCoder<TransformationMatrix>::encode(encoder, static_cast<const MatrixTransformOperation*>(operation)->matrix()); @@ -504,30 +506,262 @@ bool ArgumentCoder<TransformOperations>::decode(ArgumentDecoder* decoder, Transf } return true; } + +static void encodeTimingFunction(ArgumentEncoder& encoder, const TimingFunction* timingFunction) +{ + if (!timingFunction) { + encoder.encodeEnum(TimingFunction::TimingFunctionType(-1)); + return; + } + + TimingFunction::TimingFunctionType type = timingFunction ? timingFunction->type() : TimingFunction::LinearFunction; + encoder.encodeEnum(type); + switch (type) { + case TimingFunction::LinearFunction: + break; + case TimingFunction::CubicBezierFunction: { + const CubicBezierTimingFunction* cubic = static_cast<const CubicBezierTimingFunction*>(timingFunction); + encoder << cubic->x1(); + encoder << cubic->y1(); + encoder << cubic->x2(); + encoder << cubic->y2(); + break; + } + case TimingFunction::StepsFunction: { + const StepsTimingFunction* steps = static_cast<const StepsTimingFunction*>(timingFunction); + encoder << static_cast<uint32_t>(steps->numberOfSteps()); + encoder << steps->stepAtStart(); + break; + } + } +} + +bool decodeTimingFunction(ArgumentDecoder* decoder, RefPtr<TimingFunction>& timingFunction) +{ + TimingFunction::TimingFunctionType type; + if (!decoder->decodeEnum(type)) + return false; + + if (type == TimingFunction::TimingFunctionType(-1)) + return true; + + switch (type) { + case TimingFunction::LinearFunction: + timingFunction = LinearTimingFunction::create(); + return true; + case TimingFunction::CubicBezierFunction: { + double x1, y1, x2, y2; + if (!decoder->decodeDouble(x1)) + return false; + if (!decoder->decodeDouble(y1)) + return false; + if (!decoder->decodeDouble(x2)) + return false; + if (!decoder->decodeDouble(y2)) + return false; + + timingFunction = CubicBezierTimingFunction::create(x1, y1, x2, y2); + return true; + } + case TimingFunction::StepsFunction: { + uint32_t numberOfSteps; + bool stepAtStart; + if (!decoder->decodeUInt32(numberOfSteps)) + return false; + if (!decoder->decodeBool(stepAtStart)) + return false; + + timingFunction = StepsTimingFunction::create(numberOfSteps, stepAtStart); + return true; + } + } + + return false; +} + +void ArgumentCoder<GraphicsLayerAnimation>::encode(ArgumentEncoder& encoder, const GraphicsLayerAnimation& animation) +{ + encoder << animation.name(); + encoder << animation.boxSize(); + encoder.encodeEnum(animation.state()); + encoder << animation.startTime(); + encoder << animation.pauseTime(); + encoder << animation.listsMatch(); + + RefPtr<Animation> animationObject = animation.animation(); + encoder.encodeEnum(animationObject->direction()); + encoder << static_cast<uint32_t>(animationObject->fillMode()); + encoder << animationObject->duration(); + encoder << animationObject->iterationCount(); + encodeTimingFunction(encoder, animationObject->timingFunction().get()); + + const KeyframeValueList& keyframes = animation.keyframes(); + encoder.encodeEnum(keyframes.property()); + encoder << static_cast<uint32_t>(keyframes.size()); + for (size_t i = 0; i < keyframes.size(); ++i) { + const AnimationValue* value = keyframes.at(i); + encoder << value->keyTime(); + encodeTimingFunction(encoder, value->timingFunction()); + switch (keyframes.property()) { + case AnimatedPropertyOpacity: + encoder << static_cast<const FloatAnimationValue*>(value)->value(); + break; + case AnimatedPropertyWebkitTransform: + encoder << *static_cast<const TransformAnimationValue*>(value)->value(); + break; +#if ENABLE(CSS_FILTERS) + case AnimatedPropertyWebkitFilter: + encoder << *static_cast<const FilterAnimationValue*>(value)->value(); + break; #endif + default: + break; + } + } +} + +bool ArgumentCoder<GraphicsLayerAnimation>::decode(ArgumentDecoder* decoder, GraphicsLayerAnimation& animation) +{ + String name; + IntSize boxSize; + GraphicsLayerAnimation::AnimationState state; + double startTime; + double pauseTime; + bool listsMatch; + + Animation::AnimationDirection direction; + unsigned fillMode; + double duration; + double iterationCount; + RefPtr<TimingFunction> timingFunction; + RefPtr<Animation> animationObject; + + if (!decoder->decode(name)) + return false; + if (!decoder->decode(boxSize)) + return false; + if (!decoder->decodeEnum(state)) + return false; + if (!decoder->decodeDouble(startTime)) + return false; + if (!decoder->decodeDouble(pauseTime)) + return false; + if (!decoder->decodeBool(listsMatch)) + return false; + if (!decoder->decodeEnum(direction)) + return false; + if (!decoder->decodeUInt32(fillMode)) + return false; + if (!decoder->decodeDouble(duration)) + return false; + if (!decoder->decodeDouble(iterationCount)) + return false; + if (!decodeTimingFunction(decoder, timingFunction)) + return false; + + animationObject = Animation::create(); + animationObject->setDirection(direction); + animationObject->setFillMode(fillMode); + animationObject->setDuration(duration); + animationObject->setIterationCount(iterationCount); + if (timingFunction) + animationObject->setTimingFunction(timingFunction); + + AnimatedPropertyID property; + if (!decoder->decodeEnum(property)) + return false; + KeyframeValueList keyframes(property); + unsigned keyframesSize; + if (!decoder->decodeUInt32(keyframesSize)) + return false; + for (unsigned i = 0; i < keyframesSize; ++i) { + float keyTime; + RefPtr<TimingFunction> timingFunction; + if (!decoder->decode(keyTime)) + return false; + if (!decodeTimingFunction(decoder, timingFunction)) + return false; + + switch (property) { + case AnimatedPropertyOpacity: { + float value; + if (!decoder->decodeFloat(value)) + return false; + keyframes.insert(new FloatAnimationValue(keyTime, value, timingFunction)); + break; + } + case AnimatedPropertyWebkitTransform: { + TransformOperations transform; + if (!decoder->decode(transform)) + return false; + keyframes.insert(new TransformAnimationValue(keyTime, &transform, timingFunction)); + break; + } +#if ENABLE(CSS_FILTERS) + case AnimatedPropertyWebkitFilter: { + FilterOperations filter; + if (!decoder->decode(filter)) + return false; + keyframes.insert(new FilterAnimationValue(keyTime, &filter, timingFunction)); + break; + } +#endif + default: + break; + } + } + + animation = GraphicsLayerAnimation(name, keyframes, boxSize, animationObject.get(), startTime, listsMatch); + animation.setState(state, pauseTime); + + return true; +} + +void ArgumentCoder<GraphicsLayerAnimations>::encode(ArgumentEncoder& encoder, const GraphicsLayerAnimations& animations) +{ + encoder << animations.animations(); +} + +bool ArgumentCoder<GraphicsLayerAnimations>::decode(ArgumentDecoder* decoder, GraphicsLayerAnimations& animations) +{ + return decoder->decode(animations.animations()); +} #if USE(GRAPHICS_SURFACE) -void ArgumentCoder<WebCore::GraphicsSurfaceToken>::encode(ArgumentEncoder* encoder, const WebCore::GraphicsSurfaceToken& token) +void ArgumentCoder<WebCore::GraphicsSurfaceToken>::encode(ArgumentEncoder& encoder, const WebCore::GraphicsSurfaceToken& token) { #if OS(DARWIN) - encoder->encode(static_cast<uint32_t>(token.frontBufferHandle)); - encoder->encode(static_cast<uint32_t>(token.backBufferHandle)); -#endif -#if OS(LINUX) - encoder->encode(static_cast<uint32_t>(token.frontBufferHandle)); + encoder << Attachment(token.frontBufferHandle, MACH_MSG_TYPE_MOVE_SEND); + encoder << Attachment(token.backBufferHandle, MACH_MSG_TYPE_MOVE_SEND); +#elif OS(WINDOWS) + encoder << reinterpret_cast<uint64_t>(token.frontBufferHandle); + encoder << reinterpret_cast<uint64_t>(token.backBufferHandle); +#elif OS(LINUX) + encoder << token.frontBufferHandle; #endif } bool ArgumentCoder<WebCore::GraphicsSurfaceToken>::decode(ArgumentDecoder* decoder, WebCore::GraphicsSurfaceToken& token) { -#if OS(DARWIN) - if (!decoder->decodeUInt32(token.frontBufferHandle)) +#if OS(WINDOWS) + uint64_t frontBufferHandle; + if (!decoder->decode(frontBufferHandle)) return false; - if (!decoder->decodeUInt32(token.backBufferHandle)) + token.frontBufferHandle = reinterpret_cast<GraphicsSurfaceToken::BufferHandle>(frontBufferHandle); + uint64_t backBufferHandle; + if (!decoder->decode(backBufferHandle)) return false; -#endif -#if OS(LINUX) - if (!decoder->decodeUInt32(token.frontBufferHandle)) + token.backBufferHandle = reinterpret_cast<GraphicsSurfaceToken::BufferHandle>(backBufferHandle); +#elif OS(DARWIN) + Attachment frontAttachment, backAttachment; + if (!decoder->decode(frontAttachment)) + return false; + if (!decoder->decode(backAttachment)) + return false; + + token = GraphicsSurfaceToken(frontAttachment.port(), backAttachment.port()); +#elif OS(LINUX) + if (!decoder->decode(token.frontBufferHandle)) return false; #endif return true; @@ -535,4 +769,5 @@ bool ArgumentCoder<WebCore::GraphicsSurfaceToken>::decode(ArgumentDecoder* decod #endif } // namespace CoreIPC + #endif // USE(COORDINATED_GRAPHICS) diff --git a/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.h b/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.h index 87b4c5fe7..8544a5342 100644 --- a/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.h +++ b/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.h @@ -33,17 +33,16 @@ namespace WebCore { class FloatPoint3D; +class GraphicsLayerAnimation; +class GraphicsLayerAnimations; class TransformationMatrix; +class TransformOperations; struct Length; #if ENABLE(CSS_FILTERS) class FilterOperations; #endif -#if ENABLE(CSS_SHADERS) -class TransformOperations; -#endif - #if USE(GRAPHICS_SURFACE) struct GraphicsSurfaceToken; #endif @@ -52,42 +51,51 @@ struct GraphicsSurfaceToken; namespace CoreIPC { template<> struct ArgumentCoder<WebCore::FloatPoint3D> { - static void encode(ArgumentEncoder*, const WebCore::FloatPoint3D&); + static void encode(ArgumentEncoder&, const WebCore::FloatPoint3D&); static bool decode(ArgumentDecoder*, WebCore::FloatPoint3D&); }; template<> struct ArgumentCoder<WebCore::Length> { - static void encode(ArgumentEncoder*, const WebCore::Length&); + static void encode(ArgumentEncoder&, const WebCore::Length&); static bool decode(ArgumentDecoder*, WebCore::Length&); }; template<> struct ArgumentCoder<WebCore::TransformationMatrix> { - static void encode(ArgumentEncoder*, const WebCore::TransformationMatrix&); + static void encode(ArgumentEncoder&, const WebCore::TransformationMatrix&); static bool decode(ArgumentDecoder*, WebCore::TransformationMatrix&); }; #if ENABLE(CSS_FILTERS) template<> struct ArgumentCoder<WebCore::FilterOperations> { - static void encode(ArgumentEncoder*, const WebCore::FilterOperations&); + static void encode(ArgumentEncoder&, const WebCore::FilterOperations&); static bool decode(ArgumentDecoder*, WebCore::FilterOperations&); }; #endif -#if ENABLE(CSS_SHADERS) template<> struct ArgumentCoder<WebCore::TransformOperations> { - static void encode(ArgumentEncoder*, const WebCore::TransformOperations&); + static void encode(ArgumentEncoder&, const WebCore::TransformOperations&); static bool decode(ArgumentDecoder*, WebCore::TransformOperations&); }; -#endif + +template<> struct ArgumentCoder<WebCore::GraphicsLayerAnimations> { + static void encode(ArgumentEncoder&, const WebCore::GraphicsLayerAnimations&); + static bool decode(ArgumentDecoder*, WebCore::GraphicsLayerAnimations&); +}; + +template<> struct ArgumentCoder<WebCore::GraphicsLayerAnimation> { + static void encode(ArgumentEncoder&, const WebCore::GraphicsLayerAnimation&); + static bool decode(ArgumentDecoder*, WebCore::GraphicsLayerAnimation&); +}; #if USE(GRAPHICS_SURFACE) template<> struct ArgumentCoder<WebCore::GraphicsSurfaceToken> { - static void encode(ArgumentEncoder*, const WebCore::GraphicsSurfaceToken&); + static void encode(ArgumentEncoder&, const WebCore::GraphicsSurfaceToken&); static bool decode(ArgumentDecoder*, WebCore::GraphicsSurfaceToken&); }; #endif } // namespace CoreIPC + #endif // USE(COORDINATED_GRAPHICS) #endif // CoordinatedGraphicsArgumentCoders_h diff --git a/Source/WebKit2/Shared/CoordinatedGraphics/WebCustomFilterProgram.h b/Source/WebKit2/Shared/CoordinatedGraphics/WebCustomFilterProgram.h index eb097c295..603618dcb 100644 --- a/Source/WebKit2/Shared/CoordinatedGraphics/WebCustomFilterProgram.h +++ b/Source/WebKit2/Shared/CoordinatedGraphics/WebCustomFilterProgram.h @@ -27,15 +27,16 @@ #define WebCustomFilterProgram_h #if USE(COORDINATED_GRAPHICS) && ENABLE(CSS_SHADERS) +#include <WebCore/CustomFilterConstants.h> #include <WebCore/CustomFilterProgram.h> namespace WebKit { class WebCustomFilterProgram : public WebCore::CustomFilterProgram { public: - static PassRefPtr<WebCustomFilterProgram> create(String vertexShaderString, String m_fragmentShaderString, WebCore::CustomFilterProgramType programType, WebCore::CustomFilterProgramMixSettings mixSettings) + static PassRefPtr<WebCustomFilterProgram> create(String vertexShaderString, String m_fragmentShaderString, WebCore::CustomFilterProgramType programType, WebCore::CustomFilterProgramMixSettings mixSettings, WebCore::CustomFilterMeshType meshType) { - return adoptRef(new WebCustomFilterProgram(vertexShaderString, m_fragmentShaderString, programType, mixSettings)); + return adoptRef(new WebCustomFilterProgram(vertexShaderString, m_fragmentShaderString, programType, mixSettings, meshType)); } virtual bool isLoaded() const OVERRIDE { return true; } @@ -55,8 +56,8 @@ protected: virtual void didRemoveLastClient() OVERRIDE { } private: - WebCustomFilterProgram(String vertexShaderString, String fragmentShaderString, WebCore::CustomFilterProgramType programType, WebCore::CustomFilterProgramMixSettings mixSettings) - : WebCore::CustomFilterProgram(programType, mixSettings) + WebCustomFilterProgram(String vertexShaderString, String fragmentShaderString, WebCore::CustomFilterProgramType programType, WebCore::CustomFilterProgramMixSettings mixSettings, WebCore::CustomFilterMeshType meshType) + : WebCore::CustomFilterProgram(programType, mixSettings, meshType) , m_vertexShaderString(vertexShaderString) , m_fragmentShaderString(fragmentShaderString) { diff --git a/Source/WebKit2/Shared/DictionaryPopupInfo.cpp b/Source/WebKit2/Shared/DictionaryPopupInfo.cpp index 7e6df3a5c..f14eea3c7 100644 --- a/Source/WebKit2/Shared/DictionaryPopupInfo.cpp +++ b/Source/WebKit2/Shared/DictionaryPopupInfo.cpp @@ -34,15 +34,15 @@ namespace WebKit { -void DictionaryPopupInfo::encode(CoreIPC::ArgumentEncoder* encoder) const +void DictionaryPopupInfo::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(origin); - encoder->encode(fontInfo); - encoder->encodeEnum(type); + encoder << origin; + encoder << fontInfo; + encoder.encodeEnum(type); #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 bool hadOptions = options; - encoder->encode(hadOptions); + encoder << hadOptions; if (hadOptions) CoreIPC::encode(encoder, options.get()); #endif diff --git a/Source/WebKit2/Shared/DictionaryPopupInfo.h b/Source/WebKit2/Shared/DictionaryPopupInfo.h index bcec04c45..27eb6db37 100644 --- a/Source/WebKit2/Shared/DictionaryPopupInfo.h +++ b/Source/WebKit2/Shared/DictionaryPopupInfo.h @@ -41,7 +41,7 @@ namespace CoreIPC { namespace WebKit { struct DictionaryPopupInfo { - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, DictionaryPopupInfo&); enum Type { diff --git a/Source/WebKit2/Shared/DrawingAreaInfo.h b/Source/WebKit2/Shared/DrawingAreaInfo.h index c0e11658f..ae4ed76b4 100644 --- a/Source/WebKit2/Shared/DrawingAreaInfo.h +++ b/Source/WebKit2/Shared/DrawingAreaInfo.h @@ -33,6 +33,9 @@ enum DrawingAreaType { #if PLATFORM(MAC) && ENABLE(THREADED_SCROLLING) DrawingAreaTypeTiledCoreAnimation, #endif +#if PLATFORM(MAC) + DrawingAreaTypeRemoteLayerTree, +#endif }; } // namespace WebKit diff --git a/Source/WebKit2/Shared/EditorState.cpp b/Source/WebKit2/Shared/EditorState.cpp index 6e44a0f15..f7bde2a5c 100644 --- a/Source/WebKit2/Shared/EditorState.cpp +++ b/Source/WebKit2/Shared/EditorState.cpp @@ -31,25 +31,25 @@ namespace WebKit { -void EditorState::encode(CoreIPC::ArgumentEncoder* encoder) const +void EditorState::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(shouldIgnoreCompositionSelectionChange); - encoder->encode(selectionIsNone); - encoder->encode(selectionIsRange); - encoder->encode(isContentEditable); - encoder->encode(isContentRichlyEditable); - encoder->encode(isInPasswordField); - encoder->encode(hasComposition); + encoder << shouldIgnoreCompositionSelectionChange; + encoder << selectionIsNone; + encoder << selectionIsRange; + encoder << isContentEditable; + encoder << isContentRichlyEditable; + encoder << isInPasswordField; + encoder << hasComposition; #if PLATFORM(QT) - encoder->encode(cursorPosition); - encoder->encode(anchorPosition); - encoder->encode(editorRect); - encoder->encode(cursorRect); - encoder->encode(compositionRect); - encoder->encode(inputMethodHints); - encoder->encode(selectedText); - encoder->encode(surroundingText); + encoder << cursorPosition; + encoder << anchorPosition; + encoder << editorRect; + encoder << cursorRect; + encoder << compositionRect; + encoder << inputMethodHints; + encoder << selectedText; + encoder << surroundingText; #endif } diff --git a/Source/WebKit2/Shared/EditorState.h b/Source/WebKit2/Shared/EditorState.h index ac1d793ac..06ea087b8 100644 --- a/Source/WebKit2/Shared/EditorState.h +++ b/Source/WebKit2/Shared/EditorState.h @@ -74,7 +74,7 @@ struct EditorState { WTF::String surroundingText; #endif - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, EditorState&); }; diff --git a/Source/WebKit2/Shared/FontInfo.cpp b/Source/WebKit2/Shared/FontInfo.cpp index cd0263045..33ed47428 100644 --- a/Source/WebKit2/Shared/FontInfo.cpp +++ b/Source/WebKit2/Shared/FontInfo.cpp @@ -34,10 +34,10 @@ namespace WebKit { -void FontInfo::encode(CoreIPC::ArgumentEncoder* encoder) const +void FontInfo::encode(CoreIPC::ArgumentEncoder& encoder) const { #if PLATFORM(MAC) - encoder->encode(static_cast<bool>(fontAttributeDictionary)); + encoder << static_cast<bool>(fontAttributeDictionary); if (fontAttributeDictionary) CoreIPC::encode(encoder, fontAttributeDictionary.get()); #else diff --git a/Source/WebKit2/Shared/FontInfo.h b/Source/WebKit2/Shared/FontInfo.h index 23ea945ca..ae11d1275 100644 --- a/Source/WebKit2/Shared/FontInfo.h +++ b/Source/WebKit2/Shared/FontInfo.h @@ -38,7 +38,7 @@ namespace CoreIPC { namespace WebKit { struct FontInfo { - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, FontInfo&); #if PLATFORM(MAC) diff --git a/Source/WebKit2/Shared/IntentData.cpp b/Source/WebKit2/Shared/IntentData.cpp index 41078747c..757819e45 100644 --- a/Source/WebKit2/Shared/IntentData.cpp +++ b/Source/WebKit2/Shared/IntentData.cpp @@ -56,15 +56,15 @@ IntentData::IntentData(Intent* coreIntent) } } -void IntentData::encode(CoreIPC::ArgumentEncoder* encoder) const +void IntentData::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(action); - encoder->encode(type); - encoder->encode(service); - encoder->encode(CoreIPC::DataReference(data)); - encoder->encode(extras); - encoder->encode(suggestions); - encoder->encode(messagePorts); + encoder.encode(action); + encoder.encode(type); + encoder.encode(service); + encoder.encode(CoreIPC::DataReference(data)); + encoder.encode(extras); + encoder.encode(suggestions); + encoder.encode(messagePorts); } bool IntentData::decode(CoreIPC::ArgumentDecoder* decoder, IntentData& intentData) diff --git a/Source/WebKit2/Shared/IntentData.h b/Source/WebKit2/Shared/IntentData.h index e8435c284..e3adb190e 100644 --- a/Source/WebKit2/Shared/IntentData.h +++ b/Source/WebKit2/Shared/IntentData.h @@ -48,7 +48,7 @@ struct IntentData { IntentData() { } explicit IntentData(WebCore::Intent*); - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, IntentData&); String action; diff --git a/Source/WebKit2/Shared/IntentServiceInfo.cpp b/Source/WebKit2/Shared/IntentServiceInfo.cpp index bd954847f..340200ed1 100644 --- a/Source/WebKit2/Shared/IntentServiceInfo.cpp +++ b/Source/WebKit2/Shared/IntentServiceInfo.cpp @@ -35,13 +35,13 @@ using namespace WebCore; namespace WebKit { -void IntentServiceInfo::encode(CoreIPC::ArgumentEncoder* encoder) const +void IntentServiceInfo::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(action); - encoder->encode(type); - encoder->encode(href); - encoder->encode(title); - encoder->encode(disposition); + encoder.encode(action); + encoder.encode(type); + encoder.encode(href); + encoder.encode(title); + encoder.encode(disposition); } bool IntentServiceInfo::decode(CoreIPC::ArgumentDecoder* decoder, IntentServiceInfo& intentServiceInfo) diff --git a/Source/WebKit2/Shared/IntentServiceInfo.h b/Source/WebKit2/Shared/IntentServiceInfo.h index 59c0470c5..ff13d3b8e 100644 --- a/Source/WebKit2/Shared/IntentServiceInfo.h +++ b/Source/WebKit2/Shared/IntentServiceInfo.h @@ -40,7 +40,7 @@ class ArgumentEncoder; namespace WebKit { struct IntentServiceInfo { - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, IntentServiceInfo&); String action; diff --git a/Source/WebKit2/Shared/LayerTreeContext.h b/Source/WebKit2/Shared/LayerTreeContext.h index 5206a373c..f8e2fce61 100644 --- a/Source/WebKit2/Shared/LayerTreeContext.h +++ b/Source/WebKit2/Shared/LayerTreeContext.h @@ -47,7 +47,7 @@ public: LayerTreeContext(); ~LayerTreeContext(); - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, LayerTreeContext&); bool isEmpty() const; diff --git a/Source/WebKit2/Shared/NativeWebKeyboardEvent.h b/Source/WebKit2/Shared/NativeWebKeyboardEvent.h index 2d3bb10d2..ff54eda36 100644 --- a/Source/WebKit2/Shared/NativeWebKeyboardEvent.h +++ b/Source/WebKit2/Shared/NativeWebKeyboardEvent.h @@ -56,7 +56,7 @@ public: NativeWebKeyboardEvent(const NativeWebKeyboardEvent&); NativeWebKeyboardEvent(GdkEvent*); #elif PLATFORM(EFL) - NativeWebKeyboardEvent(const Evas_Event_Key_Down*); + NativeWebKeyboardEvent(const Evas_Event_Key_Down*, bool); NativeWebKeyboardEvent(const Evas_Event_Key_Up*); #endif @@ -70,6 +70,7 @@ public: GdkEvent* nativeEvent() const { return m_nativeEvent.get(); } #elif PLATFORM(EFL) const void* nativeEvent() const { return m_nativeEvent; } + bool isFiltered() const { return m_isFiltered; } #endif private: @@ -83,6 +84,7 @@ private: GOwnPtr<GdkEvent> m_nativeEvent; #elif PLATFORM(EFL) const void* m_nativeEvent; + bool m_isFiltered; #endif }; diff --git a/Source/WebKit2/Shared/NativeWebMouseEvent.h b/Source/WebKit2/Shared/NativeWebMouseEvent.h index 2de5c6ce7..c23d2f8f2 100644 --- a/Source/WebKit2/Shared/NativeWebMouseEvent.h +++ b/Source/WebKit2/Shared/NativeWebMouseEvent.h @@ -38,6 +38,7 @@ OBJC_CLASS NSView; typedef union _GdkEvent GdkEvent; #elif PLATFORM(EFL) #include <Evas.h> +#include <WebCore/AffineTransform.h> #endif namespace WebKit { @@ -54,9 +55,9 @@ public: NativeWebMouseEvent(const NativeWebMouseEvent&); NativeWebMouseEvent(GdkEvent*, int); #elif PLATFORM(EFL) - NativeWebMouseEvent(const Evas_Event_Mouse_Down*, const Evas_Point*); - NativeWebMouseEvent(const Evas_Event_Mouse_Up*, const Evas_Point*); - NativeWebMouseEvent(const Evas_Event_Mouse_Move*, const Evas_Point*); + NativeWebMouseEvent(const Evas_Event_Mouse_Down*, const WebCore::AffineTransform&, const WebCore::AffineTransform&); + NativeWebMouseEvent(const Evas_Event_Mouse_Up*, const WebCore::AffineTransform&, const WebCore::AffineTransform&); + NativeWebMouseEvent(const Evas_Event_Mouse_Move*, const WebCore::AffineTransform&, const WebCore::AffineTransform&); #endif #if USE(APPKIT) diff --git a/Source/WebKit2/Shared/NativeWebTouchEvent.h b/Source/WebKit2/Shared/NativeWebTouchEvent.h index 49bbf8010..c63d1cf07 100644 --- a/Source/WebKit2/Shared/NativeWebTouchEvent.h +++ b/Source/WebKit2/Shared/NativeWebTouchEvent.h @@ -33,6 +33,7 @@ #elif PLATFORM(EFL) #include "ewk_touch.h" #include <Evas.h> +#include <WebCore/AffineTransform.h> #endif namespace WebKit { @@ -42,7 +43,7 @@ public: #if PLATFORM(QT) explicit NativeWebTouchEvent(const QTouchEvent*, const QTransform& fromItemTransform); #elif PLATFORM(EFL) - NativeWebTouchEvent(Ewk_Touch_Event_Type, const Eina_List*, const Evas_Modifier*, const Evas_Point*, double timestamp); + NativeWebTouchEvent(Ewk_Touch_Event_Type, const Eina_List*, const Evas_Modifier*, const WebCore::AffineTransform& toWebContent, const WebCore::AffineTransform& toDeviceScreen, double timestamp); #endif #if PLATFORM(QT) diff --git a/Source/WebKit2/Shared/NativeWebWheelEvent.h b/Source/WebKit2/Shared/NativeWebWheelEvent.h index 3721e941b..43d708e30 100644 --- a/Source/WebKit2/Shared/NativeWebWheelEvent.h +++ b/Source/WebKit2/Shared/NativeWebWheelEvent.h @@ -38,6 +38,7 @@ OBJC_CLASS NSView; typedef union _GdkEvent GdkEvent; #elif PLATFORM(EFL) #include <Evas.h> +#include <WebCore/AffineTransform.h> #endif namespace WebKit { @@ -54,7 +55,7 @@ public: NativeWebWheelEvent(const NativeWebWheelEvent&); NativeWebWheelEvent(GdkEvent*); #elif PLATFORM(EFL) - NativeWebWheelEvent(const Evas_Event_Mouse_Wheel*, const Evas_Point*); + NativeWebWheelEvent(const Evas_Event_Mouse_Wheel*, const WebCore::AffineTransform& toWebContent, const WebCore::AffineTransform& toDeviceScreen); #endif #if USE(APPKIT) diff --git a/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.cpp b/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.cpp index efbe3572d..8ea946724 100644 --- a/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.cpp +++ b/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.cpp @@ -36,10 +36,10 @@ NetworkProcessCreationParameters::NetworkProcessCreationParameters() { } -void NetworkProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) const +void NetworkProcessCreationParameters::encode(CoreIPC::ArgumentEncoder& encoder) const { #if PLATFORM(MAC) - encoder->encode(parentProcessName); + encoder << parentProcessName; #endif } diff --git a/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.h b/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.h index 4f59e2941..ebc03a7ed 100644 --- a/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.h +++ b/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.h @@ -40,7 +40,7 @@ namespace WebKit { struct NetworkProcessCreationParameters { NetworkProcessCreationParameters(); - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, NetworkProcessCreationParameters&); #if PLATFORM(MAC) diff --git a/Source/WebKit2/Shared/OriginAndDatabases.cpp b/Source/WebKit2/Shared/OriginAndDatabases.cpp index 0ad0549ad..5d86c2b65 100644 --- a/Source/WebKit2/Shared/OriginAndDatabases.cpp +++ b/Source/WebKit2/Shared/OriginAndDatabases.cpp @@ -34,12 +34,12 @@ using namespace WebCore; namespace WebKit { -void OriginAndDatabases::encode(CoreIPC::ArgumentEncoder* encoder) const +void OriginAndDatabases::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(originIdentifier); - encoder->encode(originQuota); - encoder->encode(originUsage); - encoder->encode(databases); + encoder << originIdentifier; + encoder << originQuota; + encoder << originUsage; + encoder << databases; } bool OriginAndDatabases::decode(CoreIPC::ArgumentDecoder* decoder, OriginAndDatabases& originAndDatabases) diff --git a/Source/WebKit2/Shared/OriginAndDatabases.h b/Source/WebKit2/Shared/OriginAndDatabases.h index 51ef4fae7..ec064f91c 100644 --- a/Source/WebKit2/Shared/OriginAndDatabases.h +++ b/Source/WebKit2/Shared/OriginAndDatabases.h @@ -40,7 +40,7 @@ namespace CoreIPC { namespace WebKit { struct OriginAndDatabases { - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, OriginAndDatabases&); String originIdentifier; diff --git a/Source/WebKit2/Shared/PlatformPopupMenuData.cpp b/Source/WebKit2/Shared/PlatformPopupMenuData.cpp index 1decaacc5..9cb223c54 100644 --- a/Source/WebKit2/Shared/PlatformPopupMenuData.cpp +++ b/Source/WebKit2/Shared/PlatformPopupMenuData.cpp @@ -44,28 +44,28 @@ PlatformPopupMenuData::PlatformPopupMenuData() { } -void PlatformPopupMenuData::encode(CoreIPC::ArgumentEncoder* encoder) const +void PlatformPopupMenuData::encode(CoreIPC::ArgumentEncoder& encoder) const { #if PLATFORM(WIN) - encoder->encode(m_clientPaddingLeft); - encoder->encode(m_clientPaddingRight); - encoder->encode(m_clientInsetLeft); - encoder->encode(m_clientInsetRight); - encoder->encode(m_popupWidth); - encoder->encode(m_itemHeight); + encoder << m_clientPaddingLeft; + encoder << m_clientPaddingRight; + encoder << m_clientInsetLeft; + encoder << m_clientInsetRight; + encoder << m_popupWidth; + encoder << m_itemHeight; ShareableBitmap::Handle notSelectedBackingStoreHandle; m_notSelectedBackingStore->createHandle(notSelectedBackingStoreHandle); - encoder->encode(notSelectedBackingStoreHandle); + encoder << notSelectedBackingStoreHandle; ShareableBitmap::Handle selectedBackingStoreHandle; m_selectedBackingStore->createHandle(selectedBackingStoreHandle); - encoder->encode(selectedBackingStoreHandle); + encoder << selectedBackingStoreHandle; #elif PLATFORM(MAC) - encoder->encode(fontInfo); - encoder->encode(shouldPopOver); + encoder << fontInfo; + encoder << shouldPopOver; #elif PLATFORM(QT) - encoder->encode(multipleSelections); + encoder << multipleSelections; #else UNUSED_PARAM(encoder); #endif diff --git a/Source/WebKit2/Shared/PlatformPopupMenuData.h b/Source/WebKit2/Shared/PlatformPopupMenuData.h index 21abde4ff..7d9d94d2a 100644 --- a/Source/WebKit2/Shared/PlatformPopupMenuData.h +++ b/Source/WebKit2/Shared/PlatformPopupMenuData.h @@ -40,7 +40,7 @@ namespace WebKit { struct PlatformPopupMenuData { PlatformPopupMenuData(); - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, PlatformPopupMenuData&); #if PLATFORM(WIN) diff --git a/Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp b/Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp index ff2bef140..a297bc438 100644 --- a/Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp +++ b/Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp @@ -67,13 +67,13 @@ NPIdentifier NPIdentifierData::createNPIdentifier() const return static_cast<NPIdentifier>(IdentifierRep::get(m_number)); } -void NPIdentifierData::encode(CoreIPC::ArgumentEncoder* encoder) const +void NPIdentifierData::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(m_isString); + encoder << m_isString; if (m_isString) - encoder->encode(m_string); + encoder << m_string; else - encoder->encode(m_number); + encoder << m_number; } bool NPIdentifierData::decode(CoreIPC::ArgumentDecoder* decoder, NPIdentifierData& result) diff --git a/Source/WebKit2/Shared/Plugins/NPIdentifierData.h b/Source/WebKit2/Shared/Plugins/NPIdentifierData.h index 1a7c772a7..56d57fc96 100644 --- a/Source/WebKit2/Shared/Plugins/NPIdentifierData.h +++ b/Source/WebKit2/Shared/Plugins/NPIdentifierData.h @@ -47,7 +47,7 @@ public: static NPIdentifierData fromNPIdentifier(NPIdentifier); NPIdentifier createNPIdentifier() const; - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, NPIdentifierData&); private: diff --git a/Source/WebKit2/Shared/Plugins/NPVariantData.cpp b/Source/WebKit2/Shared/Plugins/NPVariantData.cpp index 04bb3f5bd..db96dc71f 100644 --- a/Source/WebKit2/Shared/Plugins/NPVariantData.cpp +++ b/Source/WebKit2/Shared/Plugins/NPVariantData.cpp @@ -118,31 +118,31 @@ NPVariantData NPVariantData::makeRemoteNPObjectID(uint64_t value) return npVariantData; } -void NPVariantData::encode(CoreIPC::ArgumentEncoder* encoder) const +void NPVariantData::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(m_type); + encoder << m_type; switch (type()) { case NPVariantData::Void: case NPVariantData::Null: break; case NPVariantData::Bool: - encoder->encode(boolValue()); + encoder << boolValue(); break; case NPVariantData::Int32: - encoder->encode(int32Value()); + encoder << int32Value(); break; case NPVariantData::Double: - encoder->encode(doubleValue()); + encoder << doubleValue(); break; case NPVariantData::String: - encoder->encode(stringValue()); + encoder << stringValue(); break; case NPVariantData::LocalNPObjectID: - encoder->encode(localNPObjectIDValue()); + encoder << localNPObjectIDValue(); break; case NPVariantData::RemoteNPObjectID: - encoder->encode(remoteNPObjectIDValue()); + encoder << remoteNPObjectIDValue(); break; } } diff --git a/Source/WebKit2/Shared/Plugins/NPVariantData.h b/Source/WebKit2/Shared/Plugins/NPVariantData.h index 805640e9e..a23204616 100644 --- a/Source/WebKit2/Shared/Plugins/NPVariantData.h +++ b/Source/WebKit2/Shared/Plugins/NPVariantData.h @@ -100,7 +100,7 @@ public: return m_remoteNPObjectIDValue; } - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, NPVariantData&); private: diff --git a/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm b/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm index 81b38e0ec..3dc377c44 100644 --- a/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm +++ b/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm @@ -352,11 +352,10 @@ static bool getPluginInfoFromCarbonResources(CFBundleRef bundle, PluginModuleInf bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginModuleInfo& plugin) { - RetainPtr<CFStringRef> bundlePath(AdoptCF, pluginPath.createCFString()); - RetainPtr<CFURLRef> bundleURL(AdoptCF, CFURLCreateWithFileSystemPath(kCFAllocatorDefault, bundlePath.get(), kCFURLPOSIXPathStyle, false)); + RetainPtr<CFURLRef> bundleURL = adoptCF(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, pluginPath.createCFString().get(), kCFURLPOSIXPathStyle, false)); // Try to initialize the bundle. - RetainPtr<CFBundleRef> bundle(AdoptCF, CFBundleCreate(kCFAllocatorDefault, bundleURL.get())); + RetainPtr<CFBundleRef> bundle = adoptCF(CFBundleCreate(kCFAllocatorDefault, bundleURL.get())); if (!bundle) return false; @@ -395,11 +394,9 @@ bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginModuleI bool NetscapePluginModule::createPluginMIMETypesPreferences(const String& pluginPath) { - RetainPtr<CFStringRef> bundlePath(AdoptCF, pluginPath.createCFString()); - RetainPtr<CFURLRef> bundleURL(AdoptCF, CFURLCreateWithFileSystemPath(kCFAllocatorDefault, bundlePath.get(), kCFURLPOSIXPathStyle, false)); + RetainPtr<CFURLRef> bundleURL = adoptCF(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, pluginPath.createCFString().get(), kCFURLPOSIXPathStyle, false)); - // Try to initialize the bundle. - RetainPtr<CFBundleRef> bundle(AdoptCF, CFBundleCreate(kCFAllocatorDefault, bundleURL.get())); + RetainPtr<CFBundleRef> bundle = adoptCF(CFBundleCreate(kCFAllocatorDefault, bundleURL.get())); if (!bundle) return false; diff --git a/Source/WebKit2/Shared/Plugins/PluginModuleInfo.h b/Source/WebKit2/Shared/Plugins/PluginModuleInfo.h index a232db3c1..9e50f6396 100644 --- a/Source/WebKit2/Shared/Plugins/PluginModuleInfo.h +++ b/Source/WebKit2/Shared/Plugins/PluginModuleInfo.h @@ -34,6 +34,18 @@ namespace WebKit { +enum PluginModuleLoadPolicy { + // The plug-in module should be loaded normally. + PluginModuleLoadNormally, + + // The plug-in should be blocked from being instantiated. + // Note that the plug-in will still be seen by e.g. navigator.plugins + PluginModuleBlocked, + + // The plug-in module is inactive and should not be instantiated unless the user explicitly allows it. + PluginModuleInactive +}; + struct PluginModuleInfo { String path; WebCore::PluginInfo info; diff --git a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp index 1a0a52c41..f53c26e6b 100644 --- a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp +++ b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp @@ -37,17 +37,17 @@ PluginProcessCreationParameters::PluginProcessCreationParameters() { } -void PluginProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) const +void PluginProcessCreationParameters::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(pluginPath); - encoder->encode(supportsAsynchronousPluginInitialization); - encoder->encode(minimumLifetime); - encoder->encode(terminationTimeout); + encoder << pluginPath; + encoder << supportsAsynchronousPluginInitialization; + encoder << minimumLifetime; + encoder << terminationTimeout; #if PLATFORM(MAC) - encoder->encode(parentProcessName); - encoder->encode(acceleratedCompositingPort); - encoder->encode(sandboxProfileDirectoryPath); + encoder << parentProcessName; + encoder << acceleratedCompositingPort; + encoder << sandboxProfileDirectoryPath; #endif } diff --git a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h index 544374ad1..a414212be 100644 --- a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h +++ b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h @@ -44,7 +44,7 @@ namespace WebKit { struct PluginProcessCreationParameters { PluginProcessCreationParameters(); - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, PluginProcessCreationParameters&); String pluginPath; diff --git a/Source/WebKit2/Shared/PrintInfo.cpp b/Source/WebKit2/Shared/PrintInfo.cpp index 107884a07..faf008c79 100644 --- a/Source/WebKit2/Shared/PrintInfo.cpp +++ b/Source/WebKit2/Shared/PrintInfo.cpp @@ -43,11 +43,11 @@ PrintInfo::PrintInfo() { } -void PrintInfo::encode(CoreIPC::ArgumentEncoder* encoder) const +void PrintInfo::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(pageSetupScaleFactor); - encoder->encode(availablePaperWidth); - encoder->encode(availablePaperHeight); + encoder << pageSetupScaleFactor; + encoder << availablePaperWidth; + encoder << availablePaperHeight; #if PLATFORM(GTK) CoreIPC::encode(encoder, printSettings.get()); diff --git a/Source/WebKit2/Shared/PrintInfo.h b/Source/WebKit2/Shared/PrintInfo.h index b73b7c5e3..97facebd0 100644 --- a/Source/WebKit2/Shared/PrintInfo.h +++ b/Source/WebKit2/Shared/PrintInfo.h @@ -63,7 +63,7 @@ struct PrintInfo { GRefPtr<GtkPageSetup> pageSetup; #endif - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, PrintInfo&); }; diff --git a/Source/WebKit2/Shared/SandboxExtension.h b/Source/WebKit2/Shared/SandboxExtension.h index 4fdb1ed63..e1a904af1 100644 --- a/Source/WebKit2/Shared/SandboxExtension.h +++ b/Source/WebKit2/Shared/SandboxExtension.h @@ -58,7 +58,7 @@ public: Handle(); ~Handle(); - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, Handle&); private: @@ -78,7 +78,7 @@ public: Handle& operator[](size_t i); const Handle& operator[](size_t i) const; size_t size() const; - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, HandleArray&); private: @@ -114,7 +114,7 @@ private: #if !ENABLE(WEB_PROCESS_SANDBOX) inline SandboxExtension::Handle::Handle() { } inline SandboxExtension::Handle::~Handle() { } -inline void SandboxExtension::Handle::encode(CoreIPC::ArgumentEncoder*) const { } +inline void SandboxExtension::Handle::encode(CoreIPC::ArgumentEncoder&) const { } inline bool SandboxExtension::Handle::decode(CoreIPC::ArgumentDecoder*, Handle&) { return true; } inline SandboxExtension::HandleArray::HandleArray() { } inline SandboxExtension::HandleArray::~HandleArray() { } @@ -122,7 +122,7 @@ inline void SandboxExtension::HandleArray::allocate(size_t) { } inline size_t SandboxExtension::HandleArray::size() const { return 0; } inline const SandboxExtension::Handle& SandboxExtension::HandleArray::operator[](size_t) const { return m_emptyHandle; } inline SandboxExtension::Handle& SandboxExtension::HandleArray::operator[](size_t) { return m_emptyHandle; } -inline void SandboxExtension::HandleArray::encode(CoreIPC::ArgumentEncoder*) const { } +inline void SandboxExtension::HandleArray::encode(CoreIPC::ArgumentEncoder&) const { } inline bool SandboxExtension::HandleArray::decode(CoreIPC::ArgumentDecoder*, HandleArray&) { return true; } inline PassRefPtr<SandboxExtension> SandboxExtension::create(const Handle&) { return 0; } inline void SandboxExtension::createHandle(const String&, Type, Handle&) { } diff --git a/Source/WebKit2/Shared/SecurityOriginData.cpp b/Source/WebKit2/Shared/SecurityOriginData.cpp index cf9551bfc..4968036f7 100644 --- a/Source/WebKit2/Shared/SecurityOriginData.cpp +++ b/Source/WebKit2/Shared/SecurityOriginData.cpp @@ -35,11 +35,11 @@ using namespace WebCore; namespace WebKit { -void SecurityOriginData::encode(CoreIPC::ArgumentEncoder* encoder) const +void SecurityOriginData::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(protocol); - encoder->encode(host); - encoder->encode(port); + encoder << protocol; + encoder << host; + encoder << port; } bool SecurityOriginData::decode(CoreIPC::ArgumentDecoder* decoder, SecurityOriginData& securityOriginData) diff --git a/Source/WebKit2/Shared/SecurityOriginData.h b/Source/WebKit2/Shared/SecurityOriginData.h index 692a96e15..93909bc6e 100644 --- a/Source/WebKit2/Shared/SecurityOriginData.h +++ b/Source/WebKit2/Shared/SecurityOriginData.h @@ -40,7 +40,7 @@ namespace WebKit { typedef GenericCallback<WKArrayRef> ArrayCallback; struct SecurityOriginData { - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, SecurityOriginData&); // FIXME <rdar://9018386>: We should be sending more state across the wire than just the protocol, diff --git a/Source/WebKit2/Shared/SessionState.cpp b/Source/WebKit2/Shared/SessionState.cpp index b25289a32..c08e9aa95 100644 --- a/Source/WebKit2/Shared/SessionState.cpp +++ b/Source/WebKit2/Shared/SessionState.cpp @@ -30,9 +30,9 @@ namespace CoreIPC { // This assumes that when we encode a RefPtr we want to encode the object it points to and it is never null. template<typename T> struct ArgumentCoder<RefPtr<T> > { - static void encode(ArgumentEncoder* encoder, const RefPtr<T>& item) + static void encode(ArgumentEncoder& encoder, const RefPtr<T>& item) { - item->encode(*encoder); + item->encode(encoder); } static bool decode(ArgumentDecoder* decoder, RefPtr<T>& item) @@ -64,10 +64,10 @@ bool SessionState::isEmpty() const return m_list.isEmpty(); } -void SessionState::encode(CoreIPC::ArgumentEncoder* encoder) const +void SessionState::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(m_list); - encoder->encode(m_currentIndex); + encoder << m_list; + encoder << m_currentIndex; } bool SessionState::decode(CoreIPC::ArgumentDecoder* decoder, SessionState& state) diff --git a/Source/WebKit2/Shared/SessionState.h b/Source/WebKit2/Shared/SessionState.h index 8aa18948d..19422a1f0 100644 --- a/Source/WebKit2/Shared/SessionState.h +++ b/Source/WebKit2/Shared/SessionState.h @@ -45,7 +45,7 @@ public: bool isEmpty() const; - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, SessionState&); private: diff --git a/Source/WebKit2/Shared/ShareableBitmap.cpp b/Source/WebKit2/Shared/ShareableBitmap.cpp index cde3aa165..acae74ff6 100644 --- a/Source/WebKit2/Shared/ShareableBitmap.cpp +++ b/Source/WebKit2/Shared/ShareableBitmap.cpp @@ -39,11 +39,11 @@ ShareableBitmap::Handle::Handle() { } -void ShareableBitmap::Handle::encode(CoreIPC::ArgumentEncoder* encoder) const +void ShareableBitmap::Handle::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(m_handle); - encoder->encode(m_size); - encoder->encode(m_flags); + encoder << m_handle; + encoder << m_size; + encoder << m_flags; } bool ShareableBitmap::Handle::decode(CoreIPC::ArgumentDecoder* decoder, Handle& handle) diff --git a/Source/WebKit2/Shared/ShareableBitmap.h b/Source/WebKit2/Shared/ShareableBitmap.h index 2af228e6f..8dbf1ddfe 100644 --- a/Source/WebKit2/Shared/ShareableBitmap.h +++ b/Source/WebKit2/Shared/ShareableBitmap.h @@ -72,7 +72,7 @@ public: bool isNull() const { return m_handle.isNull(); } - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, Handle&); private: diff --git a/Source/WebKit2/Shared/ShareableSurface.cpp b/Source/WebKit2/Shared/ShareableSurface.cpp index f70769895..bf8fa1069 100644 --- a/Source/WebKit2/Shared/ShareableSurface.cpp +++ b/Source/WebKit2/Shared/ShareableSurface.cpp @@ -37,16 +37,16 @@ ShareableSurface::Handle::Handle() { } -void ShareableSurface::Handle::encode(CoreIPC::ArgumentEncoder* encoder) const +void ShareableSurface::Handle::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(m_size); - encoder->encode(m_flags); + encoder.encode(m_size); + encoder.encode(m_flags); #if USE(GRAPHICS_SURFACE) - encoder->encode(m_graphicsSurfaceToken); + encoder.encode(m_graphicsSurfaceToken); if (m_graphicsSurfaceToken.isValid()) return; #endif - encoder->encode(m_bitmapHandle); + encoder.encode(m_bitmapHandle); } bool ShareableSurface::Handle::decode(CoreIPC::ArgumentDecoder* decoder, Handle& handle) diff --git a/Source/WebKit2/Shared/ShareableSurface.h b/Source/WebKit2/Shared/ShareableSurface.h index 598dc5911..e0e7a39f2 100644 --- a/Source/WebKit2/Shared/ShareableSurface.h +++ b/Source/WebKit2/Shared/ShareableSurface.h @@ -51,7 +51,7 @@ public: bool isNull() const; - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, Handle&); #if USE(GRAPHICS_SURFACE) diff --git a/Source/WebKit2/Shared/SharedWorkerProcessCreationParameters.cpp b/Source/WebKit2/Shared/SharedWorkerProcessCreationParameters.cpp index b669307eb..87f496d8a 100644 --- a/Source/WebKit2/Shared/SharedWorkerProcessCreationParameters.cpp +++ b/Source/WebKit2/Shared/SharedWorkerProcessCreationParameters.cpp @@ -36,13 +36,13 @@ SharedWorkerProcessCreationParameters::SharedWorkerProcessCreationParameters() { } -void SharedWorkerProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) const +void SharedWorkerProcessCreationParameters::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(minimumLifetime); - encoder->encode(terminationTimeout); + encoder << minimumLifetime; + encoder << terminationTimeout; #if PLATFORM(MAC) - encoder->encode(parentProcessName); + encoder << parentProcessName; #endif } diff --git a/Source/WebKit2/Shared/SharedWorkerProcessCreationParameters.h b/Source/WebKit2/Shared/SharedWorkerProcessCreationParameters.h index 3fef97535..ccd257eb9 100644 --- a/Source/WebKit2/Shared/SharedWorkerProcessCreationParameters.h +++ b/Source/WebKit2/Shared/SharedWorkerProcessCreationParameters.h @@ -44,7 +44,7 @@ namespace WebKit { struct SharedWorkerProcessCreationParameters { SharedWorkerProcessCreationParameters(); - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, SharedWorkerProcessCreationParameters&); double minimumLifetime; diff --git a/Source/WebKit2/Shared/StatisticsData.cpp b/Source/WebKit2/Shared/StatisticsData.cpp index 59fef7a77..17dcdd9ec 100644 --- a/Source/WebKit2/Shared/StatisticsData.cpp +++ b/Source/WebKit2/Shared/StatisticsData.cpp @@ -30,12 +30,12 @@ namespace WebKit { -void StatisticsData::encode(CoreIPC::ArgumentEncoder* encoder) const +void StatisticsData::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(statisticsNumbers); - encoder->encode(javaScriptProtectedObjectTypeCounts); - encoder->encode(javaScriptObjectTypeCounts); - encoder->encode(webCoreCacheStatistics); + encoder << statisticsNumbers; + encoder << javaScriptProtectedObjectTypeCounts; + encoder << javaScriptObjectTypeCounts; + encoder << webCoreCacheStatistics; } bool StatisticsData::decode(CoreIPC::ArgumentDecoder* decoder, StatisticsData& statisticsData) diff --git a/Source/WebKit2/Shared/StatisticsData.h b/Source/WebKit2/Shared/StatisticsData.h index 2c82c28bd..7315ed250 100644 --- a/Source/WebKit2/Shared/StatisticsData.h +++ b/Source/WebKit2/Shared/StatisticsData.h @@ -36,7 +36,7 @@ namespace WebKit { struct StatisticsData { - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, StatisticsData&); HashMap<String, uint64_t> statisticsNumbers; diff --git a/Source/WebKit2/Shared/StringPairVector.h b/Source/WebKit2/Shared/StringPairVector.h index ce2da4a09..8cfd19d01 100644 --- a/Source/WebKit2/Shared/StringPairVector.h +++ b/Source/WebKit2/Shared/StringPairVector.h @@ -45,9 +45,9 @@ public: m_stringPairVector.swap(stringPairVector); } - void encode(CoreIPC::ArgumentEncoder* encoder) const + void encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(m_stringPairVector); + encoder << m_stringPairVector; } static bool decode(CoreIPC::ArgumentDecoder* decoder, StringPairVector& stringPairVector) diff --git a/Source/WebKit2/Shared/SurfaceUpdateInfo.cpp b/Source/WebKit2/Shared/SurfaceUpdateInfo.cpp index 15333793c..4147ceaa7 100644 --- a/Source/WebKit2/Shared/SurfaceUpdateInfo.cpp +++ b/Source/WebKit2/Shared/SurfaceUpdateInfo.cpp @@ -24,12 +24,12 @@ namespace WebKit { -void SurfaceUpdateInfo::encode(CoreIPC::ArgumentEncoder* encoder) const +void SurfaceUpdateInfo::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(updateRect); - encoder->encode(scaleFactor); - encoder->encode(surfaceHandle); - encoder->encode(surfaceOffset); + encoder.encode(updateRect); + encoder.encode(scaleFactor); + encoder.encode(atlasID); + encoder.encode(surfaceOffset); } bool SurfaceUpdateInfo::decode(CoreIPC::ArgumentDecoder* decoder, SurfaceUpdateInfo& result) @@ -38,7 +38,7 @@ bool SurfaceUpdateInfo::decode(CoreIPC::ArgumentDecoder* decoder, SurfaceUpdateI return false; if (!decoder->decode(result.scaleFactor)) return false; - if (!decoder->decode(result.surfaceHandle)) + if (!decoder->decode(result.atlasID)) return false; if (!decoder->decode(result.surfaceOffset)) return false; diff --git a/Source/WebKit2/Shared/SurfaceUpdateInfo.h b/Source/WebKit2/Shared/SurfaceUpdateInfo.h index 01d60d242..e08967d96 100644 --- a/Source/WebKit2/Shared/SurfaceUpdateInfo.h +++ b/Source/WebKit2/Shared/SurfaceUpdateInfo.h @@ -20,7 +20,6 @@ #ifndef SurfaceUpdateInfo_h #define SurfaceUpdateInfo_h -#include "ShareableSurface.h" #include <WebCore/IntRect.h> #include <wtf/Noncopyable.h> @@ -37,7 +36,7 @@ class SurfaceUpdateInfo { public: SurfaceUpdateInfo() { } - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, SurfaceUpdateInfo&); // The rect to be updated. @@ -46,8 +45,8 @@ public: // The page scale factor used to render this update. float scaleFactor; - // The handle of the shareable bitmap containing the updates. Will be null if there are no updates. - ShareableSurface::Handle surfaceHandle; + // The id of the update atlas including the shareable bitmap containing the updates. + int atlasID; // The offset in the bitmap where the rendered contents are. WebCore::IntPoint surfaceOffset; diff --git a/Source/WebKit2/Shared/UpdateInfo.cpp b/Source/WebKit2/Shared/UpdateInfo.cpp index 5bb189597..cf6b90620 100644 --- a/Source/WebKit2/Shared/UpdateInfo.cpp +++ b/Source/WebKit2/Shared/UpdateInfo.cpp @@ -30,17 +30,17 @@ namespace WebKit { -void UpdateInfo::encode(CoreIPC::ArgumentEncoder* encoder) const +void UpdateInfo::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(viewSize); - encoder->encode(deviceScaleFactor); - encoder->encode(scrollRect); - encoder->encode(scrollOffset); - encoder->encode(updateRectBounds); - encoder->encode(updateRects); - encoder->encode(updateScaleFactor); - encoder->encode(bitmapHandle); - encoder->encode(bitmapOffset); + encoder << viewSize; + encoder << deviceScaleFactor; + encoder << scrollRect; + encoder << scrollOffset; + encoder << updateRectBounds; + encoder << updateRects; + encoder << updateScaleFactor; + encoder << bitmapHandle; + encoder << bitmapOffset; } bool UpdateInfo::decode(CoreIPC::ArgumentDecoder* decoder, UpdateInfo& result) diff --git a/Source/WebKit2/Shared/UpdateInfo.h b/Source/WebKit2/Shared/UpdateInfo.h index e3a8de278..c11aa3542 100644 --- a/Source/WebKit2/Shared/UpdateInfo.h +++ b/Source/WebKit2/Shared/UpdateInfo.h @@ -43,7 +43,7 @@ class UpdateInfo { public: UpdateInfo() { } - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, UpdateInfo&); // The size of the web view. diff --git a/Source/WebKit2/Shared/UserMessageCoders.h b/Source/WebKit2/Shared/UserMessageCoders.h index 9d8ac5c6b..76236359a 100644 --- a/Source/WebKit2/Shared/UserMessageCoders.h +++ b/Source/WebKit2/Shared/UserMessageCoders.h @@ -67,119 +67,119 @@ namespace WebKit { template<typename Owner> class UserMessageEncoder { public: - bool baseEncode(CoreIPC::ArgumentEncoder* encoder, APIObject::Type& type) const + bool baseEncode(CoreIPC::ArgumentEncoder& encoder, APIObject::Type& type) const { if (!m_root) { - encoder->encode(static_cast<uint32_t>(APIObject::TypeNull)); + encoder << static_cast<uint32_t>(APIObject::TypeNull); return true; } type = m_root->type(); - encoder->encode(static_cast<uint32_t>(type)); + encoder << static_cast<uint32_t>(type); switch (type) { case APIObject::TypeArray: { ImmutableArray* array = static_cast<ImmutableArray*>(m_root); - encoder->encode(static_cast<uint64_t>(array->size())); + encoder << static_cast<uint64_t>(array->size()); for (size_t i = 0; i < array->size(); ++i) - encoder->encode(Owner(array->at(i))); + encoder << Owner(array->at(i)); return true; } case APIObject::TypeDictionary: { ImmutableDictionary* dictionary = static_cast<ImmutableDictionary*>(m_root); const ImmutableDictionary::MapType& map = dictionary->map(); - encoder->encode(static_cast<uint64_t>(map.size())); + encoder << static_cast<uint64_t>(map.size()); ImmutableDictionary::MapType::const_iterator it = map.begin(); ImmutableDictionary::MapType::const_iterator end = map.end(); for (; it != end; ++it) { - encoder->encode(it->key); - encoder->encode(Owner(it->value.get())); + encoder << it->key; + encoder << Owner(it->value.get()); } return true; } case APIObject::TypeString: { WebString* string = static_cast<WebString*>(m_root); - encoder->encode(string->string()); + encoder << string->string(); return true; } case APIObject::TypeSerializedScriptValue: { WebSerializedScriptValue* scriptValue = static_cast<WebSerializedScriptValue*>(m_root); - encoder->encodeVariableLengthByteArray(scriptValue->dataReference()); + encoder << scriptValue->dataReference(); return true; } case APIObject::TypeBoolean: { WebBoolean* booleanObject = static_cast<WebBoolean*>(m_root); - encoder->encode(booleanObject->value()); + encoder << booleanObject->value(); return true; } case APIObject::TypeDouble: { WebDouble* doubleObject = static_cast<WebDouble*>(m_root); - encoder->encode(doubleObject->value()); + encoder << doubleObject->value(); return true; } case APIObject::TypeUInt64: { WebUInt64* uint64Object = static_cast<WebUInt64*>(m_root); - encoder->encode(uint64Object->value()); + encoder << uint64Object->value(); return true; } case APIObject::TypePoint: { WebPoint* pointObject = static_cast<WebPoint*>(m_root); - encoder->encode(pointObject->point().x); - encoder->encode(pointObject->point().y); + encoder << pointObject->point().x; + encoder << pointObject->point().y; return true; } case APIObject::TypeSize: { WebSize* sizeObject = static_cast<WebSize*>(m_root); - encoder->encode(sizeObject->size().width); - encoder->encode(sizeObject->size().height); + encoder << sizeObject->size().width; + encoder << sizeObject->size().height; return true; } case APIObject::TypeRect: { WebRect* rectObject = static_cast<WebRect*>(m_root); - encoder->encode(rectObject->rect().origin.x); - encoder->encode(rectObject->rect().origin.y); - encoder->encode(rectObject->rect().size.width); - encoder->encode(rectObject->rect().size.height); + encoder << rectObject->rect().origin.x; + encoder << rectObject->rect().origin.y; + encoder << rectObject->rect().size.width; + encoder << rectObject->rect().size.height; return true; } case APIObject::TypeRenderLayer: { WebRenderLayer* renderLayer = static_cast<WebRenderLayer*>(m_root); - encoder->encode(Owner(renderLayer->renderer())); - encoder->encode(renderLayer->isReflection()); - encoder->encode(renderLayer->isClipping()); - encoder->encode(renderLayer->isClipped()); - encoder->encode(static_cast<uint32_t>(renderLayer->compositingLayerType())); - encoder->encode(renderLayer->absoluteBoundingBox()); - encoder->encode(Owner(renderLayer->negativeZOrderList())); - encoder->encode(Owner(renderLayer->normalFlowList())); - encoder->encode(Owner(renderLayer->positiveZOrderList())); + encoder << Owner(renderLayer->renderer()); + encoder << renderLayer->isReflection(); + encoder << renderLayer->isClipping(); + encoder << renderLayer->isClipped(); + encoder << static_cast<uint32_t>(renderLayer->compositingLayerType()); + encoder << renderLayer->absoluteBoundingBox(); + encoder << Owner(renderLayer->negativeZOrderList()); + encoder << Owner(renderLayer->normalFlowList()); + encoder << Owner(renderLayer->positiveZOrderList()); return true; } case APIObject::TypeRenderObject: { WebRenderObject* renderObject = static_cast<WebRenderObject*>(m_root); - encoder->encode(renderObject->name()); - encoder->encode(renderObject->elementTagName()); - encoder->encode(renderObject->elementID()); - encoder->encode(Owner(renderObject->elementClassNames())); - encoder->encode(renderObject->absolutePosition()); - encoder->encode(renderObject->frameRect()); - encoder->encode(Owner(renderObject->children().get())); + encoder << renderObject->name(); + encoder << renderObject->elementTagName(); + encoder << renderObject->elementID(); + encoder << Owner(renderObject->elementClassNames()); + encoder << renderObject->absolutePosition(); + encoder << renderObject->frameRect(); + encoder << Owner(renderObject->children().get()); return true; } case APIObject::TypeURL: { WebURL* urlObject = static_cast<WebURL*>(m_root); - encoder->encode(urlObject->string()); + encoder << urlObject->string(); return true; } case APIObject::TypeURLRequest: { WebURLRequest* urlRequestObject = static_cast<WebURLRequest*>(m_root); - encoder->encode(urlRequestObject->resourceRequest()); + encoder << urlRequestObject->resourceRequest(); return true; } case APIObject::TypeUserContentURLPattern: { WebUserContentURLPattern* urlPattern = static_cast<WebUserContentURLPattern*>(m_root); - encoder->encode(urlPattern->patternString()); + encoder << urlPattern->patternString(); return true; } case APIObject::TypeImage: { @@ -189,24 +189,24 @@ public: ASSERT(!image->bitmap() || image->bitmap()->isBackedBySharedMemory()); if (!image->bitmap() || !image->bitmap()->isBackedBySharedMemory() || !image->bitmap()->createHandle(handle)) { // Initial false indicates no allocated bitmap or is not shareable. - encoder->encode(false); + encoder << false; return true; } // Initial true indicates a bitmap was allocated and is shareable. - encoder->encode(true); + encoder << true; - encoder->encode(handle); + encoder << handle; return true; } case APIObject::TypeData: { WebData* data = static_cast<WebData*>(m_root); - encoder->encodeVariableLengthByteArray(data->dataReference()); + encoder << data->dataReference(); return true; } case APIObject::TypeCertificateInfo: { WebCertificateInfo* certificateInfo = static_cast<WebCertificateInfo*>(m_root); - encoder->encode(certificateInfo->platformCertificateInfo()); + encoder << certificateInfo->platformCertificateInfo(); return true; } default: @@ -303,7 +303,7 @@ public: } case APIObject::TypeSerializedScriptValue: { CoreIPC::DataReference dataReference; - if (!decoder->decodeVariableLengthByteArray(dataReference)) + if (!decoder->decode(dataReference)) return false; Vector<uint8_t> vector = dataReference.vector(); @@ -475,7 +475,7 @@ public: } case APIObject::TypeData: { CoreIPC::DataReference dataReference; - if (!decoder->decodeVariableLengthByteArray(dataReference)) + if (!decoder->decode(dataReference)) return false; coder.m_root = WebData::create(dataReference.data(), dataReference.size()); break; diff --git a/Source/WebKit2/Shared/WebBackForwardListItem.cpp b/Source/WebKit2/Shared/WebBackForwardListItem.cpp index 817825347..e5ae67a3e 100644 --- a/Source/WebKit2/Shared/WebBackForwardListItem.cpp +++ b/Source/WebKit2/Shared/WebBackForwardListItem.cpp @@ -63,11 +63,11 @@ void WebBackForwardListItem::setBackForwardData(const uint8_t* data, size_t size void WebBackForwardListItem::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder.encode(m_originalURL); - encoder.encode(m_url); - encoder.encode(m_title); - encoder.encode(m_itemID); - encoder.encode(CoreIPC::DataReference(m_backForwardData)); + encoder << m_originalURL; + encoder << m_url; + encoder << m_title; + encoder << m_itemID; + encoder << CoreIPC::DataReference(m_backForwardData); } PassRefPtr<WebBackForwardListItem> WebBackForwardListItem::decode(CoreIPC::ArgumentDecoder& decoder) diff --git a/Source/WebKit2/Shared/WebBatteryStatus.cpp b/Source/WebKit2/Shared/WebBatteryStatus.cpp index 30a5e59a1..32af01edd 100644 --- a/Source/WebKit2/Shared/WebBatteryStatus.cpp +++ b/Source/WebKit2/Shared/WebBatteryStatus.cpp @@ -45,12 +45,12 @@ WebBatteryStatus::~WebBatteryStatus() { } -void WebBatteryStatus::Data::encode(CoreIPC::ArgumentEncoder* encoder) const +void WebBatteryStatus::Data::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(isCharging); - encoder->encode(chargingTime); - encoder->encode(dischargingTime); - encoder->encode(level); + encoder.encode(isCharging); + encoder.encode(chargingTime); + encoder.encode(dischargingTime); + encoder.encode(level); } bool WebBatteryStatus::Data::decode(CoreIPC::ArgumentDecoder* decoder, Data& result) diff --git a/Source/WebKit2/Shared/WebBatteryStatus.h b/Source/WebKit2/Shared/WebBatteryStatus.h index fd1d7932d..6b630f708 100644 --- a/Source/WebKit2/Shared/WebBatteryStatus.h +++ b/Source/WebKit2/Shared/WebBatteryStatus.h @@ -40,7 +40,7 @@ public: static const Type APIType = TypeBatteryStatus; struct Data { - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, Data&); bool isCharging; diff --git a/Source/WebKit2/Shared/WebConnection.cpp b/Source/WebKit2/Shared/WebConnection.cpp index 92e63c4fc..e2263ee16 100644 --- a/Source/WebKit2/Shared/WebConnection.cpp +++ b/Source/WebKit2/Shared/WebConnection.cpp @@ -53,23 +53,21 @@ void WebConnection::postMessage(const String& messageName, APIObject* messageBod if (!m_connection) return; - OwnPtr<CoreIPC::ArgumentEncoder> messageData = CoreIPC::ArgumentEncoder::create(); - messageData->encode(messageName); - encodeMessageBody(*messageData, messageBody); + OwnPtr<CoreIPC::MessageEncoder> encoder = CoreIPC::MessageEncoder::create(Messages::WebConnection::HandleMessage::receiverName(), Messages::WebConnection::HandleMessage::name(), 0); + encoder->encode(messageName); + encodeMessageBody(*encoder, messageBody); - m_connection->send(Messages::WebConnection::HandleMessage(CoreIPC::DataReference(messageData->buffer(), messageData->bufferSize())), 0); + m_connection->sendMessage(CoreIPC::MessageID(Messages::WebConnection::HandleMessage::messageID), encoder.release()); } -void WebConnection::handleMessage(const CoreIPC::DataReference& messageData) +void WebConnection::handleMessage(CoreIPC::MessageDecoder& decoder) { - OwnPtr<CoreIPC::ArgumentDecoder> decoder = CoreIPC::ArgumentDecoder::create(messageData.data(), messageData.size()); - String messageName; - if (!decoder->decode(messageName)) + if (!decoder.decode(messageName)) return; RefPtr<APIObject> messageBody; - if (!decodeMessageBody(*decoder, messageBody)) + if (!decodeMessageBody(decoder, messageBody)) return; m_client.didReceiveMessage(this, messageName, messageBody.get()); diff --git a/Source/WebKit2/Shared/WebConnection.h b/Source/WebKit2/Shared/WebConnection.h index 06a0134dc..3a2b531a0 100644 --- a/Source/WebKit2/Shared/WebConnection.h +++ b/Source/WebKit2/Shared/WebConnection.h @@ -63,7 +63,7 @@ protected: // Implemented in generated WebConnectionMessageReceiver.cpp void didReceiveWebConnectionMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); - void handleMessage(const CoreIPC::DataReference& messageData); + void handleMessage(CoreIPC::MessageDecoder&); RefPtr<CoreIPC::Connection> m_connection; WebConnectionClient m_client; diff --git a/Source/WebKit2/Shared/WebConnection.messages.in b/Source/WebKit2/Shared/WebConnection.messages.in index 6e17707e1..65ec5b898 100644 --- a/Source/WebKit2/Shared/WebConnection.messages.in +++ b/Source/WebKit2/Shared/WebConnection.messages.in @@ -21,5 +21,5 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. messages -> WebConnection { - HandleMessage(CoreIPC::DataReference messageData) + HandleMessage() Variadic } diff --git a/Source/WebKit2/Shared/WebContextMenuItemData.cpp b/Source/WebKit2/Shared/WebContextMenuItemData.cpp index 901ce9c47..23290b376 100644 --- a/Source/WebKit2/Shared/WebContextMenuItemData.cpp +++ b/Source/WebKit2/Shared/WebContextMenuItemData.cpp @@ -104,14 +104,14 @@ void WebContextMenuItemData::setUserData(APIObject* userData) m_userData = userData; } -void WebContextMenuItemData::encode(CoreIPC::ArgumentEncoder* encoder) const +void WebContextMenuItemData::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encodeEnum(m_type); - encoder->encodeEnum(m_action); - encoder->encode(m_title); - encoder->encode(m_checked); - encoder->encode(m_enabled); - encoder->encode(m_submenu); + encoder.encodeEnum(m_type); + encoder.encodeEnum(m_action); + encoder << m_title; + encoder << m_checked; + encoder << m_enabled; + encoder << m_submenu; } bool WebContextMenuItemData::decode(CoreIPC::ArgumentDecoder* decoder, WebContextMenuItemData& item) diff --git a/Source/WebKit2/Shared/WebContextMenuItemData.h b/Source/WebKit2/Shared/WebContextMenuItemData.h index 106bdf016..9212e2813 100644 --- a/Source/WebKit2/Shared/WebContextMenuItemData.h +++ b/Source/WebKit2/Shared/WebContextMenuItemData.h @@ -63,7 +63,7 @@ public: APIObject* userData() const; void setUserData(APIObject*); - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, WebContextMenuItemData&); private: diff --git a/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp b/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp index 957313587..497eaee88 100644 --- a/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp +++ b/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp @@ -56,7 +56,7 @@ using namespace WebKit; namespace CoreIPC { -void ArgumentCoder<AffineTransform>::encode(ArgumentEncoder* encoder, const AffineTransform& affineTransform) +void ArgumentCoder<AffineTransform>::encode(ArgumentEncoder& encoder, const AffineTransform& affineTransform) { SimpleArgumentCoder<AffineTransform>::encode(encoder, affineTransform); } @@ -67,7 +67,7 @@ bool ArgumentCoder<AffineTransform>::decode(ArgumentDecoder* decoder, AffineTran } -void ArgumentCoder<FloatPoint>::encode(ArgumentEncoder* encoder, const FloatPoint& floatPoint) +void ArgumentCoder<FloatPoint>::encode(ArgumentEncoder& encoder, const FloatPoint& floatPoint) { SimpleArgumentCoder<FloatPoint>::encode(encoder, floatPoint); } @@ -78,7 +78,7 @@ bool ArgumentCoder<FloatPoint>::decode(ArgumentDecoder* decoder, FloatPoint& flo } -void ArgumentCoder<FloatRect>::encode(ArgumentEncoder* encoder, const FloatRect& floatRect) +void ArgumentCoder<FloatRect>::encode(ArgumentEncoder& encoder, const FloatRect& floatRect) { SimpleArgumentCoder<FloatRect>::encode(encoder, floatRect); } @@ -89,7 +89,7 @@ bool ArgumentCoder<FloatRect>::decode(ArgumentDecoder* decoder, FloatRect& float } -void ArgumentCoder<FloatSize>::encode(ArgumentEncoder* encoder, const FloatSize& floatSize) +void ArgumentCoder<FloatSize>::encode(ArgumentEncoder& encoder, const FloatSize& floatSize) { SimpleArgumentCoder<FloatSize>::encode(encoder, floatSize); } @@ -100,7 +100,7 @@ bool ArgumentCoder<FloatSize>::decode(ArgumentDecoder* decoder, FloatSize& float } -void ArgumentCoder<IntPoint>::encode(ArgumentEncoder* encoder, const IntPoint& intPoint) +void ArgumentCoder<IntPoint>::encode(ArgumentEncoder& encoder, const IntPoint& intPoint) { SimpleArgumentCoder<IntPoint>::encode(encoder, intPoint); } @@ -111,7 +111,7 @@ bool ArgumentCoder<IntPoint>::decode(ArgumentDecoder* decoder, IntPoint& intPoin } -void ArgumentCoder<IntRect>::encode(ArgumentEncoder* encoder, const IntRect& intRect) +void ArgumentCoder<IntRect>::encode(ArgumentEncoder& encoder, const IntRect& intRect) { SimpleArgumentCoder<IntRect>::encode(encoder, intRect); } @@ -122,7 +122,7 @@ bool ArgumentCoder<IntRect>::decode(ArgumentDecoder* decoder, IntRect& intRect) } -void ArgumentCoder<IntSize>::encode(ArgumentEncoder* encoder, const IntSize& intSize) +void ArgumentCoder<IntSize>::encode(ArgumentEncoder& encoder, const IntSize& intSize) { SimpleArgumentCoder<IntSize>::encode(encoder, intSize); } @@ -132,7 +132,8 @@ bool ArgumentCoder<IntSize>::decode(ArgumentDecoder* decoder, IntSize& intSize) return SimpleArgumentCoder<IntSize>::decode(decoder, intSize); } -void ArgumentCoder<ViewportAttributes>::encode(ArgumentEncoder* encoder, const ViewportAttributes& viewportAttributes) + +void ArgumentCoder<ViewportAttributes>::encode(ArgumentEncoder& encoder, const ViewportAttributes& viewportAttributes) { SimpleArgumentCoder<ViewportAttributes>::encode(encoder, viewportAttributes); } @@ -142,11 +143,10 @@ bool ArgumentCoder<ViewportAttributes>::decode(ArgumentDecoder* decoder, Viewpor return SimpleArgumentCoder<ViewportAttributes>::decode(decoder, viewportAttributes); } -void ArgumentCoder<MimeClassInfo>::encode(ArgumentEncoder* encoder, const MimeClassInfo& mimeClassInfo) + +void ArgumentCoder<MimeClassInfo>::encode(ArgumentEncoder& encoder, const MimeClassInfo& mimeClassInfo) { - encoder->encode(mimeClassInfo.type); - encoder->encode(mimeClassInfo.desc); - encoder->encode(mimeClassInfo.extensions); + encoder << mimeClassInfo.type << mimeClassInfo.desc << mimeClassInfo.extensions; } bool ArgumentCoder<MimeClassInfo>::decode(ArgumentDecoder* decoder, MimeClassInfo& mimeClassInfo) @@ -162,12 +162,9 @@ bool ArgumentCoder<MimeClassInfo>::decode(ArgumentDecoder* decoder, MimeClassInf } -void ArgumentCoder<PluginInfo>::encode(ArgumentEncoder* encoder, const PluginInfo& pluginInfo) +void ArgumentCoder<PluginInfo>::encode(ArgumentEncoder& encoder, const PluginInfo& pluginInfo) { - encoder->encode(pluginInfo.name); - encoder->encode(pluginInfo.file); - encoder->encode(pluginInfo.desc); - encoder->encode(pluginInfo.mimes); + encoder << pluginInfo.name << pluginInfo.file << pluginInfo.desc << pluginInfo.mimes; } bool ArgumentCoder<PluginInfo>::decode(ArgumentDecoder* decoder, PluginInfo& pluginInfo) @@ -185,9 +182,9 @@ bool ArgumentCoder<PluginInfo>::decode(ArgumentDecoder* decoder, PluginInfo& plu } -void ArgumentCoder<HTTPHeaderMap>::encode(ArgumentEncoder* encoder, const HTTPHeaderMap& headerMap) +void ArgumentCoder<HTTPHeaderMap>::encode(ArgumentEncoder& encoder, const HTTPHeaderMap& headerMap) { - encoder->encode(static_cast<const HashMap<AtomicString, String, CaseFoldingHash>&>(headerMap)); + encoder << static_cast<const HashMap<AtomicString, String, CaseFoldingHash>&>(headerMap); } bool ArgumentCoder<HTTPHeaderMap>::decode(ArgumentDecoder* decoder, HTTPHeaderMap& headerMap) @@ -196,13 +193,9 @@ bool ArgumentCoder<HTTPHeaderMap>::decode(ArgumentDecoder* decoder, HTTPHeaderMa } -void ArgumentCoder<AuthenticationChallenge>::encode(ArgumentEncoder* encoder, const AuthenticationChallenge& challenge) +void ArgumentCoder<AuthenticationChallenge>::encode(ArgumentEncoder& encoder, const AuthenticationChallenge& challenge) { - encoder->encode(challenge.protectionSpace()); - encoder->encode(challenge.proposedCredential()); - encoder->encode(challenge.previousFailureCount()); - encoder->encode(challenge.failureResponse()); - encoder->encode(challenge.error()); + encoder << challenge.protectionSpace() << challenge.proposedCredential() << challenge.previousFailureCount() << challenge.failureResponse() << challenge.error(); } bool ArgumentCoder<AuthenticationChallenge>::decode(ArgumentDecoder* decoder, AuthenticationChallenge& challenge) @@ -232,13 +225,11 @@ bool ArgumentCoder<AuthenticationChallenge>::decode(ArgumentDecoder* decoder, Au } -void ArgumentCoder<ProtectionSpace>::encode(ArgumentEncoder* encoder, const ProtectionSpace& space) +void ArgumentCoder<ProtectionSpace>::encode(ArgumentEncoder& encoder, const ProtectionSpace& space) { - encoder->encode(space.host()); - encoder->encode(space.port()); - encoder->encodeEnum(space.serverType()); - encoder->encode(space.realm()); - encoder->encodeEnum(space.authenticationScheme()); + encoder << space.host() << space.port() << space.realm(); + encoder.encodeEnum(space.authenticationScheme()); + encoder.encodeEnum(space.serverType()); } bool ArgumentCoder<ProtectionSpace>::decode(ArgumentDecoder* decoder, ProtectionSpace& space) @@ -251,10 +242,6 @@ bool ArgumentCoder<ProtectionSpace>::decode(ArgumentDecoder* decoder, Protection if (!decoder->decode(port)) return false; - ProtectionSpaceServerType serverType; - if (!decoder->decodeEnum(serverType)) - return false; - String realm; if (!decoder->decode(realm)) return false; @@ -263,15 +250,18 @@ bool ArgumentCoder<ProtectionSpace>::decode(ArgumentDecoder* decoder, Protection if (!decoder->decodeEnum(authenticationScheme)) return false; + ProtectionSpaceServerType serverType; + if (!decoder->decodeEnum(serverType)) + return false; + space = ProtectionSpace(host, port, serverType, realm, authenticationScheme); return true; } -void ArgumentCoder<Credential>::encode(ArgumentEncoder* encoder, const Credential& credential) +void ArgumentCoder<Credential>::encode(ArgumentEncoder& encoder, const Credential& credential) { - encoder->encode(credential.user()); - encoder->encode(credential.password()); - encoder->encodeEnum(credential.persistence()); + encoder << credential.user() << credential.password(); + encoder.encodeEnum(credential.persistence()); } bool ArgumentCoder<Credential>::decode(ArgumentDecoder* decoder, Credential& credential) @@ -292,7 +282,7 @@ bool ArgumentCoder<Credential>::decode(ArgumentDecoder* decoder, Credential& cre return true; } -static void encodeImage(ArgumentEncoder* encoder, Image* image) +static void encodeImage(ArgumentEncoder& encoder, Image* image) { RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(image->size(), ShareableBitmap::SupportsAlpha); bitmap->createGraphicsContext()->drawImage(image, ColorSpaceDeviceRGB, IntPoint()); @@ -300,7 +290,7 @@ static void encodeImage(ArgumentEncoder* encoder, Image* image) ShareableBitmap::Handle handle; bitmap->createHandle(handle); - encoder->encode(handle); + encoder << handle; } static bool decodeImage(ArgumentDecoder* decoder, RefPtr<Image>& image) @@ -318,21 +308,21 @@ static bool decodeImage(ArgumentDecoder* decoder, RefPtr<Image>& image) return true; } -void ArgumentCoder<Cursor>::encode(ArgumentEncoder* encoder, const Cursor& cursor) +void ArgumentCoder<Cursor>::encode(ArgumentEncoder& encoder, const Cursor& cursor) { - encoder->encodeEnum(cursor.type()); + encoder.encodeEnum(cursor.type()); if (cursor.type() != Cursor::Custom) return; if (cursor.image()->isNull()) { - encoder->encode(false); // There is no valid image being encoded. + encoder << false; // There is no valid image being encoded. return; } - encoder->encode(true); + encoder << true; encodeImage(encoder, cursor.image()); - encoder->encode(cursor.hotSpot()); + encoder << cursor.hotSpot(); } bool ArgumentCoder<Cursor>::decode(ArgumentDecoder* decoder, Cursor& cursor) @@ -378,21 +368,19 @@ bool ArgumentCoder<Cursor>::decode(ArgumentDecoder* decoder, Cursor& cursor) return true; } -void ArgumentCoder<ResourceRequest>::encode(ArgumentEncoder* encoder, const ResourceRequest& resourceRequest) +void ArgumentCoder<ResourceRequest>::encode(ArgumentEncoder& encoder, const ResourceRequest& resourceRequest) { if (kShouldSerializeWebCoreData) { - encoder->encode(resourceRequest.url().string()); - encoder->encode(resourceRequest.httpMethod()); - - const HTTPHeaderMap& headers = resourceRequest.httpHeaderFields(); - encoder->encode(headers); + encoder << resourceRequest.url().string(); + encoder << resourceRequest.httpMethod(); + encoder << resourceRequest.httpHeaderFields(); FormData* httpBody = resourceRequest.httpBody(); - encoder->encode(static_cast<bool>(httpBody)); + encoder << static_cast<bool>(httpBody); if (httpBody) - encoder->encode(httpBody->flattenToString()); + encoder << httpBody->flattenToString(); - encoder->encode(resourceRequest.firstPartyForCookies().string()); + encoder << resourceRequest.firstPartyForCookies().string(); } encodePlatformData(encoder, resourceRequest); @@ -439,25 +427,23 @@ bool ArgumentCoder<ResourceRequest>::decode(ArgumentDecoder* decoder, ResourceRe return decodePlatformData(decoder, resourceRequest); } -void ArgumentCoder<ResourceResponse>::encode(ArgumentEncoder* encoder, const ResourceResponse& resourceResponse) +void ArgumentCoder<ResourceResponse>::encode(ArgumentEncoder& encoder, const ResourceResponse& resourceResponse) { if (kShouldSerializeWebCoreData) { bool responseIsNull = resourceResponse.isNull(); - encoder->encode(responseIsNull); + encoder << responseIsNull; if (responseIsNull) return; - encoder->encode(resourceResponse.url().string()); - encoder->encode(static_cast<int32_t>(resourceResponse.httpStatusCode())); - - const HTTPHeaderMap& headers = resourceResponse.httpHeaderFields(); - encoder->encode(headers); + encoder << resourceResponse.url().string(); + encoder << static_cast<int32_t>(resourceResponse.httpStatusCode()); + encoder << resourceResponse.httpHeaderFields(); - encoder->encode(resourceResponse.mimeType()); - encoder->encode(resourceResponse.textEncodingName()); - encoder->encode(static_cast<int64_t>(resourceResponse.expectedContentLength())); - encoder->encode(resourceResponse.httpStatusText()); - encoder->encode(resourceResponse.suggestedFilename()); + encoder << resourceResponse.mimeType(); + encoder << resourceResponse.textEncodingName(); + encoder << static_cast<int64_t>(resourceResponse.expectedContentLength()); + encoder << resourceResponse.httpStatusText(); + encoder << resourceResponse.suggestedFilename(); } encodePlatformData(encoder, resourceResponse); @@ -523,20 +509,20 @@ bool ArgumentCoder<ResourceResponse>::decode(ArgumentDecoder* decoder, ResourceR return decodePlatformData(decoder, resourceResponse); } -void ArgumentCoder<ResourceError>::encode(ArgumentEncoder* encoder, const ResourceError& resourceError) +void ArgumentCoder<ResourceError>::encode(ArgumentEncoder& encoder, const ResourceError& resourceError) { if (kShouldSerializeWebCoreData) { bool errorIsNull = resourceError.isNull(); - encoder->encode(errorIsNull); + encoder << errorIsNull; if (errorIsNull) return; - encoder->encode(resourceError.domain()); - encoder->encode(resourceError.errorCode()); - encoder->encode(resourceError.failingURL()); - encoder->encode(resourceError.localizedDescription()); - encoder->encode(resourceError.isCancellation()); - encoder->encode(resourceError.isTimeout()); + encoder << resourceError.domain(); + encoder << resourceError.errorCode(); + encoder << resourceError.failingURL(); + encoder << resourceError.localizedDescription(); + encoder << resourceError.isCancellation(); + encoder << resourceError.isTimeout(); } encodePlatformData(encoder, resourceError); @@ -585,24 +571,24 @@ bool ArgumentCoder<ResourceError>::decode(ArgumentDecoder* decoder, ResourceErro return decodePlatformData(decoder, resourceError); } -void ArgumentCoder<WindowFeatures>::encode(ArgumentEncoder* encoder, const WindowFeatures& windowFeatures) +void ArgumentCoder<WindowFeatures>::encode(ArgumentEncoder& encoder, const WindowFeatures& windowFeatures) { - encoder->encode(windowFeatures.x); - encoder->encode(windowFeatures.y); - encoder->encode(windowFeatures.width); - encoder->encode(windowFeatures.height); - encoder->encode(windowFeatures.xSet); - encoder->encode(windowFeatures.ySet); - encoder->encode(windowFeatures.widthSet); - encoder->encode(windowFeatures.heightSet); - encoder->encode(windowFeatures.menuBarVisible); - encoder->encode(windowFeatures.statusBarVisible); - encoder->encode(windowFeatures.toolBarVisible); - encoder->encode(windowFeatures.locationBarVisible); - encoder->encode(windowFeatures.scrollbarsVisible); - encoder->encode(windowFeatures.resizable); - encoder->encode(windowFeatures.fullscreen); - encoder->encode(windowFeatures.dialog); + encoder << windowFeatures.x; + encoder << windowFeatures.y; + encoder << windowFeatures.width; + encoder << windowFeatures.height; + encoder << windowFeatures.xSet; + encoder << windowFeatures.ySet; + encoder << windowFeatures.widthSet; + encoder << windowFeatures.heightSet; + encoder << windowFeatures.menuBarVisible; + encoder << windowFeatures.statusBarVisible; + encoder << windowFeatures.toolBarVisible; + encoder << windowFeatures.locationBarVisible; + encoder << windowFeatures.scrollbarsVisible; + encoder << windowFeatures.resizable; + encoder << windowFeatures.fullscreen; + encoder << windowFeatures.dialog; } bool ArgumentCoder<WindowFeatures>::decode(ArgumentDecoder* decoder, WindowFeatures& windowFeatures) @@ -643,15 +629,15 @@ bool ArgumentCoder<WindowFeatures>::decode(ArgumentDecoder* decoder, WindowFeatu } -void ArgumentCoder<Color>::encode(ArgumentEncoder* encoder, const Color& color) +void ArgumentCoder<Color>::encode(ArgumentEncoder& encoder, const Color& color) { if (!color.isValid()) { - encoder->encode(false); + encoder << false; return; } - encoder->encode(true); - encoder->encode(color.rgb()); + encoder << true; + encoder << color.rgb(); } bool ArgumentCoder<Color>::decode(ArgumentDecoder* decoder, Color& color) @@ -674,12 +660,12 @@ bool ArgumentCoder<Color>::decode(ArgumentDecoder* decoder, Color& color) } -void ArgumentCoder<CompositionUnderline>::encode(ArgumentEncoder* encoder, const CompositionUnderline& underline) +void ArgumentCoder<CompositionUnderline>::encode(ArgumentEncoder& encoder, const CompositionUnderline& underline) { - encoder->encode(underline.startOffset); - encoder->encode(underline.endOffset); - encoder->encode(underline.thick); - encoder->encode(underline.color); + encoder << underline.startOffset; + encoder << underline.endOffset; + encoder << underline.thick; + encoder << underline.color; } bool ArgumentCoder<CompositionUnderline>::decode(ArgumentDecoder* decoder, CompositionUnderline& underline) @@ -697,12 +683,12 @@ bool ArgumentCoder<CompositionUnderline>::decode(ArgumentDecoder* decoder, Compo } #if ENABLE(SQL_DATABASE) -void ArgumentCoder<DatabaseDetails>::encode(ArgumentEncoder* encoder, const DatabaseDetails& details) +void ArgumentCoder<DatabaseDetails>::encode(ArgumentEncoder& encoder, const DatabaseDetails& details) { - encoder->encode(details.name()); - encoder->encode(details.displayName()); - encoder->encode(details.expectedUsage()); - encoder->encode(details.currentUsage()); + encoder << details.name(); + encoder << details.displayName(); + encoder << details.expectedUsage(); + encoder << details.currentUsage(); } bool ArgumentCoder<DatabaseDetails>::decode(ArgumentDecoder* decoder, DatabaseDetails& details) @@ -728,11 +714,11 @@ bool ArgumentCoder<DatabaseDetails>::decode(ArgumentDecoder* decoder, DatabaseDe } #endif -void ArgumentCoder<DictationAlternative>::encode(ArgumentEncoder* encoder, const DictationAlternative& dictationAlternative) +void ArgumentCoder<DictationAlternative>::encode(ArgumentEncoder& encoder, const DictationAlternative& dictationAlternative) { - encoder->encode(dictationAlternative.rangeStart); - encoder->encode(dictationAlternative.rangeLength); - encoder->encode(dictationAlternative.dictationContext); + encoder << dictationAlternative.rangeStart; + encoder << dictationAlternative.rangeLength; + encoder << dictationAlternative.dictationContext; } bool ArgumentCoder<DictationAlternative>::decode(ArgumentDecoder* decoder, DictationAlternative& dictationAlternative) @@ -747,16 +733,16 @@ bool ArgumentCoder<DictationAlternative>::decode(ArgumentDecoder* decoder, Dicta } -void ArgumentCoder<FileChooserSettings>::encode(ArgumentEncoder* encoder, const FileChooserSettings& settings) +void ArgumentCoder<FileChooserSettings>::encode(ArgumentEncoder& encoder, const FileChooserSettings& settings) { - encoder->encode(settings.allowsMultipleFiles); + encoder << settings.allowsMultipleFiles; #if ENABLE(DIRECTORY_UPLOAD) - encoder->encode(settings.allowsDirectoryUpload); + encoder << settings.allowsDirectoryUpload; #endif - encoder->encode(settings.acceptMIMETypes); - encoder->encode(settings.selectedFiles); + encoder << settings.acceptMIMETypes; + encoder << settings.selectedFiles; #if ENABLE(MEDIA_CAPTURE) - encoder->encode(settings.capture); + encoder << settings.capture; #endif } @@ -781,12 +767,12 @@ bool ArgumentCoder<FileChooserSettings>::decode(ArgumentDecoder* decoder, FileCh } -void ArgumentCoder<GrammarDetail>::encode(ArgumentEncoder* encoder, const GrammarDetail& detail) +void ArgumentCoder<GrammarDetail>::encode(ArgumentEncoder& encoder, const GrammarDetail& detail) { - encoder->encode(detail.location); - encoder->encode(detail.length); - encoder->encode(detail.guesses); - encoder->encode(detail.userDescription); + encoder << detail.location; + encoder << detail.length; + encoder << detail.guesses; + encoder << detail.userDescription; } bool ArgumentCoder<GrammarDetail>::decode(ArgumentDecoder* decoder, GrammarDetail& detail) @@ -804,13 +790,13 @@ bool ArgumentCoder<GrammarDetail>::decode(ArgumentDecoder* decoder, GrammarDetai } -void ArgumentCoder<TextCheckingResult>::encode(ArgumentEncoder* encoder, const TextCheckingResult& result) +void ArgumentCoder<TextCheckingResult>::encode(ArgumentEncoder& encoder, const TextCheckingResult& result) { - encoder->encodeEnum(result.type); - encoder->encode(result.location); - encoder->encode(result.length); - encoder->encode(result.details); - encoder->encode(result.replacement); + encoder.encodeEnum(result.type); + encoder << result.location; + encoder << result.length; + encoder << result.details; + encoder << result.replacement; } bool ArgumentCoder<TextCheckingResult>::decode(ArgumentDecoder* decoder, TextCheckingResult& result) @@ -828,11 +814,11 @@ bool ArgumentCoder<TextCheckingResult>::decode(ArgumentDecoder* decoder, TextChe return true; } -void ArgumentCoder<DragSession>::encode(ArgumentEncoder* encoder, const DragSession& result) +void ArgumentCoder<DragSession>::encode(ArgumentEncoder& encoder, const DragSession& result) { - encoder->encodeEnum(result.operation); - encoder->encode(result.mouseIsOverFileInput); - encoder->encode(result.numberOfItemsToBeAccepted); + encoder.encodeEnum(result.operation); + encoder << result.mouseIsOverFileInput; + encoder << result.numberOfItemsToBeAccepted; } bool ArgumentCoder<DragSession>::decode(ArgumentDecoder* decoder, DragSession& result) @@ -846,9 +832,9 @@ bool ArgumentCoder<DragSession>::decode(ArgumentDecoder* decoder, DragSession& r return true; } -void ArgumentCoder<KURL>::encode(ArgumentEncoder* encoder, const KURL& result) +void ArgumentCoder<KURL>::encode(ArgumentEncoder& encoder, const KURL& result) { - encoder->encode(result.string()); + encoder << result.string(); } bool ArgumentCoder<KURL>::decode(ArgumentDecoder* decoder, KURL& result) @@ -860,14 +846,14 @@ bool ArgumentCoder<KURL>::decode(ArgumentDecoder* decoder, KURL& result) return true; } -void ArgumentCoder<WebCore::UserStyleSheet>::encode(ArgumentEncoder* encoder, const WebCore::UserStyleSheet& userStyleSheet) +void ArgumentCoder<WebCore::UserStyleSheet>::encode(ArgumentEncoder& encoder, const WebCore::UserStyleSheet& userStyleSheet) { - encoder->encode(userStyleSheet.source()); - encoder->encode(userStyleSheet.url()); - encoder->encode(userStyleSheet.whitelist()); - encoder->encode(userStyleSheet.blacklist()); - encoder->encodeEnum(userStyleSheet.injectedFrames()); - encoder->encodeEnum(userStyleSheet.level()); + encoder << userStyleSheet.source(); + encoder << userStyleSheet.url(); + encoder << userStyleSheet.whitelist(); + encoder << userStyleSheet.blacklist(); + encoder.encodeEnum(userStyleSheet.injectedFrames()); + encoder.encodeEnum(userStyleSheet.level()); } bool ArgumentCoder<WebCore::UserStyleSheet>::decode(ArgumentDecoder* decoder, WebCore::UserStyleSheet& userStyleSheet) @@ -900,14 +886,14 @@ bool ArgumentCoder<WebCore::UserStyleSheet>::decode(ArgumentDecoder* decoder, We return true; } -void ArgumentCoder<WebCore::UserScript>::encode(ArgumentEncoder* encoder, const WebCore::UserScript& userScript) +void ArgumentCoder<WebCore::UserScript>::encode(ArgumentEncoder& encoder, const WebCore::UserScript& userScript) { - encoder->encode(userScript.source()); - encoder->encode(userScript.url()); - encoder->encode(userScript.whitelist()); - encoder->encode(userScript.blacklist()); - encoder->encodeEnum(userScript.injectionTime()); - encoder->encodeEnum(userScript.injectedFrames()); + encoder << userScript.source(); + encoder << userScript.url(); + encoder << userScript.whitelist(); + encoder << userScript.blacklist(); + encoder.encodeEnum(userScript.injectionTime()); + encoder.encodeEnum(userScript.injectedFrames()); } bool ArgumentCoder<WebCore::UserScript>::decode(ArgumentDecoder* decoder, WebCore::UserScript& userScript) diff --git a/Source/WebKit2/Shared/WebCoreArgumentCoders.h b/Source/WebKit2/Shared/WebCoreArgumentCoders.h index 6850d6bc7..e25314758 100644 --- a/Source/WebKit2/Shared/WebCoreArgumentCoders.h +++ b/Source/WebKit2/Shared/WebCoreArgumentCoders.h @@ -72,77 +72,77 @@ namespace WebCore { namespace CoreIPC { template<> struct ArgumentCoder<WebCore::AffineTransform> { - static void encode(ArgumentEncoder*, const WebCore::AffineTransform&); + static void encode(ArgumentEncoder&, const WebCore::AffineTransform&); static bool decode(ArgumentDecoder*, WebCore::AffineTransform&); }; template<> struct ArgumentCoder<WebCore::FloatPoint> { - static void encode(ArgumentEncoder*, const WebCore::FloatPoint&); + static void encode(ArgumentEncoder&, const WebCore::FloatPoint&); static bool decode(ArgumentDecoder*, WebCore::FloatPoint&); }; template<> struct ArgumentCoder<WebCore::FloatRect> { - static void encode(ArgumentEncoder*, const WebCore::FloatRect&); + static void encode(ArgumentEncoder&, const WebCore::FloatRect&); static bool decode(ArgumentDecoder*, WebCore::FloatRect&); }; template<> struct ArgumentCoder<WebCore::FloatSize> { - static void encode(ArgumentEncoder*, const WebCore::FloatSize&); + static void encode(ArgumentEncoder&, const WebCore::FloatSize&); static bool decode(ArgumentDecoder*, WebCore::FloatSize&); }; template<> struct ArgumentCoder<WebCore::IntPoint> { - static void encode(ArgumentEncoder*, const WebCore::IntPoint&); + static void encode(ArgumentEncoder&, const WebCore::IntPoint&); static bool decode(ArgumentDecoder*, WebCore::IntPoint&); }; template<> struct ArgumentCoder<WebCore::IntRect> { - static void encode(ArgumentEncoder*, const WebCore::IntRect&); + static void encode(ArgumentEncoder&, const WebCore::IntRect&); static bool decode(ArgumentDecoder*, WebCore::IntRect&); }; template<> struct ArgumentCoder<WebCore::IntSize> { - static void encode(ArgumentEncoder*, const WebCore::IntSize&); + static void encode(ArgumentEncoder&, const WebCore::IntSize&); static bool decode(ArgumentDecoder*, WebCore::IntSize&); }; template<> struct ArgumentCoder<WebCore::ViewportAttributes> { - static void encode(ArgumentEncoder*, const WebCore::ViewportAttributes&); + static void encode(ArgumentEncoder&, const WebCore::ViewportAttributes&); static bool decode(ArgumentDecoder*, WebCore::ViewportAttributes&); }; template<> struct ArgumentCoder<WebCore::MimeClassInfo> { - static void encode(ArgumentEncoder*, const WebCore::MimeClassInfo&); + static void encode(ArgumentEncoder&, const WebCore::MimeClassInfo&); static bool decode(ArgumentDecoder*, WebCore::MimeClassInfo&); }; template<> struct ArgumentCoder<WebCore::PluginInfo> { - static void encode(ArgumentEncoder*, const WebCore::PluginInfo&); + static void encode(ArgumentEncoder&, const WebCore::PluginInfo&); static bool decode(ArgumentDecoder*, WebCore::PluginInfo&); }; template<> struct ArgumentCoder<WebCore::HTTPHeaderMap> { - static void encode(ArgumentEncoder*, const WebCore::HTTPHeaderMap&); + static void encode(ArgumentEncoder&, const WebCore::HTTPHeaderMap&); static bool decode(ArgumentDecoder*, WebCore::HTTPHeaderMap&); }; template<> struct ArgumentCoder<WebCore::AuthenticationChallenge> { - static void encode(ArgumentEncoder*, const WebCore::AuthenticationChallenge&); + static void encode(ArgumentEncoder&, const WebCore::AuthenticationChallenge&); static bool decode(ArgumentDecoder*, WebCore::AuthenticationChallenge&); }; template<> struct ArgumentCoder<WebCore::ProtectionSpace> { - static void encode(ArgumentEncoder*, const WebCore::ProtectionSpace&); + static void encode(ArgumentEncoder&, const WebCore::ProtectionSpace&); static bool decode(ArgumentDecoder*, WebCore::ProtectionSpace&); }; template<> struct ArgumentCoder<WebCore::Credential> { - static void encode(ArgumentEncoder*, const WebCore::Credential&); + static void encode(ArgumentEncoder&, const WebCore::Credential&); static bool decode(ArgumentDecoder*, WebCore::Credential&); }; template<> struct ArgumentCoder<WebCore::Cursor> { - static void encode(ArgumentEncoder*, const WebCore::Cursor&); + static void encode(ArgumentEncoder&, const WebCore::Cursor&); static bool decode(ArgumentDecoder*, WebCore::Cursor&); }; @@ -153,9 +153,9 @@ template<> struct ArgumentCoder<WebCore::ResourceRequest> { static const bool kShouldSerializeWebCoreData = true; #endif - static void encode(ArgumentEncoder*, const WebCore::ResourceRequest&); + static void encode(ArgumentEncoder&, const WebCore::ResourceRequest&); static bool decode(ArgumentDecoder*, WebCore::ResourceRequest&); - static void encodePlatformData(ArgumentEncoder*, const WebCore::ResourceRequest&); + static void encodePlatformData(ArgumentEncoder&, const WebCore::ResourceRequest&); static bool decodePlatformData(ArgumentDecoder*, WebCore::ResourceRequest&); }; @@ -166,9 +166,9 @@ template<> struct ArgumentCoder<WebCore::ResourceResponse> { static const bool kShouldSerializeWebCoreData = true; #endif - static void encode(ArgumentEncoder*, const WebCore::ResourceResponse&); + static void encode(ArgumentEncoder&, const WebCore::ResourceResponse&); static bool decode(ArgumentDecoder*, WebCore::ResourceResponse&); - static void encodePlatformData(ArgumentEncoder*, const WebCore::ResourceResponse&); + static void encodePlatformData(ArgumentEncoder&, const WebCore::ResourceResponse&); static bool decodePlatformData(ArgumentDecoder*, WebCore::ResourceResponse&); }; @@ -179,76 +179,76 @@ template<> struct ArgumentCoder<WebCore::ResourceError> { static const bool kShouldSerializeWebCoreData = true; #endif - static void encode(ArgumentEncoder*, const WebCore::ResourceError&); + static void encode(ArgumentEncoder&, const WebCore::ResourceError&); static bool decode(ArgumentDecoder*, WebCore::ResourceError&); - static void encodePlatformData(ArgumentEncoder*, const WebCore::ResourceError&); + static void encodePlatformData(ArgumentEncoder&, const WebCore::ResourceError&); static bool decodePlatformData(ArgumentDecoder*, WebCore::ResourceError&); }; template<> struct ArgumentCoder<WebCore::WindowFeatures> { - static void encode(ArgumentEncoder*, const WebCore::WindowFeatures&); + static void encode(ArgumentEncoder&, const WebCore::WindowFeatures&); static bool decode(ArgumentDecoder*, WebCore::WindowFeatures&); }; template<> struct ArgumentCoder<WebCore::Color> { - static void encode(ArgumentEncoder*, const WebCore::Color&); + static void encode(ArgumentEncoder&, const WebCore::Color&); static bool decode(ArgumentDecoder*, WebCore::Color&); }; #if PLATFORM(MAC) template<> struct ArgumentCoder<WebCore::KeypressCommand> { - static void encode(ArgumentEncoder*, const WebCore::KeypressCommand&); + static void encode(ArgumentEncoder&, const WebCore::KeypressCommand&); static bool decode(ArgumentDecoder*, WebCore::KeypressCommand&); }; #endif template<> struct ArgumentCoder<WebCore::CompositionUnderline> { - static void encode(ArgumentEncoder*, const WebCore::CompositionUnderline&); + static void encode(ArgumentEncoder&, const WebCore::CompositionUnderline&); static bool decode(ArgumentDecoder*, WebCore::CompositionUnderline&); }; template<> struct ArgumentCoder<WebCore::DatabaseDetails> { - static void encode(ArgumentEncoder*, const WebCore::DatabaseDetails&); + static void encode(ArgumentEncoder&, const WebCore::DatabaseDetails&); static bool decode(ArgumentDecoder*, WebCore::DatabaseDetails&); }; template<> struct ArgumentCoder<WebCore::DictationAlternative> { - static void encode(ArgumentEncoder*, const WebCore::DictationAlternative&); + static void encode(ArgumentEncoder&, const WebCore::DictationAlternative&); static bool decode(ArgumentDecoder*, WebCore::DictationAlternative&); }; template<> struct ArgumentCoder<WebCore::FileChooserSettings> { - static void encode(ArgumentEncoder*, const WebCore::FileChooserSettings&); + static void encode(ArgumentEncoder&, const WebCore::FileChooserSettings&); static bool decode(ArgumentDecoder*, WebCore::FileChooserSettings&); }; template<> struct ArgumentCoder<WebCore::GrammarDetail> { - static void encode(ArgumentEncoder*, const WebCore::GrammarDetail&); + static void encode(ArgumentEncoder&, const WebCore::GrammarDetail&); static bool decode(ArgumentDecoder*, WebCore::GrammarDetail&); }; template<> struct ArgumentCoder<WebCore::TextCheckingResult> { - static void encode(ArgumentEncoder*, const WebCore::TextCheckingResult&); + static void encode(ArgumentEncoder&, const WebCore::TextCheckingResult&); static bool decode(ArgumentDecoder*, WebCore::TextCheckingResult&); }; template<> struct ArgumentCoder<WebCore::DragSession> { - static void encode(ArgumentEncoder*, const WebCore::DragSession&); + static void encode(ArgumentEncoder&, const WebCore::DragSession&); static bool decode(ArgumentDecoder*, WebCore::DragSession&); }; template<> struct ArgumentCoder<WebCore::KURL> { - static void encode(ArgumentEncoder*, const WebCore::KURL&); + static void encode(ArgumentEncoder&, const WebCore::KURL&); static bool decode(ArgumentDecoder*, WebCore::KURL&); }; template<> struct ArgumentCoder<WebCore::UserStyleSheet> { - static void encode(ArgumentEncoder*, const WebCore::UserStyleSheet&); + static void encode(ArgumentEncoder&, const WebCore::UserStyleSheet&); static bool decode(ArgumentDecoder*, WebCore::UserStyleSheet&); }; template<> struct ArgumentCoder<WebCore::UserScript> { - static void encode(ArgumentEncoder*, const WebCore::UserScript&); + static void encode(ArgumentEncoder&, const WebCore::UserScript&); static bool decode(ArgumentDecoder*, WebCore::UserScript&); }; diff --git a/Source/WebKit2/Shared/WebEvent.cpp b/Source/WebKit2/Shared/WebEvent.cpp index 70bffa2c1..df3ed4ef4 100644 --- a/Source/WebKit2/Shared/WebEvent.cpp +++ b/Source/WebKit2/Shared/WebEvent.cpp @@ -46,11 +46,11 @@ WebEvent::WebEvent(Type type, Modifiers modifiers, double timestamp) { } -void WebEvent::encode(CoreIPC::ArgumentEncoder* encoder) const +void WebEvent::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(m_type); - encoder->encode(m_modifiers); - encoder->encode(m_timestamp); + encoder << m_type; + encoder << m_modifiers; + encoder << m_timestamp; } bool WebEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebEvent& result) diff --git a/Source/WebKit2/Shared/WebEvent.h b/Source/WebKit2/Shared/WebEvent.h index 8111d5160..9681dc160 100644 --- a/Source/WebKit2/Shared/WebEvent.h +++ b/Source/WebKit2/Shared/WebEvent.h @@ -103,7 +103,7 @@ protected: WebEvent(Type, Modifiers, double timestamp); - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, WebEvent&); private: @@ -140,7 +140,7 @@ public: bool didActivateWebView() const { return m_didActivateWebView; } #endif - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, WebMouseEvent&); private: @@ -199,7 +199,7 @@ public: const WebCore::FloatSize& unacceleratedScrollingDelta() const { return m_unacceleratedScrollingDelta; } #endif - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, WebWheelEvent&); private: @@ -237,7 +237,7 @@ public: bool isKeypad() const { return m_isKeypad; } bool isSystemKey() const { return m_isSystemKey; } - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, WebKeyboardEvent&); static bool isKeyboardEventType(Type); @@ -268,7 +268,7 @@ public: const WebCore::IntSize area() const { return m_area; } const WebCore::FloatPoint delta() const { return m_delta; } - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, WebGestureEvent&); private: @@ -313,7 +313,7 @@ public: void setState(TouchPointState state) { m_state = state; } - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, WebPlatformTouchPoint&); private: @@ -336,7 +336,7 @@ public: const Vector<WebPlatformTouchPoint>& touchPoints() const { return m_touchPoints; } - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, WebTouchEvent&); private: diff --git a/Source/WebKit2/Shared/WebGeolocationPosition.cpp b/Source/WebKit2/Shared/WebGeolocationPosition.cpp index 77d524cf4..645e8c0a3 100644 --- a/Source/WebKit2/Shared/WebGeolocationPosition.cpp +++ b/Source/WebKit2/Shared/WebGeolocationPosition.cpp @@ -51,7 +51,7 @@ WebGeolocationPosition::~WebGeolocationPosition() { } -void WebGeolocationPosition::Data::encode(CoreIPC::ArgumentEncoder* encoder) const +void WebGeolocationPosition::Data::encode(CoreIPC::ArgumentEncoder& encoder) const { CoreIPC::SimpleArgumentCoder<WebGeolocationPosition::Data>::encode(encoder, *this); } diff --git a/Source/WebKit2/Shared/WebGeolocationPosition.h b/Source/WebKit2/Shared/WebGeolocationPosition.h index a87bb062d..52ebed992 100644 --- a/Source/WebKit2/Shared/WebGeolocationPosition.h +++ b/Source/WebKit2/Shared/WebGeolocationPosition.h @@ -38,7 +38,7 @@ public: static const Type APIType = TypeGeolocationPosition; struct Data { - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, Data&); double timestamp; diff --git a/Source/WebKit2/Shared/WebGestureEvent.cpp b/Source/WebKit2/Shared/WebGestureEvent.cpp index d491a5707..a9089e2bb 100644 --- a/Source/WebKit2/Shared/WebGestureEvent.cpp +++ b/Source/WebKit2/Shared/WebGestureEvent.cpp @@ -53,14 +53,14 @@ WebGestureEvent::WebGestureEvent(Type type, const IntPoint& position, const IntP ASSERT(isGestureEventType(type)); } -void WebGestureEvent::encode(CoreIPC::ArgumentEncoder* encoder) const +void WebGestureEvent::encode(CoreIPC::ArgumentEncoder& encoder) const { WebEvent::encode(encoder); - encoder->encode(m_position); - encoder->encode(m_globalPosition); - encoder->encode(m_area); - encoder->encode(m_delta); + encoder << m_position; + encoder << m_globalPosition; + encoder << m_area; + encoder << m_delta; } bool WebGestureEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebGestureEvent& t) diff --git a/Source/WebKit2/Shared/WebHitTestResult.cpp b/Source/WebKit2/Shared/WebHitTestResult.cpp index 799ed5220..c2f054e12 100644 --- a/Source/WebKit2/Shared/WebHitTestResult.cpp +++ b/Source/WebKit2/Shared/WebHitTestResult.cpp @@ -34,16 +34,16 @@ PassRefPtr<WebHitTestResult> WebHitTestResult::create(const WebHitTestResult::Da return adoptRef(new WebHitTestResult(hitTestResultData)); } -void WebHitTestResult::Data::encode(CoreIPC::ArgumentEncoder* encoder) const +void WebHitTestResult::Data::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(absoluteImageURL); - encoder->encode(absolutePDFURL); - encoder->encode(absoluteLinkURL); - encoder->encode(absoluteMediaURL); - encoder->encode(linkLabel); - encoder->encode(linkTitle); - encoder->encode(isContentEditable); - encoder->encode(elementBoundingBox); + encoder << absoluteImageURL; + encoder << absolutePDFURL; + encoder << absoluteLinkURL; + encoder << absoluteMediaURL; + encoder << linkLabel; + encoder << linkTitle; + encoder << isContentEditable; + encoder << elementBoundingBox; } bool WebHitTestResult::Data::decode(CoreIPC::ArgumentDecoder* decoder, WebHitTestResult::Data& hitTestResultData) diff --git a/Source/WebKit2/Shared/WebHitTestResult.h b/Source/WebKit2/Shared/WebHitTestResult.h index e53a5c7e2..739050e11 100644 --- a/Source/WebKit2/Shared/WebHitTestResult.h +++ b/Source/WebKit2/Shared/WebHitTestResult.h @@ -86,7 +86,7 @@ public: { } - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, WebHitTestResult::Data&); }; diff --git a/Source/WebKit2/Shared/WebKeyboardEvent.cpp b/Source/WebKit2/Shared/WebKeyboardEvent.cpp index 119b86416..02056ff58 100644 --- a/Source/WebKit2/Shared/WebKeyboardEvent.cpp +++ b/Source/WebKit2/Shared/WebKeyboardEvent.cpp @@ -45,19 +45,19 @@ WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String& ASSERT(isKeyboardEventType(type)); } -void WebKeyboardEvent::encode(CoreIPC::ArgumentEncoder* encoder) const +void WebKeyboardEvent::encode(CoreIPC::ArgumentEncoder& encoder) const { WebEvent::encode(encoder); - encoder->encode(m_text); - encoder->encode(m_unmodifiedText); - encoder->encode(m_keyIdentifier); - encoder->encode(m_windowsVirtualKeyCode); - encoder->encode(m_nativeVirtualKeyCode); - encoder->encode(m_macCharCode); - encoder->encode(m_isAutoRepeat); - encoder->encode(m_isKeypad); - encoder->encode(m_isSystemKey); + encoder << m_text; + encoder << m_unmodifiedText; + encoder << m_keyIdentifier; + encoder << m_windowsVirtualKeyCode; + encoder << m_nativeVirtualKeyCode; + encoder << m_macCharCode; + encoder << m_isAutoRepeat; + encoder << m_isKeypad; + encoder << m_isSystemKey; } bool WebKeyboardEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebKeyboardEvent& result) diff --git a/Source/WebKit2/Shared/WebLayerTreeInfo.cpp b/Source/WebKit2/Shared/WebLayerTreeInfo.cpp index e08364006..d1b131fea 100644 --- a/Source/WebKit2/Shared/WebLayerTreeInfo.cpp +++ b/Source/WebKit2/Shared/WebLayerTreeInfo.cpp @@ -30,7 +30,7 @@ using namespace CoreIPC; namespace WebKit { -void WebLayerInfo::encode(CoreIPC::ArgumentEncoder* encoder) const +void WebLayerInfo::encode(CoreIPC::ArgumentEncoder& encoder) const { SimpleArgumentCoder<WebLayerInfo>::encode(encoder, *this); } diff --git a/Source/WebKit2/Shared/WebLayerTreeInfo.h b/Source/WebKit2/Shared/WebLayerTreeInfo.h index df44778a8..58e07bc02 100644 --- a/Source/WebKit2/Shared/WebLayerTreeInfo.h +++ b/Source/WebKit2/Shared/WebLayerTreeInfo.h @@ -37,14 +37,12 @@ enum { InvalidWebLayerID = 0 }; // NOTE: WebLayerInfo should only use POD types, as to make serialization faster. struct WebLayerInfo { WebLayerInfo() - : parent(InvalidWebLayerID) - , replica(InvalidWebLayerID) + : replica(InvalidWebLayerID) , mask(InvalidWebLayerID) , imageBackingStoreID(0) , opacity(0) , flags(0) { } - WebLayerID parent; WebLayerID replica; WebLayerID mask; int64_t imageBackingStoreID; @@ -71,7 +69,7 @@ struct WebLayerInfo { unsigned int flags; }; - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, WebLayerInfo&); }; diff --git a/Source/WebKit2/Shared/WebMemorySampler.cpp b/Source/WebKit2/Shared/WebMemorySampler.cpp index 344f7f573..2cfd19b44 100644 --- a/Source/WebKit2/Shared/WebMemorySampler.cpp +++ b/Source/WebKit2/Shared/WebMemorySampler.cpp @@ -29,6 +29,7 @@ #if ENABLE(MEMORY_SAMPLER) #include <stdio.h> +#include <unistd.h> #include <wtf/text/CString.h> #include <wtf/text/StringBuilder.h> @@ -82,7 +83,7 @@ void WebMemorySampler::start(const SandboxExtension::Handle& sampleLogFileHandle void WebMemorySampler::initializeTimers(double interval) { m_sampleTimer.startRepeating(1); - printf("Started memory sampler for process %s", processName().utf8().data()); + printf("Started memory sampler for process %s %d", processName().utf8().data(), getpid()); if (interval > 0) { m_stopTimer.startOneShot(interval); printf(" for a interval of %g seconds", interval); @@ -98,7 +99,7 @@ void WebMemorySampler::stop() return; m_sampleTimer.stop(); m_sampleLogFile = 0; - printf("Stopped memory sampler for process %s\n", processName().utf8().data()); + printf("Stopped memory sampler for process %s %d\n", processName().utf8().data(), getpid()); // Flush stdout buffer so python script can be guaranteed to read up to this point. fflush(stdout); m_isRunning = false; @@ -135,7 +136,7 @@ void WebMemorySampler::initializeSandboxedLogFile(const SandboxExtension::Handle void WebMemorySampler::writeHeaders() { - String processDetails = "Process: " + processName() + '\n'; + String processDetails = String::format("Process: %s Pid: %d\n", processName().utf8().data(), getpid()); CString utf8String = processDetails.utf8(); writeToFile(m_sampleLogFile, utf8String.data(), utf8String.length()); diff --git a/Source/WebKit2/Shared/WebMouseEvent.cpp b/Source/WebKit2/Shared/WebMouseEvent.cpp index 32e6ac1f3..fb02ac39e 100644 --- a/Source/WebKit2/Shared/WebMouseEvent.cpp +++ b/Source/WebKit2/Shared/WebMouseEvent.cpp @@ -78,20 +78,20 @@ WebMouseEvent::WebMouseEvent(Type type, Button button, const IntPoint& position, } #endif -void WebMouseEvent::encode(CoreIPC::ArgumentEncoder* encoder) const +void WebMouseEvent::encode(CoreIPC::ArgumentEncoder& encoder) const { WebEvent::encode(encoder); - encoder->encode(m_button); - encoder->encode(m_position); - encoder->encode(m_globalPosition); - encoder->encode(m_deltaX); - encoder->encode(m_deltaY); - encoder->encode(m_deltaZ); - encoder->encode(m_clickCount); + encoder << m_button; + encoder << m_position; + encoder << m_globalPosition; + encoder << m_deltaX; + encoder << m_deltaY; + encoder << m_deltaZ; + encoder << m_clickCount; #if PLATFORM(WIN) - encoder->encode(m_didActivateWebView); + encoder << m_didActivateWebView; #endif } diff --git a/Source/WebKit2/Shared/WebNavigationDataStore.h b/Source/WebKit2/Shared/WebNavigationDataStore.h index 947d090c9..f521a582c 100644 --- a/Source/WebKit2/Shared/WebNavigationDataStore.h +++ b/Source/WebKit2/Shared/WebNavigationDataStore.h @@ -35,11 +35,11 @@ namespace WebKit { struct WebNavigationDataStore { - void encode(CoreIPC::ArgumentEncoder* encoder) const + void encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(url); - encoder->encode(title); - encoder->encode(originalRequest); + encoder << url; + encoder << title; + encoder << originalRequest; } static bool decode(CoreIPC::ArgumentDecoder* decoder, WebNavigationDataStore& store) diff --git a/Source/WebKit2/Shared/WebNetworkInfo.cpp b/Source/WebKit2/Shared/WebNetworkInfo.cpp index a2852341a..9b133f815 100644 --- a/Source/WebKit2/Shared/WebNetworkInfo.cpp +++ b/Source/WebKit2/Shared/WebNetworkInfo.cpp @@ -43,10 +43,10 @@ WebNetworkInfo::~WebNetworkInfo() { } -void WebNetworkInfo::Data::encode(CoreIPC::ArgumentEncoder* encoder) const +void WebNetworkInfo::Data::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(bandwidth); - encoder->encode(metered); + encoder.encode(bandwidth); + encoder.encode(metered); } bool WebNetworkInfo::Data::decode(CoreIPC::ArgumentDecoder* decoder, Data& result) diff --git a/Source/WebKit2/Shared/WebNetworkInfo.h b/Source/WebKit2/Shared/WebNetworkInfo.h index 4c1617374..b31bbe367 100644 --- a/Source/WebKit2/Shared/WebNetworkInfo.h +++ b/Source/WebKit2/Shared/WebNetworkInfo.h @@ -40,7 +40,7 @@ public: static const Type APIType = TypeNetworkInfo; struct Data { - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, Data&); double bandwidth; diff --git a/Source/WebKit2/Shared/WebPageCreationParameters.cpp b/Source/WebKit2/Shared/WebPageCreationParameters.cpp index 27d55434a..2a4afd938 100644 --- a/Source/WebKit2/Shared/WebPageCreationParameters.cpp +++ b/Source/WebKit2/Shared/WebPageCreationParameters.cpp @@ -30,42 +30,42 @@ namespace WebKit { -void WebPageCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) const +void WebPageCreationParameters::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(viewSize); - encoder->encode(isActive); - encoder->encode(isFocused); - encoder->encode(isVisible); - encoder->encode(isInWindow); + encoder << viewSize; + encoder << isActive; + encoder << isFocused; + encoder << isVisible; + encoder << isInWindow; - encoder->encode(store); - encoder->encodeEnum(drawingAreaType); - encoder->encode(pageGroupData); - encoder->encode(drawsBackground); - encoder->encode(drawsTransparentBackground); - encoder->encode(areMemoryCacheClientCallsEnabled); - encoder->encode(useFixedLayout); - encoder->encode(fixedLayoutSize); - encoder->encodeEnum(paginationMode); - encoder->encode(paginationBehavesLikeColumns); - encoder->encode(pageLength); - encoder->encode(gapBetweenPages); - encoder->encode(userAgent); - encoder->encode(sessionState); - encoder->encode(highestUsedBackForwardItemID); - encoder->encode(canRunBeforeUnloadConfirmPanel); - encoder->encode(canRunModal); - encoder->encode(deviceScaleFactor); - encoder->encode(mediaVolume); + encoder << store; + encoder.encodeEnum(drawingAreaType); + encoder << pageGroupData; + encoder << drawsBackground; + encoder << drawsTransparentBackground; + encoder << areMemoryCacheClientCallsEnabled; + encoder << useFixedLayout; + encoder << fixedLayoutSize; + encoder.encodeEnum(paginationMode); + encoder << paginationBehavesLikeColumns; + encoder << pageLength; + encoder << gapBetweenPages; + encoder << userAgent; + encoder << sessionState; + encoder << highestUsedBackForwardItemID; + encoder << canRunBeforeUnloadConfirmPanel; + encoder << canRunModal; + encoder << deviceScaleFactor; + encoder << mediaVolume; #if PLATFORM(MAC) - encoder->encode(isSmartInsertDeleteEnabled); - encoder->encodeEnum(layerHostingMode); - encoder->encode(colorSpace); + encoder << isSmartInsertDeleteEnabled; + encoder.encodeEnum(layerHostingMode); + encoder << colorSpace; #endif #if PLATFORM(WIN) - encoder->encode(reinterpret_cast<uint64_t>(nativeWindow)); + encoder << reinterpret_cast<uint64_t>(nativeWindow); #endif } diff --git a/Source/WebKit2/Shared/WebPageCreationParameters.h b/Source/WebKit2/Shared/WebPageCreationParameters.h index 08c3bcd21..214c04c50 100644 --- a/Source/WebKit2/Shared/WebPageCreationParameters.h +++ b/Source/WebKit2/Shared/WebPageCreationParameters.h @@ -45,7 +45,7 @@ namespace CoreIPC { namespace WebKit { struct WebPageCreationParameters { - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, WebPageCreationParameters&); WebCore::IntSize viewSize; diff --git a/Source/WebKit2/Shared/WebPageGroupData.cpp b/Source/WebKit2/Shared/WebPageGroupData.cpp index c227d8596..871b4d1d8 100644 --- a/Source/WebKit2/Shared/WebPageGroupData.cpp +++ b/Source/WebKit2/Shared/WebPageGroupData.cpp @@ -30,14 +30,14 @@ namespace WebKit { -void WebPageGroupData::encode(CoreIPC::ArgumentEncoder* encoder) const +void WebPageGroupData::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(identifer); - encoder->encode(pageGroupID); - encoder->encode(visibleToInjectedBundle); - encoder->encode(visibleToHistoryClient); - encoder->encode(userStyleSheets); - encoder->encode(userScripts); + encoder << identifer; + encoder << pageGroupID; + encoder << visibleToInjectedBundle; + encoder << visibleToHistoryClient; + encoder << userStyleSheets; + encoder << userScripts; } bool WebPageGroupData::decode(CoreIPC::ArgumentDecoder* decoder, WebPageGroupData& data) diff --git a/Source/WebKit2/Shared/WebPageGroupData.h b/Source/WebKit2/Shared/WebPageGroupData.h index b9aa0f8f5..4dbfd2c31 100644 --- a/Source/WebKit2/Shared/WebPageGroupData.h +++ b/Source/WebKit2/Shared/WebPageGroupData.h @@ -39,7 +39,7 @@ class ArgumentEncoder; namespace WebKit { struct WebPageGroupData { - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, WebPageGroupData&); String identifer; diff --git a/Source/WebKit2/Shared/WebPlatformTouchPoint.cpp b/Source/WebKit2/Shared/WebPlatformTouchPoint.cpp index 39026e0f5..bae8d65b0 100644 --- a/Source/WebKit2/Shared/WebPlatformTouchPoint.cpp +++ b/Source/WebKit2/Shared/WebPlatformTouchPoint.cpp @@ -57,15 +57,15 @@ WebPlatformTouchPoint::WebPlatformTouchPoint(unsigned id, TouchPointState state, { } -void WebPlatformTouchPoint::encode(CoreIPC::ArgumentEncoder* encoder) const +void WebPlatformTouchPoint::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(m_id); - encoder->encode(m_state); - encoder->encode(m_screenPosition); - encoder->encode(m_position); - encoder->encode(m_radius); - encoder->encode(m_rotationAngle); - encoder->encode(m_force); + encoder << m_id; + encoder << m_state; + encoder << m_screenPosition; + encoder << m_position; + encoder << m_radius; + encoder << m_rotationAngle; + encoder << m_force; } bool WebPlatformTouchPoint::decode(CoreIPC::ArgumentDecoder* decoder, WebPlatformTouchPoint& result) diff --git a/Source/WebKit2/Shared/WebPopupItem.cpp b/Source/WebKit2/Shared/WebPopupItem.cpp index 07a29e416..bbe48fbb7 100644 --- a/Source/WebKit2/Shared/WebPopupItem.cpp +++ b/Source/WebKit2/Shared/WebPopupItem.cpp @@ -66,17 +66,17 @@ WebPopupItem::WebPopupItem(Type type, const String& text, TextDirection textDire { } -void WebPopupItem::encode(CoreIPC::ArgumentEncoder* encoder) const +void WebPopupItem::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encodeEnum(m_type); - encoder->encode(m_text); - encoder->encodeEnum(m_textDirection); - encoder->encode(m_hasTextDirectionOverride); - encoder->encode(m_toolTip); - encoder->encode(m_accessibilityText); - encoder->encode(m_isEnabled); - encoder->encode(m_isLabel); - encoder->encode(m_isSelected); + encoder.encodeEnum(m_type); + encoder << m_text; + encoder.encodeEnum(m_textDirection); + encoder << m_hasTextDirectionOverride; + encoder << m_toolTip; + encoder << m_accessibilityText; + encoder << m_isEnabled; + encoder << m_isLabel; + encoder << m_isSelected; } bool WebPopupItem::decode(CoreIPC::ArgumentDecoder* decoder, WebPopupItem& item) diff --git a/Source/WebKit2/Shared/WebPopupItem.h b/Source/WebKit2/Shared/WebPopupItem.h index d8584bea5..6f8ecb101 100644 --- a/Source/WebKit2/Shared/WebPopupItem.h +++ b/Source/WebKit2/Shared/WebPopupItem.h @@ -46,7 +46,7 @@ struct WebPopupItem { WebPopupItem(Type); 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; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, WebPopupItem&); Type m_type; diff --git a/Source/WebKit2/Shared/WebPreferencesStore.cpp b/Source/WebKit2/Shared/WebPreferencesStore.cpp index 740a971aa..e73c0f679 100644 --- a/Source/WebKit2/Shared/WebPreferencesStore.cpp +++ b/Source/WebKit2/Shared/WebPreferencesStore.cpp @@ -59,13 +59,13 @@ WebPreferencesStore::WebPreferencesStore() { } -void WebPreferencesStore::encode(CoreIPC::ArgumentEncoder* encoder) const +void WebPreferencesStore::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(m_stringValues); - encoder->encode(m_boolValues); - encoder->encode(m_uint32Values); - encoder->encode(m_doubleValues); - encoder->encode(m_floatValues); + encoder << m_stringValues; + encoder << m_boolValues; + encoder << m_uint32Values; + encoder << m_doubleValues; + encoder << m_floatValues; } bool WebPreferencesStore::decode(CoreIPC::ArgumentDecoder* decoder, WebPreferencesStore& result) @@ -227,4 +227,14 @@ double WebPreferencesStore::getDoubleValueForKey(const String& key) const return valueForKey(m_doubleValues, key); } +bool WebPreferencesStore::setFloatValueForKey(const String& key, float value) +{ + return setValueForKey(m_floatValues, key, value); +} + +float WebPreferencesStore::getFloatValueForKey(const String& key) const +{ + return valueForKey(m_floatValues, key); +} + } // namespace WebKit diff --git a/Source/WebKit2/Shared/WebPreferencesStore.h b/Source/WebKit2/Shared/WebPreferencesStore.h index 7bbcae0c2..07d62ac69 100644 --- a/Source/WebKit2/Shared/WebPreferencesStore.h +++ b/Source/WebKit2/Shared/WebPreferencesStore.h @@ -138,6 +138,7 @@ namespace WebKit { macro(CookieEnabled, cookieEnabled, Bool, bool, true) \ macro(PlugInSnapshottingEnabled, plugInSnapshottingEnabled, Bool, bool, false) \ macro(PDFPluginEnabled, pdfPluginEnabled, Bool, bool, false) \ + macro(UsesEncodingDetector, usesEncodingDetector, Bool, bool, false) \ \ #define FOR_EACH_WEBKIT_DOUBLE_PREFERENCE(macro) \ @@ -233,7 +234,7 @@ FOR_EACH_WEBKIT_PREFERENCE(DECLARE_KEY_GETTERS) struct WebPreferencesStore { WebPreferencesStore(); - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, WebPreferencesStore&); // NOTE: The getters in this class have non-standard names to aid in the use of the preference macros. diff --git a/Source/WebKit2/Shared/WebProcessCreationParameters.cpp b/Source/WebKit2/Shared/WebProcessCreationParameters.cpp index c3fcee6c2..56383f749 100644 --- a/Source/WebKit2/Shared/WebProcessCreationParameters.cpp +++ b/Source/WebKit2/Shared/WebProcessCreationParameters.cpp @@ -27,7 +27,7 @@ #include "WebProcessCreationParameters.h" #include "ArgumentCoders.h" -#if USE(CFURLSTORAGESESSIONS) && PLATFORM(WIN) +#if PLATFORM(WIN) && USE(CFNETWORK) #include "ArgumentCodersCF.h" #endif @@ -52,69 +52,69 @@ WebProcessCreationParameters::WebProcessCreationParameters() { } -void WebProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) const +void WebProcessCreationParameters::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(injectedBundlePath); - encoder->encode(injectedBundlePathExtensionHandle); - encoder->encode(applicationCacheDirectory); - encoder->encode(applicationCacheDirectoryExtensionHandle); - encoder->encode(databaseDirectory); - encoder->encode(databaseDirectoryExtensionHandle); - encoder->encode(localStorageDirectory); - encoder->encode(localStorageDirectoryExtensionHandle); - encoder->encode(diskCacheDirectory); - encoder->encode(diskCacheDirectoryExtensionHandle); - encoder->encode(cookieStorageDirectory); - encoder->encode(cookieStorageDirectoryExtensionHandle); - encoder->encode(urlSchemesRegistererdAsEmptyDocument); - encoder->encode(urlSchemesRegisteredAsSecure); - encoder->encode(urlSchemesForWhichDomainRelaxationIsForbidden); - encoder->encode(urlSchemesRegisteredAsLocal); - encoder->encode(urlSchemesRegisteredAsNoAccess); - encoder->encode(urlSchemesRegisteredAsDisplayIsolated); - encoder->encode(urlSchemesRegisteredAsCORSEnabled); - encoder->encodeEnum(cacheModel); - encoder->encode(shouldTrackVisitedLinks); - encoder->encode(shouldAlwaysUseComplexTextCodePath); - encoder->encode(shouldUseFontSmoothing); - encoder->encode(iconDatabaseEnabled); - encoder->encode(terminationTimeout); - encoder->encode(languages); - encoder->encode(textCheckerState); - encoder->encode(fullKeyboardAccessEnabled); - encoder->encode(defaultRequestTimeoutInterval); -#if PLATFORM(MAC) || USE(CFURLSTORAGESESSIONS) - encoder->encode(uiProcessBundleIdentifier); + encoder << injectedBundlePath; + encoder << injectedBundlePathExtensionHandle; + encoder << applicationCacheDirectory; + encoder << applicationCacheDirectoryExtensionHandle; + encoder << databaseDirectory; + encoder << databaseDirectoryExtensionHandle; + encoder << localStorageDirectory; + encoder << localStorageDirectoryExtensionHandle; + encoder << diskCacheDirectory; + encoder << diskCacheDirectoryExtensionHandle; + encoder << cookieStorageDirectory; + encoder << cookieStorageDirectoryExtensionHandle; + encoder << urlSchemesRegistererdAsEmptyDocument; + encoder << urlSchemesRegisteredAsSecure; + encoder << urlSchemesForWhichDomainRelaxationIsForbidden; + encoder << urlSchemesRegisteredAsLocal; + encoder << urlSchemesRegisteredAsNoAccess; + encoder << urlSchemesRegisteredAsDisplayIsolated; + encoder << urlSchemesRegisteredAsCORSEnabled; + encoder.encodeEnum(cacheModel); + encoder << shouldTrackVisitedLinks; + encoder << shouldAlwaysUseComplexTextCodePath; + encoder << shouldUseFontSmoothing; + encoder << iconDatabaseEnabled; + encoder << terminationTimeout; + encoder << languages; + encoder << textCheckerState; + encoder << fullKeyboardAccessEnabled; + encoder << defaultRequestTimeoutInterval; +#if PLATFORM(MAC) || USE(CFNETWORK) + encoder << uiProcessBundleIdentifier; #endif #if PLATFORM(MAC) - encoder->encode(parentProcessName); - encoder->encode(presenterApplicationPid); - encoder->encode(nsURLCacheMemoryCapacity); - encoder->encode(nsURLCacheDiskCapacity); - encoder->encode(acceleratedCompositingPort); - encoder->encode(uiProcessBundleResourcePath); - encoder->encode(uiProcessBundleResourcePathExtensionHandle); - encoder->encode(shouldForceScreenFontSubstitution); - encoder->encode(shouldEnableKerningAndLigaturesByDefault); + encoder << parentProcessName; + encoder << presenterApplicationPid; + encoder << nsURLCacheMemoryCapacity; + encoder << nsURLCacheDiskCapacity; + encoder << acceleratedCompositingPort; + encoder << uiProcessBundleResourcePath; + encoder << uiProcessBundleResourcePathExtensionHandle; + encoder << shouldForceScreenFontSubstitution; + encoder << shouldEnableKerningAndLigaturesByDefault; #elif PLATFORM(WIN) - encoder->encode(shouldPaintNativeControls); - encoder->encode(cfURLCacheDiskCapacity); - encoder->encode(cfURLCacheMemoryCapacity); - encoder->encode(initialHTTPCookieAcceptPolicy); -#if USE(CFURLSTORAGESESSIONS) + encoder << shouldPaintNativeControls; + encoder << cfURLCacheDiskCapacity; + encoder << cfURLCacheMemoryCapacity; + encoder << initialHTTPCookieAcceptPolicy; +#if PLATFORM(MAC) || USE(CFNETWORK) CFDataRef storageSession = serializedDefaultStorageSession.get(); - encoder->encode(static_cast<bool>(storageSession)); + encoder << static_cast<bool>(storageSession); if (storageSession) CoreIPC::encode(encoder, storageSession); -#endif // USE(CFURLSTORAGESESSIONS) +#endif #endif #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) - encoder->encode(notificationPermissions); + encoder << notificationPermissions; #endif #if ENABLE(NETWORK_PROCESS) - encoder->encode(usesNetworkProcess); + encoder << usesNetworkProcess; #endif } @@ -178,7 +178,7 @@ bool WebProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, Web return false; if (!decoder->decode(parameters.defaultRequestTimeoutInterval)) return false; -#if PLATFORM(MAC) || USE(CFURLSTORAGESESSIONS) +#if PLATFORM(MAC) || USE(CFNETWORK) if (!decoder->decode(parameters.uiProcessBundleIdentifier)) return false; #endif @@ -211,13 +211,13 @@ bool WebProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, Web return false; if (!decoder->decode(parameters.initialHTTPCookieAcceptPolicy)) return false; -#if USE(CFURLSTORAGESESSIONS) +#if PLATFORM(MAC) || USE(CFNETWORK) bool hasStorageSession = false; if (!decoder->decode(hasStorageSession)) return false; if (hasStorageSession && !CoreIPC::decode(decoder, parameters.serializedDefaultStorageSession)) return false; -#endif // USE(CFURLSTORAGESESSIONS) +#endif #endif #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) diff --git a/Source/WebKit2/Shared/WebProcessCreationParameters.h b/Source/WebKit2/Shared/WebProcessCreationParameters.h index 1f4880369..de5f9f32f 100644 --- a/Source/WebKit2/Shared/WebProcessCreationParameters.h +++ b/Source/WebKit2/Shared/WebProcessCreationParameters.h @@ -48,7 +48,7 @@ namespace WebKit { struct WebProcessCreationParameters { WebProcessCreationParameters(); - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, WebProcessCreationParameters&); String injectedBundlePath; @@ -91,7 +91,7 @@ struct WebProcessCreationParameters { double defaultRequestTimeoutInterval; -#if PLATFORM(MAC) || USE(CFURLSTORAGESESSIONS) +#if PLATFORM(MAC) || USE(CFNETWORK) String uiProcessBundleIdentifier; #endif @@ -119,9 +119,9 @@ struct WebProcessCreationParameters { bool shouldPaintNativeControls; -#if USE(CFURLSTORAGESESSIONS) +#if USE(CFNETWORK) RetainPtr<CFDataRef> serializedDefaultStorageSession; -#endif // USE(CFURLSTORAGESESSIONS) +#endif #endif // PLATFORM(WIN) #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) diff --git a/Source/WebKit2/Shared/WebSecurityOrigin.h b/Source/WebKit2/Shared/WebSecurityOrigin.h index 66074c54a..b6ec1c9c9 100644 --- a/Source/WebKit2/Shared/WebSecurityOrigin.h +++ b/Source/WebKit2/Shared/WebSecurityOrigin.h @@ -38,26 +38,24 @@ public: static PassRefPtr<WebSecurityOrigin> createFromString(const String& string) { - RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::createFromString(string); - if (!securityOrigin) - return 0; - return adoptRef(new WebSecurityOrigin(securityOrigin.release())); + return create(WebCore::SecurityOrigin::createFromString(string)); } static PassRefPtr<WebSecurityOrigin> createFromDatabaseIdentifier(const String& identifier) { - RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::createFromDatabaseIdentifier(identifier); - if (!securityOrigin) - return 0; - return adoptRef(new WebSecurityOrigin(securityOrigin.release())); + return create(WebCore::SecurityOrigin::createFromDatabaseIdentifier(identifier)); } static PassRefPtr<WebSecurityOrigin> create(const String& protocol, const String& host, int port) { - RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::create(protocol, host, port); + return create(WebCore::SecurityOrigin::create(protocol, host, port)); + } + + static PassRefPtr<WebSecurityOrigin> create(PassRefPtr<WebCore::SecurityOrigin> securityOrigin) + { if (!securityOrigin) return 0; - return adoptRef(new WebSecurityOrigin(securityOrigin.release())); + return adoptRef(new WebSecurityOrigin(securityOrigin)); } const String protocol() const { return m_securityOrigin->protocol(); } diff --git a/Source/WebKit2/Shared/WebTouchEvent.cpp b/Source/WebKit2/Shared/WebTouchEvent.cpp index 7213c78db..1f7e9f7e5 100644 --- a/Source/WebKit2/Shared/WebTouchEvent.cpp +++ b/Source/WebKit2/Shared/WebTouchEvent.cpp @@ -40,11 +40,11 @@ WebTouchEvent::WebTouchEvent(WebEvent::Type type, Vector<WebPlatformTouchPoint> ASSERT(isTouchEventType(type)); } -void WebTouchEvent::encode(CoreIPC::ArgumentEncoder* encoder) const +void WebTouchEvent::encode(CoreIPC::ArgumentEncoder& encoder) const { WebEvent::encode(encoder); - encoder->encode(m_touchPoints); + encoder << m_touchPoints; } bool WebTouchEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebTouchEvent& result) diff --git a/Source/WebKit2/Shared/WebWheelEvent.cpp b/Source/WebKit2/Shared/WebWheelEvent.cpp index 37c691e64..3bd19f4ea 100644 --- a/Source/WebKit2/Shared/WebWheelEvent.cpp +++ b/Source/WebKit2/Shared/WebWheelEvent.cpp @@ -69,22 +69,22 @@ WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint } #endif -void WebWheelEvent::encode(CoreIPC::ArgumentEncoder* encoder) const +void WebWheelEvent::encode(CoreIPC::ArgumentEncoder& encoder) const { WebEvent::encode(encoder); - encoder->encode(m_position); - encoder->encode(m_globalPosition); - encoder->encode(m_delta); - encoder->encode(m_wheelTicks); - encoder->encode(m_granularity); - encoder->encode(m_directionInvertedFromDevice); + encoder << m_position; + encoder << m_globalPosition; + encoder << m_delta; + encoder << m_wheelTicks; + encoder << m_granularity; + encoder << m_directionInvertedFromDevice; #if PLATFORM(MAC) - encoder->encode(m_phase); - encoder->encode(m_momentumPhase); - encoder->encode(m_hasPreciseScrollingDeltas); - encoder->encode(m_scrollCount); - encoder->encode(m_unacceleratedScrollingDelta); + encoder << m_phase; + encoder << m_momentumPhase; + encoder << m_hasPreciseScrollingDeltas; + encoder << m_scrollCount; + encoder << m_unacceleratedScrollingDelta; #endif } diff --git a/Source/WebKit2/Shared/cairo/LayerTreeContextCairo.cpp b/Source/WebKit2/Shared/cairo/LayerTreeContextCairo.cpp index 915997660..5d37a3ccb 100644 --- a/Source/WebKit2/Shared/cairo/LayerTreeContextCairo.cpp +++ b/Source/WebKit2/Shared/cairo/LayerTreeContextCairo.cpp @@ -40,7 +40,7 @@ LayerTreeContext::~LayerTreeContext() notImplemented(); } -void LayerTreeContext::encode(CoreIPC::ArgumentEncoder*) const +void LayerTreeContext::encode(CoreIPC::ArgumentEncoder&) const { notImplemented(); } diff --git a/Source/WebKit2/Shared/cf/ArgumentCodersCF.cpp b/Source/WebKit2/Shared/cf/ArgumentCodersCF.cpp index 7261abda6..1f01de4e9 100644 --- a/Source/WebKit2/Shared/cf/ArgumentCodersCF.cpp +++ b/Source/WebKit2/Shared/cf/ArgumentCodersCF.cpp @@ -98,10 +98,10 @@ static CFType typeFromCFTypeRef(CFTypeRef type) return Unknown; } -void encode(ArgumentEncoder* encoder, CFTypeRef typeRef) +void encode(ArgumentEncoder& encoder, CFTypeRef typeRef) { CFType type = typeFromCFTypeRef(typeRef); - encoder->encodeEnum(type); + encoder.encodeEnum(type); switch (type) { case CFArray: @@ -240,14 +240,15 @@ bool decode(ArgumentDecoder* decoder, RetainPtr<CFTypeRef>& result) return false; } -void encode(ArgumentEncoder* encoder, CFArrayRef array) +void encode(ArgumentEncoder& encoder, CFArrayRef array) { CFIndex size = CFArrayGetCount(array); Vector<CFTypeRef, 32> values(size); CFArrayGetValues(array, CFRangeMake(0, size), values.data()); - encoder->encode(static_cast<uint64_t>(size)); + encoder << static_cast<uint64_t>(size); + for (CFIndex i = 0; i < size; ++i) { ASSERT(values[i]); @@ -275,9 +276,9 @@ bool decode(ArgumentDecoder* decoder, RetainPtr<CFArrayRef>& result) return true; } -void encode(ArgumentEncoder* encoder, CFBooleanRef boolean) +void encode(ArgumentEncoder& encoder, CFBooleanRef boolean) { - encoder->encode(static_cast<bool>(CFBooleanGetValue(boolean))); + encoder << static_cast<bool>(CFBooleanGetValue(boolean)); } bool decode(ArgumentDecoder* decoder, RetainPtr<CFBooleanRef>& result) @@ -290,12 +291,12 @@ bool decode(ArgumentDecoder* decoder, RetainPtr<CFBooleanRef>& result) return true; } -void encode(ArgumentEncoder* encoder, CFDataRef data) +void encode(ArgumentEncoder& encoder, CFDataRef data) { CFIndex length = CFDataGetLength(data); const UInt8* bytePtr = CFDataGetBytePtr(data); - encoder->encodeVariableLengthByteArray(CoreIPC::DataReference(bytePtr, length)); + encoder << CoreIPC::DataReference(bytePtr, length); } bool decode(ArgumentDecoder* decoder, RetainPtr<CFDataRef>& result) @@ -308,9 +309,9 @@ bool decode(ArgumentDecoder* decoder, RetainPtr<CFDataRef>& result) return true; } -void encode(ArgumentEncoder* encoder, CFDateRef date) +void encode(ArgumentEncoder& encoder, CFDateRef date) { - encoder->encode(static_cast<double>(CFDateGetAbsoluteTime(date))); + encoder << static_cast<double>(CFDateGetAbsoluteTime(date)); } bool decode(ArgumentDecoder* decoder, RetainPtr<CFDateRef>& result) @@ -323,7 +324,7 @@ bool decode(ArgumentDecoder* decoder, RetainPtr<CFDateRef>& result) return true; } -void encode(ArgumentEncoder* encoder, CFDictionaryRef dictionary) +void encode(ArgumentEncoder& encoder, CFDictionaryRef dictionary) { CFIndex size = CFDictionaryGetCount(dictionary); Vector<CFTypeRef, 32> keys(size); @@ -331,7 +332,7 @@ void encode(ArgumentEncoder* encoder, CFDictionaryRef dictionary) CFDictionaryGetKeysAndValues(dictionary, keys.data(), values.data()); - encoder->encode(static_cast<uint64_t>(size)); + encoder << static_cast<uint64_t>(size); for (CFIndex i = 0; i < size; ++i) { ASSERT(keys[i]); @@ -371,7 +372,7 @@ bool decode(ArgumentDecoder* decoder, RetainPtr<CFDictionaryRef>& result) return true; } -void encode(ArgumentEncoder* encoder, CFNumberRef number) +void encode(ArgumentEncoder& encoder, CFNumberRef number) { CFNumberType numberType = CFNumberGetType(number); @@ -379,8 +380,8 @@ void encode(ArgumentEncoder* encoder, CFNumberRef number) bool result = CFNumberGetValue(number, numberType, buffer.data()); ASSERT_UNUSED(result, result); - encoder->encodeEnum(numberType); - encoder->encodeVariableLengthByteArray(buffer); + encoder.encodeEnum(numberType); + encoder << CoreIPC::DataReference(buffer); } static size_t sizeForNumberType(CFNumberType numberType) @@ -452,7 +453,7 @@ bool decode(ArgumentDecoder* decoder, RetainPtr<CFNumberRef>& result) return true; } -void encode(ArgumentEncoder* encoder, CFStringRef string) +void encode(ArgumentEncoder& encoder, CFStringRef string) { CFIndex length = CFStringGetLength(string); CFStringEncoding encoding = CFStringGetFastestEncoding(string); @@ -467,8 +468,8 @@ void encode(ArgumentEncoder* encoder, CFStringRef string) numConvertedBytes = CFStringGetBytes(string, range, encoding, 0, false, buffer.data(), buffer.size(), &bufferLength); ASSERT(numConvertedBytes == length); - encoder->encodeEnum(encoding); - encoder->encodeVariableLengthByteArray(buffer); + encoder.encodeEnum(encoding); + encoder << CoreIPC::DataReference(buffer); } bool decode(ArgumentDecoder* decoder, RetainPtr<CFStringRef>& result) @@ -492,10 +493,10 @@ bool decode(ArgumentDecoder* decoder, RetainPtr<CFStringRef>& result) return true; } -void encode(ArgumentEncoder* encoder, CFURLRef url) +void encode(ArgumentEncoder& encoder, CFURLRef url) { CFURLRef baseURL = CFURLGetBaseURL(url); - encoder->encode(static_cast<bool>(baseURL)); + encoder << static_cast<bool>(baseURL); if (baseURL) encode(encoder, baseURL); @@ -536,7 +537,7 @@ bool decode(ArgumentDecoder* decoder, RetainPtr<CFURLRef>& result) } #if USE(SECURITY_FRAMEWORK) -void encode(ArgumentEncoder* encoder, SecCertificateRef certificate) +void encode(ArgumentEncoder& encoder, SecCertificateRef certificate) { RetainPtr<CFDataRef> data(AdoptCF, SecCertificateCopyData(certificate)); encode(encoder, data.get()); @@ -552,7 +553,7 @@ bool decode(ArgumentDecoder* decoder, RetainPtr<SecCertificateRef>& result) return true; } -void encode(ArgumentEncoder* encoder, SecKeychainItemRef keychainItem) +void encode(ArgumentEncoder& encoder, SecKeychainItemRef keychainItem) { CFDataRef data; if (SecKeychainItemCreatePersistentReference(keychainItem, &data) == errSecSuccess) { @@ -574,7 +575,6 @@ bool decode(ArgumentDecoder* decoder, RetainPtr<SecKeychainItemRef>& result) result.adoptCF(item); return true; } - #endif } // namespace CoreIPC diff --git a/Source/WebKit2/Shared/cf/ArgumentCodersCF.h b/Source/WebKit2/Shared/cf/ArgumentCodersCF.h index 8f92f6205..514fa86bf 100644 --- a/Source/WebKit2/Shared/cf/ArgumentCodersCF.h +++ b/Source/WebKit2/Shared/cf/ArgumentCodersCF.h @@ -39,48 +39,48 @@ class ArgumentEncoder; class ArgumentDecoder; // CFArrayRef -void encode(ArgumentEncoder*, CFArrayRef); +void encode(ArgumentEncoder&, CFArrayRef); bool decode(ArgumentDecoder*, RetainPtr<CFArrayRef>& result); // CFBooleanRef -void encode(ArgumentEncoder*, CFBooleanRef); +void encode(ArgumentEncoder&, CFBooleanRef); bool decode(ArgumentDecoder*, RetainPtr<CFBooleanRef>& result); // CFDataRef -void encode(ArgumentEncoder*, CFDataRef); +void encode(ArgumentEncoder&, CFDataRef); bool decode(ArgumentDecoder*, RetainPtr<CFDataRef>& result); // CFDateRef -void encode(ArgumentEncoder*, CFDateRef); +void encode(ArgumentEncoder&, CFDateRef); bool decode(ArgumentDecoder*, RetainPtr<CFDateRef>& result); // CFDictionaryRef -void encode(ArgumentEncoder*, CFDictionaryRef); +void encode(ArgumentEncoder&, CFDictionaryRef); bool decode(ArgumentDecoder*, RetainPtr<CFDictionaryRef>& result); // CFNumberRef -void encode(ArgumentEncoder*, CFNumberRef); +void encode(ArgumentEncoder&, CFNumberRef); bool decode(ArgumentDecoder*, RetainPtr<CFNumberRef>& result); // CFStringRef -void encode(ArgumentEncoder*, CFStringRef); +void encode(ArgumentEncoder&, CFStringRef); bool decode(ArgumentDecoder*, RetainPtr<CFStringRef>& result); // CFTypeRef -void encode(ArgumentEncoder*, CFTypeRef); +void encode(ArgumentEncoder&, CFTypeRef); bool decode(ArgumentDecoder*, RetainPtr<CFTypeRef>& result); // CFURLRef -void encode(ArgumentEncoder*, CFURLRef); +void encode(ArgumentEncoder&, CFURLRef); bool decode(ArgumentDecoder*, RetainPtr<CFURLRef>& result); #if USE(SECURITY_FRAMEWORK) // SecCertificateRef -void encode(ArgumentEncoder*, SecCertificateRef); +void encode(ArgumentEncoder&, SecCertificateRef); bool decode(ArgumentDecoder*, RetainPtr<SecCertificateRef>& result); // SecKeychainItemRef -void encode(ArgumentEncoder*, SecKeychainItemRef); +void encode(ArgumentEncoder&, SecKeychainItemRef); bool decode(ArgumentDecoder*, RetainPtr<SecKeychainItemRef>& result); #endif diff --git a/Source/WebKit2/Shared/efl/LayerTreeContextEfl.cpp b/Source/WebKit2/Shared/efl/LayerTreeContextEfl.cpp index 881d78782..32fa970a8 100644 --- a/Source/WebKit2/Shared/efl/LayerTreeContextEfl.cpp +++ b/Source/WebKit2/Shared/efl/LayerTreeContextEfl.cpp @@ -40,9 +40,9 @@ LayerTreeContext::~LayerTreeContext() { } -void LayerTreeContext::encode(CoreIPC::ArgumentEncoder* encoder) const +void LayerTreeContext::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(webLayerID); + encoder.encode(webLayerID); } bool LayerTreeContext::decode(CoreIPC::ArgumentDecoder* decoder, LayerTreeContext& context) diff --git a/Source/WebKit2/Shared/efl/NativeWebKeyboardEventEfl.cpp b/Source/WebKit2/Shared/efl/NativeWebKeyboardEventEfl.cpp index 1ef02ba99..344a37c82 100644 --- a/Source/WebKit2/Shared/efl/NativeWebKeyboardEventEfl.cpp +++ b/Source/WebKit2/Shared/efl/NativeWebKeyboardEventEfl.cpp @@ -30,15 +30,17 @@ namespace WebKit { -NativeWebKeyboardEvent::NativeWebKeyboardEvent(const Evas_Event_Key_Down* event) +NativeWebKeyboardEvent::NativeWebKeyboardEvent(const Evas_Event_Key_Down* event, bool isFiltered) : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent(event)) , m_nativeEvent(event) + , m_isFiltered(isFiltered) { } NativeWebKeyboardEvent::NativeWebKeyboardEvent(const Evas_Event_Key_Up* event) : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent(event)) , m_nativeEvent(event) + , m_isFiltered(false) { } diff --git a/Source/WebKit2/Shared/efl/NativeWebMouseEventEfl.cpp b/Source/WebKit2/Shared/efl/NativeWebMouseEventEfl.cpp index 2a4d6014d..0ba44bfa0 100644 --- a/Source/WebKit2/Shared/efl/NativeWebMouseEventEfl.cpp +++ b/Source/WebKit2/Shared/efl/NativeWebMouseEventEfl.cpp @@ -30,20 +30,20 @@ namespace WebKit { -NativeWebMouseEvent::NativeWebMouseEvent(const Evas_Event_Mouse_Down* event, const Evas_Point* position) - : WebMouseEvent(WebEventFactory::createWebMouseEvent(event, position)) +NativeWebMouseEvent::NativeWebMouseEvent(const Evas_Event_Mouse_Down* event, const WebCore::AffineTransform& toWebContent, const WebCore::AffineTransform& toDeviceScreen) + : WebMouseEvent(WebEventFactory::createWebMouseEvent(event, toWebContent, toDeviceScreen)) , m_nativeEvent(event) { } -NativeWebMouseEvent::NativeWebMouseEvent(const Evas_Event_Mouse_Up* event, const Evas_Point* position) - : WebMouseEvent(WebEventFactory::createWebMouseEvent(event, position)) +NativeWebMouseEvent::NativeWebMouseEvent(const Evas_Event_Mouse_Up* event, const WebCore::AffineTransform& toWebContent, const WebCore::AffineTransform& toDeviceScreen) + : WebMouseEvent(WebEventFactory::createWebMouseEvent(event, toWebContent, toDeviceScreen)) , m_nativeEvent(event) { } -NativeWebMouseEvent::NativeWebMouseEvent(const Evas_Event_Mouse_Move* event, const Evas_Point* position) - : WebMouseEvent(WebEventFactory::createWebMouseEvent(event, position)) +NativeWebMouseEvent::NativeWebMouseEvent(const Evas_Event_Mouse_Move* event, const WebCore::AffineTransform& toWebContent, const WebCore::AffineTransform& toDeviceScreen) + : WebMouseEvent(WebEventFactory::createWebMouseEvent(event, toWebContent, toDeviceScreen)) , m_nativeEvent(event) { } diff --git a/Source/WebKit2/Shared/efl/NativeWebTouchEventEfl.cpp b/Source/WebKit2/Shared/efl/NativeWebTouchEventEfl.cpp index 70d8bb7c7..004ca3515 100644 --- a/Source/WebKit2/Shared/efl/NativeWebTouchEventEfl.cpp +++ b/Source/WebKit2/Shared/efl/NativeWebTouchEventEfl.cpp @@ -32,8 +32,8 @@ namespace WebKit { -NativeWebTouchEvent::NativeWebTouchEvent(Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers, const Evas_Point* position, double timestamp) - : WebTouchEvent(WebEventFactory::createWebTouchEvent(type, points, modifiers, position, timestamp)) +NativeWebTouchEvent::NativeWebTouchEvent(Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers, const WebCore::AffineTransform& toWebContent, const WebCore::AffineTransform& toDeviceScreen, double timestamp) + : WebTouchEvent(WebEventFactory::createWebTouchEvent(type, points, modifiers, toWebContent, toDeviceScreen, timestamp)) { } diff --git a/Source/WebKit2/Shared/efl/NativeWebWheelEventEfl.cpp b/Source/WebKit2/Shared/efl/NativeWebWheelEventEfl.cpp index 265d7d2b5..893ead8e4 100644 --- a/Source/WebKit2/Shared/efl/NativeWebWheelEventEfl.cpp +++ b/Source/WebKit2/Shared/efl/NativeWebWheelEventEfl.cpp @@ -30,8 +30,8 @@ namespace WebKit { -NativeWebWheelEvent::NativeWebWheelEvent(const Evas_Event_Mouse_Wheel* event, const Evas_Point* position) - : WebWheelEvent(WebEventFactory::createWebWheelEvent(event, position)) +NativeWebWheelEvent::NativeWebWheelEvent(const Evas_Event_Mouse_Wheel* event, const WebCore::AffineTransform& toWebContent, const WebCore::AffineTransform& toDeviceScreen) + : WebWheelEvent(WebEventFactory::createWebWheelEvent(event, toWebContent, toDeviceScreen)) , m_nativeEvent(event) { } diff --git a/Source/WebKit2/Shared/efl/WebEventFactory.cpp b/Source/WebKit2/Shared/efl/WebEventFactory.cpp index 2b0d951cb..042958714 100644 --- a/Source/WebKit2/Shared/efl/WebEventFactory.cpp +++ b/Source/WebKit2/Shared/efl/WebEventFactory.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2011 Samsung Electronics + * Copyright (C) 2012 Intel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,6 +28,7 @@ #include "WebEventFactory.h" #include "EflKeyboardUtilities.h" +#include <WebCore/AffineTransform.h> #include <WebCore/Scrollbar.h> using namespace WebCore; @@ -84,49 +86,57 @@ static inline int clickCountForEvent(const Evas_Button_Flags flags) return 1; } -WebMouseEvent WebEventFactory::createWebMouseEvent(const Evas_Event_Mouse_Down* event, const Evas_Point* position) +static inline double convertMillisecondToSecond(unsigned timestamp) { + return static_cast<double>(timestamp) / 1000; +} + +WebMouseEvent WebEventFactory::createWebMouseEvent(const Evas_Event_Mouse_Down* event, const AffineTransform& toWebContent, const AffineTransform& toDeviceScreen) +{ + IntPoint pos(event->canvas.x, event->canvas.y); return WebMouseEvent(WebEvent::MouseDown, - buttonForEvent(event->button), - IntPoint(event->canvas.x - position->x, event->canvas.y - position->y), - IntPoint(event->canvas.x, event->canvas.y), - 0 /* deltaX */, - 0 /* deltaY */, - 0 /* deltaZ */, - clickCountForEvent(event->flags), - modifiersForEvent(event->modifiers), - event->timestamp); + buttonForEvent(event->button), + toWebContent.mapPoint(pos), + toDeviceScreen.mapPoint(pos), + 0 /* deltaX */, + 0 /* deltaY */, + 0 /* deltaZ */, + clickCountForEvent(event->flags), + modifiersForEvent(event->modifiers), + convertMillisecondToSecond(event->timestamp)); } -WebMouseEvent WebEventFactory::createWebMouseEvent(const Evas_Event_Mouse_Up* event, const Evas_Point* position) +WebMouseEvent WebEventFactory::createWebMouseEvent(const Evas_Event_Mouse_Up* event, const AffineTransform& toWebContent, const AffineTransform& toDeviceScreen) { + IntPoint pos(event->canvas.x, event->canvas.y); return WebMouseEvent(WebEvent::MouseUp, - buttonForEvent(event->button), - IntPoint(event->canvas.x - position->x, event->canvas.y - position->y), - IntPoint(event->canvas.x, event->canvas.y), - 0 /* deltaX */, - 0 /* deltaY */, - 0 /* deltaZ */, - clickCountForEvent(event->flags), - modifiersForEvent(event->modifiers), - event->timestamp); + buttonForEvent(event->button), + toWebContent.mapPoint(pos), + toDeviceScreen.mapPoint(pos), + 0 /* deltaX */, + 0 /* deltaY */, + 0 /* deltaZ */, + clickCountForEvent(event->flags), + modifiersForEvent(event->modifiers), + convertMillisecondToSecond(event->timestamp)); } -WebMouseEvent WebEventFactory::createWebMouseEvent(const Evas_Event_Mouse_Move* event, const Evas_Point* position) +WebMouseEvent WebEventFactory::createWebMouseEvent(const Evas_Event_Mouse_Move* event, const AffineTransform& toWebContent, const AffineTransform& toDeviceScreen) { + IntPoint pos(event->cur.canvas.x, event->cur.canvas.y); return WebMouseEvent(WebEvent::MouseMove, - buttonForEvent(event->buttons), - IntPoint(event->cur.canvas.x - position->x, event->cur.canvas.y - position->y), - IntPoint(event->cur.canvas.x, event->cur.canvas.y), - 0 /* deltaX */, - 0 /* deltaY */, - 0 /* deltaZ */, - 0 /* clickCount */, - modifiersForEvent(event->modifiers), - event->timestamp); + buttonForEvent(event->buttons), + toWebContent.mapPoint(pos), + toDeviceScreen.mapPoint(pos), + 0 /* deltaX */, + 0 /* deltaY */, + 0 /* deltaZ */, + 0 /* clickCount */, + modifiersForEvent(event->modifiers), + convertMillisecondToSecond(event->timestamp)); } -WebWheelEvent WebEventFactory::createWebWheelEvent(const Evas_Event_Mouse_Wheel* event, const Evas_Point* position) +WebWheelEvent WebEventFactory::createWebWheelEvent(const Evas_Event_Mouse_Wheel* event, const AffineTransform& toWebContent, const AffineTransform& toDeviceScreen) { float deltaX = 0; float deltaY = 0; @@ -148,48 +158,50 @@ WebWheelEvent WebEventFactory::createWebWheelEvent(const Evas_Event_Mouse_Wheel* deltaX *= static_cast<float>(Scrollbar::pixelsPerLineStep()); deltaY *= static_cast<float>(Scrollbar::pixelsPerLineStep()); + IntPoint pos(event->canvas.x, event->canvas.y); + return WebWheelEvent(WebEvent::Wheel, - IntPoint(event->canvas.x - position->x, event->canvas.y - position->y), - IntPoint(event->canvas.x, event->canvas.y), - FloatSize(deltaX, deltaY), - FloatSize(wheelTicksX, wheelTicksY), - WebWheelEvent::ScrollByPixelWheelEvent, - modifiersForEvent(event->modifiers), - event->timestamp); + toWebContent.mapPoint(pos), + toDeviceScreen.mapPoint(pos), + FloatSize(deltaX, deltaY), + FloatSize(wheelTicksX, wheelTicksY), + WebWheelEvent::ScrollByPixelWheelEvent, + modifiersForEvent(event->modifiers), + convertMillisecondToSecond(event->timestamp)); } WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(const Evas_Event_Key_Down* event) { const String keyName(event->key); return WebKeyboardEvent(WebEvent::KeyDown, - String::fromUTF8(event->string), - String::fromUTF8(event->string), - keyIdentifierForEvasKeyName(keyName), - windowsKeyCodeForEvasKeyName(keyName), - 0 /* FIXME: nativeVirtualKeyCode */, - 0 /* macCharCode */, - false /* FIXME: isAutoRepeat */, - keyName.startsWith(keyPadPrefix), - false /* isSystemKey */, - modifiersForEvent(event->modifiers), - event->timestamp); + String::fromUTF8(event->string), + String::fromUTF8(event->string), + keyIdentifierForEvasKeyName(keyName), + windowsKeyCodeForEvasKeyName(keyName), + 0 /* FIXME: nativeVirtualKeyCode */, + 0 /* macCharCode */, + false /* FIXME: isAutoRepeat */, + keyName.startsWith(keyPadPrefix), + false /* isSystemKey */, + modifiersForEvent(event->modifiers), + convertMillisecondToSecond(event->timestamp)); } WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(const Evas_Event_Key_Up* event) { const String keyName(event->key); return WebKeyboardEvent(WebEvent::KeyUp, - String::fromUTF8(event->string), - String::fromUTF8(event->string), - keyIdentifierForEvasKeyName(keyName), - windowsKeyCodeForEvasKeyName(keyName), - 0 /* FIXME: nativeVirtualKeyCode */, - 0 /* macCharCode */, - false /* FIXME: isAutoRepeat */, - keyName.startsWith(keyPadPrefix), - false /* isSystemKey */, - modifiersForEvent(event->modifiers), - event->timestamp); + String::fromUTF8(event->string), + String::fromUTF8(event->string), + keyIdentifierForEvasKeyName(keyName), + windowsKeyCodeForEvasKeyName(keyName), + 0 /* FIXME: nativeVirtualKeyCode */, + 0 /* macCharCode */, + false /* FIXME: isAutoRepeat */, + keyName.startsWith(keyPadPrefix), + false /* isSystemKey */, + modifiersForEvent(event->modifiers), + convertMillisecondToSecond(event->timestamp)); } #if ENABLE(TOUCH_EVENTS) @@ -207,7 +219,7 @@ static inline WebEvent::Type typeForTouchEvent(Ewk_Touch_Event_Type type) return WebEvent::NoType; } -WebTouchEvent WebEventFactory::createWebTouchEvent(Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers, const Evas_Point* position, double timestamp) +WebTouchEvent WebEventFactory::createWebTouchEvent(Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers, const AffineTransform& toWebContent, const AffineTransform& toDeviceScreen, double timestamp) { Vector<WebPlatformTouchPoint> touchPoints; WebPlatformTouchPoint::TouchPointState state; @@ -237,7 +249,8 @@ WebTouchEvent WebEventFactory::createWebTouchEvent(Ewk_Touch_Event_Type type, co continue; } - touchPoints.append(WebPlatformTouchPoint(point->id, state, IntPoint(point->x, point->y), IntPoint(point->x - position->x, point->y - position->y))); + IntPoint pos(point->x, point->y); + touchPoints.append(WebPlatformTouchPoint(point->id, state, toWebContent.mapPoint(pos), toDeviceScreen.mapPoint(pos))); } return WebTouchEvent(typeForTouchEvent(type), touchPoints, modifiersForEvent(modifiers), timestamp); diff --git a/Source/WebKit2/Shared/efl/WebEventFactory.h b/Source/WebKit2/Shared/efl/WebEventFactory.h index 9a8b1d6bd..e444db29d 100644 --- a/Source/WebKit2/Shared/efl/WebEventFactory.h +++ b/Source/WebKit2/Shared/efl/WebEventFactory.h @@ -29,19 +29,20 @@ #include "WebEvent.h" #include "ewk_touch.h" #include <Evas.h> +#include <WebCore/AffineTransform.h> namespace WebKit { class WebEventFactory { public: - static WebMouseEvent createWebMouseEvent(const Evas_Event_Mouse_Down*, const Evas_Point*); - static WebMouseEvent createWebMouseEvent(const Evas_Event_Mouse_Up*, const Evas_Point*); - static WebMouseEvent createWebMouseEvent(const Evas_Event_Mouse_Move*, const Evas_Point*); - static WebWheelEvent createWebWheelEvent(const Evas_Event_Mouse_Wheel*, const Evas_Point*); + static WebMouseEvent createWebMouseEvent(const Evas_Event_Mouse_Down*, const WebCore::AffineTransform&, const WebCore::AffineTransform&); + static WebMouseEvent createWebMouseEvent(const Evas_Event_Mouse_Up*, const WebCore::AffineTransform&, const WebCore::AffineTransform&); + static WebMouseEvent createWebMouseEvent(const Evas_Event_Mouse_Move*, const WebCore::AffineTransform&, const WebCore::AffineTransform&); + static WebWheelEvent createWebWheelEvent(const Evas_Event_Mouse_Wheel*, const WebCore::AffineTransform&, const WebCore::AffineTransform&); static WebKeyboardEvent createWebKeyboardEvent(const Evas_Event_Key_Down*); static WebKeyboardEvent createWebKeyboardEvent(const Evas_Event_Key_Up*); #if ENABLE(TOUCH_EVENTS) - static WebTouchEvent createWebTouchEvent(Ewk_Touch_Event_Type, const Eina_List*, const Evas_Modifier*, const Evas_Point*, double timestamp); + static WebTouchEvent createWebTouchEvent(Ewk_Touch_Event_Type, const Eina_List*, const Evas_Modifier*, const WebCore::AffineTransform&, const WebCore::AffineTransform&, double timestamp); #endif }; diff --git a/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.cpp b/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.cpp index 7bcd33f9c..9cd20700c 100644 --- a/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.cpp +++ b/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.cpp @@ -41,7 +41,7 @@ using namespace WebKit; namespace CoreIPC { -static void encodeImage(ArgumentEncoder* encoder, const GdkPixbuf* pixbuf) +static void encodeImage(ArgumentEncoder& encoder, const GdkPixbuf* pixbuf) { IntSize imageSize(gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf)); RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(imageSize, ShareableBitmap::SupportsAlpha); @@ -54,7 +54,7 @@ static void encodeImage(ArgumentEncoder* encoder, const GdkPixbuf* pixbuf) ShareableBitmap::Handle handle; bitmap->createHandle(handle); - encoder->encode(handle); + encoder << handle; } static bool decodeImage(ArgumentDecoder* decoder, GRefPtr<GdkPixbuf>& pixbuf) @@ -85,30 +85,30 @@ static bool decodeImage(ArgumentDecoder* decoder, GRefPtr<GdkPixbuf>& pixbuf) return true; } -static void encodeDataObject(ArgumentEncoder* encoder, const DataObjectGtk* dataObject) +static void encodeDataObject(ArgumentEncoder& encoder, const DataObjectGtk* dataObject) { bool hasText = dataObject->hasText(); - encoder->encode(hasText); + encoder << hasText; if (hasText) - encoder->encode(dataObject->text()); + encoder << dataObject->text(); bool hasMarkup = dataObject->hasMarkup(); - encoder->encode(hasMarkup); + encoder << hasMarkup; if (hasMarkup) - encoder->encode(dataObject->markup()); + encoder << dataObject->markup(); bool hasURL = dataObject->hasURL(); - encoder->encode(hasURL); + encoder << hasURL; if (hasURL) - encoder->encode(dataObject->url().string()); + encoder << dataObject->url().string(); bool hasURIList = dataObject->hasURIList(); - encoder->encode(hasURIList); + encoder << hasURIList; if (hasURIList) - encoder->encode(dataObject->uriList()); + encoder << dataObject->uriList(); bool hasImage = dataObject->hasImage(); - encoder->encode(hasImage); + encoder << hasImage; if (hasImage) encodeImage(encoder, dataObject->image()); } @@ -172,15 +172,15 @@ static bool decodeDataObject(ArgumentDecoder* decoder, RefPtr<DataObjectGtk>& da return true; } -void ArgumentCoder<DragData>::encode(ArgumentEncoder* encoder, const DragData& dragData) +void ArgumentCoder<DragData>::encode(ArgumentEncoder& encoder, const DragData& dragData) { - encoder->encode(dragData.clientPosition()); - encoder->encode(dragData.globalPosition()); - encoder->encode(static_cast<uint64_t>(dragData.draggingSourceOperationMask())); - encoder->encode(static_cast<uint64_t>(dragData.flags())); + encoder << dragData.clientPosition(); + encoder << dragData.globalPosition(); + encoder << static_cast<uint64_t>(dragData.draggingSourceOperationMask()); + encoder << static_cast<uint64_t>(dragData.flags()); DataObjectGtk* platformData = dragData.platformData(); - encoder->encode(static_cast<bool>(platformData)); + encoder << static_cast<bool>(platformData); if (platformData) encodeDataObject(encoder, platformData); } @@ -219,12 +219,11 @@ bool ArgumentCoder<DragData>::decode(ArgumentDecoder* decoder, DragData& dragDat return true; } -static void encodeGKeyFile(ArgumentEncoder* encoder, GKeyFile* keyFile) +static void encodeGKeyFile(ArgumentEncoder& encoder, GKeyFile* keyFile) { gsize dataSize; GOwnPtr<char> data(g_key_file_to_data(keyFile, &dataSize, 0)); - DataReference dataReference(reinterpret_cast<uint8_t*>(data.get()), dataSize); - encoder->encode(dataReference); + encoder << DataReference(reinterpret_cast<uint8_t*>(data.get()), dataSize); } static bool decodeGKeyFile(ArgumentDecoder* decoder, GOwnPtr<GKeyFile>& keyFile) @@ -245,7 +244,7 @@ static bool decodeGKeyFile(ArgumentDecoder* decoder, GOwnPtr<GKeyFile>& keyFile) return true; } -void encode(ArgumentEncoder* encoder, GtkPrintSettings* printSettings) +void encode(ArgumentEncoder& encoder, GtkPrintSettings* printSettings) { GOwnPtr<GKeyFile> keyFile(g_key_file_new()); gtk_print_settings_to_key_file(printSettings, keyFile.get(), "Print Settings"); @@ -268,7 +267,7 @@ bool decode(ArgumentDecoder* decoder, GRefPtr<GtkPrintSettings>& printSettings) return printSettings; } -void encode(ArgumentEncoder* encoder, GtkPageSetup* pageSetup) +void encode(ArgumentEncoder& encoder, GtkPageSetup* pageSetup) { GOwnPtr<GKeyFile> keyFile(g_key_file_new()); gtk_page_setup_to_key_file(pageSetup, keyFile.get(), "Page Setup"); diff --git a/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.h b/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.h index 888424562..6ddff0076 100644 --- a/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.h +++ b/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.h @@ -40,14 +40,14 @@ class DragData; namespace CoreIPC { template<> struct ArgumentCoder<WebCore::DragData> { - static void encode(ArgumentEncoder*, const WebCore::DragData&); + static void encode(ArgumentEncoder&, const WebCore::DragData&); static bool decode(ArgumentDecoder*, WebCore::DragData&); }; -void encode(ArgumentEncoder*, GtkPrintSettings*); +void encode(ArgumentEncoder&, GtkPrintSettings*); bool decode(ArgumentDecoder*, GRefPtr<GtkPrintSettings>&); -void encode(ArgumentEncoder*, GtkPageSetup*); +void encode(ArgumentEncoder&, GtkPageSetup*); bool decode(ArgumentDecoder*, GRefPtr<GtkPageSetup>&); } // namespace CoreIPC diff --git a/Source/WebKit2/Shared/gtk/LayerTreeContextGtk.cpp b/Source/WebKit2/Shared/gtk/LayerTreeContextGtk.cpp index e7d918a70..38a0d54a6 100644 --- a/Source/WebKit2/Shared/gtk/LayerTreeContextGtk.cpp +++ b/Source/WebKit2/Shared/gtk/LayerTreeContextGtk.cpp @@ -40,9 +40,9 @@ LayerTreeContext::~LayerTreeContext() { } -void LayerTreeContext::encode(CoreIPC::ArgumentEncoder* encoder) const +void LayerTreeContext::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(windowHandle); + encoder.encode(windowHandle); } bool LayerTreeContext::decode(CoreIPC::ArgumentDecoder* decoder, LayerTreeContext& context) diff --git a/Source/WebKit2/Shared/mac/ArgumentCodersMac.h b/Source/WebKit2/Shared/mac/ArgumentCodersMac.h index 14f1dee98..07c4060a4 100644 --- a/Source/WebKit2/Shared/mac/ArgumentCodersMac.h +++ b/Source/WebKit2/Shared/mac/ArgumentCodersMac.h @@ -33,34 +33,50 @@ namespace CoreIPC { class ArgumentEncoder; class ArgumentDecoder; +// id +void encode(ArgumentEncoder&, id); +bool decode(ArgumentDecoder*, RetainPtr<id>&); + // NSAttributedString -void encode(ArgumentEncoder*, NSAttributedString *); +void encode(ArgumentEncoder&, NSAttributedString *); bool decode(ArgumentDecoder*, RetainPtr<NSAttributedString>&); #if USE(APPKIT) // NSColor -void encode(ArgumentEncoder*, NSColor *); +void encode(ArgumentEncoder&, NSColor *); bool decode(ArgumentDecoder*, RetainPtr<NSColor>&); #endif // NSDictionary -void encode(ArgumentEncoder*, NSDictionary *); +void encode(ArgumentEncoder&, NSDictionary *); bool decode(ArgumentDecoder*, RetainPtr<NSDictionary>&); +// NSArray +void encode(ArgumentEncoder&, NSArray *); +bool decode(ArgumentDecoder*, RetainPtr<NSArray>&); + #if USE(APPKIT) // NSFont -void encode(ArgumentEncoder*, NSFont *); +void encode(ArgumentEncoder&, NSFont *); bool decode(ArgumentDecoder*, RetainPtr<NSFont>&); #endif // NSNumber -void encode(ArgumentEncoder*, NSNumber *); +void encode(ArgumentEncoder&, NSNumber *); bool decode(ArgumentDecoder*, RetainPtr<NSNumber>&); // NSString -void encode(ArgumentEncoder*, NSString *); +void encode(ArgumentEncoder&, NSString *); bool decode(ArgumentDecoder*, RetainPtr<NSString>&); +// NSDate +void encode(ArgumentEncoder&, NSDate *); +bool decode(ArgumentDecoder*, RetainPtr<NSDate>&); + +// NSData +void encode(ArgumentEncoder&, NSData *); +bool decode(ArgumentDecoder*, RetainPtr<NSData>&); + } // namespace CoreIPC #endif // ArgumentCodersMac_h diff --git a/Source/WebKit2/Shared/mac/ArgumentCodersMac.mm b/Source/WebKit2/Shared/mac/ArgumentCodersMac.mm index ec6d38be4..c0817d556 100644 --- a/Source/WebKit2/Shared/mac/ArgumentCodersMac.mm +++ b/Source/WebKit2/Shared/mac/ArgumentCodersMac.mm @@ -43,11 +43,14 @@ enum NSType { NSColorType, #endif NSDictionaryType, + NSArrayType, #if USE(APPKIT) NSFontType, #endif NSNumberType, NSStringType, + NSDateType, + NSDataType, Unknown, }; @@ -71,15 +74,21 @@ static NSType typeFromObject(id object) return NSNumberType; if ([object isKindOfClass:[NSString class]]) return NSStringType; + if ([object isKindOfClass:[NSArray class]]) + return NSArrayType; + if ([object isKindOfClass:[NSDate class]]) + return NSDateType; + if ([object isKindOfClass:[NSData class]]) + return NSDataType; ASSERT_NOT_REACHED(); return Unknown; } -static void encode(ArgumentEncoder* encoder, id object) +void encode(ArgumentEncoder& encoder, id object) { NSType type = typeFromObject(object); - encoder->encodeEnum(type); + encoder.encodeEnum(type); switch (type) { case NSAttributedStringType: @@ -104,6 +113,15 @@ static void encode(ArgumentEncoder* encoder, id object) case NSStringType: encode(encoder, static_cast<NSString *>(object)); return; + case NSArrayType: + encode(encoder, static_cast<NSArray *>(object)); + return; + case NSDateType: + encode(encoder, static_cast<NSDate *>(object)); + return; + case NSDataType: + encode(encoder, static_cast<NSData *>(object)); + return; case Unknown: break; } @@ -111,7 +129,7 @@ static void encode(ArgumentEncoder* encoder, id object) ASSERT_NOT_REACHED(); } -static bool decode(ArgumentDecoder* decoder, RetainPtr<id>& result) +bool decode(ArgumentDecoder* decoder, RetainPtr<id>& result) { NSType type; if (!decoder->decodeEnum(type)) @@ -164,6 +182,27 @@ static bool decode(ArgumentDecoder* decoder, RetainPtr<id>& result) result = string; return true; } + case NSArrayType: { + RetainPtr<NSArray> array; + if (!decode(decoder, array)) + return false; + result = array; + return true; + } + case NSDateType: { + RetainPtr<NSDate> date; + if (!decode(decoder, date)) + return false; + result = date; + return true; + } + case NSDataType: { + RetainPtr<NSData> data; + if (!decode(decoder, data)) + return false; + result = data; + return true; + } case Unknown: ASSERT_NOT_REACHED(); return false; @@ -172,7 +211,7 @@ static bool decode(ArgumentDecoder* decoder, RetainPtr<id>& result) return false; } -void encode(ArgumentEncoder* encoder, NSAttributedString *string) +void encode(ArgumentEncoder& encoder, NSAttributedString *string) { // Even though NSAttributedString is toll free bridged with CFAttributedStringRef, attributes' values may be not, so we should stay within this file's code. @@ -196,11 +235,11 @@ void encode(ArgumentEncoder* encoder, NSAttributedString *string) position = NSMaxRange(effectiveRange); } - encoder->encode(static_cast<uint64_t>(ranges.size())); + encoder << static_cast<uint64_t>(ranges.size()); for (size_t i = 0; i < ranges.size(); ++i) { - encoder->encode(static_cast<uint64_t>(ranges[i].first.location)); - encoder->encode(static_cast<uint64_t>(ranges[i].first.length)); + encoder << static_cast<uint64_t>(ranges[i].first.location); + encoder << static_cast<uint64_t>(ranges[i].first.length); CoreIPC::encode(encoder, ranges[i].second.get()); } } @@ -243,9 +282,9 @@ bool decode(ArgumentDecoder* decoder, RetainPtr<NSAttributedString>& result) } #if USE(APPKIT) -void encode(ArgumentEncoder* encoder, NSColor *color) +void encode(ArgumentEncoder& encoder, NSColor *color) { - encoder->encode(colorFromNSColor(color)); + encoder << colorFromNSColor(color); } bool decode(ArgumentDecoder* decoder, RetainPtr<NSColor>& result) @@ -259,7 +298,7 @@ bool decode(ArgumentDecoder* decoder, RetainPtr<NSColor>& result) } #endif -void encode(ArgumentEncoder* encoder, NSDictionary *dictionary) +void encode(ArgumentEncoder& encoder, NSDictionary *dictionary) { // Even though NSDictionary is toll free bridged with CFDictionaryRef, values may be not, so we should stay within this file's code. @@ -267,7 +306,7 @@ void encode(ArgumentEncoder* encoder, NSDictionary *dictionary) NSArray *keys = [dictionary allKeys]; NSArray *values = [dictionary allValues]; - encoder->encode(static_cast<uint64_t>(size)); + encoder << static_cast<uint64_t>(size); for (NSUInteger i = 0; i < size; ++i) { id key = [keys objectAtIndex:i]; @@ -310,7 +349,7 @@ bool decode(ArgumentDecoder* decoder, RetainPtr<NSDictionary>& result) } #if USE(APPKIT) -void encode(ArgumentEncoder* encoder, NSFont *font) +void encode(ArgumentEncoder& encoder, NSFont *font) { // NSFont could use CTFontRef code if we had it in ArgumentCodersCF. encode(encoder, [[font fontDescriptor] fontAttributes]); @@ -329,7 +368,7 @@ bool decode(ArgumentDecoder* decoder, RetainPtr<NSFont>& result) } #endif -void encode(ArgumentEncoder* encoder, NSNumber *number) +void encode(ArgumentEncoder& encoder, NSNumber *number) { encode(encoder, (CFNumberRef)number); } @@ -344,7 +383,7 @@ bool decode(ArgumentDecoder* decoder, RetainPtr<NSNumber>& result) return true; } -void encode(ArgumentEncoder* encoder, NSString *string) +void encode(ArgumentEncoder& encoder, NSString *string) { encode(encoder, (CFStringRef)string); } @@ -359,4 +398,69 @@ bool decode(ArgumentDecoder* decoder, RetainPtr<NSString>& result) return true; } +void encode(ArgumentEncoder& encoder, NSArray *array) +{ + NSUInteger size = [array count]; + encoder << static_cast<uint64_t>(size); + + for (NSUInteger i = 0; i < size; ++i) { + id value = [array objectAtIndex:i]; + + // Ignore values we don't recognize. + if (typeFromObject(value) == Unknown) + continue; + + encode(encoder, value); + } +} + +bool decode(ArgumentDecoder* decoder, RetainPtr<NSArray>& result) +{ + uint64_t size; + if (!decoder->decodeUInt64(size)) + return false; + + RetainPtr<NSMutableArray> array = adoptNS([[NSMutableArray alloc] initWithCapacity:size]); + for (uint64_t i = 0; i < size; ++i) { + RetainPtr<id> value; + if (!decode(decoder, value)) + return false; + + [array.get() addObject:value.get()]; + } + + result.adoptNS(array.leakRef()); + return true; +} + +void encode(ArgumentEncoder& encoder, NSDate *date) +{ + encode(encoder, (CFDateRef)date); +} + +bool decode(ArgumentDecoder* decoder, RetainPtr<NSDate>& result) +{ + RetainPtr<CFDateRef> date; + if (!decode(decoder, date)) + return false; + + result.adoptCF((NSDate *)date.leakRef()); + return true; +} + +void encode(ArgumentEncoder& encoder, NSData *data) +{ + encode(encoder, (CFDataRef)data); +} + +bool decode(ArgumentDecoder* decoder, RetainPtr<NSData>& result) +{ + RetainPtr<CFDataRef> data; + if (!decode(decoder, data)) + return false; + + result.adoptCF((NSData *)data.leakRef()); + return true; +} + } // namespace CoreIPC diff --git a/Source/WebKit2/Shared/mac/AttributedString.h b/Source/WebKit2/Shared/mac/AttributedString.h index 6c8a8ae25..6d3507f6a 100644 --- a/Source/WebKit2/Shared/mac/AttributedString.h +++ b/Source/WebKit2/Shared/mac/AttributedString.h @@ -38,7 +38,7 @@ namespace CoreIPC { namespace WebKit { struct AttributedString { - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, AttributedString&); RetainPtr<NSAttributedString> string; diff --git a/Source/WebKit2/Shared/mac/AttributedString.mm b/Source/WebKit2/Shared/mac/AttributedString.mm index bc7cfd086..34c17ad8c 100644 --- a/Source/WebKit2/Shared/mac/AttributedString.mm +++ b/Source/WebKit2/Shared/mac/AttributedString.mm @@ -32,9 +32,9 @@ namespace WebKit { -void AttributedString::encode(CoreIPC::ArgumentEncoder* encoder) const +void AttributedString::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(!string); + encoder << static_cast<bool>(!string); if (!string) return; CoreIPC::encode(encoder, string.get()); diff --git a/Source/WebKit2/Shared/mac/ChildProcessMac.mm b/Source/WebKit2/Shared/mac/ChildProcessMac.mm new file mode 100644 index 000000000..0801f5d89 --- /dev/null +++ b/Source/WebKit2/Shared/mac/ChildProcessMac.mm @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2012 Apple Inc. 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. + */ + +#import "config.h" +#import "ChildProcess.h" + +namespace WebKit { + +NSString * const ChildProcess::processSuppressionVisibleApplicationReason = @"Application is Visible"; + +void ChildProcess::setApplicationIsOccluded(bool applicationIsOccluded) +{ + if (m_applicationIsOccluded == applicationIsOccluded) + return; + +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 + m_applicationIsOccluded = applicationIsOccluded; + if (m_applicationIsOccluded) + enableProcessSuppression(processSuppressionVisibleApplicationReason); + else + disableProcessSuppression(processSuppressionVisibleApplicationReason); +#endif +} + +void ChildProcess::disableProcessSuppression(NSString *reason) +{ +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 + // The following assumes that a process enabling AutomaticTerminationSupport also + // takes a AutomaticTermination assertion for the lifetime of the process. + [[NSProcessInfo processInfo] disableAutomaticTermination:reason]; +#endif +} + +void ChildProcess::enableProcessSuppression(NSString *reason) +{ +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 + // The following assumes that a process enabling AutomaticTerminationSupport also + // takes a AutomaticTermination assertion for the lifetime of the process. + [[NSProcessInfo processInfo] enableAutomaticTermination:reason]; +#endif +} + +} diff --git a/Source/WebKit2/Shared/mac/ColorSpaceData.h b/Source/WebKit2/Shared/mac/ColorSpaceData.h index cdea86ee5..afe5b7736 100644 --- a/Source/WebKit2/Shared/mac/ColorSpaceData.h +++ b/Source/WebKit2/Shared/mac/ColorSpaceData.h @@ -36,7 +36,7 @@ namespace CoreIPC { namespace WebKit { struct ColorSpaceData { - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, ColorSpaceData&); RetainPtr<CGColorSpaceRef> cgColorSpace; diff --git a/Source/WebKit2/Shared/mac/ColorSpaceData.mm b/Source/WebKit2/Shared/mac/ColorSpaceData.mm index 796c06d0a..0cecb473b 100644 --- a/Source/WebKit2/Shared/mac/ColorSpaceData.mm +++ b/Source/WebKit2/Shared/mac/ColorSpaceData.mm @@ -38,26 +38,26 @@ enum EncodedDataType { Data, }; -void ColorSpaceData::encode(CoreIPC::ArgumentEncoder* encoder) const +void ColorSpaceData::encode(CoreIPC::ArgumentEncoder& encoder) const { if (cgColorSpace) { // Try to encode the name. if (RetainPtr<CFStringRef> name = adoptCF(CGColorSpaceCopyName(cgColorSpace.get()))) { - encoder->encodeEnum(Name); + encoder.encodeEnum(Name); CoreIPC::encode(encoder, name.get()); return; } // Failing that, just encode the ICC data. if (RetainPtr<CFDataRef> profileData = adoptCF(CGColorSpaceCopyICCProfile(cgColorSpace.get()))) { - encoder->encodeEnum(Data); + encoder.encodeEnum(Data); CoreIPC::encode(encoder, profileData.get()); return; } } // The color space was null or failed to be encoded. - encoder->encodeEnum(Null); + encoder.encodeEnum(Null); } bool ColorSpaceData::decode(CoreIPC::ArgumentDecoder* decoder, ColorSpaceData& colorSpaceData) diff --git a/Source/WebKit2/Shared/mac/KeychainAttribute.cpp b/Source/WebKit2/Shared/mac/KeychainAttribute.cpp index eb284bcf7..672f15e5d 100644 --- a/Source/WebKit2/Shared/mac/KeychainAttribute.cpp +++ b/Source/WebKit2/Shared/mac/KeychainAttribute.cpp @@ -51,10 +51,10 @@ KeychainAttribute::KeychainAttribute(const SecKeychainAttribute& secKeychainAttr namespace CoreIPC { -void encode(CoreIPC::ArgumentEncoder* encoder, const WebKit::KeychainAttribute& attribute) +void encode(CoreIPC::ArgumentEncoder& encoder, const WebKit::KeychainAttribute& attribute) { - encoder->encode(static_cast<uint32_t>(attribute.tag)); - encoder->encode(static_cast<bool>(attribute.data)); + encoder << static_cast<uint32_t>(attribute.tag); + encoder << static_cast<bool>(attribute.data); if (attribute.data) CoreIPC::encode(encoder, attribute.data.get()); } diff --git a/Source/WebKit2/Shared/mac/KeychainAttribute.h b/Source/WebKit2/Shared/mac/KeychainAttribute.h index d5f1f42a9..e79103cb9 100644 --- a/Source/WebKit2/Shared/mac/KeychainAttribute.h +++ b/Source/WebKit2/Shared/mac/KeychainAttribute.h @@ -47,7 +47,7 @@ namespace CoreIPC { class ArgumentDecoder; class ArgumentEncoder; -void encode(ArgumentEncoder*, const WebKit::KeychainAttribute&); +void encode(ArgumentEncoder&, const WebKit::KeychainAttribute&); bool decode(ArgumentDecoder*, WebKit::KeychainAttribute&); } // namespace CoreIPC diff --git a/Source/WebKit2/Shared/mac/LayerTreeContextMac.mm b/Source/WebKit2/Shared/mac/LayerTreeContextMac.mm index e4ad1ce0b..531d245dc 100644 --- a/Source/WebKit2/Shared/mac/LayerTreeContextMac.mm +++ b/Source/WebKit2/Shared/mac/LayerTreeContextMac.mm @@ -40,9 +40,9 @@ LayerTreeContext::~LayerTreeContext() { } -void LayerTreeContext::encode(CoreIPC::ArgumentEncoder* encoder) const +void LayerTreeContext::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(contextID); + encoder << contextID; } bool LayerTreeContext::decode(CoreIPC::ArgumentDecoder* decoder, LayerTreeContext& result) diff --git a/Source/WebKit2/Shared/mac/PDFKitImports.h b/Source/WebKit2/Shared/mac/PDFKitImports.h index c9a1e0a25..a1a13d3d8 100644 --- a/Source/WebKit2/Shared/mac/PDFKitImports.h +++ b/Source/WebKit2/Shared/mac/PDFKitImports.h @@ -35,6 +35,8 @@ Class pdfDocumentClass(); #if ENABLE(PDFKIT_PLUGIN) Class pdfLayerControllerClass(); +Class pdfAnnotationTextWidgetClass(); +Class pdfAnnotationChoiceWidgetClass(); #endif } diff --git a/Source/WebKit2/Shared/mac/PDFKitImports.mm b/Source/WebKit2/Shared/mac/PDFKitImports.mm index bccfbefda..16697b448 100644 --- a/Source/WebKit2/Shared/mac/PDFKitImports.mm +++ b/Source/WebKit2/Shared/mac/PDFKitImports.mm @@ -62,6 +62,20 @@ Class pdfLayerControllerClass() ASSERT(pdfLayerControllerClass); return pdfLayerControllerClass; } + +Class pdfAnnotationTextWidgetClass() +{ + static Class pdfAnnotationTextWidgetClass = classFromPDFKit(@"PDFAnnotationTextWidget"); + ASSERT(pdfAnnotationTextWidgetClass); + return pdfAnnotationTextWidgetClass; +} + +Class pdfAnnotationChoiceWidgetClass() +{ + static Class pdfAnnotationChoiceWidgetClass = classFromPDFKit(@"PDFAnnotationChoiceWidget"); + ASSERT(pdfAnnotationChoiceWidgetClass); + return pdfAnnotationChoiceWidgetClass; +} #endif } diff --git a/Source/WebKit2/Shared/mac/PlatformCertificateInfo.h b/Source/WebKit2/Shared/mac/PlatformCertificateInfo.h index 7ef5b3770..93f09f369 100644 --- a/Source/WebKit2/Shared/mac/PlatformCertificateInfo.h +++ b/Source/WebKit2/Shared/mac/PlatformCertificateInfo.h @@ -44,7 +44,7 @@ public: CFArrayRef certificateChain() const { return m_certificateChain.get(); } - void encode(CoreIPC::ArgumentEncoder* encoder) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder* decoder, PlatformCertificateInfo& t); #ifndef NDEBUG diff --git a/Source/WebKit2/Shared/mac/PlatformCertificateInfo.mm b/Source/WebKit2/Shared/mac/PlatformCertificateInfo.mm index db2b90e75..ecffbe63e 100644 --- a/Source/WebKit2/Shared/mac/PlatformCertificateInfo.mm +++ b/Source/WebKit2/Shared/mac/PlatformCertificateInfo.mm @@ -49,14 +49,14 @@ PlatformCertificateInfo::PlatformCertificateInfo(CFArrayRef certificateChain) { } -void PlatformCertificateInfo::encode(CoreIPC::ArgumentEncoder* encoder) const +void PlatformCertificateInfo::encode(CoreIPC::ArgumentEncoder& encoder) const { if (!m_certificateChain) { - encoder->encode(false); + encoder << false; return; } - encoder->encode(true); + encoder << true; CoreIPC::encode(encoder, m_certificateChain.get()); } diff --git a/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm b/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm index 109d1eb88..d00058d8c 100644 --- a/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm +++ b/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm @@ -53,10 +53,10 @@ SandboxExtension::Handle::~Handle() } } -void SandboxExtension::Handle::encode(CoreIPC::ArgumentEncoder* encoder) const +void SandboxExtension::Handle::encode(CoreIPC::ArgumentEncoder& encoder) const { if (!m_sandboxExtension) { - encoder->encodeVariableLengthByteArray(CoreIPC::DataReference()); + encoder << CoreIPC::DataReference(); return; } @@ -64,7 +64,7 @@ void SandboxExtension::Handle::encode(CoreIPC::ArgumentEncoder* encoder) const const char *serializedFormat = WKSandboxExtensionGetSerializedFormat(m_sandboxExtension, &length); ASSERT(serializedFormat); - encoder->encodeVariableLengthByteArray(CoreIPC::DataReference(reinterpret_cast<const uint8_t*>(serializedFormat), length)); + encoder << CoreIPC::DataReference(reinterpret_cast<const uint8_t*>(serializedFormat), length); // Encoding will destroy the sandbox extension locally. WKSandboxExtensionDestroy(m_sandboxExtension); @@ -76,7 +76,7 @@ bool SandboxExtension::Handle::decode(CoreIPC::ArgumentDecoder* decoder, Handle& ASSERT(!result.m_sandboxExtension); CoreIPC::DataReference dataReference; - if (!decoder->decodeVariableLengthByteArray(dataReference)) + if (!decoder->decode(dataReference)) return false; if (dataReference.isEmpty()) @@ -126,11 +126,11 @@ size_t SandboxExtension::HandleArray::size() const return m_size; } -void SandboxExtension::HandleArray::encode(CoreIPC::ArgumentEncoder* encoder) const +void SandboxExtension::HandleArray::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(static_cast<uint64_t>(size())); + encoder << static_cast<uint64_t>(size()); for (size_t i = 0; i < m_size; ++i) - encoder->encode(m_data[i]); + encoder << m_data[i]; } @@ -140,9 +140,10 @@ bool SandboxExtension::HandleArray::decode(CoreIPC::ArgumentDecoder* decoder, Sa if (!decoder->decodeUInt64(size)) return false; handles.allocate(size); - for (size_t i = 0; i < size; i++) + for (size_t i = 0; i < size; i++) { if (!decoder->decode(handles[i])) return false; + } return true; } diff --git a/Source/WebKit2/Shared/mac/SecItemRequestData.cpp b/Source/WebKit2/Shared/mac/SecItemRequestData.cpp index 2fb2f2845..797e13080 100644 --- a/Source/WebKit2/Shared/mac/SecItemRequestData.cpp +++ b/Source/WebKit2/Shared/mac/SecItemRequestData.cpp @@ -49,13 +49,13 @@ SecItemRequestData::SecItemRequestData(Type type, CFDictionaryRef query, CFDicti { } -void SecItemRequestData::encode(CoreIPC::ArgumentEncoder* encoder) const +void SecItemRequestData::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encodeEnum(m_type); + encoder.encodeEnum(m_type); CoreIPC::encode(encoder, m_queryDictionary.get()); - encoder->encode(static_cast<bool>(m_attributesToMatch)); + encoder << static_cast<bool>(m_attributesToMatch); if (m_attributesToMatch) CoreIPC::encode(encoder, m_attributesToMatch.get()); } diff --git a/Source/WebKit2/Shared/mac/SecItemRequestData.h b/Source/WebKit2/Shared/mac/SecItemRequestData.h index 57b18cfc6..cae2c0aca 100644 --- a/Source/WebKit2/Shared/mac/SecItemRequestData.h +++ b/Source/WebKit2/Shared/mac/SecItemRequestData.h @@ -50,7 +50,7 @@ public: SecItemRequestData(Type, CFDictionaryRef query); SecItemRequestData(Type, CFDictionaryRef query, CFDictionaryRef attributesToMatch); - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, SecItemRequestData&); Type type() const { return m_type; } diff --git a/Source/WebKit2/Shared/mac/SecItemResponseData.cpp b/Source/WebKit2/Shared/mac/SecItemResponseData.cpp index 0cc8f1347..89dca7963 100644 --- a/Source/WebKit2/Shared/mac/SecItemResponseData.cpp +++ b/Source/WebKit2/Shared/mac/SecItemResponseData.cpp @@ -41,10 +41,10 @@ SecItemResponseData::SecItemResponseData(OSStatus resultCode, CFTypeRef resultOb { } -void SecItemResponseData::encode(CoreIPC::ArgumentEncoder* encoder) const +void SecItemResponseData::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(static_cast<int64_t>(m_resultCode)); - encoder->encode(static_cast<bool>(m_resultObject.get())); + encoder << static_cast<int64_t>(m_resultCode); + encoder << static_cast<bool>(m_resultObject.get()); if (m_resultObject) CoreIPC::encode(encoder, m_resultObject.get()); } diff --git a/Source/WebKit2/Shared/mac/SecItemResponseData.h b/Source/WebKit2/Shared/mac/SecItemResponseData.h index 5c9433692..cf5c9ee7a 100644 --- a/Source/WebKit2/Shared/mac/SecItemResponseData.h +++ b/Source/WebKit2/Shared/mac/SecItemResponseData.h @@ -40,7 +40,7 @@ public: SecItemResponseData(); SecItemResponseData(OSStatus, CFTypeRef result); - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, SecItemResponseData&); RetainPtr<CFTypeRef>& resultObject() { return m_resultObject; } diff --git a/Source/WebKit2/Shared/mac/SecKeychainItemRequestData.cpp b/Source/WebKit2/Shared/mac/SecKeychainItemRequestData.cpp index dcbf99458..4f6d29a51 100644 --- a/Source/WebKit2/Shared/mac/SecKeychainItemRequestData.cpp +++ b/Source/WebKit2/Shared/mac/SecKeychainItemRequestData.cpp @@ -123,20 +123,20 @@ SecKeychainAttributeList* SecKeychainItemRequestData::attributeList() const return m_attrs->m_attributeList.get(); } -void SecKeychainItemRequestData::encode(CoreIPC::ArgumentEncoder* encoder) const +void SecKeychainItemRequestData::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encodeEnum(m_type); + encoder.encodeEnum(m_type); - encoder->encode(static_cast<bool>(m_keychainItem)); + encoder << static_cast<bool>(m_keychainItem); if (m_keychainItem) CoreIPC::encode(encoder, m_keychainItem.get()); - encoder->encode(static_cast<int32_t>(m_keychainAttributes.size())); + encoder << static_cast<int32_t>(m_keychainAttributes.size()); for (size_t i = 0, count = m_keychainAttributes.size(); i < count; ++i) CoreIPC::encode(encoder, m_keychainAttributes[i]); - encoder->encode(static_cast<uint64_t>(m_itemClass)); - m_dataReference.encode(encoder); + encoder << static_cast<uint64_t>(m_itemClass); + encoder << m_dataReference; } bool SecKeychainItemRequestData::decode(CoreIPC::ArgumentDecoder* decoder, SecKeychainItemRequestData& secKeychainItemRequestData) @@ -171,9 +171,9 @@ bool SecKeychainItemRequestData::decode(CoreIPC::ArgumentDecoder* decoder, SecKe secKeychainItemRequestData.m_itemClass = static_cast<SecItemClass>(itemClass); - if (!CoreIPC::DataReference::decode(decoder, secKeychainItemRequestData.m_dataReference)) + if (decoder->decode(secKeychainItemRequestData.m_dataReference)) return false; - + return true; } diff --git a/Source/WebKit2/Shared/mac/SecKeychainItemRequestData.h b/Source/WebKit2/Shared/mac/SecKeychainItemRequestData.h index 512ea54bd..181231bd6 100644 --- a/Source/WebKit2/Shared/mac/SecKeychainItemRequestData.h +++ b/Source/WebKit2/Shared/mac/SecKeychainItemRequestData.h @@ -58,7 +58,7 @@ public: SecKeychainItemRequestData(Type, SecItemClass, SecKeychainAttributeList*, UInt32 length, const void* data); ~SecKeychainItemRequestData(); - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, SecKeychainItemRequestData&); Type type() const { return m_type; } diff --git a/Source/WebKit2/Shared/mac/SecKeychainItemResponseData.cpp b/Source/WebKit2/Shared/mac/SecKeychainItemResponseData.cpp index 247f89b6a..1dea63bea 100644 --- a/Source/WebKit2/Shared/mac/SecKeychainItemResponseData.cpp +++ b/Source/WebKit2/Shared/mac/SecKeychainItemResponseData.cpp @@ -63,19 +63,19 @@ SecKeychainItemResponseData::SecKeychainItemResponseData(OSStatus resultCode) { } -void SecKeychainItemResponseData::encode(CoreIPC::ArgumentEncoder* encoder) const +void SecKeychainItemResponseData::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(static_cast<int64_t>(m_resultCode)); - encoder->encode(static_cast<uint32_t>(m_itemClass)); - encoder->encode(static_cast<uint32_t>(m_attributes.size())); + encoder << static_cast<int64_t>(m_resultCode); + encoder << static_cast<uint32_t>(m_itemClass); + encoder << static_cast<uint32_t>(m_attributes.size()); for (size_t i = 0, count = m_attributes.size(); i < count; ++i) CoreIPC::encode(encoder, m_attributes[i]); - encoder->encode(static_cast<bool>(m_data)); + encoder << static_cast<bool>(m_data); if (m_data) CoreIPC::encode(encoder, m_data.get()); - encoder->encode(static_cast<bool>(m_keychainItem)); + encoder << static_cast<bool>(m_keychainItem); if (m_keychainItem) CoreIPC::encode(encoder, m_keychainItem.get()); } diff --git a/Source/WebKit2/Shared/mac/SecKeychainItemResponseData.h b/Source/WebKit2/Shared/mac/SecKeychainItemResponseData.h index 09b38f0ae..cddcfc218 100644 --- a/Source/WebKit2/Shared/mac/SecKeychainItemResponseData.h +++ b/Source/WebKit2/Shared/mac/SecKeychainItemResponseData.h @@ -47,7 +47,7 @@ public: SecKeychainItemResponseData(OSStatus, RetainPtr<SecKeychainItemRef>); SecKeychainItemResponseData(OSStatus); - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, SecKeychainItemResponseData&); SecItemClass itemClass() const { return m_itemClass; } diff --git a/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm b/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm index 9f04ef95e..cc26dceaf 100644 --- a/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm +++ b/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm @@ -38,10 +38,10 @@ using namespace WebKit; namespace CoreIPC { -void ArgumentCoder<ResourceRequest>::encodePlatformData(ArgumentEncoder* encoder, const ResourceRequest& resourceRequest) +void ArgumentCoder<ResourceRequest>::encodePlatformData(ArgumentEncoder& encoder, const ResourceRequest& resourceRequest) { bool requestIsPresent = resourceRequest.nsURLRequest(); - encoder->encode(requestIsPresent); + encoder << requestIsPresent; if (!requestIsPresent) return; @@ -73,10 +73,10 @@ bool ArgumentCoder<ResourceRequest>::decodePlatformData(ArgumentDecoder* decoder return true; } -void ArgumentCoder<ResourceResponse>::encodePlatformData(ArgumentEncoder* encoder, const ResourceResponse& resourceResponse) +void ArgumentCoder<ResourceResponse>::encodePlatformData(ArgumentEncoder& encoder, const ResourceResponse& resourceResponse) { bool responseIsPresent = resourceResponse.nsURLResponse(); - encoder->encode(responseIsPresent); + encoder << responseIsPresent; if (!responseIsPresent) return; @@ -113,10 +113,10 @@ static NSString* nsString(const String& string) return string.impl() ? [NSString stringWithCharacters:reinterpret_cast<const UniChar*>(string.characters()) length:string.length()] : @""; } -void ArgumentCoder<ResourceError>::encodePlatformData(ArgumentEncoder* encoder, const ResourceError& resourceError) +void ArgumentCoder<ResourceError>::encodePlatformData(ArgumentEncoder& encoder, const ResourceError& resourceError) { bool errorIsNull = resourceError.isNull(); - encoder->encode(errorIsNull); + encoder << errorIsNull; if (errorIsNull) return; @@ -124,10 +124,10 @@ void ArgumentCoder<ResourceError>::encodePlatformData(ArgumentEncoder* encoder, NSError *nsError = resourceError.nsError(); String domain = [nsError domain]; - encoder->encode(domain); - + encoder << domain; + int64_t code = [nsError code]; - encoder->encode(code); + encoder << code; HashMap<String, String> stringUserInfoMap; @@ -140,11 +140,11 @@ void ArgumentCoder<ResourceError>::encodePlatformData(ArgumentEncoder* encoder, stringUserInfoMap.set(key, (NSString *)value); continue; } - encoder->encode(stringUserInfoMap); + encoder << stringUserInfoMap; id peerCertificateChain = [userInfo objectForKey:@"NSErrorPeerCertificateChainKey"]; ASSERT(!peerCertificateChain || [peerCertificateChain isKindOfClass:[NSArray class]]); - encoder->encode(PlatformCertificateInfo((CFArrayRef)peerCertificateChain)); + encoder << PlatformCertificateInfo((CFArrayRef)peerCertificateChain); } bool ArgumentCoder<ResourceError>::decodePlatformData(ArgumentDecoder* decoder, ResourceError& resourceError) @@ -194,10 +194,9 @@ bool ArgumentCoder<ResourceError>::decodePlatformData(ArgumentDecoder* decoder, return true; } -void ArgumentCoder<KeypressCommand>::encode(ArgumentEncoder* encoder, const KeypressCommand& keypressCommand) +void ArgumentCoder<KeypressCommand>::encode(ArgumentEncoder& encoder, const KeypressCommand& keypressCommand) { - encoder->encode(keypressCommand.commandName); - encoder->encode(keypressCommand.text); + encoder << keypressCommand.commandName << keypressCommand.text; } bool ArgumentCoder<KeypressCommand>::decode(ArgumentDecoder* decoder, KeypressCommand& keypressCommand) diff --git a/Source/WebKit2/Shared/qt/ArgumentCodersQt.cpp b/Source/WebKit2/Shared/qt/ArgumentCodersQt.cpp index 67dad4829..9ec19d32a 100644 --- a/Source/WebKit2/Shared/qt/ArgumentCodersQt.cpp +++ b/Source/WebKit2/Shared/qt/ArgumentCodersQt.cpp @@ -33,15 +33,15 @@ namespace CoreIPC { typedef HashMap<String , Vector<uint8_t> > MIMEDataHashMap; -void ArgumentCoder<WebCore::DragData>::encode(ArgumentEncoder* encoder, const DragData& dragData) +void ArgumentCoder<WebCore::DragData>::encode(ArgumentEncoder& encoder, const DragData& dragData) { - encoder->encode(dragData.clientPosition()); - encoder->encode(dragData.globalPosition()); - encoder->encode((uint64_t)dragData.draggingSourceOperationMask()); - encoder->encode((uint64_t)dragData.flags()); + encoder << dragData.clientPosition(); + encoder << dragData.globalPosition(); + encoder << (uint64_t)dragData.draggingSourceOperationMask(); + encoder << (uint64_t)dragData.flags(); bool hasPlatformData = dragData.platformData(); - encoder->encode(hasPlatformData); + encoder << hasPlatformData; if (!hasPlatformData) return; @@ -54,7 +54,7 @@ void ArgumentCoder<WebCore::DragData>::encode(ArgumentEncoder* encoder, const Dr vdata.append((uint8_t*)(bytes.data()), bytes.size()); map.add(String(formats[i]), vdata); } - encoder->encode(map); + encoder << map; } bool ArgumentCoder<WebCore::DragData>::decode(ArgumentDecoder* decoder, DragData& dragData) diff --git a/Source/WebKit2/Shared/qt/ArgumentCodersQt.h b/Source/WebKit2/Shared/qt/ArgumentCodersQt.h index 4d15cc071..ad85799fb 100644 --- a/Source/WebKit2/Shared/qt/ArgumentCodersQt.h +++ b/Source/WebKit2/Shared/qt/ArgumentCodersQt.h @@ -26,11 +26,11 @@ namespace CoreIPC { -void encode(ArgumentEncoder*, const WebCore::DragData&); +void encode(ArgumentEncoder&, const WebCore::DragData&); bool decode(ArgumentDecoder*, WebCore::DragData&); template<> struct ArgumentCoder<WebCore::DragData> { - static void encode(ArgumentEncoder*, const WebCore::DragData&); + static void encode(ArgumentEncoder&, const WebCore::DragData&); static bool decode(ArgumentDecoder*, WebCore::DragData&); }; diff --git a/Source/WebKit2/Shared/qt/LayerTreeContextQt.cpp b/Source/WebKit2/Shared/qt/LayerTreeContextQt.cpp index d37d79cb2..00ea8735f 100644 --- a/Source/WebKit2/Shared/qt/LayerTreeContextQt.cpp +++ b/Source/WebKit2/Shared/qt/LayerTreeContextQt.cpp @@ -40,9 +40,9 @@ LayerTreeContext::~LayerTreeContext() { } -void LayerTreeContext::encode(CoreIPC::ArgumentEncoder* encoder) const +void LayerTreeContext::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(webLayerID); + encoder.encode(webLayerID); } bool LayerTreeContext::decode(CoreIPC::ArgumentDecoder* decoder, LayerTreeContext& context) diff --git a/Source/WebKit2/Shared/qt/PlatformCertificateInfo.h b/Source/WebKit2/Shared/qt/PlatformCertificateInfo.h index 32776f742..9c542a11d 100644 --- a/Source/WebKit2/Shared/qt/PlatformCertificateInfo.h +++ b/Source/WebKit2/Shared/qt/PlatformCertificateInfo.h @@ -42,7 +42,7 @@ public: { } - void encode(CoreIPC::ArgumentEncoder*) const + void encode(CoreIPC::ArgumentEncoder&) const { } diff --git a/Source/WebKit2/Shared/qt/QtNetworkReplyData.cpp b/Source/WebKit2/Shared/qt/QtNetworkReplyData.cpp index 90f68e78f..b11dc2f63 100644 --- a/Source/WebKit2/Shared/qt/QtNetworkReplyData.cpp +++ b/Source/WebKit2/Shared/qt/QtNetworkReplyData.cpp @@ -41,13 +41,13 @@ QtNetworkReplyData::QtNetworkReplyData() : m_contentLength(0) { } -void QtNetworkReplyData::encode(CoreIPC::ArgumentEncoder* encoder) const +void QtNetworkReplyData::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(m_urlString); - encoder->encode(m_contentType); - encoder->encode(static_cast<uint64_t>(m_contentLength)); - encoder->encode(m_replyUuid); - encoder->encode(m_dataHandle); + encoder.encode(m_urlString); + encoder.encode(m_contentType); + encoder.encode(static_cast<uint64_t>(m_contentLength)); + encoder.encode(m_replyUuid); + encoder.encode(m_dataHandle); } bool QtNetworkReplyData::decode(CoreIPC::ArgumentDecoder* decoder, QtNetworkReplyData& destination) diff --git a/Source/WebKit2/Shared/qt/QtNetworkReplyData.h b/Source/WebKit2/Shared/qt/QtNetworkReplyData.h index 457d7be27..02e5a1545 100644 --- a/Source/WebKit2/Shared/qt/QtNetworkReplyData.h +++ b/Source/WebKit2/Shared/qt/QtNetworkReplyData.h @@ -42,7 +42,7 @@ namespace WebKit { struct QtNetworkReplyData { QtNetworkReplyData(); - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, QtNetworkReplyData&); WTF::String m_urlString; diff --git a/Source/WebKit2/Shared/qt/QtNetworkRequestData.cpp b/Source/WebKit2/Shared/qt/QtNetworkRequestData.cpp index 8a80fb369..4c216db4f 100644 --- a/Source/WebKit2/Shared/qt/QtNetworkRequestData.cpp +++ b/Source/WebKit2/Shared/qt/QtNetworkRequestData.cpp @@ -50,11 +50,11 @@ QtNetworkRequestData::QtNetworkRequestData(const QNetworkRequest& request, QNetw m_replyUuid = QUuid::createUuid().toString(); } -void QtNetworkRequestData::encode(CoreIPC::ArgumentEncoder* encoder) const +void QtNetworkRequestData::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(m_scheme); - encoder->encode(m_urlString); - encoder->encode(m_replyUuid); + encoder.encode(m_scheme); + encoder.encode(m_urlString); + encoder.encode(m_replyUuid); } bool QtNetworkRequestData::decode(CoreIPC::ArgumentDecoder* decoder, QtNetworkRequestData& destination) diff --git a/Source/WebKit2/Shared/qt/QtNetworkRequestData.h b/Source/WebKit2/Shared/qt/QtNetworkRequestData.h index 9bcaac767..6583945ca 100644 --- a/Source/WebKit2/Shared/qt/QtNetworkRequestData.h +++ b/Source/WebKit2/Shared/qt/QtNetworkRequestData.h @@ -44,7 +44,7 @@ namespace WebKit { struct QtNetworkRequestData { QtNetworkRequestData(); QtNetworkRequestData(const QNetworkRequest&, QNetworkReply*); - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, QtNetworkRequestData&); String m_scheme; diff --git a/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp b/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp index f8d643b98..adf1f2145 100644 --- a/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp +++ b/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp @@ -34,7 +34,7 @@ using namespace WebCore; namespace CoreIPC { -void ArgumentCoder<ResourceRequest>::encodePlatformData(ArgumentEncoder* encoder, const ResourceRequest& resourceRequest) +void ArgumentCoder<ResourceRequest>::encodePlatformData(ArgumentEncoder& encoder, const ResourceRequest& resourceRequest) { } @@ -44,7 +44,7 @@ bool ArgumentCoder<ResourceRequest>::decodePlatformData(ArgumentDecoder* decoder } -void ArgumentCoder<ResourceResponse>::encodePlatformData(ArgumentEncoder* encoder, const ResourceResponse& resourceResponse) +void ArgumentCoder<ResourceResponse>::encodePlatformData(ArgumentEncoder& encoder, const ResourceResponse& resourceResponse) { } @@ -54,7 +54,7 @@ bool ArgumentCoder<ResourceResponse>::decodePlatformData(ArgumentDecoder* decode } -void ArgumentCoder<ResourceError>::encodePlatformData(ArgumentEncoder* encoder, const ResourceError& resourceError) +void ArgumentCoder<ResourceError>::encodePlatformData(ArgumentEncoder& encoder, const ResourceError& resourceError) { } diff --git a/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp b/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp index 45fc34ae6..0240729c0 100644 --- a/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp +++ b/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp @@ -66,7 +66,6 @@ static WebMouseEvent::Button mouseButtonForEvent(QMouseEvent *event) static WebEvent::Type webEventTypeForEvent(const QEvent* event) { switch (event->type()) { - case QEvent::MouseButtonDblClick: case QEvent::MouseButtonPress: return WebEvent::MouseDown; case QEvent::MouseButtonRelease: @@ -89,6 +88,9 @@ static WebEvent::Type webEventTypeForEvent(const QEvent* event) case QEvent::TouchCancel: return WebEvent::TouchCancel; #endif + case QEvent::MouseButtonDblClick: + ASSERT_NOT_REACHED(); + return WebEvent::NoType; default: // assert return WebEvent::MouseMove; diff --git a/Source/WebKit2/Shared/soup/PlatformCertificateInfo.cpp b/Source/WebKit2/Shared/soup/PlatformCertificateInfo.cpp index 388be7ad8..816920e6d 100644 --- a/Source/WebKit2/Shared/soup/PlatformCertificateInfo.cpp +++ b/Source/WebKit2/Shared/soup/PlatformCertificateInfo.cpp @@ -51,24 +51,24 @@ PlatformCertificateInfo::~PlatformCertificateInfo() { } -void PlatformCertificateInfo::encode(CoreIPC::ArgumentEncoder* encoder) const +void PlatformCertificateInfo::encode(CoreIPC::ArgumentEncoder& encoder) const { if (!m_certificate) { - encoder->encode(false); + encoder.encode(false); return; } GByteArray* certificateData = 0; g_object_get(G_OBJECT(m_certificate.get()), "certificate", &certificateData, NULL); if (!certificateData) { - encoder->encode(false); + encoder.encode(false); return; } - encoder->encode(true); + encoder.encode(true); GRefPtr<GByteArray> certificate = adoptGRef(certificateData); - encoder->encodeVariableLengthByteArray(CoreIPC::DataReference(certificate->data, certificate->len)); - encoder->encode(static_cast<uint32_t>(m_tlsErrors)); + encoder.encodeVariableLengthByteArray(CoreIPC::DataReference(certificate->data, certificate->len)); + encoder.encode(static_cast<uint32_t>(m_tlsErrors)); } bool PlatformCertificateInfo::decode(CoreIPC::ArgumentDecoder* decoder, PlatformCertificateInfo& certificateInfo) diff --git a/Source/WebKit2/Shared/soup/PlatformCertificateInfo.h b/Source/WebKit2/Shared/soup/PlatformCertificateInfo.h index 0e76a3e94..9f19a2fab 100644 --- a/Source/WebKit2/Shared/soup/PlatformCertificateInfo.h +++ b/Source/WebKit2/Shared/soup/PlatformCertificateInfo.h @@ -50,7 +50,7 @@ public: GTlsCertificate* certificate() const { return m_certificate.get(); } GTlsCertificateFlags tlsErrors() const { return m_tlsErrors; } - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, PlatformCertificateInfo&); private: diff --git a/Source/WebKit2/Shared/soup/WebCoreArgumentCodersSoup.cpp b/Source/WebKit2/Shared/soup/WebCoreArgumentCodersSoup.cpp index 4df15dc84..2e9a1968e 100644 --- a/Source/WebKit2/Shared/soup/WebCoreArgumentCodersSoup.cpp +++ b/Source/WebKit2/Shared/soup/WebCoreArgumentCodersSoup.cpp @@ -36,9 +36,9 @@ using namespace WebCore; namespace CoreIPC { -void ArgumentCoder<ResourceRequest>::encodePlatformData(ArgumentEncoder* encoder, const ResourceRequest& resourceRequest) +void ArgumentCoder<ResourceRequest>::encodePlatformData(ArgumentEncoder& encoder, const ResourceRequest& resourceRequest) { - encoder->encode(static_cast<uint32_t>(resourceRequest.soupMessageFlags())); + encoder << static_cast<uint32_t>(resourceRequest.soupMessageFlags()); } bool ArgumentCoder<ResourceRequest>::decodePlatformData(ArgumentDecoder* decoder, ResourceRequest& resourceRequest) @@ -51,9 +51,9 @@ bool ArgumentCoder<ResourceRequest>::decodePlatformData(ArgumentDecoder* decoder } -void ArgumentCoder<ResourceResponse>::encodePlatformData(ArgumentEncoder* encoder, const ResourceResponse& resourceResponse) +void ArgumentCoder<ResourceResponse>::encodePlatformData(ArgumentEncoder& encoder, const ResourceResponse& resourceResponse) { - encoder->encode(static_cast<uint32_t>(resourceResponse.soupMessageFlags())); + encoder << static_cast<uint32_t>(resourceResponse.soupMessageFlags()); } bool ArgumentCoder<ResourceResponse>::decodePlatformData(ArgumentDecoder* decoder, ResourceResponse& resourceResponse) @@ -66,7 +66,7 @@ bool ArgumentCoder<ResourceResponse>::decodePlatformData(ArgumentDecoder* decode } -void ArgumentCoder<ResourceError>::encodePlatformData(ArgumentEncoder*, const ResourceError&) +void ArgumentCoder<ResourceError>::encodePlatformData(ArgumentEncoder&, const ResourceError&) { } diff --git a/Source/WebKit2/Shared/win/LayerTreeContextWin.cpp b/Source/WebKit2/Shared/win/LayerTreeContextWin.cpp index ad05c1d03..5dd7c667e 100644 --- a/Source/WebKit2/Shared/win/LayerTreeContextWin.cpp +++ b/Source/WebKit2/Shared/win/LayerTreeContextWin.cpp @@ -39,9 +39,9 @@ LayerTreeContext::~LayerTreeContext() { } -void LayerTreeContext::encode(CoreIPC::ArgumentEncoder* encoder) const +void LayerTreeContext::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(reinterpret_cast<uint64_t>(window)); + encoder.encode(reinterpret_cast<uint64_t>(window)); } bool LayerTreeContext::decode(CoreIPC::ArgumentDecoder* decoder, LayerTreeContext& context) diff --git a/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp b/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp index 08cd4e2b3..5b0d20a84 100644 --- a/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp +++ b/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp @@ -106,19 +106,19 @@ PlatformCertificateInfo& PlatformCertificateInfo::operator=(const PlatformCertif return *this; } -void PlatformCertificateInfo::encode(CoreIPC::ArgumentEncoder* encoder) const +void PlatformCertificateInfo::encode(CoreIPC::ArgumentEncoder& encoder) const { // Special case no certificates if (m_certificateChain.isEmpty()) { - encoder->encode(std::numeric_limits<uint64_t>::max()); + encoder.encode(std::numeric_limits<uint64_t>::max()); return; } uint64_t length = m_certificateChain.size(); - encoder->encode(length); + encoder.encode(length); for (size_t i = 0; i < length; ++i) - encoder->encodeVariableLengthByteArray(CoreIPC::DataReference(static_cast<uint8_t*>(m_certificateChain[i]->pbCertEncoded), m_certificateChain[i]->cbCertEncoded)); + encoder.encodeVariableLengthByteArray(CoreIPC::DataReference(static_cast<uint8_t*>(m_certificateChain[i]->pbCertEncoded), m_certificateChain[i]->cbCertEncoded)); } bool PlatformCertificateInfo::decode(CoreIPC::ArgumentDecoder* decoder, PlatformCertificateInfo& c) diff --git a/Source/WebKit2/Shared/win/PlatformCertificateInfo.h b/Source/WebKit2/Shared/win/PlatformCertificateInfo.h index dd999ef25..7637bbbc5 100644 --- a/Source/WebKit2/Shared/win/PlatformCertificateInfo.h +++ b/Source/WebKit2/Shared/win/PlatformCertificateInfo.h @@ -51,7 +51,7 @@ public: const Vector<PCCERT_CONTEXT>& certificateChain() const { return m_certificateChain; } - void encode(CoreIPC::ArgumentEncoder* encoder) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder* decoder, PlatformCertificateInfo& t); private: diff --git a/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp b/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp index a61409194..7f04db08f 100644 --- a/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp +++ b/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp @@ -49,11 +49,11 @@ namespace CoreIPC { // FIXME: These coders should really go in a WebCoreArgumentCodersCFNetwork file. -void ArgumentCoder<ResourceRequest>::encodePlatformData(ArgumentEncoder* encoder, const ResourceRequest& resourceRequest) +void ArgumentCoder<ResourceRequest>::encodePlatformData(ArgumentEncoder& encoder, const ResourceRequest& resourceRequest) { #if USE(CFNETWORK) bool requestIsPresent = resourceRequest.cfURLRequest(); - encoder->encode(requestIsPresent); + encoder << requestIsPresent; if (!requestIsPresent) return; @@ -95,11 +95,11 @@ bool ArgumentCoder<ResourceRequest>::decodePlatformData(ArgumentDecoder* decoder } -void ArgumentCoder<ResourceResponse>::encodePlatformData(ArgumentEncoder* encoder, const ResourceResponse& resourceResponse) +void ArgumentCoder<ResourceResponse>::encodePlatformData(ArgumentEncoder& encoder, const ResourceResponse& resourceResponse) { #if USE(CFNETWORK) bool responseIsPresent = resourceResponse.cfURLResponse(); - encoder->encode(responseIsPresent); + encoder << responseIsPresent; if (!responseIsPresent) return; @@ -137,10 +137,10 @@ bool ArgumentCoder<ResourceResponse>::decodePlatformData(ArgumentDecoder* decode } -void ArgumentCoder<ResourceError>::encodePlatformData(ArgumentEncoder* encoder, const ResourceError& resourceError) +void ArgumentCoder<ResourceError>::encodePlatformData(ArgumentEncoder& encoder, const ResourceError& resourceError) { #if USE(CFNETWORK) - encoder->encode(PlatformCertificateInfo(resourceError.certificate())); + encoder << PlatformCertificateInfo(resourceError.certificate()); #endif } diff --git a/Source/WebKit2/Shared/win/WindowGeometry.cpp b/Source/WebKit2/Shared/win/WindowGeometry.cpp index 73caa05dd..da40d246f 100644 --- a/Source/WebKit2/Shared/win/WindowGeometry.cpp +++ b/Source/WebKit2/Shared/win/WindowGeometry.cpp @@ -36,12 +36,12 @@ WindowGeometry::WindowGeometry() { } -void WindowGeometry::encode(CoreIPC::ArgumentEncoder* encoder) const +void WindowGeometry::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(reinterpret_cast<uint64_t>(window)); - encoder->encode(visible); - encoder->encode(frame); - encoder->encode(clipRect); + encoder.encode(reinterpret_cast<uint64_t>(window)); + encoder.encode(visible); + encoder.encode(frame); + encoder.encode(clipRect); } bool WindowGeometry::decode(CoreIPC::ArgumentDecoder* decoder, WindowGeometry& geometry) diff --git a/Source/WebKit2/Shared/win/WindowGeometry.h b/Source/WebKit2/Shared/win/WindowGeometry.h index c5542bd26..9194e531f 100644 --- a/Source/WebKit2/Shared/win/WindowGeometry.h +++ b/Source/WebKit2/Shared/win/WindowGeometry.h @@ -38,7 +38,7 @@ namespace WebKit { struct WindowGeometry { WindowGeometry(); - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, WindowGeometry&); HWND window; diff --git a/Source/WebKit2/SharedWorkerProcess/SharedWorkerProcess.cpp b/Source/WebKit2/SharedWorkerProcess/SharedWorkerProcess.cpp index a533d25bc..c8decb4a2 100644 --- a/Source/WebKit2/SharedWorkerProcess/SharedWorkerProcess.cpp +++ b/Source/WebKit2/SharedWorkerProcess/SharedWorkerProcess.cpp @@ -114,7 +114,7 @@ void SharedWorkerProcess::didClose(CoreIPC::Connection*) RunLoop::current()->stop(); } -void SharedWorkerProcess::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID) +void SharedWorkerProcess::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference, CoreIPC::StringReference) { } diff --git a/Source/WebKit2/SharedWorkerProcess/SharedWorkerProcess.h b/Source/WebKit2/SharedWorkerProcess/SharedWorkerProcess.h index d5b5c81c8..7ebd357e4 100644 --- a/Source/WebKit2/SharedWorkerProcess/SharedWorkerProcess.h +++ b/Source/WebKit2/SharedWorkerProcess/SharedWorkerProcess.h @@ -59,7 +59,7 @@ private: // CoreIPC::Connection::Client virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); virtual void didClose(CoreIPC::Connection*); - virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID); + virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName) OVERRIDE; // Message handlers. void didReceiveSharedWorkerProcessMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); diff --git a/Source/WebKit2/SharedWorkerProcess/SharedWorkerProcess.messages.in b/Source/WebKit2/SharedWorkerProcess/SharedWorkerProcess.messages.in index 3cd75337b..789bbb318 100644 --- a/Source/WebKit2/SharedWorkerProcess/SharedWorkerProcess.messages.in +++ b/Source/WebKit2/SharedWorkerProcess/SharedWorkerProcess.messages.in @@ -30,6 +30,10 @@ messages -> SharedWorkerProcess { # The shared worker process sends back a DidCreateWebProcessConnection message with # a connection identifier. CreateWebProcessConnection() + +#if PLATFORM(MAC) + SetApplicationIsOccluded(bool flag) +#endif } #endif // ENABLE(SHARED_WORKER_PROCESS) diff --git a/Source/WebKit2/UIProcess/API/C/WKAPICast.h b/Source/WebKit2/UIProcess/API/C/WKAPICast.h index ba627708e..713b4f896 100644 --- a/Source/WebKit2/UIProcess/API/C/WKAPICast.h +++ b/Source/WebKit2/UIProcess/API/C/WKAPICast.h @@ -142,10 +142,7 @@ WK_ADD_API_MAPPING(WKRenderLayerRef, WebRenderLayer) WK_ADD_API_MAPPING(WKRenderObjectRef, WebRenderObject) WK_ADD_API_MAPPING(WKTextCheckerRef, WebTextChecker) WK_ADD_API_MAPPING(WKVibrationRef, WebVibrationProxy) - -#if ENABLE(INSPECTOR) WK_ADD_API_MAPPING(WKInspectorRef, WebInspectorProxy) -#endif /* Enum conversions */ diff --git a/Source/WebKit2/UIProcess/API/C/WKInspector.cpp b/Source/WebKit2/UIProcess/API/C/WKInspector.cpp index 7e2187dda..891388c9a 100644 --- a/Source/WebKit2/UIProcess/API/C/WKInspector.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKInspector.cpp @@ -26,8 +26,6 @@ #include "config.h" #include "WKInspector.h" -#if ENABLE(INSPECTOR) - #include "WKAPICast.h" #include "WebInspectorProxy.h" @@ -35,92 +33,142 @@ using namespace WebKit; WKTypeID WKInspectorGetTypeID() { +#if ENABLE(INSPECTOR) return toAPI(WebInspectorProxy::APIType); +#else + return 0; +#endif } WKPageRef WKInspectorGetPage(WKInspectorRef inspectorRef) { +#if ENABLE(INSPECTOR) return toAPI(toImpl(inspectorRef)->page()); +#else + return 0; +#endif } bool WKInspectorIsVisible(WKInspectorRef inspectorRef) { +#if ENABLE(INSPECTOR) return toImpl(inspectorRef)->isVisible(); +#else + return false; +#endif } bool WKInspectorIsFront(WKInspectorRef inspectorRef) { +#if ENABLE(INSPECTOR) return toImpl(inspectorRef)->isFront(); +#else + return false; +#endif } void WKInspectorShow(WKInspectorRef inspectorRef) { +#if ENABLE(INSPECTOR) toImpl(inspectorRef)->show(); +#endif } void WKInspectorClose(WKInspectorRef inspectorRef) { +#if ENABLE(INSPECTOR) toImpl(inspectorRef)->close(); +#endif } void WKInspectorShowConsole(WKInspectorRef inspectorRef) { +#if ENABLE(INSPECTOR) toImpl(inspectorRef)->showConsole(); +#endif } void WKInspectorShowResources(WKInspectorRef inspectorRef) { +#if ENABLE(INSPECTOR) toImpl(inspectorRef)->showResources(); +#endif } void WKInspectorShowMainResourceForFrame(WKInspectorRef inspectorRef, WKFrameRef frameRef) { +#if ENABLE(INSPECTOR) toImpl(inspectorRef)->showMainResourceForFrame(toImpl(frameRef)); +#endif } bool WKInspectorIsAttached(WKInspectorRef inspectorRef) { +#if ENABLE(INSPECTOR) return toImpl(inspectorRef)->isAttached(); +#else + return false; +#endif } void WKInspectorAttach(WKInspectorRef inspectorRef) { +#if ENABLE(INSPECTOR) toImpl(inspectorRef)->attach(); +#endif } void WKInspectorDetach(WKInspectorRef inspectorRef) { +#if ENABLE(INSPECTOR) toImpl(inspectorRef)->detach(); +#endif } bool WKInspectorIsDebuggingJavaScript(WKInspectorRef inspectorRef) { +#if ENABLE(INSPECTOR) return toImpl(inspectorRef)->isDebuggingJavaScript(); +#else + return false; +#endif } void WKInspectorToggleJavaScriptDebugging(WKInspectorRef inspectorRef) { +#if ENABLE(INSPECTOR) toImpl(inspectorRef)->toggleJavaScriptDebugging(); +#endif } bool WKInspectorIsProfilingJavaScript(WKInspectorRef inspectorRef) { +#if ENABLE(INSPECTOR) return toImpl(inspectorRef)->isProfilingJavaScript(); +#else + return false; +#endif } void WKInspectorToggleJavaScriptProfiling(WKInspectorRef inspectorRef) { +#if ENABLE(INSPECTOR) toImpl(inspectorRef)->toggleJavaScriptProfiling(); +#endif } bool WKInspectorIsProfilingPage(WKInspectorRef inspectorRef) { +#if ENABLE(INSPECTOR) return toImpl(inspectorRef)->isProfilingPage(); +#else + return false; +#endif } void WKInspectorTogglePageProfiling(WKInspectorRef inspectorRef) { +#if ENABLE(INSPECTOR) toImpl(inspectorRef)->togglePageProfiling(); +#endif } - -#endif // ENABLE(INSPECTOR) diff --git a/Source/WebKit2/UIProcess/API/C/WKInspector.h b/Source/WebKit2/UIProcess/API/C/WKInspector.h index a00d103de..fd3438afa 100644 --- a/Source/WebKit2/UIProcess/API/C/WKInspector.h +++ b/Source/WebKit2/UIProcess/API/C/WKInspector.h @@ -28,8 +28,6 @@ #include <WebKit2/WKBase.h> -#if ENABLE(INSPECTOR) - #ifndef __cplusplus #include <stdbool.h> #endif @@ -68,6 +66,4 @@ WK_EXPORT void WKInspectorTogglePageProfiling(WKInspectorRef inspector); } #endif -#endif // ENABLE(INSPECTOR) - #endif // WKInspector_h diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.cpp b/Source/WebKit2/UIProcess/API/C/WKPage.cpp index 52e1cebf8..bdbcb554d 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPage.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKPage.cpp @@ -182,12 +182,14 @@ uint64_t WKPageGetRenderTreeSize(WKPageRef page) return toImpl(page)->renderTreeSize(); } -#if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR WKInspectorRef WKPageGetInspector(WKPageRef pageRef) { +#if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR return toAPI(toImpl(pageRef)->inspector()); -} +#else + return 0; #endif +} double WKPageGetEstimatedProgress(WKPageRef pageRef) { diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.h b/Source/WebKit2/UIProcess/API/C/WKPage.h index 9dfd52e3c..dadebbc91 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPage.h +++ b/Source/WebKit2/UIProcess/API/C/WKPage.h @@ -387,9 +387,7 @@ WK_EXPORT uint64_t WKPageGetRenderTreeSize(WKPageRef page); WK_EXPORT void WKPageSetMemoryCacheClientCallsEnabled(WKPageRef page, bool memoryCacheClientCallsEnabled); -#if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR WK_EXPORT WKInspectorRef WKPageGetInspector(WKPageRef page); -#endif WK_EXPORT WKStringRef WKPageCopyUserAgent(WKPageRef page); diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp index 532d82caf..068563d1f 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp @@ -943,3 +943,13 @@ bool WKPreferencesGetPDFPluginEnabled(WKPreferencesRef preferencesRef) { return toImpl(preferencesRef)->pdfPluginEnabled(); } + +void WKPreferencesSetEncodingDetectorEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setUsesEncodingDetector(enabled); +} + +bool WKPreferencesGetEncodingDetectorEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->usesEncodingDetector(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.h b/Source/WebKit2/UIProcess/API/C/WKPreferences.h index d91b82d83..ff2e0a006 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPreferences.h +++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.h @@ -220,6 +220,10 @@ WK_EXPORT WKStorageBlockingPolicy WKPreferencesGetStorageBlockingPolicy(WKPrefer WK_EXPORT void WKPreferencesSetPlugInSnapshottingEnabled(WKPreferencesRef preferencesRef, bool enabled); WK_EXPORT bool WKPreferencesGetPlugInSnapshottingEnabled(WKPreferencesRef preferencesRef); +// Defaults to false. +WK_EXPORT void WKPreferencesSetEncodingDetectorEnabled(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesGetEncodingDetectorEnabled(WKPreferencesRef preferencesRef); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp b/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp index 03f6930dd..a03d189df 100644 --- a/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp +++ b/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp @@ -20,6 +20,7 @@ #include "config.h" #include "WKView.h" +#include "EwkViewImpl.h" #include "WKAPICast.h" #include "ewk_view_private.h" @@ -32,5 +33,7 @@ WKViewRef WKViewCreate(Evas* canvas, WKContextRef contextRef, WKPageGroupRef pag WKPageRef WKViewGetPage(WKViewRef viewRef) { - return toAPI(ewk_view_page_get(toImpl(viewRef))); + EwkViewImpl* viewImpl = EwkViewImpl::fromEvasObject(toImpl(viewRef)); + + return viewImpl->wkPage(); } diff --git a/Source/WebKit2/UIProcess/API/efl/EWebKit2.h b/Source/WebKit2/UIProcess/API/efl/EWebKit2.h index 17afb115d..07ca12935 100644 --- a/Source/WebKit2/UIProcess/API/efl/EWebKit2.h +++ b/Source/WebKit2/UIProcess/API/efl/EWebKit2.h @@ -28,22 +28,30 @@ #ifndef EWebKit2_h #define EWebKit2_h +#include "ewk_auth_request.h" #include "ewk_back_forward_list.h" #include "ewk_back_forward_list_item.h" +#include "ewk_color_picker.h" #include "ewk_context.h" #include "ewk_cookie_manager.h" +#include "ewk_database_manager.h" #include "ewk_download_job.h" #include "ewk_error.h" #include "ewk_favicon_database.h" +#include "ewk_file_chooser_request.h" #include "ewk_form_submission_request.h" #include "ewk_intent.h" #include "ewk_intent_service.h" #include "ewk_main.h" #include "ewk_navigation_data.h" #include "ewk_navigation_policy_decision.h" +#include "ewk_object.h" +#include "ewk_popup_menu.h" #include "ewk_popup_menu_item.h" #include "ewk_resource.h" +#include "ewk_security_origin.h" #include "ewk_settings.h" +#include "ewk_storage_manager.h" #include "ewk_text_checker.h" #include "ewk_touch.h" #include "ewk_url_request.h" diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_request_manager_client_private.h b/Source/WebKit2/UIProcess/API/efl/EvasGLContext.cpp index 311343890..98a7e6a8e 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_context_request_manager_client_private.h +++ b/Source/WebKit2/UIProcess/API/efl/EvasGLContext.cpp @@ -23,11 +23,26 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ewk_context_request_manager_client_private_h -#define ewk_context_request_manager_client_private_h +#include "config.h" +#include "EvasGLContext.h" -typedef struct Ewk_Context Ewk_Context; +#if USE(ACCELERATED_COMPOSITING) -void ewk_context_request_manager_client_attach(Ewk_Context* context); +namespace WebKit { -#endif // ewk_context_request_manager_client_private_h +EvasGLContext::EvasGLContext(Evas_GL* evasGL, Evas_GL_Context* passContext) + : m_evasGL(evasGL) + , m_context(passContext) +{ + ASSERT(evasGL); + ASSERT(passContext); +} + +EvasGLContext::~EvasGLContext() +{ + evas_gl_context_destroy(m_evasGL, m_context); +} + +} // namespace WebKit + +#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebKit2/UIProcess/API/efl/EvasGLContext.h b/Source/WebKit2/UIProcess/API/efl/EvasGLContext.h new file mode 100644 index 000000000..9899a81f4 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/EvasGLContext.h @@ -0,0 +1,62 @@ +/* + * 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 EvasGLContext_h +#define EvasGLContext_h + +#if USE(ACCELERATED_COMPOSITING) +#include <Evas_GL.h> +#include <wtf/PassOwnPtr.h> + +namespace WebKit { + +class EvasGLContext { +public: + static PassOwnPtr<EvasGLContext> create(Evas_GL* evasGL) + { + ASSERT(evasGL); + Evas_GL_Context* context = evas_gl_context_create(evasGL, 0); + if (!context) + return nullptr; + + // Ownership of context is passed to EvasGLContext. + return adoptPtr(new EvasGLContext(evasGL, context)); + } + ~EvasGLContext(); + + inline Evas_GL_Context* context() const { return m_context; } + +private: + EvasGLContext(Evas_GL* evasGL, Evas_GL_Context* passContext); + + Evas_GL* m_evasGL; + Evas_GL_Context* m_context; +}; + +} // namespace WebKit + +#endif // USE(ACCELERATED_COMPOSITING) + +#endif // EvasGLContext_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_download_client_private.h b/Source/WebKit2/UIProcess/API/efl/EvasGLSurface.cpp index e056aafe6..d5d138390 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_context_download_client_private.h +++ b/Source/WebKit2/UIProcess/API/efl/EvasGLSurface.cpp @@ -23,11 +23,26 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ewk_context_download_client_private_h -#define ewk_context_download_client_private_h +#include "config.h" +#include "EvasGLSurface.h" -typedef struct Ewk_Context Ewk_Context; +#if USE(ACCELERATED_COMPOSITING) -void ewk_context_download_client_attach(Ewk_Context*); +namespace WebKit { -#endif // ewk_context_download_client_private_h +EvasGLSurface::EvasGLSurface(Evas_GL* evasGL, Evas_GL_Surface* passSurface) + : m_evasGL(evasGL) + , m_surface(passSurface) +{ + ASSERT(evasGL); + ASSERT(passSurface); +} + +EvasGLSurface::~EvasGLSurface() +{ + evas_gl_surface_destroy(m_evasGL, m_surface); +} + +} // namespace WebKit + +#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebKit2/UIProcess/API/efl/EvasGLSurface.h b/Source/WebKit2/UIProcess/API/efl/EvasGLSurface.h new file mode 100644 index 000000000..9ab3062c4 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/EvasGLSurface.h @@ -0,0 +1,64 @@ +/* + * 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 EvasGLSurface_h +#define EvasGLSurface_h + +#if USE(ACCELERATED_COMPOSITING) +#include <Evas_GL.h> +#include <WebCore/IntSize.h> +#include <wtf/PassOwnPtr.h> + +namespace WebKit { + +class EvasGLSurface { +public: + static PassOwnPtr<EvasGLSurface> create(Evas_GL* evasGL, Evas_GL_Config* cfg, const WebCore::IntSize& size) + { + ASSERT(evasGL); + ASSERT(cfg); + Evas_GL_Surface* surface = evas_gl_surface_create(evasGL, cfg, size.width(), size.height()); + if (!surface) + return nullptr; + + // Ownership of surface is passed to EvasGLSurface. + return adoptPtr(new EvasGLSurface(evasGL, surface)); + } + ~EvasGLSurface(); + + inline Evas_GL_Surface* surface() const { return m_surface; } + +private: + EvasGLSurface(Evas_GL* evasGL, Evas_GL_Surface* passSurface); + + Evas_GL* m_evasGL; + Evas_GL_Surface* m_surface; +}; + +} // namespace WebKit + +#endif // USE(ACCELERATED_COMPOSITING) + +#endif // EvasGLSurface_h diff --git a/Source/WebKit2/UIProcess/API/efl/EwkViewCallbacks.h b/Source/WebKit2/UIProcess/API/efl/EwkViewCallbacks.h new file mode 100644 index 000000000..7f5512753 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/EwkViewCallbacks.h @@ -0,0 +1,200 @@ +/* + * 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 EwkViewCallbacks_h +#define EwkViewCallbacks_h + +#include "WKEinaSharedString.h" +#include "ewk_private.h" +#include <Evas.h> +#include <wtf/text/CString.h> +#include <wtf/text/WTFString.h> + +typedef struct Ewk_Object Ewk_Auth_Request; +typedef struct Ewk_Object Ewk_Download_Job; +struct Ewk_Download_Job_Error; +struct Ewk_File_Chooser_Request; +struct Ewk_Form_Submission_Request; +struct Ewk_Error; +struct Ewk_Resource_Request; +struct Ewk_Resource_Load_Response; +struct Ewk_Resource_Load_Error; +struct Ewk_Resource; +struct Ewk_Navigation_Policy_Decision; +#if ENABLE(WEB_INTENTS) +struct Ewk_Intent; +#endif +#if ENABLE(WEB_INTENTS_TAG) +struct Ewk_Intent_Service; +#endif + +namespace EwkViewCallbacks { + +enum CallbackType { + AuthenticationRequest, + BackForwardListChange, + CloseWindow, + CreateWindow, + DownloadJobCancelled, + DownloadJobFailed, + DownloadJobFinished, + DownloadJobRequested, + FileChooserRequest, + NewFormSubmissionRequest, + IconChanged, + LoadError, + LoadFinished, + LoadProgress, + ProvisionalLoadFailed, + ProvisionalLoadRedirect, + ProvisionalLoadStarted, + ResourceLoadStarted, + ResourceLoadResponse, + ResourceLoadFailed, + ResourceLoadFinished, + ResourceRequestSent, + NavigationPolicyDecision, + NewWindowPolicyDecision, + TextFound, + TitleChange, + TooltipTextUnset, + TooltipTextSet, + URLChanged, + WebProcessCrashed, +#if ENABLE(WEB_INTENTS) + IntentRequest, +#endif +#if ENABLE(WEB_INTENTS_TAG) + IntentServiceRegistration, +#endif +}; + +template<typename T> +inline bool callbackArgumentsExpected() +{ + return true; +} + +template<> +inline bool callbackArgumentsExpected<void>() +{ + return false; +} + +template <CallbackType> +struct CallBackInfo { + typedef void* Type; + + static inline const char* name() + { + ASSERT_NOT_REACHED(); + return ""; + } +}; + +template <CallbackType callbackType> +class CallBack { +public: + typedef typename CallBackInfo<callbackType>::Type ArgType; + + explicit CallBack(Evas_Object* view) + : m_view(view) + { + ASSERT(m_view); + } + + void call(ArgType* argument = 0) + { + if (argument && !callbackArgumentsExpected<ArgType>()) { + CRITICAL("should not pass arguments for this callback!"); + ASSERT_NOT_REACHED(); + return; + } + + evas_object_smart_callback_call(m_view, CallBackInfo<callbackType>::name(), static_cast<void*>(argument)); + } + + void call(const String& arg) + { + call(const_cast<char*>(arg.utf8().data())); + } + + void call(const WKEinaSharedString& arg) + { + call(const_cast<char*>(static_cast<const char*>(arg))); + } + +private: + Evas_Object* m_view; +}; + +#define DECLARE_EWK_VIEW_CALLBACK(callbackType, string, type) \ +template <> \ +struct CallBackInfo<callbackType> { \ + typedef type Type; \ + static inline const char* name() { return string; } \ +} + +// Note: type 'void' means that no arguments are expected. +DECLARE_EWK_VIEW_CALLBACK(AuthenticationRequest, "authentication,request", Ewk_Auth_Request); +DECLARE_EWK_VIEW_CALLBACK(BackForwardListChange, "back,forward,list,changed", void); +DECLARE_EWK_VIEW_CALLBACK(CloseWindow, "close,window", void); +DECLARE_EWK_VIEW_CALLBACK(CreateWindow, "create,window", Evas_Object*); +DECLARE_EWK_VIEW_CALLBACK(DownloadJobCancelled, "download,cancelled", Ewk_Download_Job); +DECLARE_EWK_VIEW_CALLBACK(DownloadJobFailed, "download,failed", Ewk_Download_Job_Error); +DECLARE_EWK_VIEW_CALLBACK(DownloadJobFinished, "download,finished", Ewk_Download_Job); +DECLARE_EWK_VIEW_CALLBACK(DownloadJobRequested, "download,request", Ewk_Download_Job); +DECLARE_EWK_VIEW_CALLBACK(FileChooserRequest, "file,chooser,request", Ewk_File_Chooser_Request); +DECLARE_EWK_VIEW_CALLBACK(NewFormSubmissionRequest, "form,submission,request", Ewk_Form_Submission_Request); +DECLARE_EWK_VIEW_CALLBACK(IconChanged, "icon,changed", void); +DECLARE_EWK_VIEW_CALLBACK(LoadError, "load,error", Ewk_Error); +DECLARE_EWK_VIEW_CALLBACK(LoadFinished, "load,finished", void); +DECLARE_EWK_VIEW_CALLBACK(LoadProgress, "load,progress", double); +DECLARE_EWK_VIEW_CALLBACK(ProvisionalLoadFailed, "load,provisional,failed", Ewk_Error); +DECLARE_EWK_VIEW_CALLBACK(ProvisionalLoadRedirect, "load,provisional,redirect", void); +DECLARE_EWK_VIEW_CALLBACK(ProvisionalLoadStarted, "load,provisional,started", void); +DECLARE_EWK_VIEW_CALLBACK(NavigationPolicyDecision, "policy,decision,navigation", Ewk_Navigation_Policy_Decision); +DECLARE_EWK_VIEW_CALLBACK(NewWindowPolicyDecision, "policy,decision,new,window", Ewk_Navigation_Policy_Decision); +DECLARE_EWK_VIEW_CALLBACK(ResourceLoadStarted, "resource,request,new", Ewk_Resource_Request); +DECLARE_EWK_VIEW_CALLBACK(ResourceLoadResponse, "resource,request,response", Ewk_Resource_Load_Response); +DECLARE_EWK_VIEW_CALLBACK(ResourceLoadFailed, "resource,request,failed", Ewk_Resource_Load_Error); +DECLARE_EWK_VIEW_CALLBACK(ResourceLoadFinished, "resource,request,finished", Ewk_Resource); +DECLARE_EWK_VIEW_CALLBACK(ResourceRequestSent, "resource,request,sent", Ewk_Resource_Request); +DECLARE_EWK_VIEW_CALLBACK(TextFound, "text,found", unsigned); +DECLARE_EWK_VIEW_CALLBACK(TitleChange, "title,changed", char); +DECLARE_EWK_VIEW_CALLBACK(TooltipTextUnset, "tooltip,text,unset", void); +DECLARE_EWK_VIEW_CALLBACK(TooltipTextSet, "tooltip,text,set", char); +DECLARE_EWK_VIEW_CALLBACK(URLChanged, "url,changed", char); +DECLARE_EWK_VIEW_CALLBACK(WebProcessCrashed, "webprocess,crashed", bool); +#if ENABLE(WEB_INTENTS) +DECLARE_EWK_VIEW_CALLBACK(IntentRequest, "intent,request,new", Ewk_Intent); +#endif +#if ENABLE(WEB_INTENTS_TAG) +DECLARE_EWK_VIEW_CALLBACK(IntentServiceRegistration, "intent,service,register", Ewk_Intent_Service); +#endif + +} + +#endif // #ifndef EwkViewCallbacks_h diff --git a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp new file mode 100644 index 000000000..42166c98c --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp @@ -0,0 +1,834 @@ +/* + Copyright (C) 2011 Samsung Electronics + Copyright (C) 2012 Intel Corporation. All rights reserved. + + 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 "EwkViewImpl.h" + +#include "EflScreenUtilities.h" +#include "FindClientEfl.h" +#include "FormClientEfl.h" +#include "InputMethodContextEfl.h" +#include "LayerTreeCoordinatorProxy.h" +#include "LayerTreeRenderer.h" +#include "PageClientBase.h" +#include "PageClientDefaultImpl.h" +#include "PageClientLegacyImpl.h" +#include "PageLoadClientEfl.h" +#include "PagePolicyClientEfl.h" +#include "PageUIClientEfl.h" +#include "ResourceLoadClientEfl.h" +#include "WKString.h" +#include "WebContext.h" +#include "WebPageGroup.h" +#include "WebPageProxy.h" +#include "WebPopupMenuProxyEfl.h" +#include "WebPreferences.h" +#include "ewk_back_forward_list_private.h" +#include "ewk_color_picker_private.h" +#include "ewk_context_private.h" +#include "ewk_favicon_database_private.h" +#include "ewk_popup_menu_item_private.h" +#include "ewk_popup_menu_private.h" +#include "ewk_private.h" +#include "ewk_settings_private.h" +#include "ewk_view.h" +#include "ewk_view_private.h" +#include <Ecore_Evas.h> +#include <Ecore_X.h> +#include <Edje.h> +#include <WebCore/Cursor.h> + + +#if ENABLE(FULLSCREEN_API) +#include "WebFullScreenManagerProxy.h" +#endif + +#if USE(ACCELERATED_COMPOSITING) +#include <Evas_GL.h> +#endif + +using namespace EwkViewCallbacks; +using namespace WebCore; +using namespace WebKit; + +static const int defaultCursorSize = 16; + +typedef HashMap<WKPageRef, Evas_Object*> PageViewMap; + +static inline PageViewMap& pageViewMap() +{ + DEFINE_STATIC_LOCAL(PageViewMap, map, ()); + return map; +} + +void EwkViewImpl::addToPageViewMap(EwkViewImpl* viewImpl) +{ + PageViewMap::AddResult result = pageViewMap().add(viewImpl->wkPage(), viewImpl->view()); + ASSERT_UNUSED(result, result.isNewEntry); +} + +void EwkViewImpl::removeFromPageViewMap(EwkViewImpl* viewImpl) +{ + ASSERT(pageViewMap().contains(viewImpl->wkPage())); + pageViewMap().remove(viewImpl->wkPage()); +} + +const Evas_Object* EwkViewImpl::viewFromPageViewMap(const WKPageRef page) +{ + ASSERT(page); + + return pageViewMap().get(page); +} + +EwkViewImpl::EwkViewImpl(Evas_Object* view, PassRefPtr<EwkContext> context, PassRefPtr<WebPageGroup> pageGroup, ViewBehavior behavior) + : m_view(view) + , m_context(context) + , m_pageClient(behavior == DefaultBehavior ? PageClientDefaultImpl::create(this) : PageClientLegacyImpl::create(this)) + , m_pageProxy(toImpl(m_context->wkContext())->createWebPage(m_pageClient.get(), pageGroup.get())) + , m_pageLoadClient(PageLoadClientEfl::create(this)) + , m_pagePolicyClient(PagePolicyClientEfl::create(this)) + , m_pageUIClient(PageUIClientEfl::create(this)) + , m_resourceLoadClient(ResourceLoadClientEfl::create(this)) + , m_findClient(FindClientEfl::create(this)) + , m_formClient(FormClientEfl::create(this)) + , m_backForwardList(Ewk_Back_Forward_List::create(toAPI(m_pageProxy->backForwardList()))) +#if USE(TILED_BACKING_STORE) + , m_scaleFactor(1) +#endif + , m_settings(Ewk_Settings::create(this)) + , m_cursorGroup(0) + , m_mouseEventsEnabled(false) +#if ENABLE(TOUCH_EVENTS) + , m_touchEventsEnabled(false) +#endif + , m_displayTimer(this, &EwkViewImpl::displayTimerFired) + , m_inputMethodContext(InputMethodContextEfl::create(this, smartData()->base.evas)) +{ + ASSERT(m_view); + ASSERT(m_context); + ASSERT(m_pageProxy); + +#if USE(COORDINATED_GRAPHICS) + m_pageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(true); + m_pageProxy->pageGroup()->preferences()->setForceCompositingMode(true); +#if ENABLE(WEBGL) + m_pageProxy->pageGroup()->preferences()->setWebGLEnabled(true); +#endif + if (behavior == DefaultBehavior) + m_pageProxy->setUseFixedLayout(true); +#endif + + m_pageProxy->initializeWebPage(); + +#if ENABLE(FULLSCREEN_API) + m_pageProxy->fullScreenManager()->setWebView(m_view); + m_pageProxy->pageGroup()->preferences()->setFullScreenEnabled(true); +#endif + + // Enable mouse events by default + setMouseEventsEnabled(true); + + // Listen for favicon changes. + Ewk_Favicon_Database* iconDatabase = m_context->faviconDatabase(); + ASSERT(iconDatabase); + + iconDatabase->watchChanges(IconChangeCallbackData(EwkViewImpl::onFaviconChanged, this)); + + EwkViewImpl::addToPageViewMap(this); +} + +EwkViewImpl::~EwkViewImpl() +{ + m_pageProxy->close(); + + // Unregister icon change callback. + Ewk_Favicon_Database* iconDatabase = m_context->faviconDatabase(); + ASSERT(iconDatabase); + + iconDatabase->unwatchChanges(EwkViewImpl::onFaviconChanged); + + EwkViewImpl::removeFromPageViewMap(this); +} + +Ewk_View_Smart_Data* EwkViewImpl::smartData() const +{ + return static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(m_view)); +} + +EwkViewImpl* EwkViewImpl::fromEvasObject(const Evas_Object* view) +{ + ASSERT(view); + Ewk_View_Smart_Data* sd = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(view)); + ASSERT(sd); + ASSERT(sd->priv); + return sd->priv; +} + +/** + * @internal + * Retrieves the internal WKPage for this view. + */ +WKPageRef EwkViewImpl::wkPage() +{ + return toAPI(m_pageProxy.get()); +} + +void EwkViewImpl::setCursor(const Cursor& cursor) +{ + const char* group = cursor.platformCursor(); + if (!group || group == m_cursorGroup) + return; + + m_cursorGroup = group; + Ewk_View_Smart_Data* sd = smartData(); + RefPtr<Evas_Object> cursorObject = adoptRef(edje_object_add(sd->base.evas)); + + Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(sd->base.evas); + if (!m_theme || !edje_object_file_set(cursorObject.get(), m_theme, group)) { + ecore_evas_object_cursor_set(ecoreEvas, 0, 0, 0, 0); +#ifdef HAVE_ECORE_X + if (WebCore::isUsingEcoreX(sd->base.evas)) + WebCore::applyFallbackCursor(ecoreEvas, group); +#endif + return; + } + + // Set cursor size. + Evas_Coord width, height; + edje_object_size_min_get(cursorObject.get(), &width, &height); + if (width <= 0 || height <= 0) + edje_object_size_min_calc(cursorObject.get(), &width, &height); + if (width <= 0 || height <= 0) { + width = defaultCursorSize; + height = defaultCursorSize; + } + evas_object_resize(cursorObject.get(), width, height); + + // Get cursor hot spot. + const char* data; + int hotspotX = 0; + data = edje_object_data_get(cursorObject.get(), "hot.x"); + if (data) + hotspotX = atoi(data); + + int hotspotY = 0; + data = edje_object_data_get(cursorObject.get(), "hot.y"); + if (data) + hotspotY = atoi(data); + + // ecore_evas takes care of freeing the cursor object. + ecore_evas_object_cursor_set(ecoreEvas, cursorObject.release().leakRef(), EVAS_LAYER_MAX, hotspotX, hotspotY); +} + +AffineTransform EwkViewImpl::transformFromScene() const +{ + AffineTransform transform; + +#if USE(TILED_BACKING_STORE) + transform.translate(m_scrollPosition.x(), m_scrollPosition.y()); + transform.scale(1 / m_scaleFactor); +#endif + + Ewk_View_Smart_Data* sd = smartData(); + transform.translate(-sd->view.x, -sd->view.y); + + return transform; +} + +AffineTransform EwkViewImpl::transformToScene() const +{ + return transformFromScene().inverse(); +} + +AffineTransform EwkViewImpl::transformToScreen() const +{ + AffineTransform transform; + + int windowGlobalX = 0; + int windowGlobalY = 0; + + Ewk_View_Smart_Data* sd = smartData(); + +#ifdef HAVE_ECORE_X + Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(sd->base.evas); + Ecore_X_Window window = ecore_evas_software_x11_window_get(ecoreEvas); // Returns 0 if none. + + int x, y; // x, y are relative to parent (in a reparenting window manager). + while (window) { + ecore_x_window_geometry_get(window, &x, &y, 0, 0); + windowGlobalX += x; + windowGlobalY += y; + window = ecore_x_window_parent_get(window); + } +#endif + + transform.translate(-sd->view.x, -sd->view.y); + transform.translate(windowGlobalX, windowGlobalY); + + return transform; +} + +void EwkViewImpl::displayTimerFired(Timer<EwkViewImpl>*) +{ +#if USE(COORDINATED_GRAPHICS) + Ewk_View_Smart_Data* sd = smartData(); + + evas_gl_make_current(evasGL(), evasGLSurface(), evasGLContext()); + + // We are supposed to clip to the actual viewport, nothing less. + IntRect viewport(sd->view.x, sd->view.y, sd->view.w, sd->view.h); + + LayerTreeRenderer* renderer = page()->drawingArea()->layerTreeCoordinatorProxy()->layerTreeRenderer(); + renderer->setActive(true); + renderer->syncRemoteContent(); + + renderer->paintToCurrentGLContext(transformToScene().toTransformationMatrix(), /* opacity */ 1, viewport); + + evas_object_image_data_update_add(sd->image, viewport.x(), viewport.y(), viewport.width(), viewport.height()); +#endif +} + +void EwkViewImpl::update(const IntRect& rect) +{ +#if USE(COORDINATED_GRAPHICS) + // Coordinated graphices needs to schedule an full update, not + // repainting of a region. Update in the event loop. + UNUSED_PARAM(rect); + if (!m_displayTimer.isActive()) + m_displayTimer.startOneShot(0); +#else + Ewk_View_Smart_Data* sd = smartData(); + if (!sd->image) + return; + + evas_object_image_data_update_add(sd->image, rect.x(), rect.y(), rect.width(), rect.height()); +#endif +} + +#if ENABLE(FULLSCREEN_API) +/** + * @internal + * Calls fullscreen_enter callback or falls back to default behavior and enables fullscreen mode. + */ +void EwkViewImpl::enterFullScreen() +{ + Ewk_View_Smart_Data* sd = smartData(); + + if (!sd->api->fullscreen_enter || !sd->api->fullscreen_enter(sd)) { + Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(sd->base.evas); + ecore_evas_fullscreen_set(ecoreEvas, true); + } +} + +/** + * @internal + * Calls fullscreen_exit callback or falls back to default behavior and disables fullscreen mode. + */ +void EwkViewImpl::exitFullScreen() +{ + Ewk_View_Smart_Data* sd = smartData(); + + if (!sd->api->fullscreen_exit || !sd->api->fullscreen_exit(sd)) { + Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(sd->base.evas); + ecore_evas_fullscreen_set(ecoreEvas, false); + } +} +#endif + +void EwkViewImpl::setImageData(void* imageData, const IntSize& size) +{ + Ewk_View_Smart_Data* sd = smartData(); + if (!imageData || !sd->image) + return; + + evas_object_resize(sd->image, size.width(), size.height()); + evas_object_image_size_set(sd->image, size.width(), size.height()); + evas_object_image_data_copy_set(sd->image, imageData); +} + +#if USE(TILED_BACKING_STORE) +void EwkViewImpl::informLoadCommitted() +{ + m_pageClient->didCommitLoad(); +} +#endif + +IntSize EwkViewImpl::size() const +{ + int width, height; + evas_object_geometry_get(m_view, 0, 0, &width, &height); + return IntSize(width, height); +} + +bool EwkViewImpl::isFocused() const +{ + return evas_object_focus_get(m_view); +} + +bool EwkViewImpl::isVisible() const +{ + return evas_object_visible_get(m_view); +} + +const char* EwkViewImpl::title() const +{ + m_title = m_pageProxy->pageTitle().utf8().data(); + + return m_title; +} + +/** + * @internal + * This function may return @c NULL. + */ +InputMethodContextEfl* EwkViewImpl::inputMethodContext() +{ + return m_inputMethodContext.get(); +} + +const char* EwkViewImpl::themePath() const +{ + return m_theme; +} + +void EwkViewImpl::setThemePath(const char* theme) +{ + if (m_theme != theme) { + m_theme = theme; + m_pageProxy->setThemePath(theme); + } +} + +const char* EwkViewImpl::customTextEncodingName() const +{ + String customEncoding = m_pageProxy->customTextEncodingName(); + if (customEncoding.isEmpty()) + return 0; + + m_customEncoding = customEncoding.utf8().data(); + + return m_customEncoding; +} + +void EwkViewImpl::setCustomTextEncodingName(const String& encoding) +{ + m_pageProxy->setCustomTextEncodingName(encoding); +} + +void EwkViewImpl::setMouseEventsEnabled(bool enabled) +{ + if (m_mouseEventsEnabled == enabled) + return; + + m_mouseEventsEnabled = enabled; + if (enabled) { + Ewk_View_Smart_Data* sd = smartData(); + evas_object_event_callback_add(m_view, EVAS_CALLBACK_MOUSE_DOWN, onMouseDown, sd); + evas_object_event_callback_add(m_view, EVAS_CALLBACK_MOUSE_UP, onMouseUp, sd); + evas_object_event_callback_add(m_view, EVAS_CALLBACK_MOUSE_MOVE, onMouseMove, sd); + } else { + evas_object_event_callback_del(m_view, EVAS_CALLBACK_MOUSE_DOWN, onMouseDown); + evas_object_event_callback_del(m_view, EVAS_CALLBACK_MOUSE_UP, onMouseUp); + evas_object_event_callback_del(m_view, EVAS_CALLBACK_MOUSE_MOVE, onMouseMove); + } +} + +#if ENABLE(TOUCH_EVENTS) +void EwkViewImpl::setTouchEventsEnabled(bool enabled) +{ + if (m_touchEventsEnabled == enabled) + return; + + m_touchEventsEnabled = enabled; + + if (enabled) { + // FIXME: We have to connect touch callbacks with mouse and multi events + // because the Evas creates mouse events for first touch and multi events + // for second and third touches. Below codes should be fixed when the Evas + // supports the touch events. + // See https://bugs.webkit.org/show_bug.cgi?id=97785 for details. + Ewk_View_Smart_Data* sd = smartData(); + evas_object_event_callback_add(m_view, EVAS_CALLBACK_MOUSE_DOWN, onTouchDown, sd); + evas_object_event_callback_add(m_view, EVAS_CALLBACK_MOUSE_UP, onTouchUp, sd); + evas_object_event_callback_add(m_view, EVAS_CALLBACK_MOUSE_MOVE, onTouchMove, sd); + evas_object_event_callback_add(m_view, EVAS_CALLBACK_MULTI_DOWN, onTouchDown, sd); + evas_object_event_callback_add(m_view, EVAS_CALLBACK_MULTI_UP, onTouchUp, sd); + evas_object_event_callback_add(m_view, EVAS_CALLBACK_MULTI_MOVE, onTouchMove, sd); + } else { + evas_object_event_callback_del(m_view, EVAS_CALLBACK_MOUSE_DOWN, onTouchDown); + evas_object_event_callback_del(m_view, EVAS_CALLBACK_MOUSE_UP, onTouchUp); + evas_object_event_callback_del(m_view, EVAS_CALLBACK_MOUSE_MOVE, onTouchMove); + evas_object_event_callback_del(m_view, EVAS_CALLBACK_MULTI_DOWN, onTouchDown); + evas_object_event_callback_del(m_view, EVAS_CALLBACK_MULTI_UP, onTouchUp); + evas_object_event_callback_del(m_view, EVAS_CALLBACK_MULTI_MOVE, onTouchMove); + } +} +#endif + +/** + * @internal + * Update the view's favicon and emits a "icon,changed" signal if it has + * changed. + * + * This function is called whenever the URL has changed or when the icon for + * the current page URL has changed. + */ +void EwkViewImpl::informIconChange() +{ + Ewk_Favicon_Database* iconDatabase = m_context->faviconDatabase(); + ASSERT(iconDatabase); + + m_faviconURL = ewk_favicon_database_icon_url_get(iconDatabase, m_url); + smartCallback<IconChanged>().call(); +} + +#if USE(ACCELERATED_COMPOSITING) +bool EwkViewImpl::createGLSurface(const IntSize& viewSize) +{ + if (!m_evasGL) { + Evas* evas = evas_object_evas_get(m_view); + m_evasGL = adoptPtr(evas_gl_new(evas)); + if (!m_evasGL) + return false; + } + + if (!m_evasGLContext) { + m_evasGLContext = EvasGLContext::create(evasGL()); + if (!m_evasGLContext) { + WARN("Failed to create GLContext."); + return false; + } + } + + Ewk_View_Smart_Data* sd = smartData(); + + Evas_GL_Config evasGLConfig = { + EVAS_GL_RGBA_8888, + EVAS_GL_DEPTH_BIT_8, + EVAS_GL_STENCIL_NONE, + EVAS_GL_OPTIONS_NONE, + EVAS_GL_MULTISAMPLE_NONE + }; + + ASSERT(!m_evasGLSurface); + m_evasGLSurface = EvasGLSurface::create(evasGL(), &evasGLConfig, viewSize); + if (!m_evasGLSurface) + return false; + + Evas_Native_Surface nativeSurface; + evas_gl_native_surface_get(evasGL(), evasGLSurface(), &nativeSurface); + evas_object_image_native_surface_set(sd->image, &nativeSurface); + + evas_gl_make_current(evasGL(), evasGLSurface(), evasGLContext()); + + Evas_GL_API* gl = evas_gl_api_get(evasGL()); + gl->glViewport(0, 0, viewSize.width() + sd->view.x, viewSize.height() + sd->view.y); + + return true; +} + +bool EwkViewImpl::enterAcceleratedCompositingMode() +{ + if (!m_evasGLSurface) { + if (!createGLSurface(size())) { + WARN("Failed to create GLSurface."); + return false; + } + } + + page()->drawingArea()->layerTreeCoordinatorProxy()->layerTreeRenderer()->setActive(true); + return true; +} + +bool EwkViewImpl::exitAcceleratedCompositingMode() +{ + return true; +} +#endif + +#if ENABLE(INPUT_TYPE_COLOR) +/** + * @internal + * Requests to show external color picker. + */ +void EwkViewImpl::requestColorPicker(WKColorPickerResultListenerRef listener, const WebCore::Color& color) +{ + Ewk_View_Smart_Data* sd = smartData(); + EINA_SAFETY_ON_NULL_RETURN(sd->api->input_picker_color_request); + + if (!sd->api->input_picker_color_request) + return; + + if (m_colorPicker) + dismissColorPicker(); + + m_colorPicker = Ewk_Color_Picker::create(listener, color); + + sd->api->input_picker_color_request(sd, m_colorPicker.get()); +} + +/** + * @internal + * Requests to hide external color picker. + */ +void EwkViewImpl::dismissColorPicker() +{ + if (!m_colorPicker) + return; + + Ewk_View_Smart_Data* sd = smartData(); + EINA_SAFETY_ON_NULL_RETURN(sd->api->input_picker_color_dismiss); + + if (sd->api->input_picker_color_dismiss) + sd->api->input_picker_color_dismiss(sd); + + m_colorPicker.clear(); +} +#endif + +void EwkViewImpl::informContentsSizeChange(const IntSize& size) +{ +#if USE(COORDINATED_GRAPHICS) + m_pageClient->didChangeContentsSize(size); +#else + UNUSED_PARAM(size); +#endif +} + +COMPILE_ASSERT_MATCHING_ENUM(EWK_TEXT_DIRECTION_RIGHT_TO_LEFT, RTL); +COMPILE_ASSERT_MATCHING_ENUM(EWK_TEXT_DIRECTION_LEFT_TO_RIGHT, LTR); + +void EwkViewImpl::requestPopupMenu(WebPopupMenuProxyEfl* popupMenuProxy, const IntRect& rect, TextDirection textDirection, double pageScaleFactor, const Vector<WebPopupItem>& items, int32_t selectedIndex) +{ + Ewk_View_Smart_Data* sd = smartData(); + ASSERT(sd->api); + + ASSERT(popupMenuProxy); + + if (!sd->api->popup_menu_show) + return; + + if (m_popupMenu) + closePopupMenu(); + + m_popupMenu = Ewk_Popup_Menu::create(this, popupMenuProxy, items, selectedIndex); + + sd->api->popup_menu_show(sd, rect, static_cast<Ewk_Text_Direction>(textDirection), pageScaleFactor, m_popupMenu.get()); +} + +void EwkViewImpl::closePopupMenu() +{ + if (!m_popupMenu) + return; + + Ewk_View_Smart_Data* sd = smartData(); + ASSERT(sd->api); + + if (sd->api->popup_menu_hide) + sd->api->popup_menu_hide(sd); + + m_popupMenu.clear(); +} + +/** + * @internal + * Calls a smart member function for javascript alert(). + */ +void EwkViewImpl::requestJSAlertPopup(const WKEinaSharedString& message) +{ + Ewk_View_Smart_Data* sd = smartData(); + ASSERT(sd->api); + + if (!sd->api->run_javascript_alert) + return; + + sd->api->run_javascript_alert(sd, message); +} + +/** + * @internal + * Calls a smart member function for javascript confirm() and returns a value from the function. Returns false by default. + */ +bool EwkViewImpl::requestJSConfirmPopup(const WKEinaSharedString& message) +{ + Ewk_View_Smart_Data* sd = smartData(); + ASSERT(sd->api); + + if (!sd->api->run_javascript_confirm) + return false; + + return sd->api->run_javascript_confirm(sd, message); +} + +/** + * @internal + * Calls a smart member function for javascript prompt() and returns a value from the function. Returns null string by default. + */ +WKEinaSharedString EwkViewImpl::requestJSPromptPopup(const WKEinaSharedString& message, const WKEinaSharedString& defaultValue) +{ + Ewk_View_Smart_Data* sd = smartData(); + ASSERT(sd->api); + + if (!sd->api->run_javascript_prompt) + return WKEinaSharedString(); + + return WKEinaSharedString::adopt(sd->api->run_javascript_prompt(sd, message, defaultValue)); +} + +#if ENABLE(SQL_DATABASE) +/** + * @internal + * Calls exceeded_database_quota callback or falls back to default behavior returns default database quota. + */ +unsigned long long EwkViewImpl::informDatabaseQuotaReached(const String& databaseName, const String& displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage) +{ + Ewk_View_Smart_Data* sd = smartData(); + ASSERT(sd->api); + + static const unsigned long long defaultQuota = 5 * 1024 * 1204; // 5 MB + if (sd->api->exceeded_database_quota) + return sd->api->exceeded_database_quota(sd, databaseName.utf8().data(), displayName.utf8().data(), currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage); + + return defaultQuota; +} +#endif + +/** + * @internal + * The url of view was changed by the frame loader. + * + * Emits signal: "url,changed" with pointer to new url string. + */ +void EwkViewImpl::informURLChange() +{ + String activeURL = m_pageProxy->activeURL(); + if (activeURL.isEmpty()) + return; + + CString rawActiveURL = activeURL.utf8(); + if (m_url == rawActiveURL.data()) + return; + + m_url = rawActiveURL.data(); + smartCallback<URLChanged>().call(m_url); + + // Update the view's favicon. + informIconChange(); +} + +WKPageRef EwkViewImpl::createNewPage() +{ + Evas_Object* newEwkView = 0; + smartCallback<CreateWindow>().call(&newEwkView); + + if (!newEwkView) + return 0; + + EwkViewImpl* newViewImpl = EwkViewImpl::fromEvasObject(newEwkView); + ASSERT(newViewImpl); + + return static_cast<WKPageRef>(WKRetain(newViewImpl->page())); +} + +void EwkViewImpl::closePage() +{ + smartCallback<CloseWindow>().call(); +} + +void EwkViewImpl::onMouseDown(void* data, Evas*, Evas_Object*, void* eventInfo) +{ + Evas_Event_Mouse_Down* downEvent = static_cast<Evas_Event_Mouse_Down*>(eventInfo); + Ewk_View_Smart_Data* sd = static_cast<Ewk_View_Smart_Data*>(data); + EINA_SAFETY_ON_NULL_RETURN(sd->api); + EINA_SAFETY_ON_NULL_RETURN(sd->api->mouse_down); + sd->api->mouse_down(sd, downEvent); +} + +void EwkViewImpl::onMouseUp(void* data, Evas*, Evas_Object*, void* eventInfo) +{ + Evas_Event_Mouse_Up* upEvent = static_cast<Evas_Event_Mouse_Up*>(eventInfo); + Ewk_View_Smart_Data* sd = static_cast<Ewk_View_Smart_Data*>(data); + EINA_SAFETY_ON_NULL_RETURN(sd->api); + EINA_SAFETY_ON_NULL_RETURN(sd->api->mouse_up); + sd->api->mouse_up(sd, upEvent); +} + +void EwkViewImpl::onMouseMove(void* data, Evas*, Evas_Object*, void* eventInfo) +{ + Evas_Event_Mouse_Move* moveEvent = static_cast<Evas_Event_Mouse_Move*>(eventInfo); + Ewk_View_Smart_Data* sd = static_cast<Ewk_View_Smart_Data*>(data); + EINA_SAFETY_ON_NULL_RETURN(sd->api); + EINA_SAFETY_ON_NULL_RETURN(sd->api->mouse_move); + sd->api->mouse_move(sd, moveEvent); +} + +#if ENABLE(TOUCH_EVENTS) +void EwkViewImpl::feedTouchEvents(Ewk_Touch_Event_Type type) +{ + Ewk_View_Smart_Data* sd = smartData(); + + unsigned count = evas_touch_point_list_count(sd->base.evas); + if (!count) + return; + + Eina_List* points = 0; + for (unsigned i = 0; i < count; ++i) { + Ewk_Touch_Point* point = new Ewk_Touch_Point; + point->id = evas_touch_point_list_nth_id_get(sd->base.evas, i); + evas_touch_point_list_nth_xy_get(sd->base.evas, i, &point->x, &point->y); + point->state = evas_touch_point_list_nth_state_get(sd->base.evas, i); + points = eina_list_append(points, point); + } + + ewk_view_feed_touch_event(m_view, type, points, evas_key_modifier_get(sd->base.evas)); + + void* data; + EINA_LIST_FREE(points, data) + delete static_cast<Ewk_Touch_Point*>(data); +} + +void EwkViewImpl::onTouchDown(void* /* data */, Evas* /* canvas */, Evas_Object* ewkView, void* /* eventInfo */) +{ + EwkViewImpl* viewImpl = EwkViewImpl::fromEvasObject(ewkView); + viewImpl->feedTouchEvents(EWK_TOUCH_START); +} + +void EwkViewImpl::onTouchUp(void* /* data */, Evas* /* canvas */, Evas_Object* ewkView, void* /* eventInfo */) +{ + EwkViewImpl* viewImpl = EwkViewImpl::fromEvasObject(ewkView); + viewImpl->feedTouchEvents(EWK_TOUCH_END); +} + +void EwkViewImpl::onTouchMove(void* /* data */, Evas* /* canvas */, Evas_Object* ewkView, void* /* eventInfo */) +{ + EwkViewImpl* viewImpl = EwkViewImpl::fromEvasObject(ewkView); + viewImpl->feedTouchEvents(EWK_TOUCH_MOVE); +} +#endif + +void EwkViewImpl::onFaviconChanged(const char* pageURL, void* eventInfo) +{ + EwkViewImpl* viewImpl = static_cast<EwkViewImpl*>(eventInfo); + + if (!viewImpl->url() || strcasecmp(viewImpl->url(), pageURL)) + return; + + viewImpl->informIconChange(); +} diff --git a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h new file mode 100644 index 000000000..918fe22f9 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h @@ -0,0 +1,255 @@ +/* + Copyright (C) 2011 Samsung Electronics + Copyright (C) 2012 Intel Corporation. All rights reserved. + + 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 EwkViewImpl_h +#define EwkViewImpl_h + +#include "EwkViewCallbacks.h" +#include "RefPtrEfl.h" +#include "WKEinaSharedString.h" +#include "WKRetainPtr.h" +#include <Evas.h> +#include <WebCore/IntRect.h> +#include <WebCore/TextDirection.h> +#include <WebCore/Timer.h> +#include <WebKit2/WKBase.h> +#include <wtf/HashMap.h> +#include <wtf/OwnPtr.h> +#include <wtf/RefPtr.h> +#include <wtf/text/WTFString.h> + +#if ENABLE(TOUCH_EVENTS) +#include "ewk_touch.h" +#endif + +#if USE(ACCELERATED_COMPOSITING) +#include "EvasGLContext.h" +#include "EvasGLSurface.h" +#endif + +namespace WebKit { +class FindClientEfl; +class FormClientEfl; +class InputMethodContextEfl; +class PageClientBase; +class PageLoadClientEfl; +class PagePolicyClientEfl; +class PageUIClientEfl; +class ResourceLoadClientEfl; +class WebPageGroup; +class WebPageProxy; +class WebPopupItem; +class WebPopupMenuProxyEfl; +} + +namespace WebCore { +class AffineTransform; +class Color; +class Cursor; +class IntSize; +} + +class EwkContext; + +class Ewk_Back_Forward_List; +class Ewk_Color_Picker; +class Ewk_Error; +class Ewk_Form_Submission_Request; +class Ewk_Intent; +class Ewk_Intent_Service; +class Ewk_Resource; +class Ewk_Popup_Menu; +class Ewk_Settings; + +#if USE(ACCELERATED_COMPOSITING) +typedef struct _Evas_GL_Context Evas_GL_Context; +typedef struct _Evas_GL_Surface Evas_GL_Surface; +#endif + +typedef struct Ewk_View_Smart_Data Ewk_View_Smart_Data; + +class EwkViewImpl { +public: + + enum ViewBehavior { + LegacyBehavior, + DefaultBehavior + }; + EwkViewImpl(Evas_Object* view, PassRefPtr<EwkContext> context, PassRefPtr<WebKit::WebPageGroup> pageGroup, ViewBehavior); + ~EwkViewImpl(); + + static EwkViewImpl* fromEvasObject(const Evas_Object* view); + + Evas_Object* view() { return m_view; } + WKPageRef wkPage(); + WebKit::WebPageProxy* page() { return m_pageProxy.get(); } + EwkContext* ewkContext() { return m_context.get(); } + Ewk_Settings* settings() { return m_settings.get(); } + Ewk_Back_Forward_List* backForwardList() { return m_backForwardList.get(); } + + WebCore::IntSize size() const; + bool isFocused() const; + bool isVisible() const; + + WebCore::AffineTransform transformToScene() const; + WebCore::AffineTransform transformFromScene() const; + WebCore::AffineTransform transformToScreen() const; + + const char* url() const { return m_url; } + const char* faviconURL() const { return m_faviconURL; } + const char* title() const; + WebKit::InputMethodContextEfl* inputMethodContext(); + + const char* themePath() const; + void setThemePath(const char* theme); + const char* customTextEncodingName() const; + void setCustomTextEncodingName(const String& encoding); + + bool mouseEventsEnabled() const { return m_mouseEventsEnabled; } + void setMouseEventsEnabled(bool enabled); +#if ENABLE(TOUCH_EVENTS) + bool touchEventsEnabled() const { return m_touchEventsEnabled; } + void setTouchEventsEnabled(bool enabled); +#endif + + void setCursor(const WebCore::Cursor& cursor); + void setImageData(void* imageData, const WebCore::IntSize& size); + + void update(const WebCore::IntRect& rect = WebCore::IntRect()); + + static void addToPageViewMap(EwkViewImpl* viewImpl); + static void removeFromPageViewMap(EwkViewImpl* viewImpl); + static const Evas_Object* viewFromPageViewMap(const WKPageRef); + +#if ENABLE(FULLSCREEN_API) + void enterFullScreen(); + void exitFullScreen(); +#endif + +#if USE(ACCELERATED_COMPOSITING) + bool createGLSurface(const WebCore::IntSize& viewSize); + bool enterAcceleratedCompositingMode(); + bool exitAcceleratedCompositingMode(); +#endif + +#if ENABLE(INPUT_TYPE_COLOR) + void requestColorPicker(WKColorPickerResultListenerRef listener, const WebCore::Color&); + void dismissColorPicker(); +#endif + + WKPageRef createNewPage(); + void closePage(); + + void requestPopupMenu(WebKit::WebPopupMenuProxyEfl*, const WebCore::IntRect&, WebCore::TextDirection, double pageScaleFactor, const Vector<WebKit::WebPopupItem>& items, int32_t selectedIndex); + void closePopupMenu(); + + void updateTextInputState(); + + void requestJSAlertPopup(const WKEinaSharedString& message); + bool requestJSConfirmPopup(const WKEinaSharedString& message); + WKEinaSharedString requestJSPromptPopup(const WKEinaSharedString& message, const WKEinaSharedString& defaultValue); + + template<EwkViewCallbacks::CallbackType callbackType> + EwkViewCallbacks::CallBack<callbackType> smartCallback() const + { + return EwkViewCallbacks::CallBack<callbackType>(m_view); + } + +#if USE(TILED_BACKING_STORE) + void informLoadCommitted(); +#endif + void informContentsSizeChange(const WebCore::IntSize& size); + unsigned long long informDatabaseQuotaReached(const String& databaseName, const String& displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage); + +#if USE(TILED_BACKING_STORE) + WebKit::PageClientBase* pageClient() { return m_pageClient.get(); } + + void setScaleFactor(float scaleFactor) { m_scaleFactor = scaleFactor; } + float scaleFactor() const { return m_scaleFactor; } + + void setScrollPosition(WebCore::IntPoint position) { m_scrollPosition = position; } + const WebCore::IntPoint scrollPosition() const { return m_scrollPosition; } +#endif +#if USE(ACCELERATED_COMPOSITING) + Evas_GL* evasGL() { return m_evasGL.get(); } + Evas_GL_Context* evasGLContext() { return m_evasGLContext ? m_evasGLContext->context() : 0; } + Evas_GL_Surface* evasGLSurface() { return m_evasGLSurface ? m_evasGLSurface->surface() : 0; } + void clearEvasGLSurface() { m_evasGLSurface.clear(); } +#endif + + // FIXME: needs refactoring (split callback invoke) + void informURLChange(); + +private: + inline Ewk_View_Smart_Data* smartData() const; + void displayTimerFired(WebCore::Timer<EwkViewImpl>*); + + void informIconChange(); + + static void onMouseDown(void* data, Evas*, Evas_Object*, void* eventInfo); + static void onMouseUp(void* data, Evas*, Evas_Object*, void* eventInfo); + static void onMouseMove(void* data, Evas*, Evas_Object*, void* eventInfo); +#if ENABLE(TOUCH_EVENTS) + void feedTouchEvents(Ewk_Touch_Event_Type type); + static void onTouchDown(void* /* data */, Evas* /* canvas */, Evas_Object* ewkView, void* /* eventInfo */); + static void onTouchUp(void* /* data */, Evas* /* canvas */, Evas_Object* ewkView, void* /* eventInfo */); + static void onTouchMove(void* /* data */, Evas* /* canvas */, Evas_Object* ewkView, void* /* eventInfo */); +#endif + static void onFaviconChanged(const char* pageURL, void* eventInfo); + + // Note, initialization matters. + Evas_Object* m_view; + RefPtr<EwkContext> m_context; +#if USE(ACCELERATED_COMPOSITING) + OwnPtr<Evas_GL> m_evasGL; + OwnPtr<WebKit::EvasGLContext> m_evasGLContext; + OwnPtr<WebKit::EvasGLSurface> m_evasGLSurface; +#endif + OwnPtr<WebKit::PageClientBase> m_pageClient; + RefPtr<WebKit::WebPageProxy> m_pageProxy; + OwnPtr<WebKit::PageLoadClientEfl> m_pageLoadClient; + OwnPtr<WebKit::PagePolicyClientEfl> m_pagePolicyClient; + OwnPtr<WebKit::PageUIClientEfl> m_pageUIClient; + OwnPtr<WebKit::ResourceLoadClientEfl> m_resourceLoadClient; + OwnPtr<WebKit::FindClientEfl> m_findClient; + OwnPtr<WebKit::FormClientEfl> m_formClient; + OwnPtr<Ewk_Back_Forward_List> m_backForwardList; +#if USE(TILED_BACKING_STORE) + float m_scaleFactor; + WebCore::IntPoint m_scrollPosition; +#endif + OwnPtr<Ewk_Settings> m_settings; + const char* m_cursorGroup; // This is an address, do not free it or use WKEinaSharedString. + WKEinaSharedString m_faviconURL; + WKEinaSharedString m_url; + mutable WKEinaSharedString m_title; + WKEinaSharedString m_theme; + mutable WKEinaSharedString m_customEncoding; + bool m_mouseEventsEnabled; +#if ENABLE(TOUCH_EVENTS) + bool m_touchEventsEnabled; +#endif + WebCore::Timer<EwkViewImpl> m_displayTimer; + OwnPtr<Ewk_Popup_Menu> m_popupMenu; + OwnPtr<WebKit::InputMethodContextEfl> m_inputMethodContext; + OwnPtr<Ewk_Color_Picker> m_colorPicker; +}; + +#endif // EwkViewImpl_h diff --git a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp deleted file mode 100644 index 054bfcbf7..000000000 --- a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Copyright (C) 2011 Samsung Electronics - * - * 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 "PageClientImpl.h" - -#include "DrawingAreaProxyImpl.h" -#include "NativeWebKeyboardEvent.h" -#include "NotImplemented.h" -#include "WebContext.h" -#include "WebContextMenuProxy.h" -#include "WebPageGroup.h" -#include "WebPageProxy.h" -#include "WebPopupMenuProxyEfl.h" -#include "WebPreferences.h" -#include "ewk_context.h" -#include "ewk_context_private.h" -#include "ewk_download_job.h" -#include "ewk_download_job_private.h" -#include "ewk_view.h" -#include "ewk_view_private.h" - -using namespace WebCore; - -namespace WebKit { - -PageClientImpl::PageClientImpl(Evas_Object* viewWidget) - : m_viewWidget(viewWidget) -{ -} - -PageClientImpl::~PageClientImpl() -{ -} - -// PageClient -PassOwnPtr<DrawingAreaProxy> PageClientImpl::createDrawingAreaProxy() -{ - return DrawingAreaProxyImpl::create(ewk_view_page_get(m_viewWidget)); -} - -void PageClientImpl::setViewNeedsDisplay(const WebCore::IntRect& rect) -{ - ewk_view_display(m_viewWidget, rect); -} - -void PageClientImpl::displayView() -{ - notImplemented(); -} - -void PageClientImpl::scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize&) -{ - setViewNeedsDisplay(scrollRect); -} - -WebCore::IntSize PageClientImpl::viewSize() -{ - return ewk_view_size_get(m_viewWidget); -} - -bool PageClientImpl::isViewWindowActive() -{ - notImplemented(); - return true; -} - -bool PageClientImpl::isViewFocused() -{ - return evas_object_focus_get(m_viewWidget); -} - -bool PageClientImpl::isViewVisible() -{ - return evas_object_visible_get(m_viewWidget); -} - -bool PageClientImpl::isViewInWindow() -{ - notImplemented(); - return true; -} - -void PageClientImpl::processDidCrash() -{ - // Check if loading was ongoing, when web process crashed. - double loadProgress = ewk_view_load_progress_get(m_viewWidget); - if (loadProgress >= 0 && loadProgress < 1) - ewk_view_load_progress_changed(m_viewWidget, 1); - - ewk_view_webprocess_crashed(m_viewWidget); -} - -void PageClientImpl::didRelaunchProcess() -{ - notImplemented(); -} - -void PageClientImpl::pageClosed() -{ - notImplemented(); -} - -void PageClientImpl::toolTipChanged(const String&, const String& newToolTip) -{ - ewk_view_tooltip_text_set(m_viewWidget, newToolTip.utf8().data()); -} - -void PageClientImpl::setCursor(const Cursor& cursor) -{ - ewk_view_cursor_set(m_viewWidget, cursor); -} - -void PageClientImpl::setCursorHiddenUntilMouseMoves(bool) -{ - notImplemented(); -} - -void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportAttributes&) -{ - notImplemented(); -} - -void PageClientImpl::registerEditCommand(PassRefPtr<WebEditCommandProxy> command, WebPageProxy::UndoOrRedo undoOrRedo) -{ - m_undoController.registerEditCommand(command, undoOrRedo); -} - -void PageClientImpl::clearAllEditCommands() -{ - m_undoController.clearAllEditCommands(); -} - -bool PageClientImpl::canUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo) -{ - return m_undoController.canUndoRedo(undoOrRedo); -} - -void PageClientImpl::executeUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo) -{ - m_undoController.executeUndoRedo(undoOrRedo); -} - -FloatRect PageClientImpl::convertToDeviceSpace(const FloatRect& viewRect) -{ - notImplemented(); - return viewRect; -} - -FloatRect PageClientImpl::convertToUserSpace(const FloatRect& viewRect) -{ - notImplemented(); - return viewRect; -} - -IntPoint PageClientImpl::screenToWindow(const IntPoint& point) -{ - notImplemented(); - return point; -} - -IntRect PageClientImpl::windowToScreen(const IntRect&) -{ - notImplemented(); - return IntRect(); -} - -void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent&, bool) -{ - notImplemented(); -} - -#if ENABLE(TOUCH_EVENTS) -void PageClientImpl::doneWithTouchEvent(const NativeWebTouchEvent&, bool /*wasEventHandled*/) -{ - notImplemented(); -} -#endif - -PassRefPtr<WebPopupMenuProxy> PageClientImpl::createPopupMenuProxy(WebPageProxy* page) -{ - return WebPopupMenuProxyEfl::create(m_viewWidget, page); -} - -PassRefPtr<WebContextMenuProxy> PageClientImpl::createContextMenuProxy(WebPageProxy*) -{ - notImplemented(); - return 0; -} - -#if ENABLE(INPUT_TYPE_COLOR) -PassRefPtr<WebColorChooserProxy> PageClientImpl::createColorChooserProxy(WebPageProxy*, const WebCore::Color&, const WebCore::IntRect&) -{ - notImplemented(); - return 0; -} -#endif - -void PageClientImpl::setFindIndicator(PassRefPtr<FindIndicator>, bool, bool) -{ - notImplemented(); -} - -#if USE(ACCELERATED_COMPOSITING) -void PageClientImpl::enterAcceleratedCompositingMode(const LayerTreeContext&) -{ - ewk_view_accelerated_compositing_mode_enter(m_viewWidget); -} - -void PageClientImpl::exitAcceleratedCompositingMode() -{ - ewk_view_accelerated_compositing_mode_exit(m_viewWidget); -} - -void PageClientImpl::updateAcceleratedCompositingMode(const LayerTreeContext&) -{ - notImplemented(); -} -#endif // USE(ACCELERATED_COMPOSITING) - -void PageClientImpl::didChangeScrollbarsForMainFrame() const -{ - notImplemented(); -} - -void PageClientImpl::didCommitLoadForMainFrame(bool) -{ - notImplemented(); -} - -void PageClientImpl::didFinishLoadingDataForCustomRepresentation(const String&, const CoreIPC::DataReference&) -{ - notImplemented(); -} - -double PageClientImpl::customRepresentationZoomFactor() -{ - notImplemented(); - return 0; -} - -void PageClientImpl::setCustomRepresentationZoomFactor(double) -{ - notImplemented(); -} - -void PageClientImpl::flashBackingStoreUpdates(const Vector<IntRect>&) -{ - notImplemented(); -} - -void PageClientImpl::findStringInCustomRepresentation(const String&, FindOptions, unsigned) -{ - notImplemented(); -} - -void PageClientImpl::countStringMatchesInCustomRepresentation(const String&, FindOptions, unsigned) -{ - notImplemented(); -} - -void PageClientImpl::handleDownloadRequest(DownloadProxy* download) -{ - RefPtr<Ewk_Download_Job> ewkDownload = Ewk_Download_Job::create(download, m_viewWidget); - ewk_view_context_get(m_viewWidget)->addDownloadJob(ewkDownload.get()); -} - -#if USE(TILED_BACKING_STORE) -void PageClientImpl::pageDidRequestScroll(const IntPoint&) -{ - notImplemented(); -} -#endif - -void PageClientImpl::didChangeContentsSize(const WebCore::IntSize& size) -{ - ewk_view_contents_size_changed(m_viewWidget, size); -} - -} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/API/efl/WebKitTextChecker.cpp b/Source/WebKit2/UIProcess/API/efl/WebKitTextChecker.cpp deleted file mode 100644 index 2ff39c4df..000000000 --- a/Source/WebKit2/UIProcess/API/efl/WebKitTextChecker.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (C) 2012 Samsung Electronics - * - * 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR - * 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 "WebKitTextChecker.h" - -#if ENABLE(SPELLCHECK) - -#include "NotImplemented.h" -#include "WKAPICast.h" -#include "WKMutableArray.h" -#include "WKRetainPtr.h" -#include "WebPageProxy.h" -#include "WebString.h" -#include "ewk_settings.h" -#include "ewk_text_checker_private.h" -#include <Eina.h> -#include <wtf/OwnPtr.h> -#include <wtf/text/CString.h> - -namespace WebKit { - -static OwnPtr<WebCore::TextCheckerEnchant> textCheckerEnchant = WebCore::TextCheckerEnchant::create(); - -static Ewk_Text_Checker* ewkTextCheckerCallbacks = ewk_text_checker_callbacks_get(); - -bool isContinuousSpellCheckingEnabled(const void*) -{ - return ewk_settings_continuous_spell_checking_enabled_get(); -} - -void setContinuousSpellCheckingEnabled(bool enabled, const void*) -{ - ewk_settings_continuous_spell_checking_enabled_set(enabled); -} - -uint64_t uniqueSpellDocumentTag(WKPageRef page, const void*) -{ - if (ewkTextCheckerCallbacks->unique_spell_document_tag_get) - return ewkTextCheckerCallbacks->unique_spell_document_tag_get(toImpl(page)->viewWidget()); - - return 0; -} - -void closeSpellDocumentWithTag(uint64_t tag, const void*) -{ - if (ewkTextCheckerCallbacks->unique_spell_document_tag_close) - ewkTextCheckerCallbacks->unique_spell_document_tag_close(tag); -} - -void checkSpellingOfString(uint64_t tag, WKStringRef text, int32_t* misspellingLocation, int32_t* misspellingLength, const void*) -{ - if (ewkTextCheckerCallbacks->string_spelling_check) - ewkTextCheckerCallbacks->string_spelling_check(tag, toImpl(text)->string().utf8().data(), misspellingLocation, misspellingLength); - else - textCheckerEnchant->checkSpellingOfString(toImpl(text)->string(), *misspellingLocation, *misspellingLength); -} - -WKArrayRef guessesForWord(uint64_t tag, WKStringRef word, const void*) -{ - WKMutableArrayRef suggestionsForWord = WKMutableArrayCreate(); - - if (ewkTextCheckerCallbacks->word_guesses_get) { - Eina_List* list = ewkTextCheckerCallbacks->word_guesses_get(tag, toImpl(word)->string().utf8().data()); - void* item; - - EINA_LIST_FREE(list, item) { - WKRetainPtr<WKStringRef> suggestion(AdoptWK, WKStringCreateWithUTF8CString(static_cast<char*>(item))); - WKArrayAppendItem(suggestionsForWord, suggestion.get()); - free(item); - } - } else { - Vector<String> guesses = textCheckerEnchant->getGuessesForWord(toImpl(word)->string()); - size_t numberOfGuesses = guesses.size(); - for (size_t i = 0; i < numberOfGuesses; ++i) { - WKRetainPtr<WKStringRef> suggestion(AdoptWK, WKStringCreateWithUTF8CString(guesses[i].utf8().data())); - WKArrayAppendItem(suggestionsForWord, suggestion.get()); - } - } - - return suggestionsForWord; -} - -void learnWord(uint64_t tag, WKStringRef word, const void*) -{ - if (ewkTextCheckerCallbacks->word_learn) - ewkTextCheckerCallbacks->word_learn(tag, toImpl(word)->string().utf8().data()); - else - textCheckerEnchant->learnWord(toImpl(word)->string()); -} - -void ignoreWord(uint64_t tag, WKStringRef word, const void*) -{ - if (ewkTextCheckerCallbacks->word_ignore) - ewkTextCheckerCallbacks->word_ignore(tag, toImpl(word)->string().utf8().data()); - else - textCheckerEnchant->ignoreWord(toImpl(word)->string()); -} - -Vector<String> availableSpellCheckingLanguages() -{ - return textCheckerEnchant->availableSpellCheckingLanguages(); -} - -void updateSpellCheckingLanguages(const Vector<String>& languages) -{ - textCheckerEnchant->updateSpellCheckingLanguages(languages); -} - -Vector<String> loadedSpellCheckingLanguages() -{ - return textCheckerEnchant->loadedSpellCheckingLanguages(); -} - -} // namespace WebKit - -#endif // ENABLE(SPELLCHECK) diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_auth_request.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_auth_request.cpp new file mode 100644 index 000000000..20279e3a6 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_auth_request.cpp @@ -0,0 +1,171 @@ +/* + * 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_auth_request.h" + +#include "AuthenticationChallengeProxy.h" +#include "AuthenticationDecisionListener.h" +#include "WebCredential.h" +#include "WebProtectionSpace.h" +#include "WebString.h" +#include "ewk_auth_request_private.h" +#include <wtf/text/CString.h> + +using namespace WebKit; +using namespace WebCore; + +EwkAuthRequest::EwkAuthRequest(AuthenticationChallengeProxy* authenticationChallenge) + : m_authenticationChallenge(authenticationChallenge) + , m_wasHandled(false) +{ + ASSERT(m_authenticationChallenge); +} + +EwkAuthRequest::~EwkAuthRequest() +{ + if (!m_wasHandled) + continueWithoutCredential(); +} + +const char* EwkAuthRequest::suggestedUsername() const +{ + if (!m_suggestedUsername) { + WebCredential* credential = m_authenticationChallenge->proposedCredential(); + ASSERT(credential); + + const String& suggestedUsername = credential->user(); + if (suggestedUsername.isEmpty()) + return 0; + + m_suggestedUsername = suggestedUsername.utf8().data(); + } + + return m_suggestedUsername; +} + +const char* EwkAuthRequest::realm() const +{ + if (!m_realm) { + WebProtectionSpace* protectionSpace = m_authenticationChallenge->protectionSpace(); + ASSERT(protectionSpace); + + const String& realm = protectionSpace->realm(); + if (realm.isEmpty()) + return 0; + + m_realm = realm.utf8().data(); + } + + return m_realm; +} + +const char* EwkAuthRequest::host() const +{ + if (!m_host) { + WebProtectionSpace* protectionSpace = m_authenticationChallenge->protectionSpace(); + ASSERT(protectionSpace); + + const String& host = protectionSpace->host(); + if (host.isEmpty()) + return 0; + + m_host = host.utf8().data(); + } + + return m_host; +} + +bool EwkAuthRequest::continueWithoutCredential() +{ + if (m_wasHandled) + return false; + + m_wasHandled = true; + m_authenticationChallenge->useCredential(0); + + return true; +} + +bool EwkAuthRequest::authenticate(const String& username, const String& password) +{ + if (m_wasHandled) + return false; + + m_wasHandled = true; + RefPtr<WebCredential> credential = WebCredential::create(WebString::create(username).get(), WebString::create(password).get(), CredentialPersistenceForSession); + m_authenticationChallenge->useCredential(credential.get()); + + return true; +} + +bool EwkAuthRequest::isRetrying() const +{ + return m_authenticationChallenge->previousFailureCount() > 0; +} + +const char* ewk_auth_request_suggested_username_get(const Ewk_Auth_Request* request) +{ + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkAuthRequest, request, impl, 0); + + return impl->suggestedUsername(); +} + +Eina_Bool ewk_auth_request_cancel(Ewk_Auth_Request* request) +{ + EWK_OBJ_GET_IMPL_OR_RETURN(EwkAuthRequest, request, impl, false); + + return impl->continueWithoutCredential(); +} + +Eina_Bool ewk_auth_request_authenticate(Ewk_Auth_Request* request, const char* username, const char* password) +{ + EWK_OBJ_GET_IMPL_OR_RETURN(EwkAuthRequest, request, impl, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(username, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(password, false); + + return impl->authenticate(String::fromUTF8(username), String::fromUTF8(password)); +} + +Eina_Bool ewk_auth_request_retrying_get(const Ewk_Auth_Request* request) +{ + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkAuthRequest, request, impl, false); + + return impl->isRetrying(); +} + +const char* ewk_auth_request_realm_get(const Ewk_Auth_Request* request) +{ + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkAuthRequest, request, impl, 0); + + return impl->realm(); +} + +const char* ewk_auth_request_host_get(const Ewk_Auth_Request* request) +{ + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkAuthRequest, request, impl, 0); + + return impl->host(); +} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_auth_request.h b/Source/WebKit2/UIProcess/API/efl/ewk_auth_request.h new file mode 100644 index 000000000..78abb2b38 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_auth_request.h @@ -0,0 +1,118 @@ +/* + * 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_auth_request.h + * @brief Describes the Ewk Authentication Request API. + */ + +#ifndef ewk_auth_request_h +#define ewk_auth_request_h + +#include <Eina.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Declare Ewk_Auth_Request as Ewk_Object. + * + * @see Ewk_Object + */ +typedef struct Ewk_Object Ewk_Auth_Request; + +/** + * Queries the suggested username to be used for authenticating. + * + * @param request request object to query + * + * @return the username pointer, that may be @c NULL. This pointer is + * guaranteed to be eina_stringshare, so whenever possible + * save yourself some cpu cycles and use + * eina_stringshare_ref() instead of eina_stringshare_add() or + * strdup() + */ +EAPI const char *ewk_auth_request_suggested_username_get(const Ewk_Auth_Request *request); + +/** + * Queries if this an authentication attempt retrying. + * + * @param request request object to query + * + * @return @c EINA_TRUE if this is not the first authentication attempt + * and we are trying, @c EINA_FALSE otherwise. + */ +EAPI Eina_Bool ewk_auth_request_retrying_get(const Ewk_Auth_Request *request); + +/** + * Queries the authentication realm. + * + * @param request request object to query + * + * @return the realm pointer, that may be @c NULL. This pointer is + * guaranteed to be eina_stringshare, so whenever possible + * save yourself some cpu cycles and use + * eina_stringshare_ref() instead of eina_stringshare_add() or + * strdup() + */ +EAPI const char *ewk_auth_request_realm_get(const Ewk_Auth_Request *request); + +/** + * Queries the host requiring the authentication. + * + * @param request request object to query + * + * @return the host pointer, that may be @c NULL. This pointer is + * guaranteed to be eina_stringshare, so whenever possible + * save yourself some cpu cycles and use + * eina_stringshare_ref() instead of eina_stringshare_add() or + * strdup() + */ +EAPI const char *ewk_auth_request_host_get(const Ewk_Auth_Request *request); + +/** + * Cancels the authentication request. + * + * @param request request object to cancel + * + * @return @c EINA_TRUE if successful, @c EINA_FALSE otherwise + */ +EAPI Eina_Bool ewk_auth_request_cancel(Ewk_Auth_Request *request); + +/** + * Set credential for the authentication request. + * + * @param request request object to update + * + * @return @c EINA_TRUE if the credential was successfuly sent, @c EINA_FALSE otherwise. + */ +EAPI Eina_Bool ewk_auth_request_authenticate(Ewk_Auth_Request *request, const char *username, const char *password); + +#ifdef __cplusplus +} +#endif + +#endif /* ewk_auth_request_h */ diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_auth_request_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_auth_request_private.h new file mode 100644 index 000000000..ad1277cd0 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_auth_request_private.h @@ -0,0 +1,67 @@ +/* + * 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_auth_request_private_h +#define ewk_auth_request_private_h + +#include "WKEinaSharedString.h" +#include "ewk_object_private.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/text/WTFString.h> + +namespace WebKit { +class AuthenticationChallengeProxy; +} + +class EwkAuthRequest : public Ewk_Object { +public: + EWK_OBJECT_DECLARE(EwkAuthRequest) + + static PassRefPtr<EwkAuthRequest> create(WebKit::AuthenticationChallengeProxy* authenticationChallenge) + { + return adoptRef(new EwkAuthRequest(authenticationChallenge)); + } + ~EwkAuthRequest(); + + const char* suggestedUsername() const; + const char* realm() const; + const char* host() const; + bool isRetrying() const; + + bool continueWithoutCredential(); + bool authenticate(const String& username, const String& password); + +private: + explicit EwkAuthRequest(WebKit::AuthenticationChallengeProxy* authenticationChallenge); + + RefPtr<WebKit::AuthenticationChallengeProxy> m_authenticationChallenge; + bool m_wasHandled; + mutable WKEinaSharedString m_suggestedUsername; + mutable WKEinaSharedString m_realm; + mutable WKEinaSharedString m_host; +}; + +#endif // ewk_auth_request_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.cpp index 12dbb8f4b..dd3ae623b 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.cpp @@ -30,6 +30,7 @@ #include "WKArray.h" #include "WKBackForwardList.h" #include "ewk_back_forward_list_private.h" +#include "ewk_object.h" #include <wtf/text/CString.h> using namespace WebKit; @@ -90,7 +91,7 @@ Ewk_Back_Forward_List_Item* Ewk_Back_Forward_List::getFromCacheOrCreate(WKBackFo RefPtr<Ewk_Back_Forward_List_Item> item = m_wrapperCache.get(wkItem); if (!item) { - item = Ewk_Back_Forward_List_Item::create(wkItem); + item = EwkBackForwardListItem::create(wkItem); m_wrapperCache.set(wkItem, item); } @@ -108,7 +109,7 @@ Eina_List* Ewk_Back_Forward_List::createEinaList(WKArrayRef wkList) const for (size_t i = 0; i < count; ++i) { WKBackForwardListItemRef wkItem = static_cast<WKBackForwardListItemRef>(WKArrayGetItemAtIndex(wkList, i)); Ewk_Back_Forward_List_Item* item = getFromCacheOrCreate(wkItem); - result = eina_list_append(result, ewk_back_forward_list_item_ref(item)); + result = eina_list_append(result, ewk_object_ref(item)); } return result; diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.h b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.h index 09dbc5ab6..9a791ba2d 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.h @@ -96,7 +96,7 @@ EAPI unsigned ewk_back_forward_list_count(Ewk_Back_Forward_List *list); * @param limit the number of items to retrieve * * @return @c Eina_List containing @c Ewk_Back_Forward_List_Item elements or @c NULL in case of error, - * the Eina_List and its items should be freed after use. Use ewk_back_forward_list_item_unref() + * the Eina_List and its items should be freed after use. Use ewk_object_unref() * to free the items */ EAPI Eina_List *ewk_back_forward_list_n_back_items_copy(const Ewk_Back_Forward_List *list, int limit); @@ -111,7 +111,7 @@ EAPI Eina_List *ewk_back_forward_list_n_back_items_copy(const Ewk_Back_Forward_L * @param limit the number of items to retrieve * * @return @c Eina_List containing @c Ewk_Back_Forward_List_Item elements or @c NULL in case of error, - * the Eina_List and its items should be freed after use. Use ewk_back_forward_list_item_unref() + * the Eina_List and its items should be freed after use. Use ewk_object_unref() * to free the items */ EAPI Eina_List *ewk_back_forward_list_n_forward_items_copy(const Ewk_Back_Forward_List *list, int limit); @@ -124,7 +124,7 @@ EAPI Eina_List *ewk_back_forward_list_n_forward_items_copy(const Ewk_Back_Forwar * @param list the back-forward list instance * * @return @c Eina_List containing @c Ewk_Back_Forward_List_Item elements or @c NULL in case of error, - * the Eina_List and its items should be freed after use. Use ewk_back_forward_list_item_unref() + * the Eina_List and its items should be freed after use. Use ewk_object_unref() * to free the items * * @see ewk_back_forward_list_n_back_items_copy @@ -140,7 +140,7 @@ EAPI Eina_List *ewk_back_forward_list_n_forward_items_copy(const Ewk_Back_Forwar * @param list the back-forward list instance * * @return @c Eina_List containing @c Ewk_Back_Forward_List_Item elements or @c NULL in case of error, - * the Eina_List and its items should be freed after use. Use ewk_back_forward_list_item_unref() + * the Eina_List and its items should be freed after use. Use ewk_object_unref() * to free the items * * @see ewk_back_forward_list_n_forward_items_copy diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp index 5ec236033..43f29c96c 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp @@ -32,63 +32,48 @@ using namespace WebKit; -Ewk_Back_Forward_List_Item::Ewk_Back_Forward_List_Item(WKBackForwardListItemRef itemRef) +EwkBackForwardListItem::EwkBackForwardListItem(WKBackForwardListItemRef itemRef) : m_wkItem(itemRef) { } -const char* Ewk_Back_Forward_List_Item::url() const +const char* EwkBackForwardListItem::url() const { m_url = WKEinaSharedString(AdoptWK, WKBackForwardListItemCopyURL(m_wkItem.get())); return m_url; } -const char* Ewk_Back_Forward_List_Item::title() const +const char* EwkBackForwardListItem::title() const { m_title = WKEinaSharedString(AdoptWK, WKBackForwardListItemCopyTitle(m_wkItem.get())); return m_title; } -const char* Ewk_Back_Forward_List_Item::originalURL() const +const char* EwkBackForwardListItem::originalURL() const { m_originalURL = WKEinaSharedString(AdoptWK, WKBackForwardListItemCopyOriginalURL(m_wkItem.get())); return m_originalURL; } -Ewk_Back_Forward_List_Item* ewk_back_forward_list_item_ref(Ewk_Back_Forward_List_Item* item) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(item, 0); - item->ref(); - - return item; -} - -void ewk_back_forward_list_item_unref(Ewk_Back_Forward_List_Item* item) -{ - EINA_SAFETY_ON_NULL_RETURN(item); - - item->deref(); -} - const char* ewk_back_forward_list_item_url_get(const Ewk_Back_Forward_List_Item* item) { - EINA_SAFETY_ON_NULL_RETURN_VAL(item, 0); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkBackForwardListItem, item, impl, 0); - return item->url(); + return impl->url(); } const char* ewk_back_forward_list_item_title_get(const Ewk_Back_Forward_List_Item* item) { - EINA_SAFETY_ON_NULL_RETURN_VAL(item, 0); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkBackForwardListItem, item, impl, 0); - return item->title(); + return impl->title(); } const char* ewk_back_forward_list_item_original_url_get(const Ewk_Back_Forward_List_Item* item) { - EINA_SAFETY_ON_NULL_RETURN_VAL(item, 0); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkBackForwardListItem, item, impl, 0); - return item->originalURL(); + return impl->originalURL(); } diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.h b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.h index 8d0724d4a..18bc61146 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.h @@ -37,26 +37,12 @@ extern "C" { #endif -/** Creates a type name for Ewk_Back_Forward_List_Item */ -typedef struct Ewk_Back_Forward_List_Item Ewk_Back_Forward_List_Item; - /** - * Increases the reference count of the given object. - * - * @param item the back-forward list item instance to increase the reference count - * - * @return a pointer to the object on success, @c NULL otherwise. - */ -EAPI Ewk_Back_Forward_List_Item *ewk_back_forward_list_item_ref(Ewk_Back_Forward_List_Item *item); - -/** - * Decreases the reference count of the given object, possibly freeing it. - * - * When the reference count reaches 0, the item is freed. + * Declare Ewk_Back_Forward_List_Item as Ewk_Object. * - * @param item the back-forward list item instance to decrease the reference count + * @see Ewk_Object */ -EAPI void ewk_back_forward_list_item_unref(Ewk_Back_Forward_List_Item *item); +typedef struct Ewk_Object Ewk_Back_Forward_List_Item; /** * Returns URL of the item. diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item_private.h index 50718bc26..87525169b 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item_private.h @@ -27,19 +27,21 @@ #define ewk_back_forward_list_item_private_h #include "WKEinaSharedString.h" +#include "ewk_object_private.h" #include <WebKit2/WKBase.h> #include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> /** * \struct Ewk_Back_Forward_List * @brief Contains the Back Forward List data. */ -class Ewk_Back_Forward_List_Item : public RefCounted<Ewk_Back_Forward_List_Item> { +class EwkBackForwardListItem : public Ewk_Object { public: - static PassRefPtr<Ewk_Back_Forward_List_Item> create(WKBackForwardListItemRef itemRef) + EWK_OBJECT_DECLARE(EwkBackForwardListItem) + + static PassRefPtr<EwkBackForwardListItem> create(WKBackForwardListItemRef itemRef) { - return adoptRef(new Ewk_Back_Forward_List_Item(itemRef)); + return adoptRef(new EwkBackForwardListItem(itemRef)); } const char* url() const; @@ -47,7 +49,7 @@ public: const char* originalURL() const; private: - explicit Ewk_Back_Forward_List_Item(WKBackForwardListItemRef itemRef); + explicit EwkBackForwardListItem(WKBackForwardListItemRef itemRef); WKRetainPtr<WKBackForwardListItemRef> m_wkItem; mutable WKEinaSharedString m_url; diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_private.h index 7aad46700..fd0db1247 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_private.h @@ -27,6 +27,7 @@ #define ewk_back_forward_list_private_h #include "WKRetainPtr.h" +#include "ewk_back_forward_list_item.h" #include "ewk_back_forward_list_item_private.h" #include <WebKit2/WKBase.h> #include <wtf/HashMap.h> diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_color_picker.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_color_picker.cpp new file mode 100644 index 000000000..24bd0ed60 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_color_picker.cpp @@ -0,0 +1,84 @@ +/* + Copyright (C) 2011 Samsung Electronics + Copyright (C) 2012 Intel Corporation. All rights reserved. + + 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 "ewk_color_picker.h" + +#include "WKColorPickerResultListener.h" +#include "WKString.h" +#include "ewk_color_picker_private.h" +#include <WebCore/Color.h> +#include <wtf/text/CString.h> +#include <wtf/text/WTFString.h> + +using namespace WebCore; + +#if ENABLE(INPUT_TYPE_COLOR) +Ewk_Color_Picker::Ewk_Color_Picker(WKColorPickerResultListenerRef colorPickerListener, const Color& initialColor) + : m_colorPickerListener(colorPickerListener) + , m_color(initialColor) +{ +} + +void Ewk_Color_Picker::setColor(const Color& color) +{ + WKRetainPtr<WKStringRef> colorString(AdoptWK, WKStringCreateWithUTF8CString(color.serialized().utf8().data())); + WKColorPickerResultListenerSetColor(m_colorPickerListener.get(), colorString.get()); +} + +const Color& Ewk_Color_Picker::color() const +{ + return m_color; +} +#endif + +Eina_Bool ewk_color_picker_color_set(Ewk_Color_Picker* colorPicker, int r, int g, int b, int a) +{ +#if ENABLE(INPUT_TYPE_COLOR) + EINA_SAFETY_ON_NULL_RETURN_VAL(colorPicker, false); + + colorPicker->setColor(Color(r, g, b, a)); + + return true; +#else + return false; +#endif +} + +Eina_Bool ewk_color_picker_color_get(const Ewk_Color_Picker* colorPicker, int* r, int* g, int* b, int* a) +{ +#if ENABLE(INPUT_TYPE_COLOR) + EINA_SAFETY_ON_NULL_RETURN_VAL(colorPicker, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(r, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(g, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(b, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(a, false); + + const Color& color = colorPicker->color(); + *r = color.red(); + *g = color.green(); + *b = color.blue(); + *a = color.alpha(); + + return true; +#else + return false; +#endif +} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_color_picker.h b/Source/WebKit2/UIProcess/API/efl/ewk_color_picker.h new file mode 100644 index 000000000..e13c37e3e --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_color_picker.h @@ -0,0 +1,67 @@ +/* + Copyright (C) 2011 Samsung Electronics + Copyright (C) 2012 Intel Corporation. All rights reserved. + + 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 ewk_color_picker_h +#define ewk_color_picker_h + +#include <Evas.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** Creates a type name for @a Ewk_Color_Picker. */ +typedef struct Ewk_Color_Picker Ewk_Color_Picker; + +/** + * Sets the selected color. + * + * The function should only be called when a color has been requested by the document. + * If called when this is not the case or when the input picker has been dismissed, this + * function will fail and return EINA_FALSE. + * + * @param color_picker color picker object + * @param r red channel value to be set + * @param g green channel value to be set + * @param b blue channel value to be set + * @param a alpha channel value to be set + * + * @return @c EINA_TRUE on success @c EINA_FALSE otherwise + */ +EAPI Eina_Bool ewk_color_picker_color_set(Ewk_Color_Picker *color_picker, int r, int g, int b, int a); + +/** + * Gets the currently selected color. + * + * @param color_picker color picker object + * @param r red channel value to be get + * @param g green channel value to be get + * @param b blue channel value to be get + * @param a alpha channel value to be get + * + * @return @c EINA_TRUE on success @c EINA_FALSE otherwise + */ +EAPI Eina_Bool ewk_color_picker_color_get(const Ewk_Color_Picker *color_picker, int *r, int *g, int *b, int *a); + +#ifdef __cplusplus +} +#endif + +#endif /* ewk_color_picker_h */ diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_color_picker_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_color_picker_private.h new file mode 100644 index 000000000..273140bd4 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_color_picker_private.h @@ -0,0 +1,49 @@ +/* + Copyright (C) 2011 Samsung Electronics + Copyright (C) 2012 Intel Corporation. All rights reserved. + + 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 ewk_color_picker_private_h +#define ewk_color_picker_private_h + +#if ENABLE(INPUT_TYPE_COLOR) + +#include "WKRetainPtr.h" +#include <WebCore/Color.h> +#include <wtf/PassOwnPtr.h> + +class Ewk_Color_Picker { +public: + static PassOwnPtr<Ewk_Color_Picker> create(WKColorPickerResultListenerRef colorPickerListener, const WebCore::Color& initialColor) + { + return adoptPtr(new Ewk_Color_Picker(colorPickerListener, initialColor)); + } + + const WebCore::Color& color() const; + void setColor(const WebCore::Color&); + +private: + Ewk_Color_Picker(WKColorPickerResultListenerRef colorPickerListener, const WebCore::Color& initialColor); + + WKRetainPtr<WKColorPickerResultListenerRef> m_colorPickerListener; + WebCore::Color m_color; +}; + +#endif // ENABLE(INPUT_TYPE_COLOR) + +#endif // ewk_color_picker_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp index 32991c5c8..2dbf37857 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp @@ -22,7 +22,9 @@ #include "ewk_context.h" #include "BatteryProvider.h" +#include "ContextHistoryClientEfl.h" #include "NetworkInfoProvider.h" +#include "RequestManagerClientEfl.h" #include "VibrationProvider.h" #include "WKAPICast.h" #include "WKContextSoup.h" @@ -32,15 +34,12 @@ #include "WebContext.h" #include "WebIconDatabase.h" #include "WebSoupRequestManagerProxy.h" -#include "ewk_context_download_client_private.h" -#include "ewk_context_history_client_private.h" #include "ewk_context_private.h" -#include "ewk_context_request_manager_client_private.h" #include "ewk_cookie_manager_private.h" -#include "ewk_download_job.h" -#include "ewk_download_job_private.h" +#include "ewk_database_manager_private.h" #include "ewk_favicon_database_private.h" #include "ewk_private.h" +#include "ewk_storage_manager_private.h" #include "ewk_url_scheme_request_private.h" #include <WebCore/FileSystem.h> #include <WebCore/IconDatabase.h> @@ -55,22 +54,7 @@ using namespace WebCore; using namespace WebKit; -struct Ewk_Url_Scheme_Handler { - Ewk_Url_Scheme_Request_Cb callback; - void* userData; - - Ewk_Url_Scheme_Handler() - : callback(0) - , userData(0) - { } - - Ewk_Url_Scheme_Handler(Ewk_Url_Scheme_Request_Cb callback, void* userData) - : callback(callback) - , userData(userData) - { } -}; - -typedef HashMap<WKContextRef, Ewk_Context*> ContextMap; +typedef HashMap<WKContextRef, EwkContext*> ContextMap; static inline ContextMap& contextMap() { @@ -78,25 +62,25 @@ static inline ContextMap& contextMap() return map; } -Ewk_Context::Ewk_Context(WKContextRef context) +EwkContext::EwkContext(WKContextRef context) : m_context(context) - , m_requestManager(WKContextGetSoupRequestManager(context)) - , m_historyClient() -{ - ContextMap::AddResult result = contextMap().add(context, this); - ASSERT_UNUSED(result, result.isNewEntry); - + , m_databaseManager(Ewk_Database_Manager::create(WKContextGetDatabaseManager(m_context.get()))) + , m_storageManager(Ewk_Storage_Manager::create(WKContextGetKeyValueStorageManager(m_context.get()))) #if ENABLE(BATTERY_STATUS) - m_batteryProvider = BatteryProvider::create(context); + , m_batteryProvider(BatteryProvider::create(context)) #endif - #if ENABLE(NETWORK_INFO) - m_networkInfoProvider = NetworkInfoProvider::create(context); + , m_networkInfoProvider(NetworkInfoProvider::create(context)) #endif - #if ENABLE(VIBRATION) - m_vibrationProvider = VibrationProvider::create(context); + , m_vibrationProvider(VibrationProvider::create(context)) #endif + , m_downloadManager(DownloadManagerEfl::create(this)) + , m_requestManagerClient(RequestManagerClientEfl::create(this)) + , m_historyClient(ContextHistoryClientEfl::create(context)) +{ + ContextMap::AddResult result = contextMap().add(context, this); + ASSERT_UNUSED(result, result.isNewEntry); #if ENABLE(MEMORY_SAMPLER) static bool initializeMemorySampler = false; @@ -110,38 +94,34 @@ Ewk_Context::Ewk_Context(WKContextRef context) #endif #if ENABLE(SPELLCHECK) - ewk_text_checker_client_attach(); + Ewk_Text_Checker::initialize(); if (ewk_settings_continuous_spell_checking_enabled_get()) { // Load the default language. ewk_settings_spell_checking_languages_set(0); } #endif - - ewk_context_request_manager_client_attach(this); - ewk_context_download_client_attach(this); - ewk_context_history_client_attach(this); } -Ewk_Context::~Ewk_Context() +EwkContext::~EwkContext() { ASSERT(contextMap().get(m_context.get()) == this); contextMap().remove(m_context.get()); } -PassRefPtr<Ewk_Context> Ewk_Context::create(WKContextRef context) +PassRefPtr<EwkContext> EwkContext::create(WKContextRef context) { if (contextMap().contains(context)) return contextMap().get(context); // Will be ref-ed automatically. - return adoptRef(new Ewk_Context(context)); + return adoptRef(new EwkContext(context)); } -PassRefPtr<Ewk_Context> Ewk_Context::create() +PassRefPtr<EwkContext> EwkContext::create() { return create(adoptWK(WKContextCreate()).get()); } -PassRefPtr<Ewk_Context> Ewk_Context::create(const String& injectedBundlePath) +PassRefPtr<EwkContext> EwkContext::create(const String& injectedBundlePath) { if (!fileExists(injectedBundlePath)) return 0; @@ -152,14 +132,14 @@ PassRefPtr<Ewk_Context> Ewk_Context::create(const String& injectedBundlePath) return create(contextWK.get()); } -PassRefPtr<Ewk_Context> Ewk_Context::defaultContext() +PassRefPtr<EwkContext> EwkContext::defaultContext() { - static RefPtr<Ewk_Context> defaultInstance = create(adoptWK(WKContextCreate()).get()); + static RefPtr<EwkContext> defaultInstance = create(adoptWK(WKContextCreate()).get()); return defaultInstance; } -Ewk_Cookie_Manager* Ewk_Context::cookieManager() +Ewk_Cookie_Manager* EwkContext::cookieManager() { if (!m_cookieManager) m_cookieManager = Ewk_Cookie_Manager::create(WKContextGetCookieManager(m_context.get())); @@ -167,206 +147,177 @@ Ewk_Cookie_Manager* Ewk_Context::cookieManager() return m_cookieManager.get(); } -Ewk_Favicon_Database* Ewk_Context::faviconDatabase() +Ewk_Database_Manager* EwkContext::databaseManager() { - if (!m_faviconDatabase) { - WKRetainPtr<WKIconDatabaseRef> iconDatabase = WKContextGetIconDatabase(m_context.get()); - // Set the database path if it is not open yet. - if (!toImpl(iconDatabase.get())->isOpen()) { - WebContext* webContext = toImpl(m_context.get()); - String databasePath = webContext->iconDatabasePath() + "/" + WebCore::IconDatabase::defaultDatabaseFilename(); - webContext->setIconDatabasePath(databasePath); - } - m_faviconDatabase = Ewk_Favicon_Database::create(iconDatabase.get()); - } + return m_databaseManager.get(); +} - return m_faviconDatabase.get(); +void EwkContext::ensureFaviconDatabase() +{ + if (m_faviconDatabase) + return; + + m_faviconDatabase = Ewk_Favicon_Database::create(toImpl(m_context.get())->iconDatabase()); } -bool Ewk_Context::registerURLScheme(const String& scheme, Ewk_Url_Scheme_Request_Cb callback, void* userData) +bool EwkContext::setFaviconDatabaseDirectoryPath(const String& databaseDirectory) { - EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false); + ensureFaviconDatabase(); + + WebContext* webContext = toImpl(m_context.get()); - m_urlSchemeHandlers.set(scheme, Ewk_Url_Scheme_Handler(callback, userData)); - toImpl(m_requestManager.get())->registerURIScheme(scheme); + // The database path is already open so its path was + // already set. + if (webContext->iconDatabase()->isOpen()) + return false; + + // If databaseDirectory is empty, we use the default database path for the platform. + String databasePath = databaseDirectory.isEmpty() ? webContext->iconDatabasePath() : pathByAppendingComponent(databaseDirectory, WebCore::IconDatabase::defaultDatabaseFilename()); + webContext->setIconDatabasePath(databasePath); return true; } +Ewk_Favicon_Database* EwkContext::faviconDatabase() +{ + ensureFaviconDatabase(); + ASSERT(m_faviconDatabase); + + return m_faviconDatabase.get(); +} + +Ewk_Storage_Manager* EwkContext::storageManager() const +{ + return m_storageManager.get(); +} + +RequestManagerClientEfl* EwkContext::requestManager() +{ + return m_requestManagerClient.get(); +} + #if ENABLE(VIBRATION) -PassRefPtr<VibrationProvider> Ewk_Context::vibrationProvider() +PassRefPtr<VibrationProvider> EwkContext::vibrationProvider() { return m_vibrationProvider; } #endif -void Ewk_Context::addVisitedLink(const String& visitedURL) +void EwkContext::addVisitedLink(const String& visitedURL) { toImpl(m_context.get())->addVisitedLink(visitedURL); } -void Ewk_Context::setCacheModel(Ewk_Cache_Model cacheModel) +void EwkContext::setCacheModel(Ewk_Cache_Model cacheModel) { WKContextSetCacheModel(m_context.get(), static_cast<Ewk_Cache_Model>(cacheModel)); } -Ewk_Cache_Model Ewk_Context::cacheModel() const +Ewk_Cache_Model EwkContext::cacheModel() const { return static_cast<Ewk_Cache_Model>(WKContextGetCacheModel(m_context.get())); } -Ewk_Context* ewk_context_ref(Ewk_Context* ewkContext) +Ewk_Cookie_Manager* ewk_context_cookie_manager_get(const Ewk_Context* ewkContext) { - EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, 0); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkContext, ewkContext, impl, 0); - ewkContext->ref(); - - return ewkContext; + return const_cast<EwkContext*>(impl)->cookieManager(); } -void ewk_context_unref(Ewk_Context* ewkContext) +Ewk_Database_Manager* ewk_context_database_manager_get(const Ewk_Context* ewkContext) { - EINA_SAFETY_ON_NULL_RETURN(ewkContext); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkContext, ewkContext, impl, 0); - ewkContext->deref(); + return const_cast<EwkContext*>(impl)->databaseManager(); } -Ewk_Cookie_Manager* ewk_context_cookie_manager_get(const Ewk_Context* ewkContext) +Eina_Bool ewk_context_favicon_database_directory_set(Ewk_Context* ewkContext, const char* directoryPath) { - EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, 0); + EWK_OBJ_GET_IMPL_OR_RETURN(EwkContext, ewkContext, impl, false); - return const_cast<Ewk_Context*>(ewkContext)->cookieManager(); + return impl->setFaviconDatabaseDirectoryPath(String::fromUTF8(directoryPath)); } Ewk_Favicon_Database* ewk_context_favicon_database_get(const Ewk_Context* ewkContext) { - EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, 0); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkContext, ewkContext, impl, 0); - return const_cast<Ewk_Context*>(ewkContext)->faviconDatabase(); + return const_cast<EwkContext*>(impl)->faviconDatabase(); } -WKContextRef Ewk_Context::wkContext() +Ewk_Storage_Manager* ewk_context_storage_manager_get(const Ewk_Context* ewkContext) { - return m_context.get(); -} - -/** - * @internal - * Registers that a new download has been requested. - */ -void Ewk_Context::addDownloadJob(Ewk_Download_Job* ewkDownload) -{ - EINA_SAFETY_ON_NULL_RETURN(ewkDownload); - - uint64_t downloadId = ewkDownload->id(); - if (m_downloadJobs.contains(downloadId)) - return; - - m_downloadJobs.add(downloadId, ewkDownload); -} + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkContext, ewkContext, impl, 0); -/** - * @internal - * Returns the #Ewk_Download_Job with the given @a downloadId, or - * @c 0 in case of failure. - */ -Ewk_Download_Job* Ewk_Context::downloadJob(uint64_t downloadId) -{ - return m_downloadJobs.get(downloadId).get(); + return impl->storageManager(); } -/** - * @internal - * Removes the #Ewk_Download_Job with the given @a downloadId from the internal - * HashMap. - */ -void Ewk_Context::removeDownloadJob(uint64_t downloadId) +WKContextRef EwkContext::wkContext() { - m_downloadJobs.remove(downloadId); + return m_context.get(); } -/** - * Retrieve the request manager for @a ewkContext. - * - * @param ewkContext a #Ewk_Context object. - */ -WKSoupRequestManagerRef Ewk_Context::requestManager() +DownloadManagerEfl* EwkContext::downloadManager() const { - return m_requestManager.get(); + return m_downloadManager.get(); } -/** - * @internal - * A new URL request was received. - * - * @param ewkContext a #Ewk_Context object. - * @param schemeRequest a #Ewk_Url_Scheme_Request object. - */ -void Ewk_Context::urlSchemeRequestReceived(Ewk_Url_Scheme_Request* schemeRequest) +ContextHistoryClientEfl* EwkContext::historyClient() { - EINA_SAFETY_ON_NULL_RETURN(schemeRequest); - - Ewk_Url_Scheme_Handler handler = m_urlSchemeHandlers.get(schemeRequest->scheme()); - if (!handler.callback) - return; - - handler.callback(schemeRequest, handler.userData); + return m_historyClient.get(); } Ewk_Context* ewk_context_default_get() { - return Ewk_Context::defaultContext().get(); + return EwkContext::defaultContext().get(); } Ewk_Context* ewk_context_new() { - return Ewk_Context::create().leakRef(); + return EwkContext::create().leakRef(); } Ewk_Context* ewk_context_new_with_injected_bundle_path(const char* path) { EINA_SAFETY_ON_NULL_RETURN_VAL(path, 0); - return Ewk_Context::create(String::fromUTF8(path)).leakRef(); + return EwkContext::create(String::fromUTF8(path)).leakRef(); } Eina_Bool ewk_context_url_scheme_register(Ewk_Context* ewkContext, const char* scheme, Ewk_Url_Scheme_Request_Cb callback, void* userData) { - EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false); + EWK_OBJ_GET_IMPL_OR_RETURN(EwkContext, ewkContext, impl, false); EINA_SAFETY_ON_NULL_RETURN_VAL(scheme, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false); - return ewkContext->registerURLScheme(String::fromUTF8(scheme), callback, userData); + impl->requestManager()->registerURLSchemeHandler(String::fromUTF8(scheme), callback, userData); + + return true; } void ewk_context_vibration_client_callbacks_set(Ewk_Context* ewkContext, Ewk_Vibration_Client_Vibrate_Cb vibrate, Ewk_Vibration_Client_Vibration_Cancel_Cb cancel, void* data) { - EINA_SAFETY_ON_NULL_RETURN(ewkContext); + EWK_OBJ_GET_IMPL_OR_RETURN(EwkContext, ewkContext, impl); #if ENABLE(VIBRATION) - ewkContext->vibrationProvider()->setVibrationClientCallbacks(vibrate, cancel, data); + impl->vibrationProvider()->setVibrationClientCallbacks(vibrate, cancel, data); #endif } void ewk_context_history_callbacks_set(Ewk_Context* ewkContext, Ewk_History_Navigation_Cb navigate, Ewk_History_Client_Redirection_Cb clientRedirect, Ewk_History_Server_Redirection_Cb serverRedirect, Ewk_History_Title_Update_Cb titleUpdate, Ewk_History_Populate_Visited_Links_Cb populateVisitedLinks, void* data) { - EINA_SAFETY_ON_NULL_RETURN(ewkContext); + EWK_OBJ_GET_IMPL_OR_RETURN(EwkContext, ewkContext, impl); - Ewk_Context_History_Client& historyClient = ewkContext->historyClient(); - historyClient.navigate_func = navigate; - historyClient.client_redirect_func = clientRedirect; - historyClient.server_redirect_func = serverRedirect; - historyClient.title_update_func = titleUpdate; - historyClient.populate_visited_links_func = populateVisitedLinks; - historyClient.user_data = data; + impl->historyClient()->setCallbacks(navigate, clientRedirect, serverRedirect, titleUpdate, populateVisitedLinks, data); } - void ewk_context_visited_link_add(Ewk_Context* ewkContext, const char* visitedURL) { - EINA_SAFETY_ON_NULL_RETURN(ewkContext); + EWK_OBJ_GET_IMPL_OR_RETURN(EwkContext, ewkContext, impl); EINA_SAFETY_ON_NULL_RETURN(visitedURL); - ewkContext->addVisitedLink(visitedURL); + impl->addVisitedLink(visitedURL); } // Ewk_Cache_Model enum validation @@ -376,17 +327,17 @@ COMPILE_ASSERT_MATCHING_ENUM(EWK_CACHE_MODEL_PRIMARY_WEBBROWSER, kWKCacheModelPr Eina_Bool ewk_context_cache_model_set(Ewk_Context* ewkContext, Ewk_Cache_Model cacheModel) { - EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false); + EWK_OBJ_GET_IMPL_OR_RETURN(EwkContext, ewkContext, impl, false); - ewkContext->setCacheModel(cacheModel); + impl->setCacheModel(cacheModel); return true; } Ewk_Cache_Model ewk_context_cache_model_get(const Ewk_Context* ewkContext) { - EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, EWK_CACHE_MODEL_DOCUMENT_VIEWER); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkContext, ewkContext, impl, EWK_CACHE_MODEL_DOCUMENT_VIEWER); - return ewkContext->cacheModel(); + return impl->cacheModel(); } diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context.h b/Source/WebKit2/UIProcess/API/efl/ewk_context.h index f6b8bb67d..4a8e95655 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_context.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_context.h @@ -38,8 +38,10 @@ #define ewk_context_h #include "ewk_cookie_manager.h" +#include "ewk_database_manager.h" #include "ewk_favicon_database.h" #include "ewk_navigation_data.h" +#include "ewk_storage_manager.h" #include "ewk_url_scheme_request.h" #include <Evas.h> @@ -47,8 +49,12 @@ extern "C" { #endif -/** Creates a type name for @a Ewk_Context. */ -typedef struct Ewk_Context Ewk_Context; +/** + * Declare Ewk_Context as Ewk_Object. + * + * @see Ewk_Object + */ +typedef struct Ewk_Object Ewk_Context; /** * \enum Ewk_Cache_Model @@ -120,24 +126,6 @@ typedef void (*Ewk_History_Title_Update_Cb)(const Evas_Object *view, const char typedef void (*Ewk_History_Populate_Visited_Links_Cb)(void *user_data); /** - * Increases the reference count of the given object. - * - * @param context context object to increase the reference count - * - * @return Ewk_Context object on success or @c NULL on failure - */ -EAPI Ewk_Context *ewk_context_ref(Ewk_Context *context); - -/** - * Decreases the reference count of the given object, possibly freeing it. - * - * When the reference count it's reached 0, the Ewk_Context is freed. - * - * @param context context object to decrease the reference count - */ -EAPI void ewk_context_unref(Ewk_Context *context); - -/** * Gets default Ewk_Context instance. * * The returned Ewk_Context object @b should not be unref'ed if application @@ -183,6 +171,34 @@ EAPI Ewk_Context *ewk_context_new_with_injected_bundle_path(const char *path); EAPI Ewk_Cookie_Manager *ewk_context_cookie_manager_get(const Ewk_Context *context); /** + * Gets the database manager instance for this @a context. + * + * @param context context object to query + * + * @return Ewk_Database_Manager object instance or @c NULL in case of failure + */ +EAPI Ewk_Database_Manager *ewk_context_database_manager_get(const Ewk_Context *context); + +/** + * Sets the favicon database directory for this @a context. + * + * Sets the directory path to be used to store the favicons database + * for @a context on disk. Passing @c NULL as @a directory_path will + * result in using the default directory for the platform. + * + * Calling this method also means enabling the favicons database for + * its use from the applications, it is therefore expected to be + * called only once. Further calls for the same instance of + * @a context will not have any effect. + * + * @param context context object to update + * @param directory_path database directory path to set + * + * @return @c EINA_TRUE if successful, @c EINA_FALSE otherwise + */ +EAPI Eina_Bool ewk_context_favicon_database_directory_set(Ewk_Context *context, const char *directory_path); + +/** * Gets the favicon database instance for this @a context. * * @param context context object to query. @@ -192,6 +208,15 @@ EAPI Ewk_Cookie_Manager *ewk_context_cookie_manager_get(const Ewk_Context *conte EAPI Ewk_Favicon_Database *ewk_context_favicon_database_get(const Ewk_Context *context); /** + * Gets the storage manager instance for this @a context. + * + * @param context context object to query. + * + * @return Ewk_Storage_Manager object instance or @c NULL in case of failure. + */ +EAPI Ewk_Storage_Manager *ewk_context_storage_manager_get(const Ewk_Context *context); + +/** * Register @a scheme in @a context. * * When an URL request with @a scheme is made in the #Ewk_Context, the callback diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_download_client.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_context_download_client.cpp deleted file mode 100644 index 2fa86e9a7..000000000 --- a/Source/WebKit2/UIProcess/API/efl/ewk_context_download_client.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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 "DownloadProxy.h" -#include "WKAPICast.h" -#include "WKContext.h" -#include "WKString.h" -#include "ewk_context_download_client_private.h" -#include "ewk_context_private.h" -#include "ewk_download_job.h" -#include "ewk_download_job_private.h" -#include "ewk_error_private.h" -#include "ewk_url_response.h" -#include "ewk_url_response_private.h" -#include "ewk_view_private.h" -#include <string.h> -#include <wtf/OwnPtr.h> -#include <wtf/text/CString.h> - -using namespace WebKit; - -static inline Ewk_Context* toEwkContext(const void* clientInfo) -{ - return static_cast<Ewk_Context*>(const_cast<void*>(clientInfo)); -} - -static WKStringRef decideDestinationWithSuggestedFilename(WKContextRef, WKDownloadRef wkDownload, WKStringRef filename, bool* /*allowOverwrite*/, const void* clientInfo) -{ - Ewk_Download_Job* download = toEwkContext(clientInfo)->downloadJob(toImpl(wkDownload)->downloadID()); - ASSERT(download); - - download->setSuggestedFileName(toImpl(filename)->string().utf8().data()); - - // We send the new download signal on the Ewk_View only once we have received the response - // and the suggested file name. - ewk_view_download_job_requested(download->view(), download); - - // DownloadSoup expects the destination to be a URL. - String destination = ASCIILiteral("file://") + String::fromUTF8(download->destination()); - - return WKStringCreateWithUTF8CString(destination.utf8().data()); -} - -static void didReceiveResponse(WKContextRef, WKDownloadRef wkDownload, WKURLResponseRef wkResponse, const void* clientInfo) -{ - Ewk_Download_Job* download = toEwkContext(clientInfo)->downloadJob(toImpl(wkDownload)->downloadID()); - ASSERT(download); - download->setResponse(Ewk_Url_Response::create(wkResponse)); -} - -static void didCreateDestination(WKContextRef, WKDownloadRef wkDownload, WKStringRef /*path*/, const void* clientInfo) -{ - Ewk_Download_Job* download = toEwkContext(clientInfo)->downloadJob(toImpl(wkDownload)->downloadID()); - ASSERT(download); - - download->setState(EWK_DOWNLOAD_JOB_STATE_DOWNLOADING); -} - -static void didReceiveData(WKContextRef, WKDownloadRef wkDownload, uint64_t length, const void* clientInfo) -{ - Ewk_Download_Job* download = toEwkContext(clientInfo)->downloadJob(toImpl(wkDownload)->downloadID()); - ASSERT(download); - download->incrementReceivedData(length); -} - -static void didFail(WKContextRef, WKDownloadRef wkDownload, WKErrorRef error, const void* clientInfo) -{ - uint64_t downloadId = toImpl(wkDownload)->downloadID(); - Ewk_Download_Job* download = toEwkContext(clientInfo)->downloadJob(downloadId); - ASSERT(download); - - OwnPtr<Ewk_Error> ewkError = Ewk_Error::create(error); - download->setState(EWK_DOWNLOAD_JOB_STATE_FAILED); - ewk_view_download_job_failed(download->view(), download, ewkError.get()); - toEwkContext(clientInfo)->removeDownloadJob(downloadId); -} - -static void didCancel(WKContextRef, WKDownloadRef wkDownload, const void* clientInfo) -{ - uint64_t downloadId = toImpl(wkDownload)->downloadID(); - Ewk_Download_Job* download = toEwkContext(clientInfo)->downloadJob(downloadId); - ASSERT(download); - - download->setState(EWK_DOWNLOAD_JOB_STATE_CANCELLED); - ewk_view_download_job_cancelled(download->view(), download); - toEwkContext(clientInfo)->removeDownloadJob(downloadId); -} - -static void didFinish(WKContextRef, WKDownloadRef wkDownload, const void* clientInfo) -{ - uint64_t downloadId = toImpl(wkDownload)->downloadID(); - Ewk_Download_Job* download = toEwkContext(clientInfo)->downloadJob(downloadId); - ASSERT(download); - - download->setState(EWK_DOWNLOAD_JOB_STATE_FINISHED); - ewk_view_download_job_finished(download->view(), download); - toEwkContext(clientInfo)->removeDownloadJob(downloadId); -} - -void ewk_context_download_client_attach(Ewk_Context* ewkContext) -{ - WKContextDownloadClient wkDownloadClient; - memset(&wkDownloadClient, 0, sizeof(WKContextDownloadClient)); - - wkDownloadClient.version = kWKContextDownloadClientCurrentVersion; - wkDownloadClient.clientInfo = ewkContext; - wkDownloadClient.didCancel = didCancel; - wkDownloadClient.decideDestinationWithSuggestedFilename = decideDestinationWithSuggestedFilename; - wkDownloadClient.didCreateDestination = didCreateDestination; - wkDownloadClient.didReceiveResponse = didReceiveResponse; - wkDownloadClient.didReceiveData = didReceiveData; - wkDownloadClient.didFail = didFail; - wkDownloadClient.didFinish = didFinish; - - WKContextSetDownloadClient(ewkContext->wkContext(), &wkDownloadClient); -} - - diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_history_client.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_context_history_client.cpp deleted file mode 100644 index 4f793b9d0..000000000 --- a/Source/WebKit2/UIProcess/API/efl/ewk_context_history_client.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * 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_context.h" - -#include "DownloadProxy.h" -#include "WKAPICast.h" -#include "WKContext.h" -#include "WKEinaSharedString.h" -#include "WKString.h" -#include "ewk_context_history_client_private.h" -#include "ewk_context_private.h" -#include "ewk_navigation_data.h" -#include "ewk_navigation_data_private.h" -#include "ewk_url_response.h" -#include "ewk_url_response_private.h" -#include "ewk_view_private.h" - -using namespace WebKit; - -static inline const Ewk_Context_History_Client& getEwkHistoryClient(const void* clientInfo) -{ - ASSERT(clientInfo); - return static_cast<const Ewk_Context*>(clientInfo)->historyClient(); -} - -static void didNavigateWithNavigationData(WKContextRef, WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef, const void* clientInfo) -{ - const Ewk_Context_History_Client& historyClient = getEwkHistoryClient(clientInfo); - - if (!historyClient.navigate_func) - return; - - RefPtr<Ewk_Navigation_Data> navigationDataEwk = Ewk_Navigation_Data::create(navigationData); - historyClient.navigate_func(ewk_view_from_page_get(toImpl(page)), navigationDataEwk.get(), historyClient.user_data); -} - -static void didPerformClientRedirect(WKContextRef, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef, const void* clientInfo) -{ - const Ewk_Context_History_Client& historyClient = getEwkHistoryClient(clientInfo); - - if (!historyClient.client_redirect_func) - return; - - WKEinaSharedString sourceURLString(sourceURL); - WKEinaSharedString destinationURLString(destinationURL); - - historyClient.client_redirect_func(ewk_view_from_page_get(toImpl(page)), sourceURLString, destinationURLString, historyClient.user_data); -} - -static void didPerformServerRedirect(WKContextRef, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef, const void* clientInfo) -{ - const Ewk_Context_History_Client& historyClient = getEwkHistoryClient(clientInfo); - - if (!historyClient.server_redirect_func) - return; - - WKEinaSharedString sourceURLString(sourceURL); - WKEinaSharedString destinationURLString(destinationURL); - - historyClient.server_redirect_func(ewk_view_from_page_get(toImpl(page)), sourceURLString, destinationURLString, historyClient.user_data); -} - -static void didUpdateHistoryTitle(WKContextRef, WKPageRef page, WKStringRef title, WKURLRef URL, WKFrameRef, const void* clientInfo) -{ - const Ewk_Context_History_Client& historyClient = getEwkHistoryClient(clientInfo); - - if (!historyClient.title_update_func) - return; - - WKEinaSharedString titleString(title); - WKEinaSharedString stringURL(URL); - - historyClient.title_update_func(ewk_view_from_page_get(toImpl(page)), titleString, stringURL, historyClient.user_data); -} - -static void populateVisitedLinks(WKContextRef, const void* clientInfo) -{ - const Ewk_Context_History_Client& historyClient = getEwkHistoryClient(clientInfo); - - if (!historyClient.populate_visited_links_func) - return; - - historyClient.populate_visited_links_func(historyClient.user_data); -} - -void ewk_context_history_client_attach(Ewk_Context* ewkContext) -{ - WKContextHistoryClient wkHistoryClient; - memset(&wkHistoryClient, 0, sizeof(WKContextHistoryClient)); - - wkHistoryClient.version = kWKContextHistoryClientCurrentVersion; - wkHistoryClient.clientInfo = ewkContext; - - wkHistoryClient.didNavigateWithNavigationData = didNavigateWithNavigationData; - wkHistoryClient.didPerformClientRedirect = didPerformClientRedirect; - wkHistoryClient.didPerformServerRedirect = didPerformServerRedirect; - wkHistoryClient.didUpdateHistoryTitle = didUpdateHistoryTitle; - wkHistoryClient.populateVisitedLinks = populateVisitedLinks; - - WKContextSetHistoryClient(ewkContext->wkContext(), &wkHistoryClient); -} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h index 489f05189..4ddb65324 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h @@ -20,14 +20,18 @@ #ifndef ewk_context_private_h #define ewk_context_private_h +#include "DownloadManagerEfl.h" #include "WKAPICast.h" #include "WKRetainPtr.h" -#include "ewk_context_history_client_private.h" +#include "ewk_context.h" +#include "ewk_object_private.h" -class Ewk_Download_Job; -class Ewk_Url_Scheme_Request; class Ewk_Cookie_Manager; class Ewk_Favicon_Database; + +namespace WebKit { +class ContextHistoryClientEfl; +class RequestManagerClientEfl; #if ENABLE(BATTERY_STATUS) class BatteryProvider; #endif @@ -37,25 +41,33 @@ class NetworkInfoProvider; #if ENABLE(VIBRATION) class VibrationProvider; #endif +} -class Ewk_Context : public RefCounted<Ewk_Context> { +class EwkContext : public Ewk_Object { public: - static PassRefPtr<Ewk_Context> create(WKContextRef context); - static PassRefPtr<Ewk_Context> create(); - static PassRefPtr<Ewk_Context> create(const String& injectedBundlePath); + EWK_OBJECT_DECLARE(EwkContext) + + static PassRefPtr<EwkContext> create(WKContextRef context); + static PassRefPtr<EwkContext> create(); + static PassRefPtr<EwkContext> create(const String& injectedBundlePath); - static PassRefPtr<Ewk_Context> defaultContext(); + static PassRefPtr<EwkContext> defaultContext(); - ~Ewk_Context(); + ~EwkContext(); Ewk_Cookie_Manager* cookieManager(); + Ewk_Database_Manager* databaseManager(); + + bool setFaviconDatabaseDirectoryPath(const String& databaseDirectory); Ewk_Favicon_Database* faviconDatabase(); - bool registerURLScheme(const String& scheme, Ewk_Url_Scheme_Request_Cb callback, void* userData); + Ewk_Storage_Manager* storageManager() const; + + WebKit::RequestManagerClientEfl* requestManager(); #if ENABLE(VIBRATION) - PassRefPtr<VibrationProvider> vibrationProvider(); + PassRefPtr<WebKit::VibrationProvider> vibrationProvider(); #endif void addVisitedLink(const String& visitedURL); @@ -66,41 +78,34 @@ public: WKContextRef wkContext(); - WKSoupRequestManagerRef requestManager(); - - void urlSchemeRequestReceived(Ewk_Url_Scheme_Request*); + WebKit::DownloadManagerEfl* downloadManager() const; - void addDownloadJob(Ewk_Download_Job*); - Ewk_Download_Job* downloadJob(uint64_t downloadId); - void removeDownloadJob(uint64_t downloadId); - - const Ewk_Context_History_Client& historyClient() const { return m_historyClient; } - Ewk_Context_History_Client& historyClient() { return m_historyClient; } + WebKit::ContextHistoryClientEfl* historyClient(); private: - explicit Ewk_Context(WKContextRef); + explicit EwkContext(WKContextRef); + + void ensureFaviconDatabase(); WKRetainPtr<WKContextRef> m_context; OwnPtr<Ewk_Cookie_Manager> m_cookieManager; + OwnPtr<Ewk_Database_Manager> m_databaseManager; OwnPtr<Ewk_Favicon_Database> m_faviconDatabase; + OwnPtr<Ewk_Storage_Manager> m_storageManager; #if ENABLE(BATTERY_STATUS) - RefPtr<BatteryProvider> m_batteryProvider; + RefPtr<WebKit::BatteryProvider> m_batteryProvider; #endif #if ENABLE(NETWORK_INFO) - RefPtr<NetworkInfoProvider> m_networkInfoProvider; + RefPtr<WebKit::NetworkInfoProvider> m_networkInfoProvider; #endif #if ENABLE(VIBRATION) - RefPtr<VibrationProvider> m_vibrationProvider; + RefPtr<WebKit::VibrationProvider> m_vibrationProvider; #endif - HashMap<uint64_t, RefPtr<Ewk_Download_Job> > m_downloadJobs; - - WKRetainPtr<WKSoupRequestManagerRef> m_requestManager; - - typedef HashMap<String, class Ewk_Url_Scheme_Handler> URLSchemeHandlerMap; - URLSchemeHandlerMap m_urlSchemeHandlers; + OwnPtr<WebKit::DownloadManagerEfl> m_downloadManager; + OwnPtr<WebKit::RequestManagerClientEfl> m_requestManagerClient; - Ewk_Context_History_Client m_historyClient; + OwnPtr<WebKit::ContextHistoryClientEfl> m_historyClient; }; #endif // ewk_context_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_database_manager.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_database_manager.cpp new file mode 100644 index 000000000..ddc13b494 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_database_manager.cpp @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2012 Samsung Electronics. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR + * 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_database_manager.h" + +#include "WKAPICast.h" +#include "WKArray.h" +#include "WKDatabaseManager.h" +#include "ewk_database_manager_private.h" +#include "ewk_error_private.h" +#include "ewk_security_origin.h" +#include "ewk_security_origin_private.h" +#include <wtf/RefCounted.h> + +using namespace WebKit; + +Ewk_Database_Manager::Ewk_Database_Manager(WKDatabaseManagerRef databaseManagerRef) + : m_databaseManager(databaseManagerRef) +{ } + +void Ewk_Database_Manager::getDatabaseOrigins(WKDatabaseManagerGetDatabaseOriginsFunction callback, void* context) const +{ + WKDatabaseManagerGetDatabaseOrigins(m_databaseManager.get(), context, callback); +} + +Eina_List* Ewk_Database_Manager::createOriginList(WKArrayRef origins) const +{ + Eina_List* originList = 0; + const size_t length = WKArrayGetSize(origins); + + for (size_t i = 0; i < length; ++i) { + WKSecurityOriginRef wkOriginRef = static_cast<WKSecurityOriginRef>(WKArrayGetItemAtIndex(origins, i)); + RefPtr<Ewk_Security_Origin> origin = m_wrapperCache.get(wkOriginRef); + if (!origin) { + origin = Ewk_Security_Origin::create(wkOriginRef); + m_wrapperCache.set(wkOriginRef, origin); + } + originList = eina_list_append(originList, origin.release().leakRef()); + } + + return originList; +} + +struct Ewk_Database_Origins_Async_Get_Context { + const Ewk_Database_Manager* manager; + Ewk_Database_Origins_Get_Cb callback; + void* userData; + + Ewk_Database_Origins_Async_Get_Context(const Ewk_Database_Manager* manager, Ewk_Database_Origins_Get_Cb callback, void* userData) + : manager(manager) + , callback(callback) + , userData(userData) + { } +}; + +static void getDatabaseOriginsCallback(WKArrayRef origins, WKErrorRef wkError, void* context) +{ + OwnPtr<Ewk_Database_Origins_Async_Get_Context*> webDatabaseContext = adoptPtr(static_cast<Ewk_Database_Origins_Async_Get_Context*>(context)); + Eina_List* originList = webDatabaseContext->manager->createOriginList(origins); + OwnPtr<Ewk_Error> ewkError = Ewk_Error::create(wkError); + webDatabaseContext->callback(originList, ewkError.get(), webDatabaseContext->userData); +} + +Eina_Bool ewk_database_manager_origins_get(const Ewk_Database_Manager* ewkDatabaseManager, Ewk_Database_Origins_Get_Cb callback, void* userData) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(ewkDatabaseManager, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false); + + Ewk_Database_Origins_Async_Get_Context* context = new Ewk_Database_Origins_Async_Get_Context(ewkDatabaseManager, callback, userData); + ewkDatabaseManager->getDatabaseOrigins(getDatabaseOriginsCallback, context); + + return true; +} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_database_manager.h b/Source/WebKit2/UIProcess/API/efl/ewk_database_manager.h new file mode 100644 index 000000000..dc8236c5b --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_database_manager.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2012 Samsung Electronics. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR + * 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_database_manager.h + * @brief Describes the Ewk Database Manager API. + * + * Ewk Database Manager manages web database. + */ + +#ifndef ewk_database_manager_h +#define ewk_database_manager_h + +#include "ewk_error.h" +#include <Eina.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** Creates a type name for Ewk_Database_Manager. */ +typedef struct Ewk_Database_Manager Ewk_Database_Manager; + +/** + * @typedef Ewk_Database_Origins_Get_Cb Ewk_Database_Origins_Get_Cb + * @brief Callback type for use with ewk_database_manager_origins_get() + * + * @param origins @c Eina_List containing @c Ewk_Security_Origin elements or @c NULL in case of error, + * the Eina_List and its items should be freed after use. Use ewk_security_origin_unref() + * to free the items + */ +typedef void (*Ewk_Database_Origins_Get_Cb)(Eina_List *origins, Ewk_Error *error, void *user_data); + +/** + * Gets list of origins using web database asynchronously. + * + * This function allocates memory for context structure made from callback and user_data. + * + * @param manager Ewk_Database_Manager object + * @param callback callback to get database origins + * @param user_data user_data will be passed when result_callback is called, + * -i.e., user data will be kept until callback is called + * + * @return @c EINA_TRUE on success, @c EINA_FALSE on failure + */ +EAPI Eina_Bool ewk_database_manager_origins_get(const Ewk_Database_Manager *manager, Ewk_Database_Origins_Get_Cb callback, void *user_data); + +#ifdef __cplusplus +} +#endif +#endif // ewk_database_manager_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_database_manager_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_database_manager_private.h new file mode 100644 index 000000000..1b4a66164 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_database_manager_private.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2012 Samsung Electronics. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR + * 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_database_manager_private_h +#define ewk_database_manager_private_h + +#include "WKDatabaseManager.h" +#include "WKRetainPtr.h" +#include "ewk_security_origin_private.h" +#include <WebKit2/WKBase.h> +#include <wtf/PassOwnPtr.h> + +class Ewk_Database_Manager { +public: + static PassOwnPtr<Ewk_Database_Manager> create(WKDatabaseManagerRef databaseManagerRef) + { + return adoptPtr(new Ewk_Database_Manager(databaseManagerRef)); + } + + Eina_List* createOriginList(WKArrayRef wkList) const; + void getDatabaseOrigins(WKDatabaseManagerGetDatabaseOriginsFunction callback, void* context) const; + +private: + explicit Ewk_Database_Manager(WKDatabaseManagerRef); + + WKRetainPtr<WKDatabaseManagerRef> m_databaseManager; + mutable HashMap<WKSecurityOriginRef, RefPtr<Ewk_Security_Origin> > m_wrapperCache; +}; +#endif // ewk_database_manager_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_download_job.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_download_job.cpp index 7dc3a1784..3ad7d4dbc 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_download_job.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_download_job.cpp @@ -36,36 +36,20 @@ using namespace WebKit; -Ewk_Download_Job::Ewk_Download_Job(WebKit::DownloadProxy* download, Evas_Object* ewkView) +EwkDownloadJob::EwkDownloadJob(WebKit::DownloadProxy* download, EwkViewImpl* viewImpl) : m_downloadProxy(download) - , m_view(ewkView) + , m_viewImpl(viewImpl) , m_state(EWK_DOWNLOAD_JOB_STATE_NOT_STARTED) , m_startTime(-1) , m_endTime(-1) , m_downloaded(0) { } -Ewk_Download_Job* ewk_download_job_ref(Ewk_Download_Job* download) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(download, 0); - - download->ref(); - - return download; -} - -void ewk_download_job_unref(Ewk_Download_Job* download) -{ - EINA_SAFETY_ON_NULL_RETURN(download); - - download->deref(); -} - /** * @internal * Queries the identifier for this download */ -uint64_t Ewk_Download_Job::id() const +uint64_t EwkDownloadJob::id() const { return m_downloadProxy->downloadID(); } @@ -75,35 +59,35 @@ uint64_t Ewk_Download_Job::id() const * Returns the view this download is attached to. * The view is needed to send notification signals. */ -Evas_Object* Ewk_Download_Job::view() const +EwkViewImpl* EwkDownloadJob::viewImpl() const { - return m_view; + return m_viewImpl; } Ewk_Download_Job_State ewk_download_job_state_get(const Ewk_Download_Job* download) { - EINA_SAFETY_ON_NULL_RETURN_VAL(download, EWK_DOWNLOAD_JOB_STATE_UNKNOWN); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkDownloadJob, download, impl, EWK_DOWNLOAD_JOB_STATE_UNKNOWN); - return download->state(); + return impl->state(); } -Ewk_Download_Job_State Ewk_Download_Job::state() const +Ewk_Download_Job_State EwkDownloadJob::state() const { return m_state; } Ewk_Url_Request* ewk_download_job_request_get(const Ewk_Download_Job* download) { - EINA_SAFETY_ON_NULL_RETURN_VAL(download, 0); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkDownloadJob, download, impl, 0); - return download->request(); + return impl->request(); } -Ewk_Url_Request* Ewk_Download_Job::request() const +EwkUrlRequest* EwkDownloadJob::request() const { if (!m_request) { WKRetainPtr<WKURLRequestRef> wkURLRequest(AdoptWK, toAPI(WebURLRequest::create(m_downloadProxy->request()).leakRef())); - m_request = Ewk_Url_Request::create(wkURLRequest.get()); + m_request = EwkUrlRequest::create(wkURLRequest.get()); } return m_request.get(); @@ -111,63 +95,63 @@ Ewk_Url_Request* Ewk_Download_Job::request() const Ewk_Url_Response* ewk_download_job_response_get(const Ewk_Download_Job* download) { - EINA_SAFETY_ON_NULL_RETURN_VAL(download, 0); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkDownloadJob, download, impl, 0); - return download->response(); + return impl->response(); } -Ewk_Url_Response* Ewk_Download_Job::response() const +EwkUrlResponse* EwkDownloadJob::response() const { return m_response.get(); } const char* ewk_download_job_destination_get(const Ewk_Download_Job* download) { - EINA_SAFETY_ON_NULL_RETURN_VAL(download, 0); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkDownloadJob, download, impl, 0); - return download->destination(); + return impl->destination(); } -const char* Ewk_Download_Job::destination() const +const char* EwkDownloadJob::destination() const { return m_destination; } Eina_Bool ewk_download_job_destination_set(Ewk_Download_Job* download, const char* destination) { - EINA_SAFETY_ON_NULL_RETURN_VAL(download, false); + EWK_OBJ_GET_IMPL_OR_RETURN(EwkDownloadJob, download, impl, false); EINA_SAFETY_ON_NULL_RETURN_VAL(destination, false); - download->setDestination(destination); + impl->setDestination(destination); return true; } -void Ewk_Download_Job::setDestination(const char* destination) +void EwkDownloadJob::setDestination(const char* destination) { m_destination = destination; } const char* ewk_download_job_suggested_filename_get(const Ewk_Download_Job* download) { - EINA_SAFETY_ON_NULL_RETURN_VAL(download, 0); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkDownloadJob, download, impl, 0); - return download->suggestedFileName(); + return impl->suggestedFileName(); } -const char* Ewk_Download_Job::suggestedFileName() const +const char* EwkDownloadJob::suggestedFileName() const { return m_suggestedFilename; } Eina_Bool ewk_download_job_cancel(Ewk_Download_Job* download) { - EINA_SAFETY_ON_NULL_RETURN_VAL(download, false); + EWK_OBJ_GET_IMPL_OR_RETURN(EwkDownloadJob, download, impl, false); - return download->cancel(); + return impl->cancel(); } -bool Ewk_Download_Job::cancel() +bool EwkDownloadJob::cancel() { if (m_state != EWK_DOWNLOAD_JOB_STATE_DOWNLOADING) return false; @@ -179,12 +163,12 @@ bool Ewk_Download_Job::cancel() double ewk_download_job_estimated_progress_get(const Ewk_Download_Job* download) { - EINA_SAFETY_ON_NULL_RETURN_VAL(download, 0); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkDownloadJob, download, impl, 0); - return download->estimatedProgress(); + return impl->estimatedProgress(); } -double Ewk_Download_Job::estimatedProgress() const +double EwkDownloadJob::estimatedProgress() const { if (!m_response) return 0; @@ -198,12 +182,12 @@ double Ewk_Download_Job::estimatedProgress() const double ewk_download_job_elapsed_time_get(const Ewk_Download_Job* download) { - EINA_SAFETY_ON_NULL_RETURN_VAL(download, 0); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkDownloadJob, download, impl, 0); - return download->elapsedTime(); + return impl->elapsedTime(); } -double Ewk_Download_Job::elapsedTime() const +double EwkDownloadJob::elapsedTime() const { // Download has not started yet. if (m_startTime < 0) @@ -222,7 +206,7 @@ double Ewk_Download_Job::elapsedTime() const * @internal * Sets the URL @a response for this @a download. */ -void Ewk_Download_Job::setResponse(PassRefPtr<Ewk_Url_Response> response) +void EwkDownloadJob::setResponse(PassRefPtr<EwkUrlResponse> response) { ASSERT(response); @@ -233,7 +217,7 @@ void Ewk_Download_Job::setResponse(PassRefPtr<Ewk_Url_Response> response) * @internal * Sets the suggested file name for this @a download. */ -void Ewk_Download_Job::setSuggestedFileName(const char* suggestedFilename) +void EwkDownloadJob::setSuggestedFileName(const char* suggestedFilename) { m_suggestedFilename = suggestedFilename; } @@ -242,7 +226,7 @@ void Ewk_Download_Job::setSuggestedFileName(const char* suggestedFilename) * @internal * Report a given amount of data was received. */ -void Ewk_Download_Job::incrementReceivedData(uint64_t length) +void EwkDownloadJob::incrementReceivedData(uint64_t length) { m_downloaded += length; } @@ -251,7 +235,7 @@ void Ewk_Download_Job::incrementReceivedData(uint64_t length) * @internal * Sets the state of the download. */ -void Ewk_Download_Job::setState(Ewk_Download_Job_State state) +void EwkDownloadJob::setState(Ewk_Download_Job_State state) { m_state = state; diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_download_job.h b/Source/WebKit2/UIProcess/API/efl/ewk_download_job.h index 156f29a26..4784fc598 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_download_job.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_download_job.h @@ -43,8 +43,12 @@ extern "C" { #endif -/** Creates a type name for Ewk_Download_Job */ -typedef struct Ewk_Download_Job Ewk_Download_Job; +/** + * Declare Ewk_Download_Job as Ewk_Object. + * + * @see Ewk_Object + */ +typedef struct Ewk_Object Ewk_Download_Job; /// Defines the possible states of a download. enum Ewk_Download_Job_State { @@ -67,24 +71,6 @@ enum Ewk_Download_Job_State { typedef enum Ewk_Download_Job_State Ewk_Download_Job_State; /** - * Increases the reference count of the given object. - * - * @param download the download object to increase the reference count - * - * @return a pointer to the object on success, @c NULL otherwise. - */ -EAPI Ewk_Download_Job *ewk_download_job_ref(Ewk_Download_Job *download); - -/** - * Decreases the reference count of the given object, possibly freeing it. - * - * When the reference count reaches 0, the download is freed. - * - * @param download the download object to decrease the reference count - */ -EAPI void ewk_download_job_unref(Ewk_Download_Job *download); - -/** * Query the state for this download. * * @param download a #Ewk_Download_Job to query. diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_download_job_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_download_job_private.h index e2501d125..d903874e6 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_download_job_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_download_job_private.h @@ -28,6 +28,7 @@ #include "WKBase.h" #include "WKEinaSharedString.h" +#include "ewk_download_job.h" #include "ewk_url_request_private.h" #include "ewk_url_response_private.h" #include <Evas.h> @@ -37,22 +38,26 @@ namespace WebKit { class DownloadProxy; } -class Ewk_Download_Job : public RefCounted<Ewk_Download_Job> { +class EwkViewImpl; + +class EwkDownloadJob : public Ewk_Object { public: - static PassRefPtr<Ewk_Download_Job> create(WebKit::DownloadProxy* download, Evas_Object* ewkView) + EWK_OBJECT_DECLARE(EwkDownloadJob) + + static PassRefPtr<EwkDownloadJob> create(WebKit::DownloadProxy* download, EwkViewImpl* viewImpl) { - return adoptRef(new Ewk_Download_Job(download, ewkView)); + return adoptRef(new EwkDownloadJob(download, viewImpl)); } uint64_t id() const; - Evas_Object* view() const; + EwkViewImpl* viewImpl() const; Ewk_Download_Job_State state() const; void setState(Ewk_Download_Job_State); - Ewk_Url_Request* request() const; - Ewk_Url_Response* response() const; - void setResponse(PassRefPtr<Ewk_Url_Response>); + EwkUrlRequest* request() const; + EwkUrlResponse* response() const; + void setResponse(PassRefPtr<EwkUrlResponse>); const char* destination() const; void setDestination(const char* destination); @@ -67,13 +72,13 @@ public: void incrementReceivedData(uint64_t length); private: - Ewk_Download_Job(WebKit::DownloadProxy* download, Evas_Object* ewkView); + EwkDownloadJob(WebKit::DownloadProxy* download, EwkViewImpl* viewImpl); WebKit::DownloadProxy* m_downloadProxy; - Evas_Object* m_view; + EwkViewImpl* m_viewImpl; Ewk_Download_Job_State m_state; - mutable RefPtr<Ewk_Url_Request> m_request; - RefPtr<Ewk_Url_Response> m_response; + mutable RefPtr<EwkUrlRequest> m_request; + RefPtr<EwkUrlResponse> m_response; double m_startTime; double m_endTime; uint64_t m_downloaded; // length already downloaded diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database.cpp index 17c99c442..b22afc89d 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database.cpp @@ -27,6 +27,7 @@ #include "ewk_favicon_database.h" #include "WKAPICast.h" +#include "WKIconDatabase.h" #include "WKURL.h" #include "WebIconDatabase.h" #include "WebURL.h" @@ -38,8 +39,8 @@ using namespace WebKit; -Ewk_Favicon_Database::Ewk_Favicon_Database(WKIconDatabaseRef iconDatabaseRef) - : m_wkIconDatabase(iconDatabaseRef) +Ewk_Favicon_Database::Ewk_Favicon_Database(WebIconDatabase* iconDatabase) + : m_iconDatabase(iconDatabase) { WKIconDatabaseClient iconDatabaseClient; memset(&iconDatabaseClient, 0, sizeof(WKIconDatabaseClient)); @@ -47,13 +48,17 @@ Ewk_Favicon_Database::Ewk_Favicon_Database(WKIconDatabaseRef iconDatabaseRef) iconDatabaseClient.clientInfo = this; iconDatabaseClient.didChangeIconForPageURL = didChangeIconForPageURL; iconDatabaseClient.iconDataReadyForPageURL = iconDataReadyForPageURL; - WKIconDatabaseSetIconDatabaseClient(m_wkIconDatabase.get(), &iconDatabaseClient); + WKIconDatabaseSetIconDatabaseClient(toAPI(m_iconDatabase.get()), &iconDatabaseClient); +} + +Ewk_Favicon_Database::~Ewk_Favicon_Database() +{ } String Ewk_Favicon_Database::iconURLForPageURL(const String& pageURL) const { String iconURL; - toImpl(m_wkIconDatabase.get())->synchronousIconURLForPageURL(pageURL, iconURL); + m_iconDatabase->synchronousIconURLForPageURL(pageURL, iconURL); return iconURL; } @@ -99,8 +104,6 @@ static Eina_Bool respond_icon_request_idle(void* data) void Ewk_Favicon_Database::iconForPageURL(const String& pageURL, const IconRequestCallbackData& callbackData) { - WebIconDatabase* webIconDatabase = toImpl(m_wkIconDatabase.get()); - // We ask for the icon directly. If we don't get the icon data now, // we'll be notified later (even if the database is still importing icons). RefPtr<cairo_surface_t> surface = getIconSurfaceSynchronously(pageURL); @@ -110,7 +113,7 @@ void Ewk_Favicon_Database::iconForPageURL(const String& pageURL, const IconReque // finished yet, we need to wait for iconDataReadyForPageURL to be // called before making and informed decision. String iconURL = iconURLForPageURL(pageURL); - if (!surface && (!iconURL.isEmpty() || !webIconDatabase->isUrlImportCompleted())) { + if (!surface && (!iconURL.isEmpty() || !m_iconDatabase->isUrlImportCompleted())) { PendingIconRequestVector requests = m_iconRequests.get(pageURL); requests.append(callbackData); m_iconRequests.set(pageURL, requests); @@ -139,13 +142,11 @@ void Ewk_Favicon_Database::didChangeIconForPageURL(WKIconDatabaseRef, WKURLRef p PassRefPtr<cairo_surface_t> Ewk_Favicon_Database::getIconSurfaceSynchronously(const String& pageURL) const { - WebIconDatabase* webIconDatabase = toImpl(m_wkIconDatabase.get()); - - webIconDatabase->retainIconForPageURL(pageURL); + m_iconDatabase->retainIconForPageURL(pageURL); - WebCore::NativeImagePtr icon = webIconDatabase->nativeImageForPageURL(pageURL); + WebCore::NativeImagePtr icon = m_iconDatabase->nativeImageForPageURL(pageURL); if (!icon) { - webIconDatabase->releaseIconForPageURL(pageURL); + m_iconDatabase->releaseIconForPageURL(pageURL); return 0; } diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database_private.h index b8ba4f666..34da50375 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database_private.h @@ -26,12 +26,14 @@ #ifndef ewk_favicon_database_private_h #define ewk_favicon_database_private_h -#include "WKIconDatabase.h" -#include "WKRetainPtr.h" #include "ewk_favicon_database.h" #include <WebKit2/WKBase.h> #include <wtf/HashMap.h> +namespace WebKit { +class WebIconDatabase; +} + struct IconChangeCallbackData { Ewk_Favicon_Database_Icon_Change_Cb callback; void* userData; @@ -71,10 +73,11 @@ typedef HashMap<String /* pageURL */, PendingIconRequestVector> PendingIconReque class Ewk_Favicon_Database { public: - static PassOwnPtr<Ewk_Favicon_Database> create(WKIconDatabaseRef iconDatabaseRef) + static PassOwnPtr<Ewk_Favicon_Database> create(WebKit::WebIconDatabase* iconDatabase) { - return adoptPtr(new Ewk_Favicon_Database(iconDatabaseRef)); + return adoptPtr(new Ewk_Favicon_Database(iconDatabase)); } + ~Ewk_Favicon_Database(); String iconURLForPageURL(const String& pageURL) const; void iconForPageURL(const String& pageURL, const IconRequestCallbackData& callbackData); @@ -83,14 +86,14 @@ public: void unwatchChanges(Ewk_Favicon_Database_Icon_Change_Cb callback); private: - explicit Ewk_Favicon_Database(WKIconDatabaseRef iconDatabaseRef); + explicit Ewk_Favicon_Database(WebKit::WebIconDatabase* iconDatabase); PassRefPtr<cairo_surface_t> getIconSurfaceSynchronously(const String& pageURL) const; static void didChangeIconForPageURL(WKIconDatabaseRef iconDatabase, WKURLRef pageURL, const void* clientInfo); static void iconDataReadyForPageURL(WKIconDatabaseRef iconDatabase, WKURLRef pageURL, const void* clientInfo); - WKRetainPtr<WKIconDatabaseRef> m_wkIconDatabase; + RefPtr<WebKit::WebIconDatabase> m_iconDatabase; ChangeListenerMap m_changeListeners; PendingIconRequestMap m_iconRequests; }; diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_file_chooser_request.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_file_chooser_request.cpp new file mode 100644 index 000000000..a990b1b05 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_file_chooser_request.cpp @@ -0,0 +1,167 @@ +/* + * 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_file_chooser_request.h" + +#include "ImmutableArray.h" +#include "MutableArray.h" +#include "WebOpenPanelParameters.h" +#include "WebOpenPanelResultListenerProxy.h" +#include "WebString.h" +#include "WebURL.h" +#include "ewk_file_chooser_request_private.h" +#include <wtf/text/CString.h> + +using namespace WebKit; + +Ewk_File_Chooser_Request::Ewk_File_Chooser_Request(WebOpenPanelParameters* parameters, WebOpenPanelResultListenerProxy* listener) + : m_parameters(parameters) + , m_listener(listener) + , m_wasRequestHandled(false) +{ + ASSERT(parameters); + ASSERT(listener); +} + +Ewk_File_Chooser_Request::~Ewk_File_Chooser_Request() +{ + if (!m_wasRequestHandled) + m_listener->cancel(); +} + +bool Ewk_File_Chooser_Request::allowMultipleFiles() const +{ + return m_parameters->allowMultipleFiles(); +} + +PassRefPtr<ImmutableArray> Ewk_File_Chooser_Request::acceptedMIMETypes() const +{ + return m_parameters->acceptMIMETypes(); +} + +void Ewk_File_Chooser_Request::cancel() +{ + m_wasRequestHandled = true; + + return m_listener->cancel(); +} + +void Ewk_File_Chooser_Request::chooseFiles(Vector< RefPtr<APIObject> >& fileURLs) +{ + ASSERT(!fileURLs.isEmpty()); + ASSERT(fileURLs.size() == 1 || m_parameters->allowMultipleFiles()); + + m_wasRequestHandled = true; + m_listener->chooseFiles(ImmutableArray::adopt(fileURLs).get()); +} + +Ewk_File_Chooser_Request* ewk_file_chooser_request_ref(Ewk_File_Chooser_Request* request) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0); + + request->ref(); + + return request; +} + +void ewk_file_chooser_request_unref(Ewk_File_Chooser_Request* request) +{ + EINA_SAFETY_ON_NULL_RETURN(request); + + request->deref(); +} + +Eina_Bool ewk_file_chooser_request_allow_multiple_files_get(const Ewk_File_Chooser_Request* request) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(request, false); + + return request->allowMultipleFiles(); +} + +Eina_List* ewk_file_chooser_request_accepted_mimetypes_get(const Ewk_File_Chooser_Request* request) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0); + + Eina_List* mimeTypeList = 0; + RefPtr<ImmutableArray> mimeTypes = request->acceptedMIMETypes(); + + const size_t size = mimeTypes->size(); + for (size_t i = 0; i < size; ++i) { + String mimeTypeString = static_cast<WebString*>(mimeTypes->at(i))->string(); + if (mimeTypeString.isEmpty()) + continue; + mimeTypeList = eina_list_append(mimeTypeList, eina_stringshare_add(mimeTypeString.utf8().data())); + } + + return mimeTypeList; +} + +Eina_Bool ewk_file_chooser_request_cancel(Ewk_File_Chooser_Request* request) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(request, false); + EINA_SAFETY_ON_TRUE_RETURN_VAL(request->wasHandled(), false); + + request->cancel(); + + return true; +} + +Eina_Bool ewk_file_chooser_request_files_choose(Ewk_File_Chooser_Request* request, const Eina_List* chosenFiles) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(request, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(chosenFiles, false); + EINA_SAFETY_ON_FALSE_RETURN_VAL(eina_list_count(chosenFiles) == 1 || request->allowMultipleFiles(), false); + EINA_SAFETY_ON_TRUE_RETURN_VAL(request->wasHandled(), false); + + Vector< RefPtr<APIObject> > fileURLs; + + const Eina_List* l; + void* data; + EINA_LIST_FOREACH(chosenFiles, l, data) { + EINA_SAFETY_ON_NULL_RETURN_VAL(data, false); + String fileURL = "file://" + String::fromUTF8(static_cast<char*>(data)); + fileURLs.append(WebURL::create(fileURL)); + } + + request->chooseFiles(fileURLs); + + return true; +} + +Eina_Bool ewk_file_chooser_request_file_choose(Ewk_File_Chooser_Request* request, const char* chosenFile) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(request, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(chosenFile, false); + EINA_SAFETY_ON_TRUE_RETURN_VAL(request->wasHandled(), false); + + Vector< RefPtr<APIObject> > fileURLs; + String fileURL = "file://" + String::fromUTF8(chosenFile); + fileURLs.append(WebURL::create(fileURL)); + + request->chooseFiles(fileURLs); + + return true; +} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_file_chooser_request.h b/Source/WebKit2/UIProcess/API/efl/ewk_file_chooser_request.h new file mode 100644 index 000000000..9c23a6bf6 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_file_chooser_request.h @@ -0,0 +1,125 @@ +/* + * 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_file_chooser_request.h + * @brief Describes the Ewk File Chooser API. + */ + +#ifndef ewk_file_chooser_request_h +#define ewk_file_chooser_request_h + +#include <Eina.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** Creates a type name for Ewk_File_Chooser_Request */ +typedef struct Ewk_File_Chooser_Request Ewk_File_Chooser_Request; + +/** + * Increases the reference count of the given object. + * + * @param request the request object to increase the reference count + * + * @return a pointer to the object on success, @c NULL otherwise + */ +EAPI Ewk_File_Chooser_Request *ewk_file_chooser_request_ref(Ewk_File_Chooser_Request *request); + +/** + * Decreases the reference count of the given object, possibly freeing it. + * + * When the reference count reaches 0, the file chooser request is freed. The request + * will be cancelled by default if the client did not act on it. + * + * @param request the request object to decrease the reference count + */ +EAPI void ewk_file_chooser_request_unref(Ewk_File_Chooser_Request *request); + +/** + * Queries if it is allowed to select multiple files or not. + * + * @param request request object to query + * + * @return @c EINA_TRUE if it is allowed to select multiple files, + * @c EINA_FALSE otherwise + */ +EAPI Eina_Bool ewk_file_chooser_request_allow_multiple_files_get(const Ewk_File_Chooser_Request *request); + +/** + * Queries the list of accepted MIME types. + * + * Possible MIME types are: + * - "audio\/\*": All sound files are accepted + * - "video\/\*": All video files are accepted + * - "image\/\*": All image files are accepted + * - standard IANA MIME type (see http://www.iana.org/assignments/media-types/ for a complete list) + * + * @param request request object to query + * + * @return The list of accepted MIME types. The list items are guaranteed to be stringshared. + * The caller needs to free the list and its items after use + */ +EAPI Eina_List *ewk_file_chooser_request_accepted_mimetypes_get(const Ewk_File_Chooser_Request *request); + +/** + * Cancels the file chooser request. + * + * @param request request object to cancel + * + * @return @c EINA_TRUE if successful, @c EINA_FALSE otherwise + */ +EAPI Eina_Bool ewk_file_chooser_request_cancel(Ewk_File_Chooser_Request *request); + +/** + * Sets the files chosen by the user. + * + * @param request request object to update + * + * @return @c EINA_TRUE if successful, @c EINA_FALSE otherwise + * + * @see ewk_file_chooser_request_file_choose() + */ +EAPI Eina_Bool ewk_file_chooser_request_files_choose(Ewk_File_Chooser_Request *request, const Eina_List *chosen_files); + +/** + * Sets the file chosen by the user. + * + * This is a convenience function in case only one file needs to be set. + * + * @param request request object to update + * + * @return @c EINA_TRUE if successful, @c EINA_FALSE otherwise + * + * @see ewk_file_chooser_request_files_choose() + */ +EAPI Eina_Bool ewk_file_chooser_request_file_choose(Ewk_File_Chooser_Request *request, const char *chosen_file); + +#ifdef __cplusplus +} +#endif + +#endif /* ewk_file_chooser_request_h */ diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_request_manager_client.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_file_chooser_request_private.h index fe801ce6b..6afb7c945 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_context_request_manager_client.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_file_chooser_request_private.h @@ -23,35 +23,42 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" - -#include "WKBase.h" -#include "WKSoupRequestManager.h" -#include "WKURL.h" -#include "ewk_context_private.h" -#include "ewk_context_request_manager_client_private.h" -#include "ewk_url_scheme_request.h" -#include "ewk_url_scheme_request_private.h" - -static inline Ewk_Context* toEwkContext(const void* clientInfo) -{ - return static_cast<Ewk_Context*>(const_cast<void*>(clientInfo)); -} +#ifndef ewk_file_chooser_request_private_h +#define ewk_file_chooser_request_private_h + +#include "APIObject.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> +#include <wtf/Vector.h> -static void didReceiveURIRequest(WKSoupRequestManagerRef soupRequestManagerRef, WKURLRef urlRef, WKPageRef, uint64_t requestID, const void* clientInfo) -{ - RefPtr<Ewk_Url_Scheme_Request> schemeRequest = Ewk_Url_Scheme_Request::create(soupRequestManagerRef, urlRef, requestID); - toEwkContext(clientInfo)->urlSchemeRequestReceived(schemeRequest.get()); +namespace WebKit { +class ImmutableArray; +class WebOpenPanelParameters; +class WebOpenPanelResultListenerProxy; } -void ewk_context_request_manager_client_attach(Ewk_Context* context) -{ - WKSoupRequestManagerClient wkRequestManagerClient; - memset(&wkRequestManagerClient, 0, sizeof(WKSoupRequestManagerClient)); +class Ewk_File_Chooser_Request : public RefCounted<Ewk_File_Chooser_Request> { +public: + static PassRefPtr<Ewk_File_Chooser_Request> create(WebKit::WebOpenPanelParameters* parameters, WebKit::WebOpenPanelResultListenerProxy* listener) + { + return adoptRef(new Ewk_File_Chooser_Request(parameters, listener)); + } - wkRequestManagerClient.version = kWKSoupRequestManagerClientCurrentVersion; - wkRequestManagerClient.clientInfo = context; - wkRequestManagerClient.didReceiveURIRequest = didReceiveURIRequest; + ~Ewk_File_Chooser_Request(); - WKSoupRequestManagerSetClient(context->requestManager(), &wkRequestManagerClient); -} + bool allowMultipleFiles() const; + PassRefPtr<WebKit::ImmutableArray> acceptedMIMETypes() const; + inline bool wasHandled() const { return m_wasRequestHandled; } + void cancel(); + void chooseFiles(Vector< RefPtr<WebKit::APIObject> >& fileURLs); + +private: + Ewk_File_Chooser_Request(WebKit::WebOpenPanelParameters* parameters, WebKit::WebOpenPanelResultListenerProxy* listener); + + RefPtr<WebKit::WebOpenPanelParameters> m_parameters; + RefPtr<WebKit::WebOpenPanelResultListenerProxy> m_listener; + bool m_wasRequestHandled; +}; + +#endif // ewk_file_chooser_request_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_main.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_main.cpp index 17e2b1eea..890bc699a 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_main.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_main.cpp @@ -25,6 +25,7 @@ #include "ewk_private.h" #include <Ecore.h> #include <Ecore_Evas.h> +#include <Ecore_IMF.h> #include <Edje.h> #include <Eina.h> #include <Evas.h> @@ -72,6 +73,11 @@ int ewk_init(void) goto error_ecore_evas; } + if (!ecore_imf_init()) { + CRITICAL("could not init ecore_imf."); + goto error_ecore_imf; + } + #ifdef HAVE_ECORE_X if (!ecore_x_init(0)) { CRITICAL("could not init ecore_x."); @@ -90,8 +96,10 @@ int ewk_init(void) #ifdef HAVE_ECORE_X error_ecore_x: - ecore_evas_shutdown(); + ecore_imf_shutdown(); #endif +error_ecore_imf: + ecore_evas_shutdown(); error_ecore_evas: ecore_shutdown(); error_ecore: @@ -113,6 +121,7 @@ int ewk_shutdown(void) #ifdef HAVE_ECORE_X ecore_x_shutdown(); #endif + ecore_imf_shutdown(); ecore_evas_shutdown(); ecore_shutdown(); evas_shutdown(); diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data.cpp index 3d1f05f8f..a2ae9a4ef 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data.cpp @@ -30,60 +30,44 @@ using namespace WebKit; -Ewk_Navigation_Data::Ewk_Navigation_Data(WKNavigationDataRef dataRef) - : m_request(Ewk_Url_Request::create(adoptWK(WKNavigationDataCopyOriginalRequest(dataRef)).get())) +EwkNavigationData::EwkNavigationData(WKNavigationDataRef dataRef) + : m_request(EwkUrlRequest::create(adoptWK(WKNavigationDataCopyOriginalRequest(dataRef)).get())) , m_title(AdoptWK, WKNavigationDataCopyTitle(dataRef)) , m_url(AdoptWK, WKNavigationDataCopyURL(dataRef)) { } -Ewk_Url_Request* Ewk_Navigation_Data::originalRequest() const +EwkUrlRequest* EwkNavigationData::originalRequest() const { return m_request.get(); } -const char* Ewk_Navigation_Data::title() const +const char* EwkNavigationData::title() const { return m_title; } -const char* Ewk_Navigation_Data::url() const +const char* EwkNavigationData::url() const { return m_url; } -Ewk_Navigation_Data* ewk_navigation_data_ref(Ewk_Navigation_Data* data) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(data, 0); - - data->ref(); - - return data; -} - -void ewk_navigation_data_unref(Ewk_Navigation_Data* data) -{ - EINA_SAFETY_ON_NULL_RETURN(data); - - data->deref(); -} - const char* ewk_navigation_data_title_get(const Ewk_Navigation_Data* data) { - EINA_SAFETY_ON_NULL_RETURN_VAL(data, 0); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkNavigationData, data, impl, 0); - return data->title(); + return impl->title(); } Ewk_Url_Request* ewk_navigation_data_original_request_get(const Ewk_Navigation_Data* data) { - EINA_SAFETY_ON_NULL_RETURN_VAL(data, 0); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkNavigationData, data, impl, 0); - return data->originalRequest(); + return impl->originalRequest(); } const char* ewk_navigation_data_url_get(const Ewk_Navigation_Data* data) { - EINA_SAFETY_ON_NULL_RETURN_VAL(data, 0); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkNavigationData, data, impl, 0); - return data->url(); + return impl->url(); } diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data.h b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data.h index b3b5c26fc..16f7bc5b8 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data.h @@ -38,26 +38,12 @@ extern "C" { #endif -/** Creates a type name for Ewk_Navigation_Data */ -typedef struct Ewk_Navigation_Data Ewk_Navigation_Data; - /** - * Increases the reference count of the given object. - * - * @param data the navigation data object to increase the reference count - * - * @return a pointer to the object on success, @c NULL otherwise. - */ -EAPI Ewk_Navigation_Data *ewk_navigation_data_ref(Ewk_Navigation_Data *data); - -/** - * Decreases the reference count of the given object, possibly freeing it. - * - * When the reference count reaches 0, the object is freed. + * Declare Ewk_Navigation_Data as Ewk_Object. * - * @param data the navigation data object to decrease the reference count + * @see Ewk_Object */ -EAPI void ewk_navigation_data_unref(Ewk_Navigation_Data *data); +typedef struct Ewk_Object Ewk_Navigation_Data; /** * Returns title for this navigation data. diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data_private.h index 0d0ecb043..59e0c6976 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data_private.h @@ -36,25 +36,27 @@ #include <wtf/RefCounted.h> /** - * \struct Ewk_Navigation_Data + * \struct EwkNavigationData * @brief Contains the navigation data details. */ -class Ewk_Navigation_Data : public RefCounted<Ewk_Navigation_Data> { +class EwkNavigationData : public Ewk_Object { public: - static PassRefPtr<Ewk_Navigation_Data> create(WKNavigationDataRef dataRef) + EWK_OBJECT_DECLARE(EwkNavigationData) + + static PassRefPtr<EwkNavigationData> create(WKNavigationDataRef dataRef) { - return adoptRef(new Ewk_Navigation_Data(dataRef)); + return adoptRef(new EwkNavigationData(dataRef)); } - Ewk_Url_Request* originalRequest() const; + EwkUrlRequest* originalRequest() const; const char* title() const; const char* url() const; private: - explicit Ewk_Navigation_Data(WKNavigationDataRef dataRef); + explicit EwkNavigationData(WKNavigationDataRef dataRef); - RefPtr<Ewk_Url_Request> m_request; + RefPtr<EwkUrlRequest> m_request; WKEinaSharedString m_title; WKEinaSharedString m_url; }; diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp index 5c4f24c5b..ad2deefbd 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp @@ -32,7 +32,7 @@ using namespace WebKit; -Ewk_Navigation_Policy_Decision::Ewk_Navigation_Policy_Decision(WKFramePolicyListenerRef listener, Ewk_Navigation_Type navigationType, Event_Mouse_Button mouseButton, Event_Modifier_Keys modifiers, PassRefPtr<Ewk_Url_Request> request, const char* frameName) +Ewk_Navigation_Policy_Decision::Ewk_Navigation_Policy_Decision(WKFramePolicyListenerRef listener, Ewk_Navigation_Type navigationType, Event_Mouse_Button mouseButton, Event_Modifier_Keys modifiers, PassRefPtr<EwkUrlRequest> request, const char* frameName) : m_listener(listener) , m_actedUponByClient(false) , m_navigationType(navigationType) @@ -69,7 +69,7 @@ const char* Ewk_Navigation_Policy_Decision::frameName() const return m_frameName; } -Ewk_Url_Request* Ewk_Navigation_Policy_Decision::request() const +EwkUrlRequest* Ewk_Navigation_Policy_Decision::request() const { return m_request.get(); } diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision_private.h index 95a18b7c2..66feb3151 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision_private.h @@ -46,8 +46,7 @@ public: static PassRefPtr<Ewk_Navigation_Policy_Decision> create(WKFrameNavigationType navigationType, WKEventMouseButton mouseButton, WKEventModifiers modifiers, WKURLRequestRef requestRef, const char* frameName, WKFramePolicyListenerRef listener) { - RefPtr<Ewk_Url_Request> request = Ewk_Url_Request::create(requestRef); - return adoptRef(new Ewk_Navigation_Policy_Decision(listener, static_cast<Ewk_Navigation_Type>(navigationType), static_cast<Event_Mouse_Button>(mouseButton), static_cast<Event_Modifier_Keys>(modifiers), request.release(), frameName)); + return adoptRef(new Ewk_Navigation_Policy_Decision(listener, static_cast<Ewk_Navigation_Type>(navigationType), static_cast<Event_Mouse_Button>(mouseButton), static_cast<Event_Modifier_Keys>(modifiers), EwkUrlRequest::create(requestRef), frameName)); } void accept(); @@ -58,17 +57,17 @@ public: Event_Mouse_Button mouseButton() const; Event_Modifier_Keys modifiers() const; const char* frameName() const; - Ewk_Url_Request* request() const; + EwkUrlRequest* request() const; private: - Ewk_Navigation_Policy_Decision(WKFramePolicyListenerRef listener, Ewk_Navigation_Type navigationType, Event_Mouse_Button mouseButton, Event_Modifier_Keys modifiers, PassRefPtr<Ewk_Url_Request> request, const char* frameName); + Ewk_Navigation_Policy_Decision(WKFramePolicyListenerRef listener, Ewk_Navigation_Type navigationType, Event_Mouse_Button mouseButton, Event_Modifier_Keys modifiers, PassRefPtr<EwkUrlRequest> request, const char* frameName); WKRetainPtr<WKFramePolicyListenerRef> m_listener; bool m_actedUponByClient; Ewk_Navigation_Type m_navigationType; Event_Mouse_Button m_mouseButton; Event_Modifier_Keys m_modifiers; - RefPtr<Ewk_Url_Request> m_request; + RefPtr<EwkUrlRequest> m_request; WKEinaSharedString m_frameName; }; diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_policy_client_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_object.cpp index c67248d96..f25d668d2 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_policy_client_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_object.cpp @@ -5,9 +5,9 @@ * 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. + * notice, this item 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 + * notice, this item 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'' @@ -23,12 +23,22 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ewk_view_policy_client_private_h -#define ewk_view_policy_client_private_h +#include "config.h" +#include "ewk_object.h" -#include <Evas.h> -#include <WebKit2/WKBase.h> +#include "ewk_object_private.h" -void ewk_view_policy_client_attach(WKPageRef pageRef, Evas_Object* ewkView); +Ewk_Object* ewk_object_ref(Ewk_Object* object) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(object, 0); + object->ref(); -#endif // ewk_view_policy_client_private_h + return object; +} + +void ewk_object_unref(Ewk_Object* object) +{ + EINA_SAFETY_ON_NULL_RETURN(object); + + object->deref(); +} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_object.h b/Source/WebKit2/UIProcess/API/efl/ewk_object.h new file mode 100644 index 000000000..0349493c8 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_object.h @@ -0,0 +1,65 @@ +/* + * 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_object.h + * @brief Describes the Ewk Ref Counted API. + */ + +#ifndef ewk_object_h +#define ewk_object_h + +#include <Eina.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** Creates a type name for Ewk_Object */ +typedef struct Ewk_Object Ewk_Object; + +/** + * Increases the reference count of the given Ewk_Object. + * + * @param object the Ewk_Object instance to increase the reference count + * + * @return a pointer to the object on success, @c NULL otherwise. + */ +EAPI Ewk_Object *ewk_object_ref(Ewk_Object *object); + +/** + * Decreases the reference count of the given Ewk_Object, possibly freeing it. + * + * When the reference count reaches 0, the item is freed. + * + * @param object the Ewk_Object instance to decrease the reference count + */ +EAPI void ewk_object_unref(Ewk_Object *object); + + +#ifdef __cplusplus +} +#endif +#endif // ewk_object_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_object_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_object_private.h new file mode 100644 index 000000000..4d4ccfabc --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_object_private.h @@ -0,0 +1,87 @@ +/* + * 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_object_private_h +#define ewk_object_private_h + +#include <wtf/RefCounted.h> + +class Ewk_Object : public RefCounted<Ewk_Object> { +public: + virtual ~Ewk_Object() { } + virtual const char* instanceClassName() const = 0; +}; + +template <class T> +inline bool ewk_object_is_of_type(const Ewk_Object* object) +{ + return (reinterpret_cast<T>(0)->className() == object->instanceClassName()); +} + +template <class T> +inline bool ewk_object_cast_check(const Ewk_Object* object) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(object, false); + + if (!ewk_object_is_of_type<T>(object)) { + EINA_LOG_CRIT("attempt to convert object of type %s to type %s", + object->instanceClassName(), reinterpret_cast<T>(0)->className()); + ASSERT_NOT_REACHED(); + return false; + } + + return true; +} + +template <class T> +inline const T ewk_object_cast(const Ewk_Object* object) +{ + return ewk_object_cast_check<T>(object) ? static_cast<T>(object) : 0; +} + +template <class T> +inline T ewk_object_cast(Ewk_Object* object) +{ + return ewk_object_cast_check<T>(object) ? static_cast<T>(object) : 0; +} + +#define EWK_OBJ_GET_IMPL_OR_RETURN(ImplClass, object, impl, ...) \ + ImplClass* impl = ewk_object_cast<ImplClass*>(object); \ + if (!impl) \ + return __VA_ARGS__ + + +#define EWK_OBJECT_DECLARE(_className) \ +static const char* className() \ +{ \ + static const char* name = #_className; \ + return name; \ +} \ +virtual const char* instanceClassName() const \ +{ \ + return className(); \ +} + +#endif // ewk_object_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu.cpp new file mode 100644 index 000000000..765114e6d --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu.cpp @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2012 Intel Corporation + * Copyright (C) 2012 Samsung Electronics + * + * 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR + * 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_popup_menu.h" + +#include "EwkViewImpl.h" +#include "WebPopupMenuProxyEfl.h" +#include "ewk_popup_menu_item_private.h" +#include "ewk_popup_menu_private.h" + +using namespace WebKit; + +Ewk_Popup_Menu::Ewk_Popup_Menu(EwkViewImpl* viewImpl, WebPopupMenuProxyEfl* popupMenuProxy, const Vector<WebKit::WebPopupItem>& items, unsigned selectedIndex) + : m_viewImpl(viewImpl) + , m_popupMenuProxy(popupMenuProxy) + , m_popupMenuItems(0) + , m_selectedIndex(selectedIndex) +{ + const size_t size = items.size(); + for (size_t i = 0; i < size; ++i) + m_popupMenuItems = eina_list_append(m_popupMenuItems, Ewk_Popup_Menu_Item::create(items[i]).leakPtr()); +} + +Ewk_Popup_Menu::~Ewk_Popup_Menu() +{ + void* item; + EINA_LIST_FREE(m_popupMenuItems, item) + delete static_cast<Ewk_Popup_Menu_Item*>(item); +} + +void Ewk_Popup_Menu::close() +{ + m_viewImpl->closePopupMenu(); +} + +const Eina_List* Ewk_Popup_Menu::items() const +{ + return m_popupMenuItems; +} + +unsigned Ewk_Popup_Menu::selectedIndex() const +{ + return m_selectedIndex; +} + +bool Ewk_Popup_Menu::setSelectedIndex(unsigned selectedIndex) +{ + if (!m_popupMenuProxy) + return false; + + if (selectedIndex >= eina_list_count(m_popupMenuItems)) + return false; + + if (m_selectedIndex == selectedIndex) + return true; + + m_selectedIndex = selectedIndex; + m_popupMenuProxy->valueChanged(selectedIndex); + + return true; +} + +Eina_Bool ewk_popup_menu_close(Ewk_Popup_Menu* popupMenu) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(popupMenu, false); + + popupMenu->close(); + + return true; +} + +Eina_Bool ewk_popup_menu_selected_index_set(Ewk_Popup_Menu* popupMenu, unsigned selectedIndex) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(popupMenu, false); + + return popupMenu->setSelectedIndex(selectedIndex); +} + +unsigned ewk_popup_menu_selected_index_get(const Ewk_Popup_Menu* popupMenu) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(popupMenu, 0); + + return popupMenu->selectedIndex(); +} + +const Eina_List* ewk_popup_menu_items_get(const Ewk_Popup_Menu* popupMenu) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(popupMenu, 0); + + return popupMenu->items(); +} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu.h b/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu.h new file mode 100644 index 000000000..04e17688c --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu.h @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2012 Intel Corporation + * Copyright (C) 2012 Samsung Electronics + * + * 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR + * 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_popup_menu.h + * @brief Describes the Ewk Popup Menu API. + */ + +#ifndef ewk_popup_menu_h +#define ewk_popup_menu_h + +#include <Eina.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** Creates a type name for Ewk_Popup_Menu */ +typedef struct Ewk_Popup_Menu Ewk_Popup_Menu; + +/** + * Selects index of current popup menu. + * + * @param popup_menu popup menu object + * @param index index of item to select + * + * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (e.g. the index is out of range) + */ +EAPI Eina_Bool ewk_popup_menu_selected_index_set(Ewk_Popup_Menu *popup_menu, unsigned index); + +/** + * Returns the index of the currently selected item in the popup menu. + * + * @param popup_menu popup menu object + * + * @return index of the currently selected popup item on success, @c 0 otherwise + */ +EAPI unsigned ewk_popup_menu_selected_index_get(const Ewk_Popup_Menu *popup_menu); + +/** + * Closes current popup menu. + * + * The Ewk_Popup_Menu object becomes invalid after calling this function. + * + * @param popup_menu popup menu object + * + * @return @c EINA_TRUE on success, @c EINA_FALSE on failure + */ +EAPI Eina_Bool ewk_popup_menu_close(Ewk_Popup_Menu *popup_menu); + +/** + * Retrieve the popup menu items + * + * @param popup_menu popup menu object + * + * @return @c list of popup menu items on success, @c NULL otherwise + */ +EAPI const Eina_List *ewk_popup_menu_items_get(const Ewk_Popup_Menu *popup_menu); + +#ifdef __cplusplus +} +#endif + +#endif /* ewk_popup_menu_h */ diff --git a/Source/WebKit2/UIProcess/API/efl/WebKitTextChecker.h b/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_private.h index 4123244c3..bdadc5ec3 100644 --- a/Source/WebKit2/UIProcess/API/efl/WebKitTextChecker.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_private.h @@ -1,4 +1,5 @@ /* + * Copyright (C) 2012 Intel Corporation * Copyright (C) 2012 Samsung Electronics * * Redistribution and use in source and binary forms, with or without @@ -23,38 +24,42 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebKitTextChecker_h -#define WebKitTextChecker_h +#ifndef ewk_popup_menu_private_h +#define ewk_popup_menu_private_h -#if ENABLE(SPELLCHECK) - -#include "TextCheckerEnchant.h" -#include "WKArray.h" -#include "WKPage.h" -#include "WKString.h" +#include <Eina.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/Vector.h> namespace WebKit { +class WebPopupItem; +class WebPopupMenuProxyEfl; +} + +class EwkViewImpl; -// The functions mainly choose between client's implementation of spelling and the WebKit one. +class Ewk_Popup_Menu { +public: + static PassOwnPtr<Ewk_Popup_Menu> create(EwkViewImpl* viewImpl, WebKit::WebPopupMenuProxyEfl* popupMenuProxy, const Vector<WebKit::WebPopupItem>& items, unsigned selectedIndex) + { + return adoptPtr(new Ewk_Popup_Menu(viewImpl, popupMenuProxy, items, selectedIndex)); + } + ~Ewk_Popup_Menu(); -// Callbacks required by WKTextChecker. -bool isContinuousSpellCheckingEnabled(const void* clientInfo); -void setContinuousSpellCheckingEnabled(bool enabled, const void* clientInfo); + void close(); -uint64_t uniqueSpellDocumentTag(WKPageRef page, const void* clientInfo); -void closeSpellDocumentWithTag(uint64_t tag, const void* clientInfo); + const Eina_List* items() const; -void checkSpellingOfString(uint64_t tag, WKStringRef text, int32_t* misspellingLocation, int32_t* misspellingLength, const void* clientInfo); -WKArrayRef guessesForWord(uint64_t tag, WKStringRef word, const void* clientInfo); -void learnWord(uint64_t tag, WKStringRef word, const void* clientInfo); -void ignoreWord(uint64_t tag, WKStringRef word, const void* clientInfo); + bool setSelectedIndex(unsigned selectedIndex); + unsigned selectedIndex() const; -// Enchant's helper. -Vector<String> availableSpellCheckingLanguages(); -void updateSpellCheckingLanguages(const Vector<String>& languages); -Vector<String> loadedSpellCheckingLanguages(); +private: + Ewk_Popup_Menu(EwkViewImpl* viewImpl, WebKit::WebPopupMenuProxyEfl*, const Vector<WebKit::WebPopupItem>& items, unsigned selectedIndex); -} // namespace WebKit + EwkViewImpl* m_viewImpl; + WebKit::WebPopupMenuProxyEfl* m_popupMenuProxy; + Eina_List* m_popupMenuItems; + unsigned m_selectedIndex; +}; -#endif // ENABLE(SPELLCHECK) -#endif // WebKitTextChecker_h +#endif // ewk_popup_menu_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_security_origin.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_security_origin.cpp new file mode 100644 index 000000000..bc0f8c7ae --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_security_origin.cpp @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2012 Samsung Electronics. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR + * 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_security_origin.h" + +#include "WKAPICast.h" +#include "WKSecurityOrigin.h" +#include "ewk_security_origin_private.h" + +using namespace WebKit; + +Ewk_Security_Origin::Ewk_Security_Origin(WKSecurityOriginRef originRef) + : m_wkOrigin(originRef) + , m_host(AdoptWK, WKSecurityOriginCopyHost(originRef)) + , m_protocol(AdoptWK, WKSecurityOriginCopyProtocol(originRef)) +{ } + +const char* Ewk_Security_Origin::host() const +{ + return m_host; +} + +const char* Ewk_Security_Origin::protocol() const +{ + return m_protocol; +} + +uint32_t Ewk_Security_Origin::port() const +{ + return WKSecurityOriginGetPort(m_wkOrigin.get()); +} + +Ewk_Security_Origin* ewk_security_origin_ref(Ewk_Security_Origin* origin) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(origin, 0); + + origin->ref(); + return origin; +} + +void ewk_security_origin_unref(Ewk_Security_Origin* origin) +{ + EINA_SAFETY_ON_NULL_RETURN(origin); + + origin->deref(); +} + +const char* ewk_security_origin_host_get(const Ewk_Security_Origin* origin) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(origin, 0); + + return origin->host(); +} + +const char* ewk_security_origin_protocol_get(const Ewk_Security_Origin* origin) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(origin, 0); + + return origin->protocol(); +} + +uint32_t ewk_security_origin_port_get(const Ewk_Security_Origin* origin) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(origin, 0); + + return origin->port(); +} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_security_origin.h b/Source/WebKit2/UIProcess/API/efl/ewk_security_origin.h new file mode 100644 index 000000000..5be84165b --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_security_origin.h @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * Copyright (C) 2012 Samsung Electronics. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR + * 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_security_origin.h + * @brief Security Origin API. + * + * Security Origin is the mechanism that defines the access limits of a website. + * Based on information such as domain, protocol and port, you can or cannot grant + * authorization for accessing data and performing certain tasks. + */ + +#ifndef ewk_security_origin_h +#define ewk_security_origin_h + +#include <Eina.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** Creates a type name for Ewk_Security_Origin. */ +typedef struct Ewk_Security_Origin Ewk_Security_Origin; + +/** + * Increases the reference count of the given object. + * + * @param origin the origin object to increase the reference count + * + * @return a pointer to the object on success, @c NULL otherwise + */ +EAPI Ewk_Security_Origin *ewk_security_origin_ref(Ewk_Security_Origin *o); + +/** + * Decreases the reference count of the given object, possibly freeing it. + * + * When the reference count reaches 0, the origin is freed. + * + * @param origin the origin object to decrease the reference count + */ +EAPI void ewk_security_origin_unref(Ewk_Security_Origin *o); + +/** + * Returns the host of the security origin. + * + * @param o security origin object + * + * @return the host domain pointer or @c NULL if there is not a host scheme. + * This pointer is guaranteed to be eina_stringshare, so whenever possible + * save yourself from cpu cycles and use eina_stringshare_ref() + * instead of eina_stringshare_add() or strdup(). + */ +EAPI const char *ewk_security_origin_host_get(const Ewk_Security_Origin *o); + +/** + * Returns the port of the security origin. + * + * @param o security origin object + * + * @return the port number or @c 0 if there is not a proper security origin scheme + */ +EAPI uint32_t ewk_security_origin_port_get(const Ewk_Security_Origin *o); + +/** + * Returns the protocol of the security origin. + * + * @param o security origin object + * + * @return the protocol scheme pointer or @c NULL if there is not a protocol scheme. + * This pointer is guaranteed to be eina_stringshare, so whenever possible + * save yourself from cpu cycles and use eina_stringshare_ref() + * instead of eina_stringshare_add() or strdup(). + */ +EAPI const char *ewk_security_origin_protocol_get(const Ewk_Security_Origin *o); + +#ifdef __cplusplus +} +#endif +#endif // ewk_security_origin_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_security_origin_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_security_origin_private.h new file mode 100644 index 000000000..04012410e --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_security_origin_private.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2012 Samsung Electronics. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR + * 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_security_origin_private_h +#define ewk_security_origin_private_h + +#include "WKEinaSharedString.h" +#include "WKSecurityOrigin.h" +#include <WebKit2/WKBase.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +class Ewk_Security_Origin : public RefCounted<Ewk_Security_Origin> { +public: + static PassRefPtr<Ewk_Security_Origin> create(WKSecurityOriginRef originRef) + { + return adoptRef(new Ewk_Security_Origin(originRef)); + } + + const char* host() const; + const char* protocol() const; + uint32_t port() const; + +private: + explicit Ewk_Security_Origin(WKSecurityOriginRef originRef); + + WKRetainPtr<WKSecurityOriginRef> m_wkOrigin; + WKEinaSharedString m_host; + WKEinaSharedString m_protocol; +}; + +#endif // ewk_security_origin_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp index 803761168..0b5083f8a 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2012 Samsung Electronics + * 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 @@ -26,13 +27,15 @@ #include "config.h" #include "ewk_settings.h" +#include "EwkViewImpl.h" #include "ewk_settings_private.h" -#include <WebKit2/WKPreferences.h> -#include <WebKit2/WKPreferencesPrivate.h> +#include <WebKit2/WebPageGroup.h> +#include <WebKit2/WebPageProxy.h> +#include <WebKit2/WebPreferences.h> #if ENABLE(SPELLCHECK) #include "WKTextChecker.h" -#include "WebKitTextChecker.h" +#include "ewk_text_checker_private.h" #include <Ecore.h> #include <wtf/Vector.h> #include <wtf/text/CString.h> @@ -40,6 +43,16 @@ using namespace WebKit; +const WebKit::WebPreferences* Ewk_Settings::preferences() const +{ + return m_viewImpl->page()->pageGroup()->preferences(); +} + +WebKit::WebPreferences* Ewk_Settings::preferences() +{ + return m_viewImpl->page()->pageGroup()->preferences(); +} + #if ENABLE(SPELLCHECK) static struct { bool isContinuousSpellCheckingEnabled : 1; @@ -58,7 +71,7 @@ static Eina_Bool onContinuousSpellCheckingIdler(void*) static Eina_Bool spellCheckingLanguagesSetUpdate(void*) { // FIXME: Consider to delegate calling of this method in WebProcess to do not delay/block UIProcess. - updateSpellCheckingLanguages(ewkTextCheckerSettings.spellCheckingLanguages); + Ewk_Text_Checker::updateSpellCheckingLanguages(ewkTextCheckerSettings.spellCheckingLanguages); return ECORE_CALLBACK_CANCEL; } @@ -73,7 +86,7 @@ Eina_Bool ewk_settings_fullscreen_enabled_set(Ewk_Settings* settings, Eina_Bool { #if ENABLE(FULLSCREEN_API) EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false); - WKPreferencesSetFullScreenEnabled(settings->preferences.get(), enable); + settings->preferences()->setFullScreenEnabled(enable); return true; #else return false; @@ -84,7 +97,7 @@ Eina_Bool ewk_settings_fullscreen_enabled_get(const Ewk_Settings* settings) { #if ENABLE(FULLSCREEN_API) EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false); - return WKPreferencesGetFullScreenEnabled(settings->preferences.get()); + return settings->preferences()->fullScreenEnabled(); #else return false; #endif @@ -94,7 +107,7 @@ Eina_Bool ewk_settings_javascript_enabled_set(Ewk_Settings* settings, Eina_Bool { EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false); - WKPreferencesSetJavaScriptEnabled(settings->preferences.get(), enable); + settings->preferences()->setJavaScriptEnabled(enable); return true; } @@ -103,14 +116,14 @@ Eina_Bool ewk_settings_javascript_enabled_get(const Ewk_Settings* settings) { EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false); - return WKPreferencesGetJavaScriptEnabled(settings->preferences.get()); + return settings->preferences()->javaScriptEnabled(); } Eina_Bool ewk_settings_loads_images_automatically_set(Ewk_Settings* settings, Eina_Bool automatic) { EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false); - WKPreferencesSetLoadsImagesAutomatically(settings->preferences.get(), automatic); + settings->preferences()->setLoadsImagesAutomatically(automatic); return true; } @@ -119,14 +132,14 @@ Eina_Bool ewk_settings_loads_images_automatically_get(const Ewk_Settings* settin { EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false); - return WKPreferencesGetLoadsImagesAutomatically(settings->preferences.get()); + return settings->preferences()->loadsImagesAutomatically(); } Eina_Bool ewk_settings_developer_extras_enabled_set(Ewk_Settings* settings, Eina_Bool enable) { EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false); - WKPreferencesSetDeveloperExtrasEnabled(settings->preferences.get(), enable); + settings->preferences()->setDeveloperExtrasEnabled(enable); return true; } @@ -135,14 +148,14 @@ Eina_Bool ewk_settings_developer_extras_enabled_get(const Ewk_Settings* settings { EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false); - return WKPreferencesGetDeveloperExtrasEnabled(settings->preferences.get()); + return settings->preferences()->developerExtrasEnabled(); } Eina_Bool ewk_settings_file_access_from_file_urls_allowed_set(Ewk_Settings* settings, Eina_Bool enable) { EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false); - WKPreferencesSetFileAccessFromFileURLsAllowed(settings->preferences.get(), enable); + settings->preferences()->setAllowFileAccessFromFileURLs(enable); return true; } @@ -151,14 +164,14 @@ Eina_Bool ewk_settings_file_access_from_file_urls_allowed_get(const Ewk_Settings { EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false); - return WKPreferencesGetFileAccessFromFileURLsAllowed(settings->preferences.get()); + return settings->preferences()->allowFileAccessFromFileURLs(); } Eina_Bool ewk_settings_frame_flattening_enabled_set(Ewk_Settings* settings, Eina_Bool enable) { EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false); - WKPreferencesSetFrameFlatteningEnabled(settings->preferences.get(), enable); + settings->preferences()->setFrameFlatteningEnabled(enable); return true; } @@ -167,14 +180,14 @@ Eina_Bool ewk_settings_frame_flattening_enabled_get(const Ewk_Settings* settings { EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false); - return WKPreferencesGetFrameFlatteningEnabled(settings->preferences.get()); + return settings->preferences()->frameFlatteningEnabled(); } Eina_Bool ewk_settings_dns_prefetching_enabled_set(Ewk_Settings* settings, Eina_Bool enable) { EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false); - WKPreferencesSetDNSPrefetchingEnabled(settings->preferences.get(), enable); + settings->preferences()->setDNSPrefetchingEnabled(enable); return true; } @@ -183,7 +196,7 @@ Eina_Bool ewk_settings_dns_prefetching_enabled_get(const Ewk_Settings* settings) { EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false); - return WKPreferencesGetDNSPrefetchingEnabled(settings->preferences.get()); + return settings->preferences()->dnsPrefetchingEnabled(); } void ewk_settings_continuous_spell_checking_change_cb_set(Ewk_Settings_Continuous_Spell_Checking_Change_Cb callback) @@ -212,7 +225,7 @@ void ewk_settings_continuous_spell_checking_enabled_set(Eina_Bool enable) WKTextCheckerContinuousSpellCheckingEnabledStateChanged(enable); // Sets the default language if user didn't specify any. - if (enable && loadedSpellCheckingLanguages().isEmpty()) + if (enable && Ewk_Text_Checker::loadedSpellCheckingLanguages().isEmpty()) spellCheckingLanguagesSet(Vector<String>()); if (ewkTextCheckerSettings.onContinuousSpellChecking) @@ -225,7 +238,7 @@ Eina_List* ewk_settings_spell_checking_available_languages_get() { Eina_List* listOflanguages = 0; #if ENABLE(SPELLCHECK) - Vector<String> languages = availableSpellCheckingLanguages(); + const Vector<String>& languages = Ewk_Text_Checker::availableSpellCheckingLanguages(); size_t numberOfLanuages = languages.size(); for (size_t i = 0; i < numberOfLanuages; ++i) @@ -248,7 +261,7 @@ Eina_List* ewk_settings_spell_checking_languages_get() { Eina_List* listOflanguages = 0; #if ENABLE(SPELLCHECK) - Vector<String> languages = loadedSpellCheckingLanguages(); + Vector<String> languages = Ewk_Text_Checker::loadedSpellCheckingLanguages(); size_t numberOfLanuages = languages.size(); for (size_t i = 0; i < numberOfLanuages; ++i) @@ -257,3 +270,19 @@ Eina_List* ewk_settings_spell_checking_languages_get() #endif return listOflanguages; } + +Eina_Bool ewk_setting_encoding_detector_enabled_set(Ewk_Settings* settings, Eina_Bool enable) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false); + + settings->preferences()->setUsesEncodingDetector(enable); + + return true; +} + +Eina_Bool ewk_setting_encoding_detector_enabled_get(const Ewk_Settings* settings) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false); + + return settings->preferences()->usesEncodingDetector(); +} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_settings.h b/Source/WebKit2/UIProcess/API/efl/ewk_settings.h index 861b9917f..5eea469b2 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_settings.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_settings.h @@ -298,6 +298,29 @@ EAPI void ewk_settings_spell_checking_languages_set(const char *languages); */ EAPI Eina_List *ewk_settings_spell_checking_languages_get(void); +/** + * Enables/disables the encoding detector. + * + * By default, the encoding detector is disabled. + * + * @param settings settings object to set the encoding detector + * @param enable @c EINA_TRUE to enable the encoding detector, + * @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EAPI Eina_Bool ewk_setting_encoding_detector_enabled_set(Ewk_Settings *settings, Eina_Bool enable); + +/** +* Returns whether the encoding detector is enabled or not. + * + * @param settings settings object to query whether encoding detector is enabled + * + * @return @c EINA_TRUE if the encoding detector is enabled + * @c EINA_FALSE if not or on failure + */ +EAPI Eina_Bool ewk_setting_encoding_detector_enabled_get(const Ewk_Settings *settings); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_settings_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_settings_private.h index 40ae3b781..ea29a8575 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_settings_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_settings_private.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2012 Samsung Electronics + * 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 @@ -26,21 +27,34 @@ #ifndef ewk_settings_private_h #define ewk_settings_private_h -#include "ewk_settings.h" -#include <WebKit2/WKPreferences.h> -#include <WebKit2/WKRetainPtr.h> #include <wtf/PassOwnPtr.h> +namespace WebKit { +class WebPreferences; +} +class EwkViewImpl; /** * \struct Ewk_Settings * @brief Contains the settings data. */ -struct Ewk_Settings { - WKRetainPtr<WKPreferencesRef> preferences; +class Ewk_Settings { +public: + static PassOwnPtr<Ewk_Settings> create(EwkViewImpl* viewImpl) + { + return adoptPtr(new Ewk_Settings(viewImpl)); + } - explicit Ewk_Settings(WKPreferencesRef wkPreferences) - : preferences(wkPreferences) - { } + const WebKit::WebPreferences* preferences() const; + WebKit::WebPreferences* preferences(); + +private: + explicit Ewk_Settings(EwkViewImpl* viewImpl) + : m_viewImpl(viewImpl) + { + ASSERT(m_viewImpl); + } + + EwkViewImpl* m_viewImpl; }; #endif // ewk_settings_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_storage_manager.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_storage_manager.cpp new file mode 100644 index 000000000..1632b2e6b --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_storage_manager.cpp @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2012 Samsung Electronics. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR + * 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_storage_manager.h" + +#include "WKAPICast.h" +#include "WKArray.h" +#include "WKKeyValueStorageManager.h" +#include "ewk_error_private.h" +#include "ewk_security_origin.h" +#include "ewk_security_origin_private.h" +#include "ewk_storage_manager_private.h" +#include <wtf/RefCounted.h> + +using namespace WebKit; + +Ewk_Storage_Manager::Ewk_Storage_Manager(WKKeyValueStorageManagerRef wkStorageManagerRef) + : m_wkStorageManager(wkStorageManagerRef) +{ } + +void Ewk_Storage_Manager::getStorageOrigins(void* context, WKKeyValueStorageManagerGetKeyValueStorageOriginsFunction callback) const +{ + WKKeyValueStorageManagerGetKeyValueStorageOrigins(m_wkStorageManager.get(), context, callback); +} + +Eina_List* Ewk_Storage_Manager::createOriginList(WKArrayRef origins) const +{ + Eina_List* originList = 0; + const size_t length = WKArrayGetSize(origins); + + for (size_t i = 0; i < length; ++i) { + WKSecurityOriginRef wkOriginRef = static_cast<WKSecurityOriginRef>(WKArrayGetItemAtIndex(origins, i)); + RefPtr<Ewk_Security_Origin> origin = m_wrapperCache.get(wkOriginRef); + if (!origin) { + origin = Ewk_Security_Origin::create(wkOriginRef); + m_wrapperCache.set(wkOriginRef, origin); + } + originList = eina_list_append(originList, origin.release().leakRef()); + } + + return originList; +} + +struct Ewk_Storage_Origins_Async_Get_Context { + const Ewk_Storage_Manager* manager; + Ewk_Storage_Origins_Get_Cb callback; + void* userData; + + Ewk_Storage_Origins_Async_Get_Context(const Ewk_Storage_Manager* manager, Ewk_Storage_Origins_Get_Cb callback, void* userData) + : manager(manager) + , callback(callback) + , userData(userData) + { } +}; + +static void getStorageOriginsCallback(WKArrayRef origins, WKErrorRef wkError, void* context) +{ + Eina_List* originList = 0; + OwnPtr<Ewk_Storage_Origins_Async_Get_Context*> webStorageContext = adoptPtr(static_cast<Ewk_Storage_Origins_Async_Get_Context*>(context)); + + originList = webStorageContext->manager->createOriginList(origins); + + OwnPtr<Ewk_Error> ewkError = Ewk_Error::create(wkError); + webStorageContext->callback(originList, ewkError.get(), webStorageContext->userData); +} + +Eina_Bool ewk_storage_manager_origins_get(const Ewk_Storage_Manager* ewkStorageManager, Ewk_Storage_Origins_Get_Cb callback, void* userData) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(ewkStorageManager, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false); + + Ewk_Storage_Origins_Async_Get_Context* context = new Ewk_Storage_Origins_Async_Get_Context(ewkStorageManager, callback, userData); + ewkStorageManager->getStorageOrigins(context, getStorageOriginsCallback); + + return true; +} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_storage_manager.h b/Source/WebKit2/UIProcess/API/efl/ewk_storage_manager.h new file mode 100644 index 000000000..d94a556b6 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_storage_manager.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2012 Samsung Electronics. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR + * 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_storage_manager.h + * @brief Describes the Ewk Storage Manager API. + * + * Ewk Storage Manager manages web storage. + */ + +#ifndef ewk_storage_manager_h +#define ewk_storage_manager_h + +#include "ewk_error.h" +#include <Eina.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** Creates a type name for Ewk_Storage_Manager. */ +typedef struct Ewk_Storage_Manager Ewk_Storage_Manager; + +/** + * @typedef Ewk_Storage_Origins_Get_Cb Ewk_Storage_Origins_Get_Cb + * @brief Callback type for use with ewk_storage_manager_origins_get(). + * + * @param origins @c Eina_List containing @c Ewk_Security_Origin elements or @c NULL in case of error, + * the Eina_List and its items should be freed after use. Use ewk_security_origin_unref() + * to free the items + */ +typedef void (*Ewk_Storage_Origins_Get_Cb)(Eina_List *origins, Ewk_Error *error, void *user_data); + +/** + * Gets list of origins that are stored in storage db asynchronously. + * + * This function allocates memory for context structure made from callback and user_data. + * + * @param manager Ewk_Storage_Manager object + * @param callback callback to get storage origins + * @param user_data user_data will be passed when result_callback is called, + * -i.e., user data will be kept until callback is called + * + * @return @c EINA_TRUE on success, @c EINA_FALSE on failure + */ +EAPI Eina_Bool ewk_storage_manager_origins_get(const Ewk_Storage_Manager *manager, Ewk_Storage_Origins_Get_Cb callback, void *user_data); + +#ifdef __cplusplus +} +#endif +#endif // ewk_storage_manager_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_storage_manager_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_storage_manager_private.h new file mode 100644 index 000000000..5eeea4913 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_storage_manager_private.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2012 Samsung Electronics. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR + * 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_storage_manager_private_h +#define ewk_storage_manager_private_h + +#include "WKKeyValueStorageManager.h" +#include "WKRetainPtr.h" +#include "ewk_security_origin_private.h" +#include <WebKit2/WKBase.h> +#include <wtf/PassOwnPtr.h> + +class Ewk_Storage_Manager { +public: + static PassOwnPtr<Ewk_Storage_Manager> create(WKKeyValueStorageManagerRef wkStorageManagerRef) + { + return adoptPtr(new Ewk_Storage_Manager(wkStorageManagerRef)); + } + + Eina_List* createOriginList(WKArrayRef wkList) const; + void getStorageOrigins(void* context, WKKeyValueStorageManagerGetKeyValueStorageOriginsFunction callback) const; + +private: + explicit Ewk_Storage_Manager(WKKeyValueStorageManagerRef wkStorageManagerRef); + + WKRetainPtr<WKKeyValueStorageManagerRef> m_wkStorageManager; + mutable HashMap<WKSecurityOriginRef, RefPtr<Ewk_Security_Origin> > m_wrapperCache; +}; + +#endif // ewk_storage_manager_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_text_checker.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_text_checker.cpp index 525d6d4db..e15b8fc1a 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_text_checker.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_text_checker.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2012 Samsung Electronics + * Copyright (C) 2012 Intel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,38 +29,149 @@ #if ENABLE(SPELLCHECK) +#include "TextCheckerEnchant.h" +#include "WKAPICast.h" +#include "WKMutableArray.h" +#include "WKRetainPtr.h" +#include "WKString.h" #include "WKTextChecker.h" -#include "WebKitTextChecker.h" +#include "WebPageProxy.h" +#include "WebString.h" +#include "ewk_settings.h" #include "ewk_text_checker_private.h" +#include <Eina.h> +#include <wtf/OwnPtr.h> +#include <wtf/text/CString.h> +using namespace WebCore; using namespace WebKit; -// Initializes the client's functions to @c 0 to be sure that they are not defined. -static Ewk_Text_Checker ewkTextCheckerCallbacks = { - 0, // unique_spell_document_tag_get - 0, // unique_spell_document_tag_close - 0, // string_spelling_check - 0, // word_guesses_get - 0, // word_learn - 0 // word_ignore +/** + * @brief Structure to store client callback functions. + * + * @internal + */ +struct ClientCallbacks { + Ewk_Text_Checker_Unique_Spell_Document_Tag_Get_Cb unique_spell_document_tag_get; + Ewk_Text_Checker_Unique_Spell_Document_Tag_Close_Cb unique_spell_document_tag_close; + Ewk_Text_Checker_String_Spelling_Check_Cb string_spelling_check; + Ewk_Text_Checker_Word_Guesses_Get_Cb word_guesses_get; + Ewk_Text_Checker_Word_Learn_Cb word_learn; + Ewk_Text_Checker_Word_Ignore_Cb word_ignore; }; -#define EWK_TEXT_CHECKER_CALLBACK_SET(TYPE_NAME, NAME) \ -void ewk_text_checker_##NAME##_cb_set(TYPE_NAME cb) \ -{ \ - ewkTextCheckerCallbacks.NAME = cb; \ +static inline TextCheckerEnchant* textCheckerEnchant() +{ + static OwnPtr<TextCheckerEnchant> textCheckerEnchant = TextCheckerEnchant::create(); + return textCheckerEnchant.get(); +} + +static inline ClientCallbacks& clientCallbacks() +{ + DEFINE_STATIC_LOCAL(ClientCallbacks, clientCallbacks, ()); + return clientCallbacks; +} + +static bool isContinuousSpellCheckingEnabled(const void*) +{ + return ewk_settings_continuous_spell_checking_enabled_get(); +} + +static void setContinuousSpellCheckingEnabled(bool enabled, const void*) +{ + ewk_settings_continuous_spell_checking_enabled_set(enabled); +} + +static uint64_t uniqueSpellDocumentTag(WKPageRef page, const void*) +{ + if (clientCallbacks().unique_spell_document_tag_get) + return clientCallbacks().unique_spell_document_tag_get(toImpl(page)->viewWidget()); + + return 0; +} + +static void closeSpellDocumentWithTag(uint64_t tag, const void*) +{ + if (clientCallbacks().unique_spell_document_tag_close) + clientCallbacks().unique_spell_document_tag_close(tag); +} + +static void checkSpellingOfString(uint64_t tag, WKStringRef text, int32_t* misspellingLocation, int32_t* misspellingLength, const void*) +{ + if (clientCallbacks().string_spelling_check) + clientCallbacks().string_spelling_check(tag, toImpl(text)->string().utf8().data(), misspellingLocation, misspellingLength); + else + textCheckerEnchant()->checkSpellingOfString(toImpl(text)->string(), *misspellingLocation, *misspellingLength); +} + +static WKArrayRef guessesForWord(uint64_t tag, WKStringRef word, const void*) +{ + WKMutableArrayRef suggestionsForWord = WKMutableArrayCreate(); + + if (clientCallbacks().word_guesses_get) { + Eina_List* list = clientCallbacks().word_guesses_get(tag, toImpl(word)->string().utf8().data()); + void* item; + + EINA_LIST_FREE(list, item) { + WKRetainPtr<WKStringRef> suggestion(AdoptWK, WKStringCreateWithUTF8CString(static_cast<const char*>(item))); + WKArrayAppendItem(suggestionsForWord, suggestion.get()); + free(item); + } + } else { + const Vector<String>& guesses = textCheckerEnchant()->getGuessesForWord(toImpl(word)->string()); + size_t numberOfGuesses = guesses.size(); + for (size_t i = 0; i < numberOfGuesses; ++i) { + WKRetainPtr<WKStringRef> suggestion(AdoptWK, WKStringCreateWithUTF8CString(guesses[i].utf8().data())); + WKArrayAppendItem(suggestionsForWord, suggestion.get()); + } + } + + return suggestionsForWord; +} + +static void learnWord(uint64_t tag, WKStringRef word, const void*) +{ + if (clientCallbacks().word_learn) + clientCallbacks().word_learn(tag, toImpl(word)->string().utf8().data()); + else + textCheckerEnchant()->learnWord(toImpl(word)->string()); +} + +static void ignoreWord(uint64_t tag, WKStringRef word, const void*) +{ + if (clientCallbacks().word_ignore) + clientCallbacks().word_ignore(tag, toImpl(word)->string().utf8().data()); + else + textCheckerEnchant()->ignoreWord(toImpl(word)->string()); +} + +namespace Ewk_Text_Checker { + +Vector<String> availableSpellCheckingLanguages() +{ + return textCheckerEnchant()->availableSpellCheckingLanguages(); +} + +void updateSpellCheckingLanguages(const Vector<String>& languages) +{ + textCheckerEnchant()->updateSpellCheckingLanguages(languages); +} + +Vector<String> loadedSpellCheckingLanguages() +{ + return textCheckerEnchant()->loadedSpellCheckingLanguages(); } /** - * Attaches spellchecker feature. + * Initializes spellcheck feature. * * @internal * - * The default spellchecker feature is based on Enchant library. - * Client may use own implementation of spellchecker previously set + * The default spellcheck feature is based on Enchant library. + * Client may use own spellcheck implementation previously set * through the callback functions. */ -void ewk_text_checker_client_attach() +void initialize() { static bool didInitializeTextCheckerClient = false; if (didInitializeTextCheckerClient) @@ -90,21 +202,12 @@ void ewk_text_checker_client_attach() didInitializeTextCheckerClient = true; } -/* - * Gets the client's callbacks. - * - * @internal - * - * The client't callbacks are not defined by default. - * If the client hasn't set the callback, the corresponding callback will - * return @c 0 and the default WebKit implementation will be used for this - * functionality. - * - * @return the struct with the client's callbacks. - */ -Ewk_Text_Checker* ewk_text_checker_callbacks_get() -{ - return &ewkTextCheckerCallbacks; +} // namespace Ewk_Text_Checker + +#define EWK_TEXT_CHECKER_CALLBACK_SET(TYPE_NAME, NAME) \ +void ewk_text_checker_##NAME##_cb_set(TYPE_NAME cb) \ +{ \ + clientCallbacks().NAME = cb; \ } #else diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_text_checker_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_text_checker_private.h index e74810613..462d314f4 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_text_checker_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_text_checker_private.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2012 Samsung Electronics + * Copyright (C) 2012 Intel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,24 +31,16 @@ #include "ewk_text_checker.h" -/** - * @brief Structure keeps client's callback functions. - * - * @internal - */ -struct Ewk_Text_Checker { - Ewk_Text_Checker_Unique_Spell_Document_Tag_Get_Cb unique_spell_document_tag_get; - Ewk_Text_Checker_Unique_Spell_Document_Tag_Close_Cb unique_spell_document_tag_close; - Ewk_Text_Checker_String_Spelling_Check_Cb string_spelling_check; - Ewk_Text_Checker_Word_Guesses_Get_Cb word_guesses_get; - Ewk_Text_Checker_Word_Learn_Cb word_learn; - Ewk_Text_Checker_Word_Ignore_Cb word_ignore; -}; - -Ewk_Text_Checker* ewk_text_checker_callbacks_get(); - -// Makes it visible for WTR. -EAPI void ewk_text_checker_client_attach(); +namespace Ewk_Text_Checker { + +void initialize(); + +// Enchant helpers. +Vector<String> availableSpellCheckingLanguages(); +void updateSpellCheckingLanguages(const Vector<String>& languages); +Vector<String> loadedSpellCheckingLanguages(); + +} #endif // ENABLE(SPELLCHECK) #endif // ewk_text_checker_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp index 55a6801ab..879791a59 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp @@ -30,59 +30,44 @@ using namespace WebKit; -Ewk_Url_Request::Ewk_Url_Request(WKURLRequestRef requestRef) +EwkUrlRequest::EwkUrlRequest(WKURLRequestRef requestRef) : m_url(AdoptWK, WKURLRequestCopyURL(requestRef)) , m_firstParty(AdoptWK, WKURLRequestCopyFirstPartyForCookies(requestRef)) , m_httpMethod(AdoptWK, WKURLRequestCopyHTTPMethod(requestRef)) { } -const char* Ewk_Url_Request::url() const +const char* EwkUrlRequest::url() const { return m_url; } -const char* Ewk_Url_Request::firstParty() const +const char* EwkUrlRequest::firstParty() const { return m_firstParty; } -const char* Ewk_Url_Request::httpMethod() const +const char* EwkUrlRequest::httpMethod() const { return m_httpMethod; } -Ewk_Url_Request* ewk_url_request_ref(Ewk_Url_Request* request) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0); - request->ref(); - - return request; -} - -void ewk_url_request_unref(Ewk_Url_Request* request) -{ - EINA_SAFETY_ON_NULL_RETURN(request); - - request->deref(); -} - const char* ewk_url_request_url_get(const Ewk_Url_Request* request) { - EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkUrlRequest, request, impl, 0); - return request->url(); + return impl->url(); } const char* ewk_request_cookies_first_party_get(const Ewk_Url_Request* request) { - EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkUrlRequest, request, impl, 0); - return request->firstParty(); + return impl->firstParty(); } const char* ewk_url_request_http_method_get(const Ewk_Url_Request* request) { - EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkUrlRequest, request, impl, 0); - return request->httpMethod(); + return impl->httpMethod(); } diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_request.h b/Source/WebKit2/UIProcess/API/efl/ewk_url_request.h index 987bd8f05..e696dc83d 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_url_request.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_request.h @@ -37,26 +37,12 @@ extern "C" { #endif -/** Creates a type name for Ewk_Url_Request */ -typedef struct Ewk_Url_Request Ewk_Url_Request; - /** - * Increases the reference count of the given object. - * - * @param request the URL request object to increase the reference count - * - * @return a pointer to the object on success, @c NULL otherwise. - */ -EAPI Ewk_Url_Request *ewk_url_request_ref(Ewk_Url_Request *request); - -/** - * Decreases the reference count of the given object, possibly freeing it. - * - * When the reference count reaches 0, the URL request is freed. + * Declare Ewk_Url_Request as Ewk_Object. * - * @param request the URL request object to decrease the reference count + * @see Ewk_Object */ -EAPI void ewk_url_request_unref(Ewk_Url_Request *request); +typedef struct Ewk_Object Ewk_Url_Request; /** * Query URL for this request. diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_request_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_url_request_private.h index 31a1bea4e..e9911054b 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_url_request_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_request_private.h @@ -30,17 +30,20 @@ #include "WKURL.h" #include "WKURLRequest.h" #include "WebURLRequest.h" +#include "ewk_object_private.h" #include <wtf/PassRefPtr.h> /** - * \struct Ewk_Url_Request + * \struct EwkUrlRequest * @brief Contains the URL request data. */ -class Ewk_Url_Request : public RefCounted<Ewk_Url_Request> { +class EwkUrlRequest : public Ewk_Object { public: - static PassRefPtr<Ewk_Url_Request> create(WKURLRequestRef requestRef) + EWK_OBJECT_DECLARE(EwkUrlRequest) + + static PassRefPtr<EwkUrlRequest> create(WKURLRequestRef requestRef) { - return adoptRef(new Ewk_Url_Request(requestRef)); + return adoptRef(new EwkUrlRequest(requestRef)); } const char* url() const; @@ -48,7 +51,7 @@ public: const char* httpMethod() const; private: - explicit Ewk_Url_Request(WKURLRequestRef requestRef); + explicit EwkUrlRequest(WKURLRequestRef requestRef); WKEinaSharedString m_url; WKEinaSharedString m_firstParty; diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp index 04e176b84..6d5b87652 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp @@ -31,71 +31,56 @@ using namespace WebKit; -Ewk_Url_Response::Ewk_Url_Response(const WebCore::ResourceResponse& coreResponse) +EwkUrlResponse::EwkUrlResponse(const WebCore::ResourceResponse& coreResponse) : m_coreResponse(coreResponse) , m_url(AdoptWK, WKURLResponseCopyURL(WebKit::toAPI(coreResponse))) , m_mimeType(AdoptWK, WKURLResponseCopyMIMEType(WebKit::toAPI(coreResponse))) { } -int Ewk_Url_Response::httpStatusCode() const +int EwkUrlResponse::httpStatusCode() const { return m_coreResponse.httpStatusCode(); } -const char* Ewk_Url_Response::url() const +const char* EwkUrlResponse::url() const { return m_url; } -const char* Ewk_Url_Response::mimeType() const +const char* EwkUrlResponse::mimeType() const { return m_mimeType; } -unsigned long Ewk_Url_Response::contentLength() const +unsigned long EwkUrlResponse::contentLength() const { return m_coreResponse.expectedContentLength(); } -Ewk_Url_Response* ewk_url_response_ref(Ewk_Url_Response* response) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(response, 0); - response->ref(); - - return response; -} - -void ewk_url_response_unref(Ewk_Url_Response* response) -{ - EINA_SAFETY_ON_NULL_RETURN(response); - - response->deref(); -} - const char* ewk_url_response_url_get(const Ewk_Url_Response* response) { - EINA_SAFETY_ON_NULL_RETURN_VAL(response, 0); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkUrlResponse, response, impl, 0); - return response->url(); + return impl->url(); } int ewk_url_response_status_code_get(const Ewk_Url_Response* response) { - EINA_SAFETY_ON_NULL_RETURN_VAL(response, 0); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkUrlResponse, response, impl, 0); - return response->httpStatusCode(); + return impl->httpStatusCode(); } const char* ewk_url_response_mime_type_get(const Ewk_Url_Response* response) { - EINA_SAFETY_ON_NULL_RETURN_VAL(response, 0); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkUrlResponse, response, impl, 0); - return response->mimeType(); + return impl->mimeType(); } unsigned long ewk_url_response_content_length_get(const Ewk_Url_Response* response) { - EINA_SAFETY_ON_NULL_RETURN_VAL(response, 0); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkUrlResponse, response, impl, 0); - return response->contentLength(); + return impl->contentLength(); } diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_response.h b/Source/WebKit2/UIProcess/API/efl/ewk_url_response.h index cad8e0f76..2f34171ee 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_url_response.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_response.h @@ -37,26 +37,12 @@ extern "C" { #endif -/** Creates a type name for Ewk_Url_Response */ -typedef struct Ewk_Url_Response Ewk_Url_Response; - /** - * Increases the reference count of the given object. - * - * @param response the URL response object to increase the reference count - * - * @return a pointer to the object on success, @c NULL otherwise. - */ -EAPI Ewk_Url_Response *ewk_url_response_ref(Ewk_Url_Response *response); - -/** - * Decreases the reference count of the given object, possibly freeing it. - * - * When the reference count reaches 0, the URL response is freed. + * Declare Ewk_Url_Response as Ewk_Object. * - * @param response the URL response object to decrease the reference count + * @see Ewk_Object */ -EAPI void ewk_url_response_unref(Ewk_Url_Response *response); +typedef struct Ewk_Object Ewk_Url_Response; /** * Query URL for this response. diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_response_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_url_response_private.h index 2d918a8fb..fc512d127 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_url_response_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_response_private.h @@ -29,21 +29,24 @@ #include "WKAPICast.h" #include "WKEinaSharedString.h" #include "WKURLResponse.h" +#include "ewk_object_private.h" #include <WebCore/ResourceResponse.h> #include <wtf/PassRefPtr.h> /** - * \struct Ewk_Url_Response + * \struct EwkUrlResponse * @brief Contains the URL response data. */ -class Ewk_Url_Response : public RefCounted<Ewk_Url_Response> { +class EwkUrlResponse : public Ewk_Object { public: - static PassRefPtr<Ewk_Url_Response> create(WKURLResponseRef wkResponse) + EWK_OBJECT_DECLARE(EwkUrlResponse) + + static PassRefPtr<EwkUrlResponse> create(WKURLResponseRef wkResponse) { if (!wkResponse) return 0; - return adoptRef(new Ewk_Url_Response(WebKit::toImpl(wkResponse)->resourceResponse())); + return adoptRef(new EwkUrlResponse(WebKit::toImpl(wkResponse)->resourceResponse())); } int httpStatusCode() const; @@ -52,7 +55,7 @@ public: unsigned long contentLength() const; private: - explicit Ewk_Url_Response(const WebCore::ResourceResponse& coreResponse); + explicit EwkUrlResponse(const WebCore::ResourceResponse& coreResponse); WebCore::ResourceResponse m_coreResponse; WKEinaSharedString m_url; diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.cpp index 04d9118d6..889173088 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.cpp @@ -33,7 +33,7 @@ using namespace WebKit; -Ewk_Url_Scheme_Request::Ewk_Url_Scheme_Request(WKSoupRequestManagerRef manager, WKURLRef url, uint64_t requestID) +EwkUrlSchemeRequest::EwkUrlSchemeRequest(WKSoupRequestManagerRef manager, WKURLRef url, uint64_t requestID) : m_wkRequestManager(manager) , m_url(url) , m_requestID(requestID) @@ -43,27 +43,27 @@ Ewk_Url_Scheme_Request::Ewk_Url_Scheme_Request(WKSoupRequestManagerRef manager, m_path = soupURI->path; } -uint64_t Ewk_Url_Scheme_Request::id() const +uint64_t EwkUrlSchemeRequest::id() const { return m_requestID; } -const char* Ewk_Url_Scheme_Request::url() const +const char* EwkUrlSchemeRequest::url() const { return m_url; } -const char* Ewk_Url_Scheme_Request::scheme() const +const char* EwkUrlSchemeRequest::scheme() const { return m_scheme; } -const char* Ewk_Url_Scheme_Request::path() const +const char* EwkUrlSchemeRequest::path() const { return m_path; } -void Ewk_Url_Scheme_Request::finish(const void* contentData, uint64_t contentLength, const char* mimeType) +void EwkUrlSchemeRequest::finish(const void* contentData, uint64_t contentLength, const char* mimeType) { WKRetainPtr<WKDataRef> wkData(AdoptWK, WKDataCreate(contentLength ? reinterpret_cast<const unsigned char*>(contentData) : 0, contentLength)); WKRetainPtr<WKStringRef> wkMimeType = mimeType ? adoptWK(WKStringCreateWithUTF8CString(mimeType)) : 0; @@ -72,47 +72,32 @@ void Ewk_Url_Scheme_Request::finish(const void* contentData, uint64_t contentLen WKSoupRequestManagerDidHandleURIRequest(m_wkRequestManager.get(), wkData.get(), contentLength, wkMimeType.get(), m_requestID); } -Ewk_Url_Scheme_Request* ewk_url_scheme_request_ref(Ewk_Url_Scheme_Request* request) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0); - request->ref(); - - return request; -} - -void ewk_url_scheme_request_unref(Ewk_Url_Scheme_Request* request) -{ - EINA_SAFETY_ON_NULL_RETURN(request); - - request->deref(); -} - const char* ewk_url_scheme_request_scheme_get(const Ewk_Url_Scheme_Request* request) { - EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkUrlSchemeRequest, request, impl, 0); - return request->scheme(); + return impl->scheme(); } const char* ewk_url_scheme_request_url_get(const Ewk_Url_Scheme_Request* request) { - EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkUrlSchemeRequest, request, impl, 0); - return request->url(); + return impl->url(); } const char* ewk_url_scheme_request_path_get(const Ewk_Url_Scheme_Request* request) { - EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0); + EWK_OBJ_GET_IMPL_OR_RETURN(const EwkUrlSchemeRequest, request, impl, 0); - return request->path(); + return impl->path(); } Eina_Bool ewk_url_scheme_request_finish(Ewk_Url_Scheme_Request* request, const void* contentData, uint64_t contentLength, const char* mimeType) { - EINA_SAFETY_ON_NULL_RETURN_VAL(request, false); + EWK_OBJ_GET_IMPL_OR_RETURN(EwkUrlSchemeRequest, request, impl, false); - request->finish(contentData, contentLength, mimeType); + impl->finish(contentData, contentLength, mimeType); return true; } diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.h b/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.h index ce01afc31..62b72158b 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.h @@ -37,26 +37,12 @@ extern "C" { #endif -/** Creates a type name for Ewk_Url_Scheme_Request */ -typedef struct Ewk_Url_Scheme_Request Ewk_Url_Scheme_Request; - /** - * Increases the reference count of the given object. - * - * @param request the URL scheme request object to increase the reference count - * - * @return a pointer to the object on success, @c NULL otherwise. - */ -EAPI Ewk_Url_Scheme_Request *ewk_url_scheme_request_ref(Ewk_Url_Scheme_Request *request); - -/** - * Decreases the reference count of the given object, possibly freeing it. - * - * When the reference count it's reached 0, the URL scheme request is freed. + * Declare Ewk_Url_Scheme_Request as Ewk_Object. * - * @param request the URL request object to decrease the reference count + * @see Ewk_Object */ -EAPI void ewk_url_scheme_request_unref(Ewk_Url_Scheme_Request *request); +typedef struct Ewk_Object Ewk_Url_Scheme_Request; /** * Query the URL scheme for this request. diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request_private.h index 30fd6f514..65fc9f94a 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request_private.h @@ -31,18 +31,21 @@ #include "WKEinaSharedString.h" #include "WKRetainPtr.h" #include "WKSoupRequestManager.h" +#include "ewk_object_private.h" /** - * \struct Ewk_Url_Scheme_Request + * \struct EwkUrlSchemeRequest * @brief Contains the URL scheme request data. */ -struct Ewk_Url_Scheme_Request : public RefCounted<Ewk_Url_Scheme_Request> { - static PassRefPtr<Ewk_Url_Scheme_Request> create(WKSoupRequestManagerRef manager, WKURLRef url, uint64_t requestID) +class EwkUrlSchemeRequest : public Ewk_Object { +public: + EWK_OBJECT_DECLARE(EwkUrlSchemeRequest) + static PassRefPtr<EwkUrlSchemeRequest> create(WKSoupRequestManagerRef manager, WKURLRef url, uint64_t requestID) { if (!manager || !url) return 0; - return adoptRef(new Ewk_Url_Scheme_Request(manager, url, requestID)); + return adoptRef(new EwkUrlSchemeRequest(manager, url, requestID)); } uint64_t id() const; @@ -53,7 +56,7 @@ struct Ewk_Url_Scheme_Request : public RefCounted<Ewk_Url_Scheme_Request> { void finish(const void* contentData, uint64_t contentLength, const char* mimeType); private: - Ewk_Url_Scheme_Request(WKSoupRequestManagerRef manager, WKURLRef urlRef, uint64_t requestID); + EwkUrlSchemeRequest(WKSoupRequestManagerRef manager, WKURLRef urlRef, uint64_t requestID); WKRetainPtr<WKSoupRequestManagerRef> m_wkRequestManager; WKEinaSharedString m_url; diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp index e77751934..429185cef 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp @@ -21,61 +21,44 @@ #include "config.h" #include "ewk_view.h" +#include "EwkViewImpl.h" +#include "FindClientEfl.h" +#include "FormClientEfl.h" +#include "InputMethodContextEfl.h" #include "NativeWebKeyboardEvent.h" #include "NativeWebMouseEvent.h" #include "NativeWebWheelEvent.h" -#include "PageClientImpl.h" +#include "PageClientBase.h" #include "PageLoadClientEfl.h" -#include "RefPtrEfl.h" +#include "PagePolicyClientEfl.h" +#include "PageUIClientEfl.h" #include "ResourceLoadClientEfl.h" #include "WKAPICast.h" -#include "WKColorPickerResultListener.h" #include "WKEinaSharedString.h" #include "WKFindOptions.h" #include "WKRetainPtr.h" #include "WKString.h" -#include "WKURL.h" #include "WebContext.h" #include "WebPageGroup.h" -#include "WebPopupItem.h" -#include "WebPopupMenuProxyEfl.h" #include "WebPreferences.h" #include "ewk_back_forward_list_private.h" #include "ewk_context.h" #include "ewk_context_private.h" #include "ewk_favicon_database_private.h" #include "ewk_intent_private.h" -#include "ewk_popup_menu_item.h" -#include "ewk_popup_menu_item_private.h" #include "ewk_private.h" -#include "ewk_resource.h" -#include "ewk_resource_private.h" #include "ewk_settings_private.h" -#include "ewk_view_find_client_private.h" -#include "ewk_view_form_client_private.h" -#include "ewk_view_policy_client_private.h" #include "ewk_view_private.h" -#include "ewk_view_ui_client_private.h" #include <Ecore_Evas.h> -#include <Edje.h> -#include <WebCore/Cursor.h> -#include <WebCore/EflScreenUtilities.h> #include <WebKit2/WKPageGroup.h> #include <wtf/text/CString.h> -#if ENABLE(FULLSCREEN_API) -#include "WebFullScreenManagerProxy.h" -#endif - #if ENABLE(INSPECTOR) #include "WebInspectorProxy.h" #endif -#if USE(ACCELERATED_COMPOSITING) -#include <Evas_GL.h> -#endif - -#if USE(COORDINATED_GRAPHICS) +#if USE(TILED_BACKING_STORE) +#include "PageViewportController.h" #include "PageViewportControllerClientEfl.h" #endif @@ -84,104 +67,14 @@ using namespace WebCore; static const char EWK_VIEW_TYPE_STR[] = "EWK2_View"; -static const int defaultCursorSize = 16; - -static void _ewk_view_on_favicon_changed(const char* pageURL, void* eventInfo); - -typedef HashMap<const WebPageProxy*, const Evas_Object*> PageViewMap; - -static inline PageViewMap& pageViewMap() -{ - DEFINE_STATIC_LOCAL(PageViewMap, map, ()); - return map; -} - -static inline void addToPageViewMap(const Evas_Object* ewkView) -{ - ASSERT(ewkView); - ASSERT(ewk_view_page_get(ewkView)); - PageViewMap::AddResult result = pageViewMap().add(ewk_view_page_get(ewkView), ewkView); - ASSERT_UNUSED(result, result.isNewEntry); -} - -static inline void removeFromPageViewMap(const Evas_Object* ewkView) -{ - ASSERT(ewkView); - ASSERT(ewk_view_page_get(ewkView)); - ASSERT(pageViewMap().contains(ewk_view_page_get(ewkView))); - pageViewMap().remove(ewk_view_page_get(ewkView)); -} - -struct Ewk_View_Private_Data { - OwnPtr<PageClientImpl> pageClient; -#if USE(COORDINATED_GRAPHICS) - OwnPtr<PageViewportControllerClientEfl> pageViewportControllerClient; -#endif - RefPtr<WebPageProxy> pageProxy; - OwnPtr<PageLoadClientEfl> pageLoadClient; - OwnPtr<ResourceLoadClientEfl> resourceLoadClient; - - WKEinaSharedString url; - WKEinaSharedString title; - WKEinaSharedString theme; - WKEinaSharedString customEncoding; - WKEinaSharedString cursorGroup; - WKEinaSharedString faviconURL; - RefPtr<Evas_Object> cursorObject; - OwnPtr<Ewk_Back_Forward_List> backForwardList; - OwnPtr<Ewk_Settings> settings; - bool areMouseEventsEnabled; - WKRetainPtr<WKColorPickerResultListenerRef> colorPickerResultListener; - RefPtr<Ewk_Context> context; -#if ENABLE(TOUCH_EVENTS) - bool areTouchEventsEnabled; -#endif - - WebPopupMenuProxyEfl* popupMenuProxy; - Eina_List* popupMenuItems; - -#ifdef HAVE_ECORE_X - bool isUsingEcoreX; -#endif - -#if USE(ACCELERATED_COMPOSITING) - Evas_GL* evasGl; - Evas_GL_Context* evasGlContext; - Evas_GL_Surface* evasGlSurface; -#endif - - Ewk_View_Private_Data() - : areMouseEventsEnabled(false) -#if ENABLE(TOUCH_EVENTS) - , areTouchEventsEnabled(false) -#endif - , popupMenuProxy(0) - , popupMenuItems(0) -#ifdef HAVE_ECORE_X - , isUsingEcoreX(false) -#endif -#if USE(ACCELERATED_COMPOSITING) - , evasGl(0) - , evasGlContext(0) - , evasGlSurface(0) -#endif - { } - - ~Ewk_View_Private_Data() - { - /* Unregister icon change callback */ - Ewk_Favicon_Database* iconDatabase = context->faviconDatabase(); - iconDatabase->unwatchChanges(_ewk_view_on_favicon_changed); - - void* item; - EINA_LIST_FREE(popupMenuItems, item) - delete static_cast<Ewk_Popup_Menu_Item*>(item); - } -}; - #define EWK_VIEW_TYPE_CHECK(ewkView, result) \ bool result = true; \ do { \ + if (!ewkView) { \ + EINA_LOG_CRIT("null is not a ewk_view"); \ + result = false; \ + break; \ + } \ const char* _tmp_otype = evas_object_type_get(ewkView); \ const Evas_Smart* _tmp_s = evas_object_smart_smart_get(ewkView); \ if (EINA_UNLIKELY(!_tmp_s)) { \ @@ -189,6 +82,7 @@ struct Ewk_View_Private_Data { ("%p (%s) is not a smart object!", \ ewkView, _tmp_otype ? _tmp_otype : "(null)"); \ result = false; \ + break; \ } \ const Evas_Smart_Class* _tmp_sc = evas_smart_class_get(_tmp_s); \ if (EINA_UNLIKELY(!_tmp_sc)) { \ @@ -196,6 +90,7 @@ struct Ewk_View_Private_Data { ("%p (%s) is not a smart object!", \ ewkView, _tmp_otype ? _tmp_otype : "(null)"); \ result = false; \ + break; \ } \ if (EINA_UNLIKELY(_tmp_sc->data != EWK_VIEW_TYPE_STR)) { \ EINA_LOG_CRIT \ @@ -222,19 +117,28 @@ struct Ewk_View_Private_Data { } \ } while (0) -#define EWK_VIEW_PRIV_GET(smartData, priv) \ - Ewk_View_Private_Data* priv = smartData->priv - -#define EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, ...) \ +#define EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, ...) \ if (!smartData) { \ EINA_LOG_CRIT("smart data is null"); \ return __VA_ARGS__; \ } \ - EWK_VIEW_PRIV_GET(smartData, priv); \ + EwkViewImpl* impl = smartData->priv; \ do { \ - if (!priv) { \ + if (!impl) { \ EINA_LOG_CRIT("no private data for object %p (%s)", \ - smartData->self, evas_object_type_get(smartData->self)); \ + smartData->self, evas_object_type_get(smartData->self)); \ + return __VA_ARGS__; \ + } \ + } while (0) + +#define EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, ...) \ + EwkViewImpl* impl = 0; \ + do { \ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, __VA_ARGS__); \ + impl = smartData->priv; \ + if (!impl) { \ + EINA_LOG_CRIT("no private data for object %p (%s)", \ + smartData->self, evas_object_type_get(smartData->self)); \ return __VA_ARGS__; \ } \ } while (0) @@ -247,83 +151,78 @@ static void _ewk_view_smart_changed(Ewk_View_Smart_Data* smartData) evas_object_smart_changed(smartData->self); } -static void _ewk_view_on_favicon_changed(const char* pageURL, void* eventInfo) -{ - Evas_Object* ewkView = static_cast<Evas_Object*>(eventInfo); - - const char* view_url = ewk_view_url_get(ewkView); - if (!view_url || strcasecmp(view_url, pageURL)) - return; - - ewk_view_update_icon(ewkView); -} - // Default Event Handling. static Eina_Bool _ewk_view_smart_focus_in(Ewk_View_Smart_Data* smartData) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false); - priv->pageProxy->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive); + impl->page()->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive); return true; } static Eina_Bool _ewk_view_smart_focus_out(Ewk_View_Smart_Data* smartData) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false); - priv->pageProxy->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive); + impl->page()->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive); return true; } static Eina_Bool _ewk_view_smart_mouse_wheel(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Wheel* wheelEvent) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false); - Evas_Point position = {smartData->view.x, smartData->view.y}; - priv->pageProxy->handleWheelEvent(NativeWebWheelEvent(wheelEvent, &position)); + impl->page()->handleWheelEvent(NativeWebWheelEvent(wheelEvent, impl->transformFromScene(), impl->transformToScreen())); return true; } static Eina_Bool _ewk_view_smart_mouse_down(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Down* downEvent) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false); - Evas_Point position = {smartData->view.x, smartData->view.y}; - priv->pageProxy->handleMouseEvent(NativeWebMouseEvent(downEvent, &position)); + impl->page()->handleMouseEvent(NativeWebMouseEvent(downEvent, impl->transformFromScene(), impl->transformToScreen())); return true; } static Eina_Bool _ewk_view_smart_mouse_up(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Up* upEvent) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false); + + impl->page()->handleMouseEvent(NativeWebMouseEvent(upEvent, impl->transformFromScene(), impl->transformToScreen())); + + InputMethodContextEfl* inputMethodContext = impl->inputMethodContext(); + if (inputMethodContext) + inputMethodContext->handleMouseUpEvent(upEvent); - Evas_Point position = {smartData->view.x, smartData->view.y}; - priv->pageProxy->handleMouseEvent(NativeWebMouseEvent(upEvent, &position)); return true; } static Eina_Bool _ewk_view_smart_mouse_move(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Move* moveEvent) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false); - Evas_Point position = {smartData->view.x, smartData->view.y}; - priv->pageProxy->handleMouseEvent(NativeWebMouseEvent(moveEvent, &position)); + impl->page()->handleMouseEvent(NativeWebMouseEvent(moveEvent, impl->transformFromScene(), impl->transformToScreen())); return true; } static Eina_Bool _ewk_view_smart_key_down(Ewk_View_Smart_Data* smartData, const Evas_Event_Key_Down* downEvent) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false); + + bool isFiltered = false; + InputMethodContextEfl* inputMethodContext = impl->inputMethodContext(); + if (inputMethodContext) + inputMethodContext->handleKeyDownEvent(downEvent, &isFiltered); - priv->pageProxy->handleKeyboardEvent(NativeWebKeyboardEvent(downEvent)); + impl->page()->handleKeyboardEvent(NativeWebKeyboardEvent(downEvent, isFiltered)); return true; } static Eina_Bool _ewk_view_smart_key_up(Ewk_View_Smart_Data* smartData, const Evas_Event_Key_Up* upEvent) { - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false); - priv->pageProxy->handleKeyboardEvent(NativeWebKeyboardEvent(upEvent)); + impl->page()->handleKeyboardEvent(NativeWebKeyboardEvent(upEvent)); return true; } @@ -353,33 +252,6 @@ static void _ewk_view_on_mouse_wheel(void* data, Evas*, Evas_Object*, void* even smartData->api->mouse_wheel(smartData, wheelEvent); } -static void _ewk_view_on_mouse_down(void* data, Evas*, Evas_Object*, void* eventInfo) -{ - Evas_Event_Mouse_Down* downEvent = static_cast<Evas_Event_Mouse_Down*>(eventInfo); - Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data); - EINA_SAFETY_ON_NULL_RETURN(smartData->api); - EINA_SAFETY_ON_NULL_RETURN(smartData->api->mouse_down); - smartData->api->mouse_down(smartData, downEvent); -} - -static void _ewk_view_on_mouse_up(void* data, Evas*, Evas_Object*, void* eventInfo) -{ - Evas_Event_Mouse_Up* upEvent = static_cast<Evas_Event_Mouse_Up*>(eventInfo); - Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data); - EINA_SAFETY_ON_NULL_RETURN(smartData->api); - EINA_SAFETY_ON_NULL_RETURN(smartData->api->mouse_up); - smartData->api->mouse_up(smartData, upEvent); -} - -static void _ewk_view_on_mouse_move(void* data, Evas*, Evas_Object*, void* eventInfo) -{ - Evas_Event_Mouse_Move* moveEvent = static_cast<Evas_Event_Mouse_Move*>(eventInfo); - Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data); - EINA_SAFETY_ON_NULL_RETURN(smartData->api); - EINA_SAFETY_ON_NULL_RETURN(smartData->api->mouse_move); - smartData->api->mouse_move(smartData, moveEvent); -} - static void _ewk_view_on_key_down(void* data, Evas*, Evas_Object*, void* eventInfo) { Evas_Event_Key_Down* downEvent = static_cast<Evas_Event_Key_Down*>(eventInfo); @@ -401,84 +273,23 @@ static void _ewk_view_on_key_up(void* data, Evas*, Evas_Object*, void* eventInfo static void _ewk_view_on_show(void* data, Evas*, Evas_Object*, void* /*eventInfo*/) { Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - priv->pageProxy->viewStateDidChange(WebPageProxy::ViewIsVisible); + EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl); + impl->page()->viewStateDidChange(WebPageProxy::ViewIsVisible); } static void _ewk_view_on_hide(void* data, Evas*, Evas_Object*, void* /*eventInfo*/) { Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl); // This call may look wrong, but we really need to pass ViewIsVisible here. // viewStateDidChange() itself is responsible for actually setting the visibility to Visible or Hidden // depending on what WebPageProxy::isViewVisible() returns, this simply triggers the process. - priv->pageProxy->viewStateDidChange(WebPageProxy::ViewIsVisible); + impl->page()->viewStateDidChange(WebPageProxy::ViewIsVisible); } -#if ENABLE(TOUCH_EVENTS) -static inline void _ewk_view_feed_touch_event_using_touch_point_list_of_evas(Evas_Object* ewkView, Ewk_Touch_Event_Type type) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - - unsigned count = evas_touch_point_list_count(smartData->base.evas); - if (!count) - return; - - Eina_List* points = 0; - for (unsigned i = 0; i < count; ++i) { - Ewk_Touch_Point* point = new Ewk_Touch_Point; - point->id = evas_touch_point_list_nth_id_get(smartData->base.evas, i); - evas_touch_point_list_nth_xy_get(smartData->base.evas, i, &point->x, &point->y); - point->state = evas_touch_point_list_nth_state_get(smartData->base.evas, i); - points = eina_list_append(points, point); - } - - ewk_view_feed_touch_event(ewkView, type, points, evas_key_modifier_get(smartData->base.evas)); - - void* data; - EINA_LIST_FREE(points, data) - delete static_cast<Ewk_Touch_Point*>(data); -} - -static void _ewk_view_on_touch_down(void* /* data */, Evas* /* canvas */, Evas_Object* ewkView, void* /* eventInfo */) -{ - _ewk_view_feed_touch_event_using_touch_point_list_of_evas(ewkView, EWK_TOUCH_START); -} - -static void _ewk_view_on_touch_up(void* /* data */, Evas* /* canvas */, Evas_Object* ewkView, void* /* eventInfo */) -{ - _ewk_view_feed_touch_event_using_touch_point_list_of_evas(ewkView, EWK_TOUCH_END); -} - -static void _ewk_view_on_touch_move(void* /* data */, Evas* /* canvas */, Evas_Object* ewkView, void* /* eventInfo */) -{ - _ewk_view_feed_touch_event_using_touch_point_list_of_evas(ewkView, EWK_TOUCH_MOVE); -} -#endif - static Evas_Smart_Class g_parentSmartClass = EVAS_SMART_CLASS_INIT_NULL; -static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* smartData) -{ - Ewk_View_Private_Data* priv = new Ewk_View_Private_Data; - if (!priv) { - EINA_LOG_CRIT("could not allocate Ewk_View_Private_Data"); - return 0; - } - -#ifdef HAVE_ECORE_X - priv->isUsingEcoreX = WebCore::isUsingEcoreX(smartData->base.evas); -#endif - - return priv; -} - -static void _ewk_view_priv_del(Ewk_View_Private_Data* priv) -{ - delete priv; -} - static void _ewk_view_smart_add(Evas_Object* ewkView) { const Evas_Smart* smart = evas_object_smart_smart_get(ewkView); @@ -500,13 +311,7 @@ static void _ewk_view_smart_add(Evas_Object* ewkView) g_parentSmartClass.add(ewkView); - smartData->priv = _ewk_view_priv_new(smartData); - if (!smartData->priv) { - EINA_LOG_CRIT("could not allocate Ewk_View_Private_Data"); - evas_object_smart_data_set(ewkView, 0); - free(smartData); - return; - } + smartData->priv = 0; // Create evas_object_image to draw web contents. smartData->image = evas_object_image_add(smartData->base.evas); @@ -515,8 +320,6 @@ static void _ewk_view_smart_add(Evas_Object* ewkView) evas_object_smart_member_add(smartData->image, ewkView); evas_object_show(smartData->image); - ewk_view_mouse_events_enabled_set(ewkView, true); - #define CONNECT(s, c) evas_object_event_callback_add(ewkView, s, c, smartData) CONNECT(EVAS_CALLBACK_FOCUS_IN, _ewk_view_on_focus_in); CONNECT(EVAS_CALLBACK_FOCUS_OUT, _ewk_view_on_focus_out); @@ -530,10 +333,9 @@ static void _ewk_view_smart_add(Evas_Object* ewkView) static void _ewk_view_smart_del(Evas_Object* ewkView) { - removeFromPageViewMap(ewkView); EWK_VIEW_SD_GET(ewkView, smartData); - if (smartData && smartData->priv) - _ewk_view_priv_del(smartData->priv); + if (smartData) + delete smartData->priv; g_parentSmartClass.del(ewkView); } @@ -558,143 +360,42 @@ static void _ewk_view_smart_move(Evas_Object* ewkView, Evas_Coord /*x*/, Evas_Co _ewk_view_smart_changed(smartData); } -IntSize ewk_view_size_get(const Evas_Object* ewkView) -{ - int width, height; - evas_object_geometry_get(ewkView, 0, 0, &width, &height); - return IntSize(width, height); -} - -#if USE(ACCELERATED_COMPOSITING) -static bool ewk_view_create_gl_surface(const Evas_Object* ewkView, const IntSize& viewSize) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - - Evas_GL_Config evasGlConfig = { - EVAS_GL_RGBA_8888, - EVAS_GL_DEPTH_BIT_8, - EVAS_GL_STENCIL_NONE, - EVAS_GL_OPTIONS_NONE, - EVAS_GL_MULTISAMPLE_NONE - }; - - ASSERT(!priv->evasGlSurface); - priv->evasGlSurface = evas_gl_surface_create(priv->evasGl, &evasGlConfig, viewSize.width(), viewSize.height()); - if (!priv->evasGlSurface) - return false; - - Evas_Native_Surface nativeSurface; - evas_gl_native_surface_get(priv->evasGl, priv->evasGlSurface, &nativeSurface); - evas_object_image_native_surface_set(smartData->image, &nativeSurface); - - return true; -} - -bool ewk_view_accelerated_compositing_mode_enter(const Evas_Object* ewkView) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - - if (priv->evasGl) { - EINA_LOG_DOM_WARN(_ewk_log_dom, "Accelerated compositing mode already entered."); - return false; - } - - Evas* evas = evas_object_evas_get(ewkView); - priv->evasGl = evas_gl_new(evas); - if (!priv->evasGl) - return false; - - priv->evasGlContext = evas_gl_context_create(priv->evasGl, 0); - if (!priv->evasGlContext) { - evas_gl_free(priv->evasGl); - priv->evasGl = 0; - return false; - } - - if (!ewk_view_create_gl_surface(ewkView, ewk_view_size_get(ewkView))) { - evas_gl_context_destroy(priv->evasGl, priv->evasGlContext); - priv->evasGlContext = 0; - - evas_gl_free(priv->evasGl); - priv->evasGl = 0; - return false; - } - - priv->pageViewportControllerClient->setRendererActive(true); - return true; -} - -bool ewk_view_accelerated_compositing_mode_exit(const Evas_Object* ewkView) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - - EINA_SAFETY_ON_NULL_RETURN_VAL(priv->evasGl, false); - - if (priv->evasGlSurface) { - evas_gl_surface_destroy(priv->evasGl, priv->evasGlSurface); - priv->evasGlSurface = 0; - } - - if (priv->evasGlContext) { - evas_gl_context_destroy(priv->evasGl, priv->evasGlContext); - priv->evasGlContext = 0; - } - - evas_gl_free(priv->evasGl); - priv->evasGl = 0; - - return true; -} -#endif - static void _ewk_view_smart_calculate(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - -#if USE(ACCELERATED_COMPOSITING) - bool needsNewSurface = false; -#endif + EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl); smartData->changed.any = false; Evas_Coord x, y, width, height; evas_object_geometry_get(ewkView, &x, &y, &width, &height); - if (smartData->changed.size) { -#if USE(COORDINATED_GRAPHICS) - priv->pageViewportControllerClient->updateViewportSize(IntSize(width, height)); -#endif -#if USE(ACCELERATED_COMPOSITING) - needsNewSurface = priv->evasGlSurface; -#endif - - if (priv->pageProxy->drawingArea()) - priv->pageProxy->drawingArea()->setSize(IntSize(width, height), IntSize()); - - smartData->view.w = width; - smartData->view.h = height; - smartData->changed.size = false; - } - if (smartData->changed.position) { - evas_object_move(smartData->image, x, y); + smartData->changed.position = false; smartData->view.x = x; smartData->view.y = y; - smartData->changed.position = false; + evas_object_move(smartData->image, x, y); } + if (smartData->changed.size) { + smartData->changed.size = false; + smartData->view.w = width; + smartData->view.h = height; + + if (impl->page()->drawingArea()) + impl->page()->drawingArea()->setSize(IntSize(width, height), IntSize()); + #if USE(ACCELERATED_COMPOSITING) - if (needsNewSurface) { - evas_gl_surface_destroy(priv->evasGl, priv->evasGlSurface); - priv->evasGlSurface = 0; - ewk_view_create_gl_surface(ewkView, IntSize(width, height)); - ewk_view_display(ewkView, IntRect(IntPoint(), IntSize(width, height))); - } + // Recreate surface if needed. + if (impl->evasGLSurface()) + impl->clearEvasGLSurface(); + + impl->createGLSurface(IntSize(width, height)); #endif +#if USE(TILED_BACKING_STORE) + impl->pageClient()->updateViewportSize(IntSize(width, height)); +#endif + } } static void _ewk_view_smart_show(Evas_Object* ewkView) @@ -717,7 +418,7 @@ static void _ewk_view_smart_hide(Evas_Object* ewkView) static void _ewk_view_smart_color_set(Evas_Object* ewkView, int red, int green, int blue, int alpha) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl); if (alpha < 0) alpha = 0; @@ -735,8 +436,8 @@ static void _ewk_view_smart_color_set(Evas_Object* ewkView, int red, int green, #undef CHECK_COLOR evas_object_image_alpha_set(smartData->image, alpha < 255); - priv->pageProxy->setDrawsBackground(red || green || blue); - priv->pageProxy->setDrawsTransparentBackground(alpha < 255); + impl->page()->setDrawsBackground(red || green || blue); + impl->page()->setDrawsTransparentBackground(alpha < 255); g_parentSmartClass.color_set(ewkView, red, green, blue, alpha); } @@ -780,7 +481,7 @@ Eina_Bool ewk_view_smart_class_set(Ewk_View_Smart_Class* api) return true; } -static inline Evas_Smart* _ewk_view_smart_class_new(void) +static inline Evas_Smart* createEwkViewSmartClass(void) { static Ewk_View_Smart_Class api = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("Ewk_View"); static Evas_Smart* smart = 0; @@ -793,65 +494,14 @@ static inline Evas_Smart* _ewk_view_smart_class_new(void) return smart; } -static void _ewk_view_initialize(Evas_Object* ewkView, PassRefPtr<Ewk_Context> context, WKPageGroupRef pageGroupRef) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - EINA_SAFETY_ON_NULL_RETURN(context); - - if (priv->pageClient) - return; - - priv->pageClient = PageClientImpl::create(ewkView); - - if (pageGroupRef) - priv->pageProxy = toImpl(context->wkContext())->createWebPage(priv->pageClient.get(), toImpl(pageGroupRef)); - else - priv->pageProxy = toImpl(context->wkContext())->createWebPage(priv->pageClient.get(), WebPageGroup::create().get()); - - addToPageViewMap(ewkView); - -#if USE(COORDINATED_GRAPHICS) - priv->pageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(true); - priv->pageProxy->pageGroup()->preferences()->setForceCompositingMode(true); - priv->pageProxy->setUseFixedLayout(true); -#endif - priv->pageProxy->initializeWebPage(); - - priv->backForwardList = Ewk_Back_Forward_List::create(toAPI(priv->pageProxy->backForwardList())); - priv->settings = adoptPtr(new Ewk_Settings(WKPageGroupGetPreferences(WKPageGetPageGroup(toAPI(priv->pageProxy.get()))))); - priv->context = context; - -#if USE(COORDINATED_GRAPHICS) - priv->pageViewportControllerClient = PageViewportControllerClientEfl::create(ewkView); -#endif - - // Initialize page clients. - WKPageRef wkPage = toAPI(priv->pageProxy.get()); - ewk_view_find_client_attach(wkPage, ewkView); - ewk_view_form_client_attach(wkPage, ewkView); - ewk_view_policy_client_attach(wkPage, ewkView); - ewk_view_ui_client_attach(wkPage, ewkView); -#if ENABLE(FULLSCREEN_API) - priv->pageProxy->fullScreenManager()->setWebView(ewkView); - ewk_settings_fullscreen_enabled_set(priv->settings.get(), true); -#endif - priv->pageLoadClient = PageLoadClientEfl::create(ewkView); - priv->resourceLoadClient = ResourceLoadClientEfl::create(ewkView); - - /* Listen for favicon changes */ - Ewk_Favicon_Database* iconDatabase = priv->context->faviconDatabase(); - iconDatabase->watchChanges(IconChangeCallbackData(_ewk_view_on_favicon_changed, ewkView)); -} - -static Evas_Object* _ewk_view_add_with_smart(Evas* canvas, Evas_Smart* smart) +static inline Evas_Object* createEwkView(Evas* canvas, Evas_Smart* smart, PassRefPtr<EwkContext> context, WKPageGroupRef pageGroupRef = 0, EwkViewImpl::ViewBehavior behavior = EwkViewImpl::DefaultBehavior) { EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0); EINA_SAFETY_ON_NULL_RETURN_VAL(smart, 0); + EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0); Evas_Object* ewkView = evas_object_smart_add(canvas, smart); - if (!ewkView) - return 0; + EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, 0); EWK_VIEW_SD_GET(ewkView, smartData); if (!smartData) { @@ -859,12 +509,9 @@ static Evas_Object* _ewk_view_add_with_smart(Evas* canvas, Evas_Smart* smart) return 0; } - EWK_VIEW_PRIV_GET(smartData, priv); - if (!priv) { - evas_object_del(ewkView); - return 0; - } - + ASSERT(!smartData->priv); + RefPtr<WebPageGroup> pageGroup = pageGroupRef ? toImpl(pageGroupRef) : WebPageGroup::create(); + smartData->priv = new EwkViewImpl(ewkView, context, pageGroup, behavior); return ewkView; } @@ -874,36 +521,17 @@ static Evas_Object* _ewk_view_add_with_smart(Evas* canvas, Evas_Smart* smart) */ Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef contextRef, WKPageGroupRef pageGroupRef) { - EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0); - EINA_SAFETY_ON_NULL_RETURN_VAL(contextRef, 0); - Evas_Object* ewkView = _ewk_view_add_with_smart(canvas, _ewk_view_smart_class_new()); - if (!ewkView) - return 0; - - _ewk_view_initialize(ewkView, Ewk_Context::create(contextRef), pageGroupRef); - - return ewkView; + return createEwkView(canvas, createEwkViewSmartClass(), EwkContext::create(contextRef), pageGroupRef, EwkViewImpl::LegacyBehavior); } Evas_Object* ewk_view_smart_add(Evas* canvas, Evas_Smart* smart, Ewk_Context* context) { - EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0); - EINA_SAFETY_ON_NULL_RETURN_VAL(smart, 0); - EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0); - - Evas_Object* ewkView = _ewk_view_add_with_smart(canvas, smart); - if (!ewkView) - return 0; - - _ewk_view_initialize(ewkView, context, 0); - - return ewkView; + return createEwkView(canvas, smart, ewk_object_cast<EwkContext*>(context)); } Evas_Object* ewk_view_add_with_context(Evas* canvas, Ewk_Context* context) { - EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0); - return ewk_view_smart_add(canvas, _ewk_view_smart_class_new(), context); + return ewk_view_smart_add(canvas, createEwkViewSmartClass(), ewk_object_cast<EwkContext*>(context)); } Evas_Object* ewk_view_add(Evas* canvas) @@ -913,470 +541,136 @@ Evas_Object* ewk_view_add(Evas* canvas) Ewk_Context* ewk_view_context_get(const Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0); - return priv->context.get(); -} - -/** - * @internal - * The url of view was changed by the frame loader. - * - * Emits signal: "url,changed" with pointer to new url string. - */ -void ewk_view_url_update(Evas_Object* ewkView) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - String activeURL = priv->pageProxy->activeURL(); - if (activeURL.isEmpty()) - return; - - if (priv->url == activeURL.utf8().data()) - return; - - priv->url = activeURL.utf8().data(); - const char* callbackArgument = static_cast<const char*>(priv->url); - evas_object_smart_callback_call(ewkView, "url,changed", const_cast<char*>(callbackArgument)); - - // Update the view's favicon. - ewk_view_update_icon(ewkView); + return impl->ewkContext(); } Eina_Bool ewk_view_url_set(Evas_Object* ewkView, const char* url) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false); EINA_SAFETY_ON_NULL_RETURN_VAL(url, false); - priv->pageProxy->loadURL(url); - ewk_view_url_update(ewkView); + impl->page()->loadURL(url); + impl->informURLChange(); return true; } const char* ewk_view_url_get(const Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0); - return priv->url; + return impl->url(); } const char *ewk_view_icon_url_get(const Evas_Object *ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0); - return priv->faviconURL; + return impl->faviconURL(); } Eina_Bool ewk_view_reload(Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false); - priv->pageProxy->reload(/*reloadFromOrigin*/ false); - ewk_view_url_update(ewkView); + impl->page()->reload(/*reloadFromOrigin*/ false); + impl->informURLChange(); return true; } Eina_Bool ewk_view_reload_bypass_cache(Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false); - priv->pageProxy->reload(/*reloadFromOrigin*/ true); - ewk_view_url_update(ewkView); + impl->page()->reload(/*reloadFromOrigin*/ true); + impl->informURLChange(); return true; } Eina_Bool ewk_view_stop(Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false); - priv->pageProxy->stopLoading(); + impl->page()->stopLoading(); return true; } Ewk_Settings* ewk_view_settings_get(const Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0); - return priv->settings.get(); -} - -/** - * @internal - * Retrieves the internal WKPage for this view. - */ -WKPageRef ewk_view_wkpage_get(const Evas_Object* ewkView) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); - - return toAPI(priv->pageProxy.get()); -} - -/** - * @internal - * Load was initiated for a resource in the view. - * - * Emits signal: "resource,request,new" with pointer to resource request. - */ -void ewk_view_resource_load_initiated(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Url_Request* request) -{ - Ewk_Resource_Request resourceRequest = {resource, request, 0}; - - evas_object_smart_callback_call(ewkView, "resource,request,new", &resourceRequest); -} - -/** - * @internal - * Received a response to a resource load request in the view. - * - * Emits signal: "resource,request,response" with pointer to resource response. - */ -void ewk_view_resource_load_response(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Url_Response* response) -{ - Ewk_Resource_Load_Response resourceLoadResponse = {resource, response}; - evas_object_smart_callback_call(ewkView, "resource,request,response", &resourceLoadResponse); -} - -/** - * @internal - * Failed loading a resource in the view. - * - * Emits signal: "resource,request,finished" with pointer to the resource load error. - */ -void ewk_view_resource_load_failed(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Error* error) -{ - Ewk_Resource_Load_Error resourceLoadError = {resource, error}; - evas_object_smart_callback_call(ewkView, "resource,request,failed", &resourceLoadError); -} - -/** - * @internal - * Finished loading a resource in the view. - * - * Emits signal: "resource,request,finished" with pointer to the resource. - */ -void ewk_view_resource_load_finished(Evas_Object* ewkView, Ewk_Resource* resource) -{ - evas_object_smart_callback_call(ewkView, "resource,request,finished", resource); -} - -/** - * @internal - * Request was sent for a resource in the view. - * - * Emits signal: "resource,request,sent" with pointer to resource request and possible redirect response. - */ -void ewk_view_resource_request_sent(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Url_Request* request, Ewk_Url_Response* redirectResponse) -{ - Ewk_Resource_Request resourceRequest = {resource, request, redirectResponse}; - evas_object_smart_callback_call(ewkView, "resource,request,sent", &resourceRequest); + return impl->settings(); } const char* ewk_view_title_get(const Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0); - CString title = priv->pageProxy->pageTitle().utf8(); - priv->title = title.data(); - - return priv->title; -} - -/** - * @internal - * Reports that the requested text was found. - * - * Emits signal: "text,found" with the number of matches. - */ -void ewk_view_text_found(Evas_Object* ewkView, unsigned int matchCount) -{ - evas_object_smart_callback_call(ewkView, "text,found", &matchCount); -} - -/** - * @internal - * The view title was changed by the frame loader. - * - * Emits signal: "title,changed" with pointer to new title string. - */ -void ewk_view_title_changed(Evas_Object* ewkView, const char* title) -{ - evas_object_smart_callback_call(ewkView, "title,changed", const_cast<char*>(title)); -} - -/** - * @internal - */ -void ewk_view_tooltip_text_set(Evas_Object* ewkView, const char* text) -{ - if (text && *text) - evas_object_smart_callback_call(ewkView, "tooltip,text,set", const_cast<char*>(text)); - else - evas_object_smart_callback_call(ewkView, "tooltip,text,unset", 0); + return impl->title(); } double ewk_view_load_progress_get(const Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, -1.0); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, -1.0); - return priv->pageProxy->estimatedProgress(); + return impl->page()->estimatedProgress(); } Eina_Bool ewk_view_scale_set(Evas_Object* ewkView, double scaleFactor, int x, int y) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false); - priv->pageProxy->scalePage(scaleFactor, IntPoint(x, y)); + impl->page()->scalePage(scaleFactor, IntPoint(x, y)); return true; } double ewk_view_scale_get(const Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, -1); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, -1); - return priv->pageProxy->pageScaleFactor(); + return impl->page()->pageScaleFactor(); } Eina_Bool ewk_view_device_pixel_ratio_set(Evas_Object* ewkView, float ratio) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false); - priv->pageProxy->setCustomDeviceScaleFactor(ratio); + impl->page()->setCustomDeviceScaleFactor(ratio); return true; } float ewk_view_device_pixel_ratio_get(const Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, -1.0); - - return priv->pageProxy->deviceScaleFactor(); -} - -/** - * @internal - * Reports load progress changed. - * - * Emits signal: "load,progress" with pointer to a double from 0.0 to 1.0. - */ -void ewk_view_load_progress_changed(Evas_Object* ewkView, double progress) -{ - evas_object_smart_callback_call(ewkView, "load,progress", &progress); -} + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, -1.0); -/** - * @internal - * The view received a new intent request. - * - * Emits signal: "intent,request,new" with pointer to a Ewk_Intent. - */ -void ewk_view_intent_request_new(Evas_Object* ewkView, const Ewk_Intent* ewkIntent) -{ -#if ENABLE(WEB_INTENTS) - evas_object_smart_callback_call(ewkView, "intent,request,new", const_cast<Ewk_Intent*>(ewkIntent)); -#endif + return impl->page()->deviceScaleFactor(); } void ewk_view_theme_set(Evas_Object* ewkView, const char* path) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl); - if (priv->theme != path) { - priv->theme = path; - priv->pageProxy->setThemePath(path); - } + impl->setThemePath(path); } const char* ewk_view_theme_get(const Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); - - return priv->theme; -} - -void ewk_view_cursor_set(Evas_Object* ewkView, const Cursor& cursor) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - const char* group = cursor.platformCursor(); - if (!group || group == priv->cursorGroup) - return; - - priv->cursorGroup = group; - priv->cursorObject = adoptRef(edje_object_add(smartData->base.evas)); - - Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(smartData->base.evas); - if (!priv->theme || !edje_object_file_set(priv->cursorObject.get(), priv->theme, group)) { - priv->cursorObject.clear(); - - ecore_evas_object_cursor_set(ecoreEvas, 0, 0, 0, 0); -#ifdef HAVE_ECORE_X - if (priv->isUsingEcoreX) - WebCore::applyFallbackCursor(ecoreEvas, group); -#endif - return; - } - - Evas_Coord width, height; - edje_object_size_min_get(priv->cursorObject.get(), &width, &height); - if (width <= 0 || height <= 0) - edje_object_size_min_calc(priv->cursorObject.get(), &width, &height); - if (width <= 0 || height <= 0) { - width = defaultCursorSize; - height = defaultCursorSize; - } - evas_object_resize(priv->cursorObject.get(), width, height); - - const char* data; - int hotspotX = 0; - data = edje_object_data_get(priv->cursorObject.get(), "hot.x"); - if (data) - hotspotX = atoi(data); - - int hotspotY = 0; - data = edje_object_data_get(priv->cursorObject.get(), "hot.y"); - if (data) - hotspotY = atoi(data); - - ecore_evas_object_cursor_set(ecoreEvas, priv->cursorObject.get(), EVAS_LAYER_MAX, hotspotX, hotspotY); -} - -void ewk_view_display(Evas_Object* ewkView, const IntRect& rect) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - if (!smartData->image) - return; - -#if USE(COORDINATED_GRAPHICS) - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - evas_gl_make_current(priv->evasGl, priv->evasGlSurface, priv->evasGlContext); - priv->pageViewportControllerClient->display(rect, IntPoint(smartData->view.x, smartData->view.y)); -#endif - - evas_object_image_data_update_add(smartData->image, rect.x(), rect.y(), rect.width(), rect.height()); -} - -#if ENABLE(FULLSCREEN_API) -/** - * @internal - * Calls fullscreen_enter callback or falls back to default behavior and enables fullscreen mode. - */ -void ewk_view_full_screen_enter(Evas_Object* ewkView) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - - if (!smartData->api->fullscreen_enter || !smartData->api->fullscreen_enter(smartData)) { - Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(smartData->base.evas); - ecore_evas_fullscreen_set(ecoreEvas, true); - } -} - -/** - * @internal - * Calls fullscreen_exit callback or falls back to default behavior and disables fullscreen mode. - */ -void ewk_view_full_screen_exit(Evas_Object* ewkView) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0); - if (!smartData->api->fullscreen_exit || !smartData->api->fullscreen_exit(smartData)) { - Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(smartData->base.evas); - ecore_evas_fullscreen_set(ecoreEvas, false); - } -} -#endif - -#if ENABLE(SQL_DATABASE) -/** - * @internal - * Calls exceeded_database_quota callback or falls back to default behavior returns default database quota. - */ -unsigned long long ewk_view_database_quota_exceeded(Evas_Object* ewkView, const char* databaseName, const char* displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - - static const unsigned long long defaultQuota = 5 * 1024 * 1204; // 5 MB - if (smartData->api->exceeded_database_quota) - return smartData->api->exceeded_database_quota(smartData, databaseName, displayName, currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage); - - return defaultQuota; -} -#endif - -/** - * @internal - * A download for that view was cancelled. - * - * Emits signal: "download,cancelled" with pointer to a Ewk_Download_Job. - */ -void ewk_view_download_job_cancelled(Evas_Object* ewkView, Ewk_Download_Job* download) -{ - evas_object_smart_callback_call(ewkView, "download,cancelled", download); -} - -/** - * @internal - * A new download has been requested for that view. - * - * Emits signal: "download,request" with pointer to a Ewk_Download_Job. - */ -void ewk_view_download_job_requested(Evas_Object* ewkView, Ewk_Download_Job* download) -{ - evas_object_smart_callback_call(ewkView, "download,request", download); -} - -/** - * @internal - * A download for that view has failed. - * - * Emits signal: "download,failed" with pointer to a Ewk_Download_Job_Error. - */ -void ewk_view_download_job_failed(Evas_Object* ewkView, Ewk_Download_Job* download, Ewk_Error* error) -{ - Ewk_Download_Job_Error downloadError = { download, error }; - evas_object_smart_callback_call(ewkView, "download,failed", &downloadError); -} - -/** - * @internal - * A download for that view finished successfully. - * - * Emits signal: "download,finished" with pointer to a Ewk_Download_Job. - */ -void ewk_view_download_job_finished(Evas_Object* ewkView, Ewk_Download_Job* download) -{ - evas_object_smart_callback_call(ewkView, "download,finished", download); + return impl->themePath(); } Eina_Bool ewk_view_back(Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false); - WebPageProxy* page = priv->pageProxy.get(); + WebPageProxy* page = impl->page(); if (page->canGoBack()) { page->goBack(); return true; @@ -1387,10 +681,9 @@ Eina_Bool ewk_view_back(Evas_Object* ewkView) Eina_Bool ewk_view_forward(Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false); - WebPageProxy* page = priv->pageProxy.get(); + WebPageProxy* page = impl->page(); if (page->canGoForward()) { page->goForward(); return true; @@ -1402,11 +695,10 @@ Eina_Bool ewk_view_forward(Evas_Object* ewkView) Eina_Bool ewk_view_intent_deliver(Evas_Object* ewkView, Ewk_Intent* intent) { #if ENABLE(WEB_INTENTS) - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false); EINA_SAFETY_ON_NULL_RETURN_VAL(intent, false); - WebPageProxy* page = priv->pageProxy.get(); + WebPageProxy* page = impl->page(); page->deliverIntentToFrame(page->mainFrame(), intent->webIntentData()); return true; @@ -1417,245 +709,56 @@ Eina_Bool ewk_view_intent_deliver(Evas_Object* ewkView, Ewk_Intent* intent) Eina_Bool ewk_view_back_possible(Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false); - return priv->pageProxy->canGoBack(); + return impl->page()->canGoBack(); } Eina_Bool ewk_view_forward_possible(Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false); - return priv->pageProxy->canGoForward(); + return impl->page()->canGoForward(); } Ewk_Back_Forward_List* ewk_view_back_forward_list_get(const Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); - - return priv->backForwardList.get(); -} - -void ewk_view_image_data_set(Evas_Object* ewkView, void* imageData, const IntSize& size) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - if (!imageData || !smartData->image) - return; - - evas_object_resize(smartData->image, size.width(), size.height()); - evas_object_image_size_set(smartData->image, size.width(), size.height()); - evas_object_image_data_copy_set(smartData->image, imageData); -} - -/** - * @internal - * Reports that a form request is about to be submitted. - * - * Emits signal: "form,submission,request" with pointer to Ewk_Form_Submission_Request. - */ -void ewk_view_form_submission_request_new(Evas_Object* ewkView, Ewk_Form_Submission_Request* request) -{ - evas_object_smart_callback_call(ewkView, "form,submission,request", request); -} + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0); -/** - * @internal - * Reports load failed with error information. - * - * Emits signal: "load,error" with pointer to Ewk_Error. - */ -void ewk_view_load_error(Evas_Object* ewkView, const Ewk_Error* error) -{ - evas_object_smart_callback_call(ewkView, "load,error", const_cast<Ewk_Error*>(error)); -} - -/** - * @internal - * Reports load finished. - * - * Emits signal: "load,finished". - */ -void ewk_view_load_finished(Evas_Object* ewkView) -{ - ewk_view_url_update(ewkView); - evas_object_smart_callback_call(ewkView, "load,finished", 0); -} - -/** - * @internal - * Reports view provisional load failed with error information. - * - * Emits signal: "load,provisional,failed" with pointer to Ewk_Error. - */ -void ewk_view_load_provisional_failed(Evas_Object* ewkView, const Ewk_Error* error) -{ - evas_object_smart_callback_call(ewkView, "load,provisional,failed", const_cast<Ewk_Error*>(error)); -} - -/** - * @internal - * Reports view received redirect for provisional load. - * - * Emits signal: "load,provisional,redirect". - */ -void ewk_view_load_provisional_redirect(Evas_Object* ewkView) -{ - ewk_view_url_update(ewkView); - evas_object_smart_callback_call(ewkView, "load,provisional,redirect", 0); -} - -/** - * @internal - * Reports view provisional load started. - * - * Emits signal: "load,provisional,started". - */ -void ewk_view_load_provisional_started(Evas_Object* ewkView) -{ - ewk_view_url_update(ewkView); - evas_object_smart_callback_call(ewkView, "load,provisional,started", 0); -} - -/** - * @internal - * Reports that the view's back / forward list has changed. - * - * Emits signal: "back,forward,list,changed". - */ -void ewk_view_back_forward_list_changed(Evas_Object* ewkView) -{ - evas_object_smart_callback_call(ewkView, "back,forward,list,changed", 0); -} - -/** - * @internal - * Update the view's favicon and emits a "icon,changed" signal if it has - * changed. - * - * This function is called whenever the URL has changed or when the icon for - * the current page URL has changed. - */ -void ewk_view_update_icon(Evas_Object* ewkView) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - Ewk_Favicon_Database* iconDatabase = priv->context->faviconDatabase(); - ASSERT(iconDatabase); - - priv->faviconURL = ewk_favicon_database_icon_url_get(iconDatabase, priv->url); - evas_object_smart_callback_call(ewkView, "icon,changed", 0); -} - -/** - * @internal - * Reports that a navigation policy decision should be taken. - * - * Emits signal: "policy,decision,navigation". - */ -void ewk_view_navigation_policy_decision(Evas_Object* ewkView, Ewk_Navigation_Policy_Decision* decision) -{ - evas_object_smart_callback_call(ewkView, "policy,decision,navigation", decision); -} - -/** - * @internal - * Reports that a new window policy decision should be taken. - * - * Emits signal: "policy,decision,new,window". - */ -void ewk_view_new_window_policy_decision(Evas_Object* ewkView, Ewk_Navigation_Policy_Decision* decision) -{ - evas_object_smart_callback_call(ewkView, "policy,decision,new,window", decision); + return impl->backForwardList(); } Eina_Bool ewk_view_html_string_load(Evas_Object* ewkView, const char* html, const char* baseUrl, const char* unreachableUrl) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false); EINA_SAFETY_ON_NULL_RETURN_VAL(html, false); if (unreachableUrl && *unreachableUrl) - priv->pageProxy->loadAlternateHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : "", String::fromUTF8(unreachableUrl)); + impl->page()->loadAlternateHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : "", String::fromUTF8(unreachableUrl)); else - priv->pageProxy->loadHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : ""); - ewk_view_url_update(ewkView); - - return true; -} - -#if ENABLE(WEB_INTENTS_TAG) -/** - * @internal - * The view received a new intent service registration. - * - * Emits signal: "intent,service,register" with pointer to a Ewk_Intent_Service. - */ -void ewk_view_intent_service_register(Evas_Object* ewkView, const Ewk_Intent_Service* ewkIntentService) -{ - evas_object_smart_callback_call(ewkView, "intent,service,register", const_cast<Ewk_Intent_Service*>(ewkIntentService)); -} -#endif // ENABLE(WEB_INTENTS_TAG) - -const Evas_Object* ewk_view_from_page_get(const WebKit::WebPageProxy* page) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(page, 0); + impl->page()->loadHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : ""); - return pageViewMap().get(page); -} - -WebPageProxy* ewk_view_page_get(const Evas_Object* ewkView) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + impl->informURLChange(); - return priv->pageProxy.get(); + return true; } 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); - - String customEncoding = priv->pageProxy->customTextEncodingName(); - if (customEncoding.isEmpty()) - return 0; - - priv->customEncoding = customEncoding.utf8().data(); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0); - return priv->customEncoding; + return impl->customTextEncodingName(); } 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); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false); - priv->customEncoding = encoding; - priv->pageProxy->setCustomTextEncodingName(encoding ? encoding : String()); + impl->setCustomTextEncodingName(encoding ? encoding : String()); return true; } -void ewk_view_page_close(Evas_Object* ewkView) -{ - evas_object_smart_callback_call(ewkView, "close,window", 0); -} - -WKPageRef ewk_view_page_create(Evas_Object* ewkView) -{ - Evas_Object* newEwkView = 0; - evas_object_smart_callback_call(ewkView, "create,window", &newEwkView); - - if (!newEwkView) - return 0; - - return static_cast<WKPageRef>(WKRetain(ewk_view_page_get(newEwkView))); -} - // EwkFindOptions should be matched up orders with WkFindOptions. COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_CASE_INSENSITIVE, kWKFindOptionsCaseInsensitive); COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_AT_WORD_STARTS, kWKFindOptionsAtWordStarts); @@ -1668,258 +771,47 @@ COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_SHOW_HIGHLIGHT, kWKFindOptionsShow Eina_Bool ewk_view_text_find(Evas_Object* ewkView, const char* text, Ewk_Find_Options options, unsigned maxMatchCount) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false); EINA_SAFETY_ON_NULL_RETURN_VAL(text, false); - priv->pageProxy->findString(String::fromUTF8(text), static_cast<WebKit::FindOptions>(options), maxMatchCount); + impl->page()->findString(String::fromUTF8(text), static_cast<WebKit::FindOptions>(options), maxMatchCount); return true; } Eina_Bool ewk_view_text_find_highlight_clear(Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false); - priv->pageProxy->hideFindUI(); + impl->page()->hideFindUI(); return true; } Eina_Bool ewk_view_text_matches_count(Evas_Object* ewkView, const char* text, Ewk_Find_Options options, unsigned maxMatchCount) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false); EINA_SAFETY_ON_NULL_RETURN_VAL(text, false); - priv->pageProxy->countStringMatches(String::fromUTF8(text), static_cast<WebKit::FindOptions>(options), maxMatchCount); - - return true; -} - -void ewk_view_contents_size_changed(const Evas_Object* ewkView, const IntSize& size) -{ -#if USE(COORDINATED_GRAPHICS) - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - priv->pageViewportControllerClient->didChangeContentsSize(size); -#else - UNUSED_PARAM(ewkView); - UNUSED_PARAM(size); -#endif -} - -COMPILE_ASSERT_MATCHING_ENUM(EWK_TEXT_DIRECTION_RIGHT_TO_LEFT, RTL); -COMPILE_ASSERT_MATCHING_ENUM(EWK_TEXT_DIRECTION_LEFT_TO_RIGHT, LTR); - -void ewk_view_popup_menu_request(Evas_Object* ewkView, WebPopupMenuProxyEfl* popupMenu, const IntRect& rect, TextDirection textDirection, double pageScaleFactor, const Vector<WebPopupItem>& items, int32_t selectedIndex) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - EINA_SAFETY_ON_NULL_RETURN(smartData->api); - - ASSERT(popupMenu); - - if (!smartData->api->popup_menu_show) - return; - - if (priv->popupMenuProxy) - ewk_view_popup_menu_close(ewkView); - priv->popupMenuProxy = popupMenu; - - Eina_List* popupItems = 0; - size_t size = items.size(); - for (size_t i = 0; i < size; ++i) - popupItems = eina_list_append(popupItems, Ewk_Popup_Menu_Item::create(items[i]).leakPtr()); - priv->popupMenuItems = popupItems; - - smartData->api->popup_menu_show(smartData, rect, static_cast<Ewk_Text_Direction>(textDirection), pageScaleFactor, popupItems, selectedIndex); -} - -Eina_Bool ewk_view_popup_menu_close(Evas_Object* ewkView) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false); - - if (!priv->popupMenuProxy) - return false; - - priv->popupMenuProxy = 0; - - if (smartData->api->popup_menu_hide) - smartData->api->popup_menu_hide(smartData); - - void* item; - EINA_LIST_FREE(priv->popupMenuItems, item) - delete static_cast<Ewk_Popup_Menu_Item*>(item); - - return true; -} - -Eina_Bool ewk_view_popup_menu_select(Evas_Object* ewkView, unsigned int selectedIndex) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - EINA_SAFETY_ON_NULL_RETURN_VAL(priv->popupMenuProxy, false); - - if (selectedIndex >= eina_list_count(priv->popupMenuItems)) - return false; - - priv->popupMenuProxy->valueChanged(selectedIndex); + impl->page()->countStringMatches(String::fromUTF8(text), static_cast<WebKit::FindOptions>(options), maxMatchCount); return true; } Eina_Bool ewk_view_mouse_events_enabled_set(Evas_Object* ewkView, Eina_Bool enabled) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false); - enabled = !!enabled; - if (priv->areMouseEventsEnabled == enabled) - return true; - - priv->areMouseEventsEnabled = enabled; - if (enabled) { - evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_DOWN, _ewk_view_on_mouse_down, smartData); - evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_UP, _ewk_view_on_mouse_up, smartData); - evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_MOVE, _ewk_view_on_mouse_move, smartData); - } else { - evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_DOWN, _ewk_view_on_mouse_down); - evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_UP, _ewk_view_on_mouse_up); - evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_MOVE, _ewk_view_on_mouse_move); - } + impl->setMouseEventsEnabled(!!enabled); return true; } Eina_Bool ewk_view_mouse_events_enabled_get(const Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false); - return priv->areMouseEventsEnabled; -} - -/** - * @internal - * Web process has crashed. - * - * Emits signal: "webprocess,crashed" with pointer to crash handling boolean. - */ -void ewk_view_webprocess_crashed(Evas_Object* ewkView) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - bool handled = false; - evas_object_smart_callback_call(ewkView, "webprocess,crashed", &handled); - - if (!handled) { - CString url = priv->pageProxy->urlAtProcessExit().utf8(); - WARN("WARNING: The web process experienced a crash on '%s'.\n", url.data()); - - // Display an error page - ewk_view_html_string_load(ewkView, "The web process has crashed.", 0, url.data()); - } -} - -/** - * @internal - * Calls a smart member function for javascript alert(). - */ -void ewk_view_run_javascript_alert(Evas_Object* ewkView, const WKEinaSharedString& message) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EINA_SAFETY_ON_NULL_RETURN(smartData->api); - - if (!smartData->api->run_javascript_alert) - return; - - smartData->api->run_javascript_alert(smartData, message); -} - -/** - * @internal - * Calls a smart member function for javascript confirm() and returns a value from the function. Returns false by default. - */ -bool ewk_view_run_javascript_confirm(Evas_Object* ewkView, const WKEinaSharedString& message) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false); - - if (!smartData->api->run_javascript_confirm) - return false; - - return smartData->api->run_javascript_confirm(smartData, message); -} - -/** - * @internal - * Calls a smart member function for javascript prompt() and returns a value from the function. Returns null string by default. - */ -WKEinaSharedString ewk_view_run_javascript_prompt(Evas_Object* ewkView, const WKEinaSharedString& message, const WKEinaSharedString& defaultValue) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, WKEinaSharedString()); - EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, WKEinaSharedString()); - - if (!smartData->api->run_javascript_prompt) - return WKEinaSharedString(); - - return WKEinaSharedString::adopt(smartData->api->run_javascript_prompt(smartData, message, defaultValue)); -} - -#if ENABLE(INPUT_TYPE_COLOR) -/** - * @internal - * Requests to show external color picker. - */ -void ewk_view_color_picker_request(Evas_Object* ewkView, int r, int g, int b, int a, WKColorPickerResultListenerRef listener) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - EINA_SAFETY_ON_NULL_RETURN(smartData->api->input_picker_color_request); - - priv->colorPickerResultListener = listener; - - smartData->api->input_picker_color_request(smartData, r, g, b, a); -} - -/** - * @internal - * Requests to hide external color picker. - */ -void ewk_view_color_picker_dismiss(Evas_Object* ewkView) -{ - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - EINA_SAFETY_ON_NULL_RETURN(smartData->api->input_picker_color_dismiss); - - priv->colorPickerResultListener.clear(); - - smartData->api->input_picker_color_dismiss(smartData); -} -#endif - -Eina_Bool ewk_view_color_picker_color_set(Evas_Object* ewkView, int r, int g, int b, int a) -{ -#if ENABLE(INPUT_TYPE_COLOR) - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - EINA_SAFETY_ON_NULL_RETURN_VAL(priv->colorPickerResultListener, false); - - WebCore::Color color = WebCore::Color(r, g, b, a); - WKRetainPtr<WKStringRef> colorString(AdoptWK, WKStringCreateWithUTF8CString(color.serialized().utf8().data())); - WKColorPickerResultListenerSetColor(priv->colorPickerResultListener.get(), colorString.get()); - priv->colorPickerResultListener.clear(); - - return true; -#else - return false; -#endif + return impl->mouseEventsEnabled(); } Eina_Bool ewk_view_feed_touch_event(Evas_Object* ewkView, Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers) @@ -1927,10 +819,9 @@ Eina_Bool ewk_view_feed_touch_event(Evas_Object* ewkView, Ewk_Touch_Event_Type t #if ENABLE(TOUCH_EVENTS) EINA_SAFETY_ON_NULL_RETURN_VAL(points, false); EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false); - Evas_Point position = { smartData->view.x, smartData->view.y }; - priv->pageProxy->handleTouchEvent(NativeWebTouchEvent(type, points, modifiers, &position, ecore_time_get())); + impl->page()->handleTouchEvent(NativeWebTouchEvent(type, points, modifiers, impl->transformFromScene(), impl->transformToScreen(), ecore_time_get())); return true; #else @@ -1941,34 +832,9 @@ Eina_Bool ewk_view_feed_touch_event(Evas_Object* ewkView, Ewk_Touch_Event_Type t Eina_Bool ewk_view_touch_events_enabled_set(Evas_Object* ewkView, Eina_Bool enabled) { #if ENABLE(TOUCH_EVENTS) - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - - enabled = !!enabled; - if (priv->areTouchEventsEnabled == enabled) - return true; + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false); - priv->areTouchEventsEnabled = enabled; - if (enabled) { - // FIXME: We have to connect touch callbacks with mouse and multi events - // because the Evas creates mouse events for first touch and multi events - // for second and third touches. Below codes should be fixed when the Evas - // supports the touch events. - // See https://bugs.webkit.org/show_bug.cgi?id=97785 for details. - evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_DOWN, _ewk_view_on_touch_down, smartData); - evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_UP, _ewk_view_on_touch_up, smartData); - evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_MOVE, _ewk_view_on_touch_move, smartData); - evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MULTI_DOWN, _ewk_view_on_touch_down, smartData); - evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MULTI_UP, _ewk_view_on_touch_up, smartData); - evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MULTI_MOVE, _ewk_view_on_touch_move, smartData); - } else { - evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_DOWN, _ewk_view_on_touch_down); - evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_UP, _ewk_view_on_touch_up); - evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_MOVE, _ewk_view_on_touch_move); - evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MULTI_DOWN, _ewk_view_on_touch_down); - evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MULTI_UP, _ewk_view_on_touch_up); - evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MULTI_MOVE, _ewk_view_on_touch_move); - } + impl->setTouchEventsEnabled(!!enabled); return true; #else @@ -1979,10 +845,9 @@ Eina_Bool ewk_view_touch_events_enabled_set(Evas_Object* ewkView, Eina_Bool enab Eina_Bool ewk_view_touch_events_enabled_get(const Evas_Object* ewkView) { #if ENABLE(TOUCH_EVENTS) - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false); - return priv->areTouchEventsEnabled; + return impl->touchEventsEnabled(); #else return false; #endif @@ -1991,10 +856,9 @@ Eina_Bool ewk_view_touch_events_enabled_get(const Evas_Object* ewkView) Eina_Bool ewk_view_inspector_show(Evas_Object* ewkView) { #if ENABLE(INSPECTOR) - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false); - WebInspectorProxy* inspector = priv->pageProxy->inspector(); + WebInspectorProxy* inspector = impl->page()->inspector(); if (inspector) inspector->show(); @@ -2007,10 +871,9 @@ Eina_Bool ewk_view_inspector_show(Evas_Object* ewkView) Eina_Bool ewk_view_inspector_close(Evas_Object* ewkView) { #if ENABLE(INSPECTOR) - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false); - WebInspectorProxy* inspector = priv->pageProxy->inspector(); + WebInspectorProxy* inspector = impl->page()->inspector(); if (inspector) inspector->close(); @@ -2019,3 +882,26 @@ Eina_Bool ewk_view_inspector_close(Evas_Object* ewkView) return false; #endif } + +// Ewk_Pagination_Mode should be matched up orders with WebCore::Pagination::Mode. +COMPILE_ASSERT_MATCHING_ENUM(EWK_PAGINATION_MODE_UNPAGINATED, WebCore::Pagination::Unpaginated); +COMPILE_ASSERT_MATCHING_ENUM(EWK_PAGINATION_MODE_LEFT_TO_RIGHT, WebCore::Pagination::LeftToRightPaginated); +COMPILE_ASSERT_MATCHING_ENUM(EWK_PAGINATION_MODE_RIGHT_TO_LEFT, WebCore::Pagination::RightToLeftPaginated); +COMPILE_ASSERT_MATCHING_ENUM(EWK_PAGINATION_MODE_TOP_TO_BOTTOM, WebCore::Pagination::TopToBottomPaginated); +COMPILE_ASSERT_MATCHING_ENUM(EWK_PAGINATION_MODE_BOTTOM_TO_TOP, WebCore::Pagination::BottomToTopPaginated); + +Eina_Bool ewk_view_pagination_mode_set(Evas_Object* ewkView, Ewk_Pagination_Mode mode) +{ + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false); + + impl->page()->setPaginationMode(static_cast<WebCore::Pagination::Mode>(mode)); + + return true; +} + +Ewk_Pagination_Mode ewk_view_pagination_mode_get(const Evas_Object* ewkView) +{ + EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EWK_PAGINATION_MODE_INVALID); + + return static_cast<Ewk_Pagination_Mode>(impl->page()->paginationMode()); +} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.h b/Source/WebKit2/UIProcess/API/efl/ewk_view.h index 59809fab6..175c28cf2 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.h @@ -26,6 +26,8 @@ * * The following signals (see evas_object_smart_callback_add()) are emitted: * + * - "authentication,request", Ewk_Auth_Request*: reports that user authentication was requested. Call + * ewk_auth_request_ref() on the request object to process the authentication asynchronously. * - "back,forward,list,changed", void: reports that the view's back / forward list had changed. * - "close,window", void: window is closed. * - "create,window", Evas_Object**: a new window is created. @@ -34,6 +36,9 @@ * - "download,finished", Ewk_Download_Job*: reports that a download completed successfully. * - "download,request", Ewk_Download_Job*: reports that a new download has been requested. The client should set the * destination path by calling ewk_download_job_destination_set() or the download will fail. + * - "file,chooser,request", Ewk_File_Chooser_Request*: reports that a request has been made for the user to choose + * a file (or several) on the file system. Call ewk_file_chooser_request_ref() on the request object to process it + * asynchronously. * - "form,submission,request", Ewk_Form_Submission_Request*: Reports that a form request is about to be submitted. * The Ewk_Form_Submission_Request 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. @@ -75,10 +80,12 @@ #define ewk_view_h #include "ewk_back_forward_list.h" +#include "ewk_color_picker.h" #include "ewk_context.h" #include "ewk_download_job.h" #include "ewk_error.h" #include "ewk_intent.h" +#include "ewk_popup_menu.h" #include "ewk_resource.h" #include "ewk_settings.h" #include "ewk_touch.h" @@ -104,7 +111,7 @@ struct Ewk_View_Smart_Class { Evas_Smart_Class sc; /**< all but 'data' is free to be changed. */ unsigned long version; - Eina_Bool (*popup_menu_show)(Ewk_View_Smart_Data *sd, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Eina_List *items, int selected_index); + Eina_Bool (*popup_menu_show)(Ewk_View_Smart_Data *sd, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Ewk_Popup_Menu *menu); Eina_Bool (*popup_menu_hide)(Ewk_View_Smart_Data *sd); // event handling: @@ -129,7 +136,7 @@ struct Ewk_View_Smart_Class { // color picker: // - Shows and hides color picker. - Eina_Bool (*input_picker_color_request)(Ewk_View_Smart_Data *sd, int r, int g, int b, int a); + Eina_Bool (*input_picker_color_request)(Ewk_View_Smart_Data *sd, Ewk_Color_Picker *color_picker); Eina_Bool (*input_picker_color_dismiss)(Ewk_View_Smart_Data *sd); // storage: @@ -182,7 +189,7 @@ struct Ewk_View_Smart_Class { */ #define EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION(name) EWK_VIEW_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NAME_VERSION(name)) -typedef struct Ewk_View_Private_Data Ewk_View_Private_Data; +typedef struct EwkViewImpl EwkViewImpl; /** * @brief Contains an internal View data. * @@ -194,7 +201,7 @@ struct Ewk_View_Smart_Data { const Ewk_View_Smart_Class* api; /**< reference to casted class instance */ Evas_Object* self; /**< reference to owner object */ Evas_Object* image; /**< reference to evas_object_image for drawing web contents */ - Ewk_View_Private_Data* priv; /**< should never be accessed, c++ stuff */ + EwkViewImpl* priv; /**< should never be accessed, c++ stuff */ struct { Evas_Coord x, y, w, h; /**< last used viewport */ } view; @@ -271,6 +278,18 @@ enum Ewk_Find_Options { typedef enum Ewk_Find_Options Ewk_Find_Options; /** + * Enum values used to set pagination mode. + */ +typedef enum { + EWK_PAGINATION_MODE_INVALID = -1, /**< invalid pagination mode that will be returned when error occured. */ + EWK_PAGINATION_MODE_UNPAGINATED, /**< default mode for pagination. not paginated */ + EWK_PAGINATION_MODE_LEFT_TO_RIGHT, /**< go to the next page with scrolling left to right horizontally. */ + EWK_PAGINATION_MODE_RIGHT_TO_LEFT, /**< go to the next page with scrolling right to left horizontally. */ + EWK_PAGINATION_MODE_TOP_TO_BOTTOM, /**< go to the next page with scrolling top to bottom vertically. */ + EWK_PAGINATION_MODE_BOTTOM_TO_TOP /**< go to the next page with scrolling bottom to top vertically. */ +} Ewk_Pagination_Mode; + +/** * Sets the smart class APIs, enabling view to be inherited. * * @param api class definition to set, all members with the @@ -677,27 +696,6 @@ EAPI Eina_Bool ewk_view_text_find_highlight_clear(Evas_Object *o); EAPI Eina_Bool ewk_view_text_matches_count(Evas_Object *o, const char *text, Ewk_Find_Options options, unsigned max_match_count); /** - * Selects index of current popup menu. - * - * @param o view object contains popup menu. - * @param index index of item to select - * - * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (probably - * popup menu is not selected or index is out of range) - */ -EAPI Eina_Bool ewk_view_popup_menu_select(Evas_Object *o, unsigned int index); - -/** - * Closes current popup menu. - * - * @param o view object contains popup menu. - * - * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (probably - * popup menu is not selected) - */ -EAPI Eina_Bool ewk_view_popup_menu_close(Evas_Object *o); - -/** * Sets whether the ewk_view supports the mouse events or not. * * The ewk_view will support the mouse events if EINA_TRUE or not support the @@ -719,23 +717,6 @@ EAPI Eina_Bool ewk_view_mouse_events_enabled_set(Evas_Object *o, Eina_Bool enabl */ EAPI Eina_Bool ewk_view_mouse_events_enabled_get(const Evas_Object *o); -/* - * Sets the user chosen color. To be used when implementing a color picker. - * - * The function should only be called when a color has been requested by the document. - * If called when this is not the case or when the input picker has been dismissed, this - * function will fail and return EINA_FALSE. - * - * @param o view object contains color picker - * @param r red channel value to be set - * @param g green channel value to be set - * @param b blue channel value to be set - * @param a alpha channel value to be set - * - * @return @c EINA_TRUE on success @c EINA_FALSE otherwise - */ -EAPI Eina_Bool ewk_view_color_picker_color_set(Evas_Object *o, int r, int g, int b, int a); - /** * Feeds the touch event to the view. * @@ -793,6 +774,28 @@ EAPI Eina_Bool ewk_view_inspector_show(Evas_Object *o); */ EAPI Eina_Bool ewk_view_inspector_close(Evas_Object *o); +/** + * Set pagination mode to the current web page. + * + * @param o view object to set the pagenation mode + * @param mode The Ewk_Pagination_Mode to set + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EAPI Eina_Bool ewk_view_pagination_mode_set(Evas_Object *o, Ewk_Pagination_Mode mode); + +/** + * Get pagination mode of the current web page. + * + * The default value is EWK_PAGINATION_MODE_UNPAGINATED. + * When error occured, EWK_PAGINATION_MODE_INVALID is returned. + * + * @param o view object to get the pagination mode + * + * @return The pagination mode of the current web page + */ +EAPI Ewk_Pagination_Mode ewk_view_pagination_mode_get(const Evas_Object *o); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h index 2066f9eff..28038857f 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h @@ -21,107 +21,9 @@ #ifndef ewk_view_private_h #define ewk_view_private_h -#include "WebPageProxy.h" #include <Evas.h> -#include <WKEinaSharedString.h> -#include <WebCore/TextDirection.h> #include <WebKit2/WKBase.h> -#include <wtf/Vector.h> - -namespace WebCore { -class Cursor; -class IntRect; -class IntSize; -} - -namespace WebKit { -class WebPopupItem; -class WebPopupMenuProxyEfl; -} - -typedef struct Ewk_Download_Job Ewk_Download_Job; -typedef struct Ewk_Form_Submission_Request Ewk_Form_Submission_Request; -typedef struct Ewk_Url_Request Ewk_Url_Request; -typedef struct Ewk_Url_Response Ewk_Url_Response; -typedef struct Ewk_Error Ewk_Error; -typedef struct Ewk_Resource Ewk_Resource; -typedef struct Ewk_Navigation_Policy_Decision Ewk_Navigation_Policy_Decision; -#if ENABLE(WEB_INTENTS) -typedef struct Ewk_Intent Ewk_Intent; -#endif -#if ENABLE(WEB_INTENTS_TAG) -typedef struct Ewk_Intent_Service Ewk_Intent_Service; -#endif - -void ewk_view_cursor_set(Evas_Object* ewkView, const WebCore::Cursor& cursor); -void ewk_view_display(Evas_Object* ewkView, const WebCore::IntRect& rect); -void ewk_view_download_job_cancelled(Evas_Object* ewkView, Ewk_Download_Job*); -void ewk_view_download_job_failed(Evas_Object* ewkView, Ewk_Download_Job*, Ewk_Error*); -void ewk_view_download_job_finished(Evas_Object* ewkView, Ewk_Download_Job*); -void ewk_view_download_job_requested(Evas_Object* ewkView, Ewk_Download_Job*); -void ewk_view_form_submission_request_new(Evas_Object* ewkView, Ewk_Form_Submission_Request*); -#if ENABLE(FULLSCREEN_API) -void ewk_view_full_screen_enter(Evas_Object* ewkView); -void ewk_view_full_screen_exit(Evas_Object* ewkView); -#endif -void ewk_view_image_data_set(Evas_Object* ewkView, void* imageData, const WebCore::IntSize& size); -void ewk_view_load_error(Evas_Object* ewkView, const Ewk_Error* error); -void ewk_view_load_finished(Evas_Object* ewkView); -void ewk_view_load_progress_changed(Evas_Object* ewkView, double progress); -void ewk_view_load_provisional_failed(Evas_Object* ewkView, const Ewk_Error* error); -void ewk_view_load_provisional_redirect(Evas_Object* ewkView); -void ewk_view_load_provisional_started(Evas_Object* ewkView); -void ewk_view_navigation_policy_decision(Evas_Object* ewkView, Ewk_Navigation_Policy_Decision* decision); -void ewk_view_new_window_policy_decision(Evas_Object* ewkView, Ewk_Navigation_Policy_Decision* decision); -void ewk_view_page_close(Evas_Object* ewkView); -WKPageRef ewk_view_page_create(Evas_Object* ewkView); -void ewk_view_title_changed(Evas_Object* ewkView, const char* title); -void ewk_view_tooltip_text_set(Evas_Object* ewkView, const char* text); -void ewk_view_resource_load_failed(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Error* error); -void ewk_view_resource_load_finished(Evas_Object* ewkView, Ewk_Resource* resource); -void ewk_view_resource_load_initiated(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Url_Request* request); -void ewk_view_resource_load_response(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Url_Response* response); -void ewk_view_resource_request_sent(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Url_Request* request, Ewk_Url_Response* redirectResponse); -void ewk_view_text_found(Evas_Object* ewkView, unsigned int matchCount); -void ewk_view_url_update(Evas_Object* ewkView); -void ewk_view_contents_size_changed(const Evas_Object* ewkView, const WebCore::IntSize&); -void ewk_view_back_forward_list_changed(Evas_Object* ewkView); -void ewk_view_update_icon(Evas_Object* ewkView); - -WKPageRef ewk_view_wkpage_get(const Evas_Object* ewkView); Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef, WKPageGroupRef); -#if ENABLE(WEB_INTENTS) -void ewk_view_intent_request_new(Evas_Object* ewkView, const Ewk_Intent* ewkIntent); -#endif -#if ENABLE(WEB_INTENTS_TAG) -void ewk_view_intent_service_register(Evas_Object* ewkView, const Ewk_Intent_Service* ewkIntentService); -#endif - -const Evas_Object* ewk_view_from_page_get(const WebKit::WebPageProxy*); -WebKit::WebPageProxy* ewk_view_page_get(const Evas_Object* ewkView); -WebCore::IntSize ewk_view_size_get(const Evas_Object* ewkView); - -#if USE(ACCELERATED_COMPOSITING) -bool ewk_view_accelerated_compositing_mode_enter(const Evas_Object* ewkView); -bool ewk_view_accelerated_compositing_mode_exit(const Evas_Object* ewkView); -#endif - -void ewk_view_popup_menu_request(Evas_Object* ewkView, WebKit::WebPopupMenuProxyEfl* popupMenu, const WebCore::IntRect&, WebCore::TextDirection, double pageScaleFactor, const Vector<WebKit::WebPopupItem>& items, int32_t selectedIndex); -void ewk_view_webprocess_crashed(Evas_Object* ewkView); - -void ewk_view_run_javascript_alert(Evas_Object* ewkView, const WKEinaSharedString& message); -bool ewk_view_run_javascript_confirm(Evas_Object* ewkView, const WKEinaSharedString& message); -WKEinaSharedString ewk_view_run_javascript_prompt(Evas_Object* ewkView, const WKEinaSharedString& message, const WKEinaSharedString& defaultValue); - -#if ENABLE(INPUT_TYPE_COLOR) -void ewk_view_color_picker_request(Evas_Object* ewkView, int r, int g, int b, int a, WKColorPickerResultListenerRef listener); -void ewk_view_color_picker_dismiss(Evas_Object* ewkView); -#endif - -#if ENABLE(SQL_DATABASE) -unsigned long long ewk_view_database_quota_exceeded(Evas_Object* ewkView, const char* databaseName, const char* displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage); -#endif - #endif // ewk_view_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_ui_client.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view_ui_client.cpp deleted file mode 100644 index 0f7bd9277..000000000 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_ui_client.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (C) 2012 Samsung Electronics. 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 "WKString.h" -#include "ewk_view_private.h" -#include "ewk_view_ui_client_private.h" -#include <Ecore_Evas.h> - -static inline Evas_Object* toEwkView(const void* clientInfo) -{ - return static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); -} - -static void closePage(WKPageRef, const void* clientInfo) -{ - ewk_view_page_close(toEwkView(clientInfo)); -} - -static WKPageRef createNewPage(WKPageRef, WKURLRequestRef, WKDictionaryRef, WKEventModifiers, WKEventMouseButton, const void* clientInfo) -{ - return ewk_view_page_create(toEwkView(clientInfo)); -} - -static void runJavaScriptAlert(WKPageRef, WKStringRef alertText, WKFrameRef, const void* clientInfo) -{ - ewk_view_run_javascript_alert(toEwkView(clientInfo), WKEinaSharedString(alertText)); -} - -static bool runJavaScriptConfirm(WKPageRef, WKStringRef message, WKFrameRef, const void* clientInfo) -{ - return ewk_view_run_javascript_confirm(toEwkView(clientInfo), WKEinaSharedString(message)); -} - -static WKStringRef runJavaScriptPrompt(WKPageRef, WKStringRef message, WKStringRef defaultValue, WKFrameRef, const void* clientInfo) -{ - WKEinaSharedString value = ewk_view_run_javascript_prompt(toEwkView(clientInfo), WKEinaSharedString(message), WKEinaSharedString(defaultValue)); - return value ? WKStringCreateWithUTF8CString(value) : 0; -} - -#if ENABLE(INPUT_TYPE_COLOR) -static void showColorPicker(WKPageRef, WKStringRef initialColor, WKColorPickerResultListenerRef listener, const void* clientInfo) -{ - WebCore::Color color = WebCore::Color(WebKit::toWTFString(initialColor)); - ewk_view_color_picker_request(toEwkView(clientInfo), color.red(), color.green(), color.blue(), color.alpha(), listener); -} - -static void hideColorPicker(WKPageRef, const void* clientInfo) -{ - ewk_view_color_picker_dismiss(toEwkView(clientInfo)); -} -#endif - -#if ENABLE(SQL_DATABASE) -static unsigned long long exceededDatabaseQuota(WKPageRef, WKFrameRef, WKSecurityOriginRef, WKStringRef databaseName, WKStringRef displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage, const void* clientInfo) -{ - return ewk_view_database_quota_exceeded(toEwkView(clientInfo), WKEinaSharedString(databaseName), WKEinaSharedString(displayName), currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage); -} -#endif - -static void focus(WKPageRef, const void* clientInfo) -{ - evas_object_focus_set(toEwkView(clientInfo), true); -} - -static void unfocus(WKPageRef, const void* clientInfo) -{ - evas_object_focus_set(toEwkView(clientInfo), false); -} - -static void takeFocus(WKPageRef, WKFocusDirection, const void* clientInfo) -{ - // FIXME: this is only a partial implementation. - evas_object_focus_set(toEwkView(clientInfo), false); -} - -static WKRect getWindowFrame(WKPageRef, const void* clientInfo) -{ - int x, y, width, height; - - Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_object_evas_get(toEwkView(clientInfo))); - ecore_evas_request_geometry_get(ee, &x, &y, &width, &height); - - return WKRectMake(x, y, width, height); -} - -static void setWindowFrame(WKPageRef, WKRect frame, const void* clientInfo) -{ - Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_object_evas_get(toEwkView(clientInfo))); - ecore_evas_move_resize(ee, frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); -} - -void ewk_view_ui_client_attach(WKPageRef pageRef, Evas_Object* ewkView) -{ - WKPageUIClient uiClient; - memset(&uiClient, 0, sizeof(WKPageUIClient)); - uiClient.version = kWKPageUIClientCurrentVersion; - uiClient.clientInfo = ewkView; - uiClient.close = closePage; - uiClient.createNewPage = createNewPage; - uiClient.runJavaScriptAlert = runJavaScriptAlert; - uiClient.runJavaScriptConfirm = runJavaScriptConfirm; - uiClient.runJavaScriptPrompt = runJavaScriptPrompt; - uiClient.takeFocus = takeFocus; - uiClient.focus = focus; - uiClient.unfocus = unfocus; - uiClient.getWindowFrame = getWindowFrame; - uiClient.setWindowFrame = setWindowFrame; -#if ENABLE(SQL_DATABASE) - uiClient.exceededDatabaseQuota = exceededDatabaseQuota; -#endif - -#if ENABLE(INPUT_TYPE_COLOR) - uiClient.showColorPicker = showColorPicker; - uiClient.hideColorPicker = hideColorPicker; -#endif - - WKPageSetPageUIClient(pageRef, &uiClient); -} diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp index 63d315050..82280fcd4 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp @@ -48,7 +48,12 @@ void EWK2UnitTestBase::SetUp() unsigned int width = environment->defaultWidth(); unsigned int height = environment->defaultHeight(); +#if defined(WTF_USE_ACCELERATED_COMPOSITING) && defined(HAVE_ECORE_X) + const char* engine = "opengl_x11"; + m_ecoreEvas = ecore_evas_new(engine, 0, 0, width, height, 0); +#else m_ecoreEvas = ecore_evas_new(0, 0, 0, width, height, 0); +#endif ecore_evas_show(m_ecoreEvas); Evas* evas = ecore_evas_get(m_ecoreEvas); diff --git a/Source/WebKit2/UIProcess/API/efl/tests/resources/file_chooser.html b/Source/WebKit2/UIProcess/API/efl/tests/resources/file_chooser.html new file mode 100644 index 000000000..4418c6477 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/tests/resources/file_chooser.html @@ -0,0 +1,21 @@ +<html> +<head> +<title>File chooser test</title> +<script> +function updateTitle() +{ + var myinput = document.getElementById('myInput'); + var title = "" + for (var i = 0; i < myinput.files.length; i++) { + title += myinput.files[i].name; + if (i < (myinput.files.length - 1)) + title += "|"; + } + document.title = title; +} +</script> +</head> +<body> +<input type="file" id="myInput" name="Upload media" accept="image/*,video/*" multiple="multiple" onchange="updateTitle()" style="top: 10; left: 10;"/> +</body> +</html> diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_auth_request.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_auth_request.cpp new file mode 100644 index 000000000..093b507e6 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_auth_request.cpp @@ -0,0 +1,198 @@ +/* + * 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 "UnitTestUtils/EWK2UnitTestBase.h" +#include "UnitTestUtils/EWK2UnitTestEnvironment.h" +#include "UnitTestUtils/EWK2UnitTestServer.h" +#include <EWebKit2.h> +#include <Ecore.h> +#include <wtf/PassOwnPtr.h> + +using namespace EWK2UnitTest; + +extern EWK2UnitTestEnvironment* environment; + +static const char TEST_USERNAME[] = "username"; +static const char TEST_PASSWORD[] = "password"; +static const char EXPECTED_AUTHORIZATION[] = "Basic dXNlcm5hbWU6cGFzc3dvcmQ="; // Base64 encoding of "username:password". +static const char INDEX_HTML_STRING[] = + "<html>" + "<head><title>EFLWebKit2 Authentication test</title></head>" + "<body></body></html>"; + +static void serverCallback(SoupServer*, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, void*) +{ + if (message->method != SOUP_METHOD_GET) { + soup_message_set_status(message, SOUP_STATUS_NOT_IMPLEMENTED); + return; + } + + if (!strcmp(path, "/index.html")) { + const char* authorization = soup_message_headers_get_one(message->request_headers, "Authorization"); + // Require authentication + if (authorization && !strcmp(authorization, EXPECTED_AUTHORIZATION)) { + // Successful authentication. + soup_message_set_status(message, SOUP_STATUS_OK); + soup_message_body_append(message->response_body, SOUP_MEMORY_COPY, INDEX_HTML_STRING, strlen(INDEX_HTML_STRING)); + } else { + // No (valid) authorization header provided by the client, request authentication. + soup_message_set_status(message, SOUP_STATUS_UNAUTHORIZED); + soup_message_headers_append(message->response_headers, "WWW-Authenticate", "Basic realm=\"my realm\""); + } + } else + soup_message_set_status(message, SOUP_STATUS_NOT_FOUND); + + soup_message_body_complete(message->response_body); +} + +static void onAuthenticationRequest(void* userData, Evas_Object*, void* eventInfo) +{ + Ewk_Auth_Request** returnRequest = static_cast<Ewk_Auth_Request**>(userData); + ASSERT_TRUE(returnRequest); + + Ewk_Auth_Request* request = static_cast<Ewk_Auth_Request*>(eventInfo); + ASSERT_TRUE(request); + + *returnRequest = ewk_object_ref(request); +} + +TEST_F(EWK2UnitTestBase, ewk_auth_request_success) +{ + OwnPtr<EWK2UnitTestServer> httpServer = adoptPtr(new EWK2UnitTestServer); + httpServer->run(serverCallback); + + Ewk_Auth_Request* authenticationRequest = 0; + evas_object_smart_callback_add(webView(), "authentication,request", onAuthenticationRequest, &authenticationRequest); + + ewk_view_url_set(webView(), httpServer->getURLForPath("/index.html").data()); + + while (!authenticationRequest) + ecore_main_loop_iterate(); + + ASSERT_TRUE(authenticationRequest); + evas_object_smart_callback_del(webView(), "authentication,request", onAuthenticationRequest); + + EXPECT_STREQ("my realm", ewk_auth_request_realm_get(authenticationRequest)); + EXPECT_STREQ("127.0.0.1", ewk_auth_request_host_get(authenticationRequest)); + EXPECT_FALSE(ewk_auth_request_retrying_get(authenticationRequest)); + + ASSERT_TRUE(ewk_auth_request_authenticate(authenticationRequest, TEST_USERNAME, TEST_PASSWORD)); + + ewk_object_unref(authenticationRequest); + + ASSERT_TRUE(waitUntilTitleChangedTo("EFLWebKit2 Authentication test")); +} + +TEST_F(EWK2UnitTestBase, ewk_auth_request_failure_then_success) +{ + OwnPtr<EWK2UnitTestServer> httpServer = adoptPtr(new EWK2UnitTestServer); + httpServer->run(serverCallback); + + Ewk_Auth_Request* authenticationRequest = 0; + evas_object_smart_callback_add(webView(), "authentication,request", onAuthenticationRequest, &authenticationRequest); + + ewk_view_url_set(webView(), httpServer->getURLForPath("/index.html").data()); + + while (!authenticationRequest) + ecore_main_loop_iterate(); + + ASSERT_TRUE(authenticationRequest); + + EXPECT_STREQ("my realm", ewk_auth_request_realm_get(authenticationRequest)); + EXPECT_STREQ("127.0.0.1", ewk_auth_request_host_get(authenticationRequest)); + EXPECT_FALSE(ewk_auth_request_retrying_get(authenticationRequest)); + + ASSERT_TRUE(ewk_auth_request_authenticate(authenticationRequest, TEST_USERNAME, "wrongpassword")); + + ewk_object_unref(authenticationRequest); + authenticationRequest = 0; + + // We expect a second authentication request since the first one failed. + while (!authenticationRequest) + ecore_main_loop_iterate(); + evas_object_smart_callback_del(webView(), "authentication,request", onAuthenticationRequest); + + EXPECT_STREQ("my realm", ewk_auth_request_realm_get(authenticationRequest)); + EXPECT_STREQ("127.0.0.1", ewk_auth_request_host_get(authenticationRequest)); + EXPECT_TRUE(ewk_auth_request_retrying_get(authenticationRequest)); + + // Now provide the right password. + ASSERT_TRUE(ewk_auth_request_authenticate(authenticationRequest, TEST_USERNAME, TEST_PASSWORD)); + + ewk_object_unref(authenticationRequest); + + ASSERT_TRUE(waitUntilTitleChangedTo("EFLWebKit2 Authentication test")); +} + +static void onResourceLoadResponse(void* userData, Evas_Object*, void* eventInfo) +{ + int* statusCode = static_cast<int*>(userData); + ASSERT_TRUE(statusCode); + + Ewk_Resource_Load_Response* response = static_cast<Ewk_Resource_Load_Response*>(eventInfo); + ASSERT_TRUE(response); + + if (!ewk_resource_main_resource_get(response->resource)) + return; + + *statusCode = ewk_url_response_status_code_get(response->response); +} + +TEST_F(EWK2UnitTestBase, ewk_auth_request_cancel) +{ + OwnPtr<EWK2UnitTestServer> httpServer = adoptPtr(new EWK2UnitTestServer); + httpServer->run(serverCallback); + + Ewk_Auth_Request* authenticationRequest = 0; + evas_object_smart_callback_add(webView(), "authentication,request", onAuthenticationRequest, &authenticationRequest); + + ewk_view_url_set(webView(), httpServer->getURLForPath("/index.html").data()); + + while (!authenticationRequest) + ecore_main_loop_iterate(); + + ASSERT_TRUE(authenticationRequest); + evas_object_smart_callback_del(webView(), "authentication,request", onAuthenticationRequest); + + EXPECT_STREQ("my realm", ewk_auth_request_realm_get(authenticationRequest)); + EXPECT_STREQ("127.0.0.1", ewk_auth_request_host_get(authenticationRequest)); + EXPECT_FALSE(ewk_auth_request_retrying_get(authenticationRequest)); + + int statusCode = 0; + evas_object_smart_callback_add(webView(), "resource,request,response", onResourceLoadResponse, &statusCode); + + // Will attempt to continue without authentication by default. + ewk_object_unref(authenticationRequest); + + while (!statusCode) + ecore_main_loop_iterate(); + + // We should get a "402 Unauthorized" error. + EXPECT_EQ(SOUP_STATUS_UNAUTHORIZED, statusCode); + + evas_object_smart_callback_del(webView(), "resource,request,response", onResourceLoadResponse); +} diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_back_forward_list.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_back_forward_list.cpp index 80d7755ec..ec4a4d90a 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_back_forward_list.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_back_forward_list.cpp @@ -83,7 +83,7 @@ static inline void freeEinaList(Eina_List* list) { void* data = 0; EINA_LIST_FREE(list, data) - ewk_back_forward_list_item_unref(static_cast<Ewk_Back_Forward_List_Item*>(data)); + ewk_object_unref(static_cast<Ewk_Object*>(data)); } TEST_F(EWK2UnitTestBase, ewk_back_forward_list_current_item_get) diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_color_picker.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_color_picker.cpp new file mode 100644 index 000000000..7f59c33f6 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_color_picker.cpp @@ -0,0 +1,164 @@ +/* + Copyright (C) 2012 Samsung Electronics + Copyright (C) 2012 Intel Corporation. All rights reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "config.h" + +#include "UnitTestUtils/EWK2UnitTestBase.h" +#include "UnitTestUtils/EWK2UnitTestEnvironment.h" +#include <EWebKit2.h> +#include <Ecore.h> + +using namespace EWK2UnitTest; + +extern EWK2UnitTestEnvironment* environment; + +#if ENABLE(INPUT_TYPE_COLOR) +static const int initialRed = 0x12; +static const int initialGreen = 0x34; +static const int initialBlue = 0x56; +static const int initialAlpha = 0xff; +static const int changedRed = 0x98; +static const int changedGreen = 0x76; +static const int changedBlue = 0x54; +static const int changedAlpha = 0xff; + +static bool s_isColorPickerShown = false; +static Ewk_Color_Picker* s_colorPicker = 0; + + +static void onColorPickerDone(void* userData, Evas_Object*, void*) +{ + bool* handled = static_cast<bool*>(userData); + + *handled = true; +} + +static unsigned char setColorPickerColor(void* data) +{ + Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data); + + // 4. Change color to changed color. + EXPECT_TRUE(ewk_color_picker_color_set(s_colorPicker, changedRed, changedGreen, changedBlue, changedAlpha)); + + evas_object_smart_callback_call(smartData->self, "input,type,color,request", 0); + + return 0; +} + +static Eina_Bool showColorPicker(Ewk_View_Smart_Data* smartData, Ewk_Color_Picker* colorPicker) +{ + static bool isFirstRun = true; + + s_colorPicker = colorPicker; + s_isColorPickerShown = true; + + int r, g, b, a; + EXPECT_TRUE(ewk_color_picker_color_get(colorPicker, &r, &g, &b, &a)); + + if (isFirstRun) { + // 2. Check initial value from html file. + EXPECT_EQ(initialRed, r); + EXPECT_EQ(initialGreen, g); + EXPECT_EQ(initialBlue, b); + EXPECT_EQ(initialAlpha, a); + + isFirstRun = false; + } else { + // 7. Input values should be same as changed color. + EXPECT_EQ(changedRed, r); + EXPECT_EQ(changedGreen, g); + EXPECT_EQ(changedBlue, b); + EXPECT_EQ(changedAlpha, a); + + evas_object_smart_callback_call(smartData->self, "input,type,color,request", 0); + return true; + } + + // 3. Return after making a color picker. + ecore_timer_add(0.0, setColorPickerColor, smartData); + return true; +} + +static Eina_Bool hideColorPicker(Ewk_View_Smart_Data*) +{ + // 5. Test color picker is shown. + EXPECT_TRUE(s_isColorPickerShown); + s_isColorPickerShown = false; +} + +static Eina_Bool hideColorPickerByRemovingElement(Ewk_View_Smart_Data* smartData) +{ + // 9. input_picker_color_dismiss() is called if the element is removed. + EXPECT_TRUE(s_isColorPickerShown); + s_isColorPickerShown = false; + evas_object_smart_callback_call(smartData->self, "input,type,color,request", 0); +} + +TEST_F(EWK2UnitTestBase, ewk_color_picker_color_set) +{ + Ewk_View_Smart_Class* api = ewkViewClass(); + api->input_picker_color_request = showColorPicker; + api->input_picker_color_dismiss = hideColorPicker; + + const char colorPickerHTML[] = + "<!DOCTYPE html>" + "<html>" + "<head>" + "<script>function removeInputElement(){" + "var parentElement = document.getElementById('parent');" + "var inputElement = document.getElementById('color');" + "parentElement.removeChild(inputElement);" + "}</script>" + "</head>" + "<body>" + "<div id='parent'>" + "<input type='color' value='#123456' id='color'>" + "<button onclick='removeInputElement();'>Remove Element</button>" + "</div>" + "</body>" + "</html>"; + + ewk_view_html_string_load(webView(), colorPickerHTML, 0, 0); + waitUntilLoadFinished(); + + // 1. Click input element to show color picker. + mouseClick(30, 20); + + bool handled = false; + evas_object_smart_callback_add(webView(), "input,type,color,request", onColorPickerDone, &handled); + while (!handled) + ecore_main_loop_iterate(); + + // 6. Click input element to show color picker again. + mouseClick(30, 20); + + handled = false; + while (!handled) + ecore_main_loop_iterate(); + + // 8. Click button to remove input element durlng color picker is shown. + api->input_picker_color_dismiss = hideColorPickerByRemovingElement; + mouseClick(80, 20); + + handled = false; + while (!handled) + ecore_main_loop_iterate(); + evas_object_smart_callback_del(webView(), "input,type,color,request", onColorPickerDone); +} +#endif // ENABLE(INPUT_TYPE_COLOR) diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp index 27e46dc1e..b02a8d26e 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp @@ -53,6 +53,14 @@ TEST_F(EWK2UnitTestBase, ewk_context_cookie_manager_get) ASSERT_EQ(cookieManager, ewk_context_cookie_manager_get(context)); } +TEST_F(EWK2UnitTestBase, ewk_context_database_manager_get) +{ + Ewk_Context* context = ewk_view_context_get(webView()); + Ewk_Database_Manager* databaseManager = ewk_context_database_manager_get(context); + ASSERT_TRUE(databaseManager); + ASSERT_EQ(databaseManager, ewk_context_database_manager_get(context)); +} + TEST_F(EWK2UnitTestBase, ewk_context_favicon_database_get) { Ewk_Context* context = ewk_view_context_get(webView()); @@ -61,6 +69,14 @@ TEST_F(EWK2UnitTestBase, ewk_context_favicon_database_get) ASSERT_EQ(faviconDatabase, ewk_context_favicon_database_get(context)); } +TEST_F(EWK2UnitTestBase, ewk_context_storage_manager_get) +{ + Ewk_Context* context = ewk_view_context_get(webView()); + Ewk_Storage_Manager* storageManager = ewk_context_storage_manager_get(context); + ASSERT_TRUE(storageManager); + ASSERT_EQ(storageManager, ewk_context_storage_manager_get(context)); +} + static void schemeRequestCallback(Ewk_Url_Scheme_Request* request, void* userData) { const char* scheme = ewk_url_scheme_request_scheme_get(request); @@ -121,7 +137,7 @@ static void loadVibrationHTMLString(Evas_Object* webView, const char* vibrationP ecore_main_loop_iterate(); } -TEST_F(EWK2UnitTestBase, ewk_context_vibration_client_callbacks_set) +TEST_F(EWK2UnitTestBase, DISABLED_ewk_context_vibration_client_callbacks_set) { VibrationCbData data = { false, false, 0, 5000 }; ewk_context_vibration_client_callbacks_set(ewk_view_context_get(webView()), vibrateCallback, cancelVibrationCallback, &data); @@ -179,21 +195,12 @@ TEST_F(EWK2UnitTestBase, ewk_context_new) { Ewk_Context* context = ewk_context_new(); ASSERT_TRUE(context); - ewk_context_unref(context); + ewk_object_unref(context); } TEST_F(EWK2UnitTestBase, ewk_context_new_with_injected_bundle_path) { Ewk_Context* context = ewk_context_new_with_injected_bundle_path(environment->injectedBundleSample()); ASSERT_TRUE(context); - ewk_context_unref(context); -} - -TEST_F(EWK2UnitTestBase, ewk_context_ref) -{ - Ewk_Context* context = ewk_context_new(); - ASSERT_EQ(context, ewk_context_ref(context)); - ewk_context_unref(context); - ewk_context_unref(context); + ewk_object_unref(context); } - diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_database_manager.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_database_manager.cpp new file mode 100644 index 000000000..dd9b4b079 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_database_manager.cpp @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * 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 "UnitTestUtils/EWK2UnitTestBase.h" +#include <EWebKit2.h> +#include <Ecore.h> + +using namespace EWK2UnitTest; + +struct OriginData { + Eina_List* originList; + Ewk_Database_Manager* manager; + bool didReceiveOriginsCallback; + bool isSynchronized; + unsigned timeoutSeconds; + + OriginData() + : originList(0) + , manager(0) + , didReceiveOriginsCallback(false) + , isSynchronized(false) + , timeoutSeconds(10) + { } +}; + +static void getDatabaseOriginsCallback(Eina_List* origins, Ewk_Error* error, void* userData) +{ + ASSERT_FALSE(error); + + OriginData* originData = static_cast<OriginData*>(userData); + originData->didReceiveOriginsCallback = true; + + Eina_List* l; + void* data; + EINA_LIST_FOREACH(origins, l, data) { + originData->originList = eina_list_append(originData->originList, data); + Ewk_Security_Origin* origin = static_cast<Ewk_Security_Origin*>(data); + if (!strcmp(ewk_security_origin_protocol_get(origin), "http") + && !strcmp(ewk_security_origin_host_get(origin), "www.databasetest.com") + && !ewk_security_origin_port_get(origin)) { + originData->isSynchronized = true; + ecore_main_loop_quit(); + } + } +} + +static bool timerCallback(void* userData) +{ + OriginData* originData = static_cast<OriginData*>(userData); + + if (originData->isSynchronized || !--(originData->timeoutSeconds)) { + ecore_main_loop_quit(); + return ECORE_CALLBACK_CANCEL; + } + + if (originData->didReceiveOriginsCallback) { + originData->didReceiveOriginsCallback = false; + ewk_database_manager_origins_get(originData->manager, getDatabaseOriginsCallback, originData); + } + + return ECORE_CALLBACK_RENEW; +} + +TEST_F(EWK2UnitTestBase, ewk_database_manager_origins_get) +{ + Evas_Object* view = webView(); + const char* databaseHTML = + "<html><head><title>original title</title></head>" + "<body>" + "<script type='text/javascript'>" + " var db = openDatabase(\"DBTest\", \"1.0\", \"HTML5 Database example\", 200000);" + "</script>" + "</body></html>"; + + ASSERT_TRUE(ewk_view_html_string_load(view, databaseHTML, "http://www.databasetest.com", 0)); + ASSERT_TRUE(waitUntilLoadFinished()); + + OriginData originData; + originData.manager = ewk_context_database_manager_get(ewk_view_context_get(view)); + ASSERT_TRUE(ewk_database_manager_origins_get(originData.manager, getDatabaseOriginsCallback, &originData)); + Ecore_Timer* database_timer = ecore_timer_add(1, reinterpret_cast<Ecore_Task_Cb>(timerCallback), &originData); + + ecore_main_loop_begin(); + if (database_timer) + ecore_timer_del(database_timer); + + ASSERT_TRUE(originData.isSynchronized); + ASSERT_LE(1, eina_list_count(originData.originList)); +} diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_favicon_database.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_favicon_database.cpp index 7a57b9122..cda6efa06 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_favicon_database.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_favicon_database.cpp @@ -89,6 +89,10 @@ TEST_F(EWK2UnitTestBase, ewk_favicon_database_url_get) OwnPtr<EWK2UnitTestServer> httpServer = adoptPtr(new EWK2UnitTestServer); httpServer->run(serverCallback); + // Set favicon database path and enable functionality. + Ewk_Context* context = ewk_view_context_get(webView()); + ewk_context_favicon_database_directory_set(context, 0); + bool iconChanged = false; evas_object_smart_callback_add(webView(), "icon,changed", onIconChanged, &iconChanged); @@ -103,7 +107,6 @@ TEST_F(EWK2UnitTestBase, ewk_favicon_database_url_get) evas_object_smart_callback_del(webView(), "icon,changed", onIconChanged); // Check the API retrieving a favicon URL. - Ewk_Context* context = ewk_view_context_get(webView()); Ewk_Favicon_Database* faviconDatabase = ewk_context_favicon_database_get(context); ASSERT_TRUE(faviconDatabase); @@ -146,6 +149,10 @@ TEST_F(EWK2UnitTestBase, ewk_favicon_database_async_icon_get) OwnPtr<EWK2UnitTestServer> httpServer = adoptPtr(new EWK2UnitTestServer); httpServer->run(serverCallback); + // Set favicon database path and enable functionality. + Ewk_Context* context = ewk_view_context_get(webView()); + ewk_context_favicon_database_directory_set(context, 0); + IconRequestData data = { webView(), 0 }; evas_object_smart_callback_add(webView(), "icon,changed", requestFaviconData, &data); diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_file_chooser_request.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_file_chooser_request.cpp new file mode 100644 index 000000000..a562d74c2 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_file_chooser_request.cpp @@ -0,0 +1,171 @@ +/* + * 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 "UnitTestUtils/EWK2UnitTestBase.h" +#include "UnitTestUtils/EWK2UnitTestEnvironment.h" +#include "UnitTestUtils/EWK2UnitTestServer.h" +#include <EWebKit2.h> +#include <Ecore.h> + +using namespace EWK2UnitTest; + +extern EWK2UnitTestEnvironment* environment; + +static void onFileChooserRequest(void* userData, Evas_Object*, void* eventInfo) +{ + Ewk_File_Chooser_Request** returnRequest = static_cast<Ewk_File_Chooser_Request**>(userData); + ASSERT_TRUE(returnRequest); + Ewk_File_Chooser_Request* request = static_cast<Ewk_File_Chooser_Request*>(eventInfo); + ASSERT_TRUE(request); + + // Ref the request to process asynchronously. + *returnRequest = ewk_file_chooser_request_ref(request); +} + +static int compareStrings(const void* string1, const void* string2) +{ + ASSERT(string1); + ASSERT(string2); + + return strcmp(static_cast<const char*>(string1), static_cast<const char*>(string2)); +} + +static void freeStringList(Eina_List** list) +{ + void* data; + EINA_LIST_FREE(*list, data) { + eina_stringshare_del(static_cast<char*>(data)); + } +} + +TEST_F(EWK2UnitTestBase, ewk_file_chooser_request_files_choose) +{ + Ewk_File_Chooser_Request* request = 0; + evas_object_smart_callback_add(webView(), "file,chooser,request", onFileChooserRequest, &request); + ASSERT_TRUE(loadUrlSync(environment->urlForResource("file_chooser.html").data())); + + // Click on the file input. + mouseClick(15, 15); + + // Wait for the file chooser request. + while (!request) + ecore_main_loop_iterate(); + + evas_object_smart_callback_del(webView(), "file,chooser,request", onFileChooserRequest); + ASSERT_TRUE(request); + // Validate file chooser request. + EXPECT_TRUE(ewk_file_chooser_request_allow_multiple_files_get(request)); + Eina_List* mimeTypes = ewk_file_chooser_request_accepted_mimetypes_get(request); + mimeTypes = eina_list_sort(mimeTypes, eina_list_count(mimeTypes), compareStrings); + + ASSERT_EQ(2, eina_list_count(mimeTypes)); + EXPECT_STREQ("image/*", static_cast<char*>(eina_list_nth(mimeTypes, 0))); + EXPECT_STREQ("video/*", static_cast<char*>(eina_list_nth(mimeTypes, 1))); + freeStringList(&mimeTypes); + + ASSERT_FALSE(ewk_file_chooser_request_files_choose(request, 0)); + Eina_List* files = 0; + files = eina_list_append(files, eina_stringshare_add("/tmp/file1.png")); + files = eina_list_append(files, eina_stringshare_add("/tmp/file2.png")); + ASSERT_TRUE(ewk_file_chooser_request_files_choose(request, files)); + ASSERT_FALSE(ewk_file_chooser_request_files_choose(request, files)); + freeStringList(&files); + + ewk_file_chooser_request_unref(request); + + // Check that the JS side received the files. + EXPECT_TRUE(waitUntilTitleChangedTo("file1.png|file2.png")); +} + +TEST_F(EWK2UnitTestBase, ewk_file_chooser_request_file_choose) +{ + Ewk_File_Chooser_Request* request = 0; + evas_object_smart_callback_add(webView(), "file,chooser,request", onFileChooserRequest, &request); + ASSERT_TRUE(loadUrlSync(environment->urlForResource("file_chooser.html").data())); + + // Click on the file input. + mouseClick(15, 15); + + // Wait for the file chooser request. + while (!request) + ecore_main_loop_iterate(); + + evas_object_smart_callback_del(webView(), "file,chooser,request", onFileChooserRequest); + ASSERT_TRUE(request); + + ASSERT_FALSE(ewk_file_chooser_request_file_choose(request, 0)); + ASSERT_TRUE(ewk_file_chooser_request_file_choose(request, "/tmp/file3.png")); + ASSERT_FALSE(ewk_file_chooser_request_file_choose(request, "/tmp/file3.png")); + + ewk_file_chooser_request_unref(request); + + // Check that the JS side received the file. + EXPECT_TRUE(waitUntilTitleChangedTo("file3.png")); +} + +TEST_F(EWK2UnitTestBase, ewk_file_chooser_request_file_cancel) +{ + Ewk_File_Chooser_Request* request = 0; + evas_object_smart_callback_add(webView(), "file,chooser,request", onFileChooserRequest, &request); + ASSERT_TRUE(loadUrlSync(environment->urlForResource("file_chooser.html").data())); + + // Click on the file input. + mouseClick(15, 15); + + // Wait for the file chooser request. + while (!request) + ecore_main_loop_iterate(); + + evas_object_smart_callback_del(webView(), "file,chooser,request", onFileChooserRequest); + ASSERT_TRUE(request); + + ASSERT_TRUE(ewk_file_chooser_request_cancel(request)); + ASSERT_FALSE(ewk_file_chooser_request_cancel(request)); + + ewk_file_chooser_request_unref(request); + + ecore_main_loop_iterate(); + EXPECT_STREQ("File chooser test", ewk_view_title_get(webView())); + + // Default behavior is to cancel if the client does not act on the request. + request = 0; + evas_object_smart_callback_add(webView(), "file,chooser,request", onFileChooserRequest, &request); + // Click on the file input. + mouseClick(15, 15); + + // Wait for the file chooser request. + while (!request) + ecore_main_loop_iterate(); + + evas_object_smart_callback_del(webView(), "file,chooser,request", onFileChooserRequest); + ASSERT_TRUE(request); + + ewk_file_chooser_request_unref(request); + + ecore_main_loop_iterate(); + EXPECT_STREQ("File chooser test", ewk_view_title_get(webView())); +} diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_object.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_object.cpp new file mode 100644 index 000000000..1c96f2e80 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_object.cpp @@ -0,0 +1,115 @@ +/* + * 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 "UnitTestUtils/EWK2UnitTestBase.h" +#include "UnitTestUtils/EWK2UnitTestEnvironment.h" +#include "UnitTestUtils/EWK2UnitTestServer.h" +#include "WKEinaSharedString.h" +#include "ewk_object_private.h" +#include <EWebKit2.h> +#include <gtest/gtest.h> +#include <wtf/PassRefPtr.h> + +using namespace EWK2UnitTest; +using namespace WTF; + +extern EWK2UnitTestEnvironment* environment; + +class TestEwkObject1 : public Ewk_Object { +public: + EWK_OBJECT_DECLARE(TestEwkObject) + + static PassRefPtr<TestEwkObject1> create() + { + wasDeleted = false; + return adoptRef(new TestEwkObject1()); + } + + static bool wasDeleted; // We always test only one instance of TestEwkObject. + + ~TestEwkObject1() + { + wasDeleted = true; + } +}; + +bool TestEwkObject1::wasDeleted = false; + +class TestEwkObject2 : public Ewk_Object { +public: + EWK_OBJECT_DECLARE(TestEwkObject2) + + static PassRefPtr<TestEwkObject2> create() + { + return adoptRef(new TestEwkObject2()); + } +}; + +TEST_F(EWK2UnitTestBase, ewk_object_ref) +{ + Ewk_Object* objectRef = 0; + + { + RefPtr<Ewk_Object> object = TestEwkObject1::create(); + ASSERT_FALSE(TestEwkObject1::wasDeleted); + ASSERT_EQ(1, object->refCount()); + + objectRef = object.get(); + ewk_object_ref(objectRef); + ASSERT_EQ(2, objectRef->refCount()); + } + + ASSERT_FALSE(TestEwkObject1::wasDeleted); + ASSERT_EQ(1, objectRef->refCount()); + + ewk_object_unref(objectRef); + ASSERT_TRUE(TestEwkObject1::wasDeleted); +} + +TEST_F(EWK2UnitTestBase, ewk_object_is_of_type) +{ + RefPtr<Ewk_Object> object1 = TestEwkObject1::create(); + RefPtr<Ewk_Object> object2 = TestEwkObject2::create(); + + ASSERT_TRUE(ewk_object_is_of_type<TestEwkObject1*>(object1.get())); + ASSERT_TRUE(ewk_object_is_of_type<TestEwkObject2*>(object2.get())); + + ASSERT_FALSE(ewk_object_is_of_type<TestEwkObject1*>(object2.get())); + ASSERT_FALSE(ewk_object_is_of_type<TestEwkObject2*>(object1.get())); +} + +TEST_F(EWK2UnitTestBase, ewk_object_cast) +{ + RefPtr<Ewk_Object> object1 = TestEwkObject1::create(); + RefPtr<Ewk_Object> object2 = TestEwkObject2::create(); + + TestEwkObject1* objectRef1 = ewk_object_cast<TestEwkObject1*>(object1.get()); + ASSERT_TRUE(objectRef1); + + TestEwkObject2* objectRef2 = ewk_object_cast<TestEwkObject2*>(object2.get()); + ASSERT_TRUE(objectRef2); +} diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_popup_menu.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_popup_menu.cpp new file mode 100644 index 000000000..7a033519a --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_popup_menu.cpp @@ -0,0 +1,105 @@ +/* + Copyright (C) 2012 Samsung Electronics + Copyright (C) 2012 Intel Corporation. All rights reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "config.h" + +#include "UnitTestUtils/EWK2UnitTestBase.h" +#include "UnitTestUtils/EWK2UnitTestEnvironment.h" +#include <EWebKit2.h> +#include <Ecore.h> + +using namespace EWK2UnitTest; + +extern EWK2UnitTestEnvironment* environment; + +static Ewk_Popup_Menu* s_popupMenu = 0; + +static inline void checkBasicPopupMenuItem(Ewk_Popup_Menu_Item* item, const char* title, bool enabled) +{ + EXPECT_EQ(EWK_POPUP_MENU_ITEM, ewk_popup_menu_item_type_get(item)); + EXPECT_STREQ(title, ewk_popup_menu_item_text_get(item)); + EXPECT_EQ(enabled, ewk_popup_menu_item_enabled_get(item)); +} + +static Eina_Bool selectItemAfterDelayed(void* data) +{ + EXPECT_TRUE(ewk_popup_menu_selected_index_set(static_cast<Ewk_Popup_Menu*>(data), 0)); + return ECORE_CALLBACK_CANCEL; +} + +static Eina_Bool showPopupMenu(Ewk_View_Smart_Data* smartData, Eina_Rectangle, Ewk_Text_Direction, double, Ewk_Popup_Menu* popupMenu) +{ + s_popupMenu = popupMenu; + + EXPECT_EQ(2, ewk_popup_menu_selected_index_get(popupMenu)); + + const Eina_List* list = ewk_popup_menu_items_get(popupMenu); + + Ewk_Popup_Menu_Item* item = static_cast<Ewk_Popup_Menu_Item*>(eina_list_nth(list, 0)); + checkBasicPopupMenuItem(item, "first", true); + EXPECT_EQ(EWK_TEXT_DIRECTION_LEFT_TO_RIGHT, ewk_popup_menu_item_text_direction_get(item)); + EXPECT_STREQ("", ewk_popup_menu_item_tooltip_get(item)); + EXPECT_STREQ("", ewk_popup_menu_item_accessibility_text_get(item)); + EXPECT_FALSE(ewk_popup_menu_item_is_label_get(item)); + EXPECT_FALSE(ewk_popup_menu_item_selected_get(item)); + + item = static_cast<Ewk_Popup_Menu_Item*>(eina_list_nth(list, 1)); + checkBasicPopupMenuItem(item, "second", false); + EXPECT_FALSE(ewk_popup_menu_item_enabled_get(item)); + + item = static_cast<Ewk_Popup_Menu_Item*>(eina_list_nth(list, 2)); + checkBasicPopupMenuItem(item, "third", true); + EXPECT_EQ(EWK_TEXT_DIRECTION_RIGHT_TO_LEFT, ewk_popup_menu_item_text_direction_get(item)); + EXPECT_STREQ("tooltip", ewk_popup_menu_item_tooltip_get(item)); + EXPECT_STREQ("aria", ewk_popup_menu_item_accessibility_text_get(item)); + EXPECT_TRUE(ewk_popup_menu_item_selected_get(item)); + + item = static_cast<Ewk_Popup_Menu_Item*>(eina_list_nth(list, 3)); + checkBasicPopupMenuItem(item, "label", false); + EXPECT_TRUE(ewk_popup_menu_item_is_label_get(item)); + + item = static_cast<Ewk_Popup_Menu_Item*>(eina_list_nth(list, 4)); + checkBasicPopupMenuItem(item, " forth", true); + + item = static_cast<Ewk_Popup_Menu_Item*>(eina_list_nth(list, 5)); + EXPECT_EQ(EWK_POPUP_MENU_UNKNOWN, ewk_popup_menu_item_type_get(item)); + EXPECT_STREQ(0, ewk_popup_menu_item_text_get(item)); + + ecore_timer_add(0, selectItemAfterDelayed, popupMenu); + return true; +} + +TEST_F(EWK2UnitTestBase, ewk_popup_menu_select_item) +{ + const char* selectHTML = + "<!doctype html><body><select onchange=\"document.title=this.value;\">" + "<option>first</option><option disabled>second</option><option selected dir=\"rtl\" title=\"tooltip\" aria-label=\"aria\">third</option>" + "<optgroup label=\"label\"><option>forth</option></optgroup>" + "</select></body>"; + + ewkViewClass()->popup_menu_show = showPopupMenu; + + ewk_view_html_string_load(webView(), selectHTML, "file:///", 0); + ASSERT_TRUE(waitUntilLoadFinished()); + mouseClick(30, 20); + ASSERT_TRUE(waitUntilTitleChangedTo("first")); + + ASSERT_TRUE(s_popupMenu); + EXPECT_TRUE(ewk_popup_menu_close(s_popupMenu)); +} diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_settings.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_settings.cpp index 32f981788..d3312f8fe 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_settings.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_settings.cpp @@ -157,3 +157,17 @@ TEST_F(EWK2UnitTestBase, ewk_settings_dns_prefetching_enabled) ASSERT_TRUE(ewk_settings_dns_prefetching_enabled_set(settings, false)); ASSERT_FALSE(ewk_settings_dns_prefetching_enabled_get(settings)); } + +TEST_F(EWK2UnitTestBase, ewk_setting_encoding_detector_enabled) +{ + Ewk_Settings* settings = ewk_view_settings_get(webView()); + + // The encoding detector is disabled by default. + ASSERT_FALSE(ewk_setting_encoding_detector_enabled_get(settings)); + + ASSERT_TRUE(ewk_setting_encoding_detector_enabled_set(settings, true)); + ASSERT_TRUE(ewk_setting_encoding_detector_enabled_get(settings)); + + ASSERT_TRUE(ewk_setting_encoding_detector_enabled_set(settings, false)); + ASSERT_FALSE(ewk_setting_encoding_detector_enabled_get(settings)); +} diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_storage_manager.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_storage_manager.cpp new file mode 100644 index 000000000..b5d962a9a --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_storage_manager.cpp @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * 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 "UnitTestUtils/EWK2UnitTestBase.h" +#include <EWebKit2.h> +#include <Ecore.h> +#include <gtest/gtest.h> + +using namespace EWK2UnitTest; + +struct OriginData { + Eina_List* originList; + Ewk_Storage_Manager* manager; + bool didReceiveOriginsCallback; + bool isSynchronized; + unsigned timeToCheck; + + OriginData() + : originList(0) + , manager(0) + , didReceiveOriginsCallback(false) + , isSynchronized(false) + , timeToCheck(10) + { } +}; + +static void getStorageOriginsCallback(Eina_List* origins, Ewk_Error* error, void* userData) +{ + ASSERT_FALSE(error); + + OriginData* originData = static_cast<OriginData*>(userData); + originData->didReceiveOriginsCallback = true; + + Eina_List* l; + void* data; + EINA_LIST_FOREACH(origins, l, data) { + originData->originList = eina_list_append(originData->originList, data); + Ewk_Security_Origin* origin = static_cast<Ewk_Security_Origin*>(data); + if (!strcmp(ewk_security_origin_protocol_get(origin), "http") + && !strcmp(ewk_security_origin_host_get(origin), "www.storagetest.com") + && !ewk_security_origin_port_get(origin)) { + originData->isSynchronized = true; + ecore_main_loop_quit(); + } + } +} + +static bool timerCallback(void* userData) +{ + OriginData* originData = static_cast<OriginData*>(userData); + + if (originData->isSynchronized || !--(originData->timeToCheck)) { + ecore_main_loop_quit(); + return ECORE_CALLBACK_CANCEL; + } + + if (originData->didReceiveOriginsCallback) { + originData->didReceiveOriginsCallback = false; + ewk_storage_manager_origins_get(originData->manager, getStorageOriginsCallback, originData); + } + + return ECORE_CALLBACK_RENEW; +} + +static bool checkOrigin(Eina_List* origins, Ewk_Security_Origin** origin) +{ + Eina_List* l; + void* data; + EINA_LIST_FOREACH(origins, l, data) { + *origin = static_cast<Ewk_Security_Origin*>(data); + if (!strcmp(ewk_security_origin_protocol_get(*origin), "http") + && !strcmp(ewk_security_origin_host_get(*origin), "www.storagetest.com") + && !ewk_security_origin_port_get(*origin)) + return true; + } + + return false; +} + +TEST_F(EWK2UnitTestBase, ewk_storage_manager_origins_get) +{ + Evas_Object* view = webView(); + const char* storageHTML = + "<html><head><title>original title</title></head>" + "<body>" + "<script type='text/javascript'>" + " localStorage.setItem('item', 'storage');" + "</script>" + "</body></html>"; + + ewk_view_html_string_load(view, storageHTML, "http://www.storagetest.com", 0); + + OriginData originData; + originData.manager = ewk_context_storage_manager_get(ewk_view_context_get(view)); + ASSERT_TRUE(ewk_storage_manager_origins_get(originData.manager, getStorageOriginsCallback, &originData)); + Ecore_Timer* storage_timer = ecore_timer_add(1, reinterpret_cast<Ecore_Task_Cb>(timerCallback), &originData); + + ecore_main_loop_begin(); + if (storage_timer) + ecore_timer_del(storage_timer); + + ASSERT_TRUE(originData.isSynchronized); + ASSERT_LE(1, eina_list_count(originData.originList)); + + Ewk_Security_Origin* origin = 0; + EXPECT_TRUE(checkOrigin(originData.originList, &origin)); + + EXPECT_EQ(origin, ewk_security_origin_ref(origin)); + ewk_security_origin_unref(origin); +} diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp index d4bb70fbf..80240d2ae 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp @@ -38,6 +38,14 @@ using namespace EWK2UnitTest; extern EWK2UnitTestEnvironment* environment; bool fullScreenCallbackCalled; +TEST_F(EWK2UnitTestBase, ewk_view_type_check) +{ + ASSERT_FALSE(ewk_view_context_get(0)); + + Evas_Object* rectangle = evas_object_rectangle_add(canvas()); + ASSERT_FALSE(ewk_view_url_set(rectangle, 0)); +} + static void onLoadFinishedForRedirection(void* userData, Evas_Object*, void*) { int* countLoadFinished = static_cast<int*>(userData); @@ -193,76 +201,6 @@ TEST_F(EWK2UnitTestBase, ewk_view_form_submission_request) evas_object_smart_callback_del(webView(), "form,submission,request", onFormAboutToBeSubmitted); } -static inline void checkBasicPopupMenuItem(Ewk_Popup_Menu_Item* item, const char* title, bool enabled) -{ - EXPECT_EQ(EWK_POPUP_MENU_ITEM, ewk_popup_menu_item_type_get(item)); - EXPECT_STREQ(title, ewk_popup_menu_item_text_get(item)); - EXPECT_EQ(enabled, ewk_popup_menu_item_enabled_get(item)); -} - -static Eina_Bool selectItemAfterDelayed(void* data) -{ - EXPECT_TRUE(ewk_view_popup_menu_select(static_cast<Evas_Object*>(data), 0)); - return ECORE_CALLBACK_CANCEL; -} - -static Eina_Bool showPopupMenu(Ewk_View_Smart_Data* smartData, Eina_Rectangle, Ewk_Text_Direction, double, Eina_List* list, int selectedIndex) -{ - EXPECT_EQ(2, selectedIndex); - - Ewk_Popup_Menu_Item* item = static_cast<Ewk_Popup_Menu_Item*>(eina_list_nth(list, 0)); - checkBasicPopupMenuItem(item, "first", true); - EXPECT_EQ(EWK_TEXT_DIRECTION_LEFT_TO_RIGHT, ewk_popup_menu_item_text_direction_get(item)); - EXPECT_STREQ("", ewk_popup_menu_item_tooltip_get(item)); - EXPECT_STREQ("", ewk_popup_menu_item_accessibility_text_get(item)); - EXPECT_FALSE(ewk_popup_menu_item_is_label_get(item)); - EXPECT_FALSE(ewk_popup_menu_item_selected_get(item)); - - item = static_cast<Ewk_Popup_Menu_Item*>(eina_list_nth(list, 1)); - checkBasicPopupMenuItem(item, "second", false); - EXPECT_FALSE(ewk_popup_menu_item_enabled_get(item)); - - item = static_cast<Ewk_Popup_Menu_Item*>(eina_list_nth(list, 2)); - checkBasicPopupMenuItem(item, "third", true); - EXPECT_EQ(EWK_TEXT_DIRECTION_RIGHT_TO_LEFT, ewk_popup_menu_item_text_direction_get(item)); - EXPECT_STREQ("tooltip", ewk_popup_menu_item_tooltip_get(item)); - EXPECT_STREQ("aria", ewk_popup_menu_item_accessibility_text_get(item)); - EXPECT_TRUE(ewk_popup_menu_item_selected_get(item)); - - item = static_cast<Ewk_Popup_Menu_Item*>(eina_list_nth(list, 3)); - checkBasicPopupMenuItem(item, "label", false); - EXPECT_TRUE(ewk_popup_menu_item_is_label_get(item)); - - item = static_cast<Ewk_Popup_Menu_Item*>(eina_list_nth(list, 4)); - checkBasicPopupMenuItem(item, " forth", true); - - item = static_cast<Ewk_Popup_Menu_Item*>(eina_list_nth(list, 5)); - EXPECT_EQ(EWK_POPUP_MENU_UNKNOWN, ewk_popup_menu_item_type_get(item)); - EXPECT_STREQ(0, ewk_popup_menu_item_text_get(item)); - - ecore_timer_add(0, selectItemAfterDelayed, smartData->self); - return true; -} - -TEST_F(EWK2UnitTestBase, ewk_view_popup_menu_select) -{ - const char* selectHTML = - "<!doctype html><body><select onchange=\"document.title=this.value;\">" - "<option>first</option><option disabled>second</option><option selected dir=\"rtl\" title=\"tooltip\" aria-label=\"aria\">third</option>" - "<optgroup label=\"label\"><option>forth</option></optgroup>" - "</select></body>"; - - ewkViewClass()->popup_menu_show = showPopupMenu; - - ewk_view_html_string_load(webView(), selectHTML, "file:///", 0); - ASSERT_TRUE(waitUntilLoadFinished()); - mouseClick(30, 20); - ASSERT_TRUE(waitUntilTitleChangedTo("first")); - - EXPECT_TRUE(ewk_view_popup_menu_close(webView())); - EXPECT_FALSE(ewk_view_popup_menu_select(webView(), 0)); -} - TEST_F(EWK2UnitTestBase, ewk_view_settings_get) { Ewk_Settings* settings = ewk_view_settings_get(webView()); @@ -612,135 +550,6 @@ TEST_F(EWK2UnitTestBase, ewk_view_run_javascript_prompt) EXPECT_FALSE(promptCallbackData.called); } -#if ENABLE(INPUT_TYPE_COLOR) -static const int initialRed = 0x12; -static const int initialGreen = 0x34; -static const int initialBlue = 0x56; -static const int initialAlpha = 0xff; -static const int changedRed = 0x98; -static const int changedGreen = 0x76; -static const int changedBlue = 0x54; -static const int changedAlpha = 0xff; - -static bool isColorPickerShown = false; - -static void onColorPickerDone(void* userData, Evas_Object*, void*) -{ - bool* handled = static_cast<bool*>(userData); - - *handled = true; -} - -static unsigned char setColorPickerColor(void* data) -{ - Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data); - - // 4. Change color to changed color. - EXPECT_TRUE(ewk_view_color_picker_color_set(smartData->self, changedRed, changedGreen, changedBlue, changedAlpha)); - - evas_object_smart_callback_call(smartData->self, "input,type,color,request", 0); - - return 0; -} - -static Eina_Bool showColorPicker(Ewk_View_Smart_Data* smartData, int r, int g, int b, int a) -{ - static bool isFirstRun = true; - - isColorPickerShown = true; - - if (isFirstRun) { - // 2. Check initial value from html file. - EXPECT_EQ(initialRed, r); - EXPECT_EQ(initialGreen, g); - EXPECT_EQ(initialBlue, b); - EXPECT_EQ(initialAlpha, a); - - isFirstRun = false; - } else { - // 7. Input values should be same as changed color. - EXPECT_EQ(changedRed, r); - EXPECT_EQ(changedGreen, g); - EXPECT_EQ(changedBlue, b); - EXPECT_EQ(changedAlpha, a); - - evas_object_smart_callback_call(smartData->self, "input,type,color,request", 0); - return true; - } - - // 3. Return after making a color picker. - ecore_timer_add(0.0, setColorPickerColor, smartData); - return true; -} - -static Eina_Bool hideColorPicker(Ewk_View_Smart_Data*) -{ - // 5. Test color picker is shown. - EXPECT_TRUE(isColorPickerShown); - isColorPickerShown = false; -} - -static Eina_Bool hideColorPickerByRemovingElement(Ewk_View_Smart_Data* smartData) -{ - // 9. input_picker_color_dismiss() is called if the element is removed. - EXPECT_TRUE(isColorPickerShown); - isColorPickerShown = false; - evas_object_smart_callback_call(smartData->self, "input,type,color,request", 0); -} - -TEST_F(EWK2UnitTestBase, ewk_view_color_picker_color_set) -{ - Ewk_View_Smart_Class* api = ewkViewClass(); - api->input_picker_color_request = showColorPicker; - api->input_picker_color_dismiss = hideColorPicker; - - const char colorPickerHTML[] = - "<!DOCTYPE html>" - "<html>" - "<head>" - "<script>function removeInputElement(){" - "var parentElement = document.getElementById('parent');" - "var inputElement = document.getElementById('color');" - "parentElement.removeChild(inputElement);" - "}</script>" - "</head>" - "<body>" - "<div id='parent'>" - "<input type='color' value='#123456' id='color'>" - "<button onclick='removeInputElement();'>Remove Element</button>" - "</div>" - "</body>" - "</html>"; - - ewk_view_html_string_load(webView(), colorPickerHTML, 0, 0); - waitUntilLoadFinished(); - - // 1. Click input element to show color picker. - mouseClick(30, 20); - - bool handled = false; - evas_object_smart_callback_add(webView(), "input,type,color,request", onColorPickerDone, &handled); - while (!handled) - ecore_main_loop_iterate(); - - // 6. Click input element to show color picker again. - mouseClick(30, 20); - - handled = false; - while (!handled) - ecore_main_loop_iterate(); - - // 8. Click button to remove input element durlng color picker is shown. - api->input_picker_color_dismiss = hideColorPickerByRemovingElement; - mouseClick(80, 20); - - handled = false; - while (!handled) - ecore_main_loop_iterate(); - evas_object_smart_callback_del(webView(), "input,type,color,request", onColorPickerDone); -} -#endif // ENABLE(INPUT_TYPE_COLOR) - TEST_F(EWK2UnitTestBase, ewk_view_context_get) { Ewk_Context* context = ewk_view_context_get(webView()); @@ -959,3 +768,32 @@ TEST_F(EWK2UnitTestBase, ewk_view_scale) ASSERT_TRUE(loadUrlSync(environment->defaultTestPageUrl())); ASSERT_FLOAT_EQ(1, ewk_view_scale_get(webView())); } + +TEST_F(EWK2UnitTestBase, ewk_view_pagination) +{ + ASSERT_TRUE(loadUrlSync(environment->defaultTestPageUrl())); + + // Default pagination value is EWK_PAGINATION_MODE_UNPAGINATED + ASSERT_EQ(EWK_PAGINATION_MODE_UNPAGINATED, ewk_view_pagination_mode_get(webView())); + + ASSERT_TRUE(ewk_view_pagination_mode_set(webView(), EWK_PAGINATION_MODE_LEFT_TO_RIGHT)); + // Reload page to check the pagination mode. + ASSERT_TRUE(loadUrlSync(environment->defaultTestPageUrl())); + ASSERT_EQ(EWK_PAGINATION_MODE_LEFT_TO_RIGHT, ewk_view_pagination_mode_get(webView())); + + ASSERT_TRUE(ewk_view_pagination_mode_set(webView(), EWK_PAGINATION_MODE_RIGHT_TO_LEFT)); + ASSERT_TRUE(loadUrlSync(environment->defaultTestPageUrl())); + ASSERT_EQ(EWK_PAGINATION_MODE_RIGHT_TO_LEFT, ewk_view_pagination_mode_get(webView())); + + ASSERT_TRUE(ewk_view_pagination_mode_set(webView(), EWK_PAGINATION_MODE_TOP_TO_BOTTOM)); + ASSERT_TRUE(loadUrlSync(environment->defaultTestPageUrl())); + ASSERT_EQ(EWK_PAGINATION_MODE_TOP_TO_BOTTOM, ewk_view_pagination_mode_get(webView())); + + ASSERT_TRUE(ewk_view_pagination_mode_set(webView(), EWK_PAGINATION_MODE_BOTTOM_TO_TOP)); + ASSERT_TRUE(loadUrlSync(environment->defaultTestPageUrl())); + ASSERT_EQ(EWK_PAGINATION_MODE_BOTTOM_TO_TOP, ewk_view_pagination_mode_get(webView())); + + ASSERT_TRUE(ewk_view_pagination_mode_set(webView(), EWK_PAGINATION_MODE_UNPAGINATED)); + ASSERT_TRUE(loadUrlSync(environment->defaultTestPageUrl())); + ASSERT_EQ(EWK_PAGINATION_MODE_UNPAGINATED, ewk_view_pagination_mode_get(webView())); +} diff --git a/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp b/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp index d42b8b703..248d07284 100644 --- a/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp @@ -306,4 +306,9 @@ void PageClientImpl::startDrag(const WebCore::DragData& dragData, PassRefPtr<Sha webkitWebViewBaseStartDrag(WEBKIT_WEB_VIEW_BASE(m_viewWidget), dragData, dragImage); } +void PageClientImpl::handleDownloadRequest(DownloadProxy* download) +{ + webkitWebViewBaseHandleDownloadRequest(WEBKIT_WEB_VIEW_BASE(m_viewWidget), download); +} + } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h b/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h index f4afd06d9..d9b34c52b 100644 --- a/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h +++ b/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h @@ -103,6 +103,8 @@ private: virtual double customRepresentationZoomFactor(); virtual void setCustomRepresentationZoomFactor(double); + virtual void handleDownloadRequest(DownloadProxy*); + // Members of PageClientImpl class GtkWidget* m_viewWidget; WebCore::KeyBindingTranslator m_keyBindingTranslator; diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardList.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardList.cpp index 602d37999..56eae4437 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardList.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardList.cpp @@ -248,7 +248,7 @@ guint webkit_back_forward_list_get_length(WebKitBackForwardList* backForwardList * webkit_back_forward_list_get_back_list: * @back_forward_list: a #WebKitBackForwardList * - * Returns: (element-type WebKit.BackForwardListItem) (transfer container): a #GList of + * Returns: (element-type WebKit2.BackForwardListItem) (transfer container): a #GList of * items preceding the current item. */ GList* webkit_back_forward_list_get_back_list(WebKitBackForwardList* backForwardList) @@ -263,7 +263,7 @@ GList* webkit_back_forward_list_get_back_list(WebKitBackForwardList* backForward * @back_forward_list: a #WebKitBackForwardList * @limit: the number of items to retrieve * - * Returns: (element-type WebKit.BackForwardListItem) (transfer container): a #GList of + * Returns: (element-type WebKit2.BackForwardListItem) (transfer container): a #GList of * items preceding the current item limited by @limit. */ GList* webkit_back_forward_list_get_back_list_with_limit(WebKitBackForwardList* backForwardList, guint limit) @@ -278,7 +278,7 @@ GList* webkit_back_forward_list_get_back_list_with_limit(WebKitBackForwardList* * webkit_back_forward_list_get_forward_list: * @back_forward_list: a #WebKitBackForwardList * - * Returns: (element-type WebKit.BackForwardListItem) (transfer container): a #GList of + * Returns: (element-type WebKit2.BackForwardListItem) (transfer container): a #GList of * items following the current item. */ GList* webkit_back_forward_list_get_forward_list(WebKitBackForwardList* backForwardList) @@ -293,7 +293,7 @@ GList* webkit_back_forward_list_get_forward_list(WebKitBackForwardList* backForw * @back_forward_list: a #WebKitBackForwardList * @limit: the number of items to retrieve * - * Returns: (element-type WebKit.BackForwardListItem) (transfer container): a #GList of + * Returns: (element-type WebKit2.BackForwardListItem) (transfer container): a #GList of * items following the current item limited by @limit. */ GList* webkit_back_forward_list_get_forward_list_with_limit(WebKitBackForwardList* backForwardList, guint limit) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp index cc3b51f52..a6754de06 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp @@ -57,6 +57,7 @@ struct _WebKitDownloadPrivate { GRefPtr<WebKitURIRequest> request; GRefPtr<WebKitURIResponse> response; + WebKitWebView* webView; CString destinationURI; guint64 currentSize; bool isCancelled; @@ -71,7 +72,10 @@ G_DEFINE_TYPE(WebKitDownload, webkit_download, G_TYPE_OBJECT) static void webkitDownloadFinalize(GObject* object) { - WEBKIT_DOWNLOAD(object)->priv->~WebKitDownloadPrivate(); + WebKitDownloadPrivate* priv = WEBKIT_DOWNLOAD(object)->priv; + if (priv->webView) + g_object_remove_weak_pointer(G_OBJECT(priv->webView), reinterpret_cast<void**>(&priv->webView)); + priv->~WebKitDownloadPrivate(); G_OBJECT_CLASS(webkit_download_parent_class)->finalize(object); } @@ -278,6 +282,12 @@ void webkitDownloadSetResponse(WebKitDownload* download, WebKitURIResponse* resp g_object_notify(G_OBJECT(download), "response"); } +void webkitDownloadSetWebView(WebKitDownload* download, WebKitWebView* webView) +{ + download->priv->webView = webView; + g_object_add_weak_pointer(G_OBJECT(webView), reinterpret_cast<void**>(&download->priv->webView)); +} + bool webkitDownloadIsCancelled(WebKitDownload* download) { return download->priv->isCancelled; @@ -530,3 +540,19 @@ guint64 webkit_download_get_received_data_length(WebKitDownload* download) return download->priv->currentSize; } + +/** + * webkit_download_get_web_view: + * @download: a #WebKitDownload + * + * Get the #WebKitWebView that initiated the download. + * + * Returns: (transfer none): the #WebKitWebView that initiated @download, + * or %NULL if @download was not initiated by a #WebKitWebView. + */ +WebKitWebView* webkit_download_get_web_view(WebKitDownload* download) +{ + g_return_val_if_fail(WEBKIT_IS_DOWNLOAD(download), 0); + + return download->priv->webView; +} diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.h b/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.h index a02aa57fd..448bebf6b 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.h @@ -81,7 +81,10 @@ WEBKIT_API gdouble webkit_download_get_elapsed_time (WebKitDownload *download); WEBKIT_API guint64 -webkit_download_get_received_data_length (WebKitDownload* download); +webkit_download_get_received_data_length (WebKitDownload *download); + +WEBKIT_API WebKitWebView * +webkit_download_get_web_view (WebKitDownload *download); G_END_DECLS diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadPrivate.h index 215f565d5..d7b43050c 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadPrivate.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadPrivate.h @@ -28,6 +28,7 @@ WebKitDownload* webkitDownloadCreate(WebKit::DownloadProxy*); bool webkitDownloadIsCancelled(WebKitDownload*); void webkitDownloadSetResponse(WebKitDownload*, WebKitURIResponse*); +void webkitDownloadSetWebView(WebKitDownload*, WebKitWebView*); void webkitDownloadNotifyProgress(WebKitDownload*, guint64 bytesReceived); void webkitDownloadFailed(WebKitDownload*, const WebCore::ResourceError&); void webkitDownloadCancelled(WebKitDownload*); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp index ca60a5dc2..7707c70ab 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp @@ -179,7 +179,7 @@ static gpointer createDefaultWebContext(gpointer) * * Gets the default web context * - * Returns: (transfer none) a #WebKitWebContext + * Returns: (transfer none): a #WebKitWebContext */ WebKitWebContext* webkit_web_context_get_default(void) { @@ -290,7 +290,10 @@ static DownloadsMap& downloadsMap() * @context: a #WebKitWebContext * @uri: the URI to download * - * Requests downloading of the specified URI string. + * Requests downloading of the specified URI string. The download operation + * will not be associated to any #WebKitWebView, if you are interested in + * starting a download from a particular #WebKitWebView use + * webkit_web_view_download_uri() instead. * * Returns: (transfer full): a new #WebKitDownload representing the * the download operation. @@ -300,10 +303,7 @@ WebKitDownload* webkit_web_context_download_uri(WebKitWebContext* context, const g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), 0); g_return_val_if_fail(uri, 0); - DownloadProxy* downloadProxy = context->priv->context->download(0, WebCore::ResourceRequest(String::fromUTF8(uri))); - WebKitDownload* download = webkitDownloadCreate(downloadProxy); - downloadsMap().set(downloadProxy, download); - return download; + return webkitWebContextStartDownload(context, uri, 0); } /** @@ -695,6 +695,14 @@ WebKitDownload* webkitWebContextGetOrCreateDownload(DownloadProxy* downloadProxy return download.get(); } +WebKitDownload* webkitWebContextStartDownload(WebKitWebContext* context, const char* uri, WebPageProxy* initiatingPage) +{ + DownloadProxy* downloadProxy = context->priv->context->download(initiatingPage, WebCore::ResourceRequest(String::fromUTF8(uri))); + WebKitDownload* download = webkitDownloadCreate(downloadProxy); + downloadsMap().set(downloadProxy, download); + return download; +} + void webkitWebContextRemoveDownload(DownloadProxy* downloadProxy) { downloadsMap().remove(downloadProxy); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h index ace23df4f..f97e167ed 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h @@ -35,6 +35,7 @@ WebKit::WebContext* webkitWebContextGetContext(WebKitWebContext*); WebKitDownload* webkitWebContextGetOrCreateDownload(WebKit::DownloadProxy*); +WebKitDownload* webkitWebContextStartDownload(WebKitWebContext*, const char* uri, WebKit::WebPageProxy*); void webkitWebContextRemoveDownload(WebKit::DownloadProxy*); void webkitWebContextDownloadStarted(WebKitWebContext*, WebKitDownload*); WebKit::WebSoupRequestManagerProxy* webkitWebContextGetRequestManager(WebKitWebContext*); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp index de0f28dce..506f11a55 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp @@ -28,6 +28,7 @@ #include "WebKitContextMenuClient.h" #include "WebKitContextMenuItemPrivate.h" #include "WebKitContextMenuPrivate.h" +#include "WebKitDownloadPrivate.h" #include "WebKitEnumTypes.h" #include "WebKitError.h" #include "WebKitFaviconDatabasePrivate.h" @@ -390,6 +391,12 @@ static gboolean webkitWebViewRunFileChooser(WebKitWebView* webView, WebKitFileCh return TRUE; } +static void webkitWebViewHandleDownloadRequest(WebKitWebViewBase* webViewBase, DownloadProxy* downloadProxy) +{ + GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(downloadProxy); + webkitDownloadSetWebView(download.get(), WEBKIT_WEB_VIEW(webViewBase)); +} + static void webkitWebViewConstructed(GObject* object) { if (G_OBJECT_CLASS(webkit_web_view_parent_class)->constructed) @@ -400,6 +407,7 @@ static void webkitWebViewConstructed(GObject* object) WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(webView); webkitWebViewBaseCreateWebPage(webViewBase, webkitWebContextGetContext(priv->context), 0); + webkitWebViewBaseSetDownloadRequestHandler(webViewBase, webkitWebViewHandleDownloadRequest); attachLoaderClientToView(webView); attachUIClientToView(webView); @@ -2758,3 +2766,24 @@ gboolean webkit_web_view_save_to_file_finish(WebKitWebView* webView, GAsyncResul return TRUE; } + +/** + * webkit_web_view_download_uri: + * @web_view: a #WebKitWebView + * @uri: the URI to download + * + * Requests downloading of the specified URI string for @web_view. + * + * Returns: (transfer full): a new #WebKitDownload representing the + * the download operation. + */ +WebKitDownload* webkit_web_view_download_uri(WebKitWebView* webView, const char* uri) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); + g_return_val_if_fail(uri, 0); + + WebKitDownload* download = webkitWebContextStartDownload(webView->priv->context, uri, getPage(webView)); + webkitDownloadSetWebView(download, webView); + + return download; +} diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h index ac2e2813f..7c8381329 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h @@ -371,6 +371,10 @@ webkit_web_view_save_to_file_finish (WebKitWebView GAsyncResult *result, GError **error); +WEBKIT_API WebKitDownload * +webkit_web_view_download_uri (WebKitWebView *web_view, + const char *uri); + G_END_DECLS #endif diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp index e5bac671e..015f668cd 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp @@ -108,6 +108,8 @@ struct _WebKitWebViewBasePrivate { bool isFocused : 1; bool isVisible : 1; + WebKitWebViewBaseDownloadRequestHandler downloadHandler; + #if ENABLE(FULLSCREEN_API) bool fullScreenModeActive; WebFullScreenClientGtk fullScreenClient; @@ -978,3 +980,14 @@ bool webkitWebViewBaseIsInWindow(WebKitWebViewBase* webViewBase) { return webViewBase->priv->toplevelOnScreenWindow; } + +void webkitWebViewBaseSetDownloadRequestHandler(WebKitWebViewBase* webViewBase, WebKitWebViewBaseDownloadRequestHandler downloadHandler) +{ + webViewBase->priv->downloadHandler = downloadHandler; +} + +void webkitWebViewBaseHandleDownloadRequest(WebKitWebViewBase* webViewBase, DownloadProxy* download) +{ + if (webViewBase->priv->downloadHandler) + webViewBase->priv->downloadHandler(webViewBase, download); +} diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h index ddb3e1451..ef05f2289 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h @@ -60,4 +60,8 @@ bool webkitWebViewBaseIsFocused(WebKitWebViewBase*); bool webkitWebViewBaseIsVisible(WebKitWebViewBase*); bool webkitWebViewBaseIsInWindow(WebKitWebViewBase*); +typedef void (*WebKitWebViewBaseDownloadRequestHandler) (WebKitWebViewBase*, WebKit::DownloadProxy*); +void webkitWebViewBaseSetDownloadRequestHandler(WebKitWebViewBase*, WebKitWebViewBaseDownloadRequestHandler); +void webkitWebViewBaseHandleDownloadRequest(WebKitWebViewBase*, WebKit::DownloadProxy*); + #endif // WebKitWebViewBasePrivate_h diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt index f56267b9a..2f6f54b0d 100644 --- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt +++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt @@ -122,6 +122,7 @@ webkit_web_view_save webkit_web_view_save_finish webkit_web_view_save_to_file webkit_web_view_save_to_file_finish +webkit_web_view_download_uri <SUBSECTION WebKitJavascriptResult> WebKitJavascriptResult @@ -395,6 +396,7 @@ webkit_download_cancel webkit_download_get_estimated_progress webkit_download_get_elapsed_time webkit_download_get_received_data_length +webkit_download_get_web_view <SUBSECTION Standard> WebKitDownloadClass diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am b/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am index 734024250..1db90a628 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am +++ b/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am @@ -58,11 +58,11 @@ webkit2_tests_ldflags = \ -no-install \ -no-fast-install -DerivedSources/WebKit2/webkit2gtk-tests-resources.gresource: Source/WebKit2/UIProcess/API/gtk/tests/resources/webkit2gtk-tests.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/Source/WebKit2/UIProcess/API/gtk/tests/resources/webkit2gtk-tests.gresource.xml) +Programs/resources/webkit2gtk-tests-resources.gresource: Source/WebKit2/UIProcess/API/gtk/tests/resources/webkit2gtk-tests.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/Source/WebKit2/UIProcess/API/gtk/tests/resources/webkit2gtk-tests.gresource.xml) $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) $< -DISTCLEANFILES += DerivedSources/WebKit2/webkit2gtk-tests-resources.gresource -noinst_DATA += DerivedSources/WebKit2/webkit2gtk-tests-resources.gresource +DISTCLEANFILES += Programs/resources/webkit2gtk-tests-resources.gresource +noinst_DATA += Programs/resources/webkit2gtk-tests-resources.gresource noinst_LTLIBRARIES += Libraries/libWebKit2APITestCore.la Libraries_libWebKit2APITestCore_la_SOURCES = \ diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestDownloads.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestDownloads.cpp index 9c3262b53..56a62cd09 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestDownloads.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestDownloads.cpp @@ -19,8 +19,8 @@ #include "config.h" -#include "TestMain.h" #include "WebKitTestServer.h" +#include "WebViewTest.h" #include <glib/gstdio.h> #include <gtk/gtk.h> #include <libsoup/soup.h> @@ -184,6 +184,7 @@ static void testDownloadLocalFile(DownloadTest* test, gconstpointer) GRefPtr<WebKitDownload> download = adoptGRef(webkit_web_context_download_uri(test->m_webContext, sourceURI.get())); test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(download.get())); test->waitUntilDownloadFinishes(); + g_assert(!webkit_download_get_web_view(download.get())); Vector<DownloadTest::DownloadEvent>& events = test->m_downloadEvents; g_assert_cmpint(events.size(), ==, 5); @@ -248,6 +249,7 @@ static void testDownloadLocalFileError(DownloadErrorTest* test, gconstpointer) GRefPtr<WebKitDownload> download = adoptGRef(webkit_web_context_download_uri(test->m_webContext, "file:///foo/bar")); test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(download.get())); test->waitUntilDownloadFinishes(); + g_assert(!webkit_download_get_web_view(download.get())); Vector<DownloadTest::DownloadEvent>& events = test->m_downloadEvents; g_assert_cmpint(events.size(), ==, 3); @@ -264,6 +266,7 @@ static void testDownloadLocalFileError(DownloadErrorTest* test, gconstpointer) download = adoptGRef(webkit_web_context_download_uri(test->m_webContext, uri.get())); test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(download.get())); test->waitUntilDownloadFinishes(); + g_assert(!webkit_download_get_web_view(download.get())); events = test->m_downloadEvents; g_assert_cmpint(events.size(), ==, 4); @@ -279,6 +282,7 @@ static void testDownloadLocalFileError(DownloadErrorTest* test, gconstpointer) download = adoptGRef(webkit_web_context_download_uri(test->m_webContext, uri.get())); test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(download.get())); test->waitUntilDownloadFinishes(); + g_assert(!webkit_download_get_web_view(download.get())); events = test->m_downloadEvents; g_assert_cmpint(events.size(), ==, 4); @@ -324,6 +328,7 @@ static void testDownloadRemoteFile(DownloadTest* test, gconstpointer) GRefPtr<WebKitDownload> download = adoptGRef(webkit_web_context_download_uri(test->m_webContext, kServer->getURIForPath("/test.pdf").data())); test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(download.get())); test->waitUntilDownloadFinishes(); + g_assert(!webkit_download_get_web_view(download.get())); Vector<DownloadTest::DownloadEvent>& events = test->m_downloadEvents; g_assert_cmpint(events.size(), ==, 5); @@ -351,6 +356,7 @@ static void testDownloadRemoteFileError(DownloadErrorTest* test, gconstpointer) kServer->getURIForPath("/foo").data())); test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(download.get())); test->waitUntilDownloadFinishes(); + g_assert(!webkit_download_get_web_view(download.get())); Vector<DownloadTest::DownloadEvent>& events = test->m_downloadEvents; g_assert_cmpint(events.size(), ==, 4); @@ -367,6 +373,7 @@ static void testDownloadRemoteFileError(DownloadErrorTest* test, gconstpointer) download = adoptGRef(webkit_web_context_download_uri(test->m_webContext, kServer->getURIForPath("/test.pdf").data())); test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(download.get())); test->waitUntilDownloadFinishes(); + g_assert(!webkit_download_get_web_view(download.get())); events = test->m_downloadEvents; g_assert_cmpint(events.size(), ==, 4); @@ -382,6 +389,7 @@ static void testDownloadRemoteFileError(DownloadErrorTest* test, gconstpointer) download = adoptGRef(webkit_web_context_download_uri(test->m_webContext, kServer->getURIForPath("/test.pdf").data())); test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(download.get())); test->waitUntilDownloadFinishes(); + g_assert(!webkit_download_get_web_view(download.get())); events = test->m_downloadEvents; g_assert_cmpint(events.size(), ==, 4); @@ -394,6 +402,110 @@ static void testDownloadRemoteFileError(DownloadErrorTest* test, gconstpointer) test->checkDestinationAndDeleteFile(download.get(), kServerSuggestedFilename); } +class WebViewDownloadTest: public WebViewTest { +public: + MAKE_GLIB_TEST_FIXTURE(WebViewDownloadTest); + + static void downloadStartedCallback(WebKitWebContext* context, WebKitDownload* download, WebViewDownloadTest* test) + { + test->m_download = download; + test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(download)); + test->quitMainLoop(); + } + + WebViewDownloadTest() + { + g_signal_connect(webkit_web_view_get_context(m_webView), "download-started", G_CALLBACK(downloadStartedCallback), this); + } + + ~WebViewDownloadTest() + { + g_signal_handlers_disconnect_matched(webkit_web_view_get_context(m_webView), G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this); + } + + void waitUntilDownloadStarted() + { + m_download = 0; + g_main_loop_run(m_mainLoop); + g_assert(m_download.get()); + } + + static gboolean downloadDecideDestinationCallback(WebKitDownload* download, const gchar* suggestedFilename, WebViewDownloadTest* test) + { + GOwnPtr<char> destination(g_build_filename(kTempDirectory, suggestedFilename, NULL)); + GOwnPtr<char> destinationURI(g_filename_to_uri(destination.get(), 0, 0)); + webkit_download_set_destination(download, destinationURI.get()); + return TRUE; + } + + static void downloadFinishedCallback(WebKitDownload* download, WebViewDownloadTest* test) + { + test->quitMainLoop(); + } + + void waitUntilDownloadFinished() + { + g_signal_connect(m_download.get(), "decide-destination", G_CALLBACK(downloadDecideDestinationCallback), this); + g_signal_connect(m_download.get(), "finished", G_CALLBACK(downloadFinishedCallback), this); + g_main_loop_run(m_mainLoop); + } + + GRefPtr<WebKitDownload> m_download; +}; + +static void testWebViewDownloadURI(WebViewDownloadTest* test, gconstpointer) +{ + GRefPtr<WebKitDownload> download = adoptGRef(webkit_web_view_download_uri(test->m_webView, kServer->getURIForPath("/test.pdf").data())); + test->waitUntilDownloadStarted(); + g_assert(test->m_webView == webkit_download_get_web_view(download.get())); + test->waitUntilDownloadFinished(); + + GRefPtr<GFile> downloadFile = adoptGRef(g_file_new_for_uri(webkit_download_get_destination(download.get()))); + GRefPtr<GFileInfo> downloadFileInfo = adoptGRef(g_file_query_info(downloadFile.get(), G_FILE_ATTRIBUTE_STANDARD_SIZE, static_cast<GFileQueryInfoFlags>(0), 0, 0)); + g_assert_cmpint(g_file_info_get_size(downloadFileInfo.get()), >, 0); + g_file_delete(downloadFile.get(), 0, 0); +} + +class PolicyResponseDownloadTest: public WebViewDownloadTest { +public: + MAKE_GLIB_TEST_FIXTURE(PolicyResponseDownloadTest); + + static gboolean decidePolicyCallback(WebKitWebView* webView, WebKitPolicyDecision* decision, WebKitPolicyDecisionType type, PolicyResponseDownloadTest* test) + { + if (type != WEBKIT_POLICY_DECISION_TYPE_RESPONSE) + return FALSE; + + webkit_policy_decision_download(decision); + return TRUE; + } + + PolicyResponseDownloadTest() + { + g_signal_connect(m_webView, "decide-policy", G_CALLBACK(decidePolicyCallback), this); + } + + ~PolicyResponseDownloadTest() + { + g_signal_handlers_disconnect_matched(m_webView, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this); + } + + void cancelDownloadAndWaitUntilFinished() + { + webkit_download_cancel(m_download.get()); + waitUntilDownloadFinished(); + m_download = 0; + } +}; + +static void testPolicyResponseDownload(PolicyResponseDownloadTest* test, gconstpointer) +{ + // Test that a download started by the the policy checker contains the web view. + test->loadURI(kServer->getURIForPath("/test.pdf").data()); + test->waitUntilDownloadStarted(); + g_assert(test->m_webView == webkit_download_get_web_view(test->m_download.get())); + test->cancelDownloadAndWaitUntilFinished(); +} + void beforeAll() { kServer = new WebKitTestServer(); @@ -406,6 +518,8 @@ void beforeAll() DownloadErrorTest::add("Downloads", "local-file-error", testDownloadLocalFileError); DownloadTest::add("Downloads", "remote-file", testDownloadRemoteFile); DownloadErrorTest::add("Downloads", "remote-file-error", testDownloadRemoteFileError); + WebViewDownloadTest::add("WebKitWebView", "download-uri", testWebViewDownloadURI); + PolicyResponseDownloadTest::add("Downloads", "policy-decision-download", testPolicyResponseDownload); } void afterAll() diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestMain.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestMain.cpp index 9db47f82b..2044ab52e 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestMain.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestMain.cpp @@ -27,7 +27,7 @@ void afterAll(); static void registerGResource(void) { - GOwnPtr<char> resourcesPath(g_build_filename(WEBKIT_DERIVED_SRC_DIR, "WebKit2", "webkit2gtk-tests-resources.gresource", NULL)); + GOwnPtr<char> resourcesPath(g_build_filename(WEBKIT_EXEC_PATH, "resources", "webkit2gtk-tests-resources.gresource", NULL)); GResource* resource = g_resource_load(resourcesPath.get(), 0); g_assert(resource); diff --git a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm index ba88107e1..7b54b4bd7 100644 --- a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm +++ b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm @@ -139,7 +139,7 @@ PageClientImpl::~PageClientImpl() PassOwnPtr<DrawingAreaProxy> PageClientImpl::createDrawingAreaProxy() { - return [m_wkView _wk_createDrawingAreaProxy]; + return [m_wkView _createDrawingAreaProxy]; } void PageClientImpl::setViewNeedsDisplay(const WebCore::IntRect& rect) @@ -156,7 +156,7 @@ void PageClientImpl::scrollView(const IntRect& scrollRect, const IntSize& scroll { NSRect clippedScrollRect = NSIntersectionRect(scrollRect, NSOffsetRect(scrollRect, -scrollOffset.width(), -scrollOffset.height())); - [m_wkView _wk_cacheWindowBottomCornerRect]; + [m_wkView _cacheWindowBottomCornerRect]; [m_wkView translateRectsNeedingDisplayInRect:clippedScrollRect by:scrollOffset]; [m_wkView scrollRect:clippedScrollRect by:scrollOffset]; @@ -174,7 +174,7 @@ bool PageClientImpl::isViewWindowActive() bool PageClientImpl::isViewFocused() { - return [m_wkView _wk_isFocused]; + return [m_wkView _isFocused]; } void PageClientImpl::makeFirstResponder() @@ -220,17 +220,17 @@ LayerHostingMode PageClientImpl::viewLayerHostingMode() ColorSpaceData PageClientImpl::colorSpace() { - return [m_wkView _wk_colorSpace]; + return [m_wkView _colorSpace]; } void PageClientImpl::processDidCrash() { - [m_wkView _wk_processDidCrash]; + [m_wkView _processDidCrash]; } void PageClientImpl::pageClosed() { - [m_wkView _wk_pageClosed]; + [m_wkView _pageClosed]; #if USE(DICTATION_ALTERNATIVES) m_alternativeTextUIController->clear(); #endif @@ -238,18 +238,18 @@ void PageClientImpl::pageClosed() void PageClientImpl::didRelaunchProcess() { - [m_wkView _wk_didRelaunchProcess]; + [m_wkView _didRelaunchProcess]; } void PageClientImpl::toolTipChanged(const String& oldToolTip, const String& newToolTip) { - [m_wkView _wk_toolTipChangedFrom:nsStringFromWebCoreString(oldToolTip) to:nsStringFromWebCoreString(newToolTip)]; + [m_wkView _toolTipChangedFrom:nsStringFromWebCoreString(oldToolTip) to:nsStringFromWebCoreString(newToolTip)]; } void PageClientImpl::setCursor(const WebCore::Cursor& cursor) { if (![NSApp _cursorRectCursor]) - [m_wkView _wk_setCursor:cursor.platformCursor()]; + [m_wkView _setCursor:cursor.platformCursor()]; } void PageClientImpl::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves) @@ -291,7 +291,7 @@ void PageClientImpl::executeUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo) bool PageClientImpl::interpretKeyEvent(const NativeWebKeyboardEvent& event, Vector<WebCore::KeypressCommand>& commands) { - return [m_wkView _wk_interpretKeyEvent:event.nativeEvent() savingCommandsTo:commands]; + return [m_wkView _interpretKeyEvent:event.nativeEvent() savingCommandsTo:commands]; } void PageClientImpl::setDragImage(const IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag) @@ -299,34 +299,34 @@ void PageClientImpl::setDragImage(const IntPoint& clientPosition, PassRefPtr<Sha RetainPtr<CGImageRef> dragCGImage = dragImage->makeCGImage(); RetainPtr<NSImage> dragNSImage(AdoptNS, [[NSImage alloc] initWithCGImage:dragCGImage.get() size:dragImage->size()]); - [m_wkView _wk_setDragImage:dragNSImage.get() at:clientPosition linkDrag:isLinkDrag]; + [m_wkView _setDragImage:dragNSImage.get() at:clientPosition linkDrag:isLinkDrag]; } void PageClientImpl::setPromisedData(const String& pasteboardName, PassRefPtr<SharedBuffer> imageBuffer, const String& filename, const String& extension, const String& title, const String& url, const String& visibleUrl, PassRefPtr<SharedBuffer> archiveBuffer) { RefPtr<Image> image = BitmapImage::create(); image->setData(imageBuffer.get(), true); - [m_wkView _wk_setPromisedData:image.get() withFileName:filename withExtension:extension withTitle:title withURL:url withVisibleURL:visibleUrl withArchive:archiveBuffer.get() forPasteboard:pasteboardName]; + [m_wkView _setPromisedData:image.get() withFileName:filename withExtension:extension withTitle:title withURL:url withVisibleURL:visibleUrl withArchive:archiveBuffer.get() forPasteboard:pasteboardName]; } void PageClientImpl::updateTextInputState(bool updateSecureInputState) { - [m_wkView _wk_updateTextInputStateIncludingSecureInputState:updateSecureInputState]; + [m_wkView _updateTextInputStateIncludingSecureInputState:updateSecureInputState]; } void PageClientImpl::resetTextInputState() { - [m_wkView _wk_resetTextInputState]; + [m_wkView _resetTextInputState]; } FloatRect PageClientImpl::convertToDeviceSpace(const FloatRect& rect) { - return [m_wkView _wk_convertToDeviceSpace:rect]; + return [m_wkView _convertToDeviceSpace:rect]; } FloatRect PageClientImpl::convertToUserSpace(const FloatRect& rect) { - return [m_wkView _wk_convertToUserSpace:rect]; + return [m_wkView _convertToUserSpace:rect]; } IntPoint PageClientImpl::screenToWindow(const IntPoint& point) @@ -352,7 +352,7 @@ void PageClientImpl::doneWithGestureEvent(const WebGestureEvent&, bool wasEventH void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent& event, bool eventWasHandled) { - [m_wkView _wk_doneWithKeyEvent:event.nativeEvent() eventWasHandled:eventWasHandled]; + [m_wkView _doneWithKeyEvent:event.nativeEvent() eventWasHandled:eventWasHandled]; } PassRefPtr<WebPopupMenuProxy> PageClientImpl::createPopupMenuProxy(WebPageProxy* page) @@ -375,40 +375,40 @@ PassRefPtr<WebColorChooserProxy> PageClientImpl::createColorChooserProxy(WebPage void PageClientImpl::setFindIndicator(PassRefPtr<FindIndicator> findIndicator, bool fadeOut, bool animate) { - [m_wkView _wk_setFindIndicator:findIndicator fadeOut:fadeOut animate:animate]; + [m_wkView _setFindIndicator:findIndicator fadeOut:fadeOut animate:animate]; } void PageClientImpl::accessibilityWebProcessTokenReceived(const CoreIPC::DataReference& data) { - NSData *remoteToken = [NSData dataWithBytes:data.data() length:data.size()]; - [m_wkView _wk_setAccessibilityWebProcessToken:remoteToken]; + NSData* remoteToken = [NSData dataWithBytes:data.data() length:data.size()]; + [m_wkView _setAccessibilityWebProcessToken:remoteToken]; } #if USE(ACCELERATED_COMPOSITING) void PageClientImpl::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext) { - [m_wkView _wk_enterAcceleratedCompositingMode:layerTreeContext]; + [m_wkView _enterAcceleratedCompositingMode:layerTreeContext]; } void PageClientImpl::exitAcceleratedCompositingMode() { - [m_wkView _wk_exitAcceleratedCompositingMode]; + [m_wkView _exitAcceleratedCompositingMode]; } void PageClientImpl::updateAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext) { - [m_wkView _wk_updateAcceleratedCompositingMode:layerTreeContext]; + [m_wkView _updateAcceleratedCompositingMode:layerTreeContext]; } #endif // USE(ACCELERATED_COMPOSITING) void PageClientImpl::pluginFocusOrWindowFocusChanged(uint64_t pluginComplexTextInputIdentifier, bool pluginHasFocusAndWindowHasFocus) { - [m_wkView _wk_pluginFocusOrWindowFocusChanged:pluginHasFocusAndWindowHasFocus pluginComplexTextInputIdentifier:pluginComplexTextInputIdentifier]; + [m_wkView _pluginFocusOrWindowFocusChanged:pluginHasFocusAndWindowHasFocus pluginComplexTextInputIdentifier:pluginComplexTextInputIdentifier]; } void PageClientImpl::setPluginComplexTextInputState(uint64_t pluginComplexTextInputIdentifier, PluginComplexTextInputState pluginComplexTextInputState) { - [m_wkView _wk_setPluginComplexTextInputState:pluginComplexTextInputState pluginComplexTextInputIdentifier:pluginComplexTextInputIdentifier]; + [m_wkView _setPluginComplexTextInputState:pluginComplexTextInputState pluginComplexTextInputIdentifier:pluginComplexTextInputIdentifier]; } CGContextRef PageClientImpl::containingWindowGraphicsContext() @@ -424,37 +424,37 @@ CGContextRef PageClientImpl::containingWindowGraphicsContext() void PageClientImpl::didChangeScrollbarsForMainFrame() const { - [m_wkView _wk_didChangeScrollbarsForMainFrame]; + [m_wkView _didChangeScrollbarsForMainFrame]; } void PageClientImpl::didCommitLoadForMainFrame(bool useCustomRepresentation) { - [m_wkView _wk_setPageHasCustomRepresentation:useCustomRepresentation]; + [m_wkView _setPageHasCustomRepresentation:useCustomRepresentation]; } void PageClientImpl::didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference& dataReference) { - [m_wkView _wk_didFinishLoadingDataForCustomRepresentationWithSuggestedFilename:suggestedFilename dataReference:dataReference]; + [m_wkView _didFinishLoadingDataForCustomRepresentationWithSuggestedFilename:suggestedFilename dataReference:dataReference]; } double PageClientImpl::customRepresentationZoomFactor() { - return [m_wkView _wk_customRepresentationZoomFactor]; + return [m_wkView _customRepresentationZoomFactor]; } void PageClientImpl::setCustomRepresentationZoomFactor(double zoomFactor) { - [m_wkView _wk_setCustomRepresentationZoomFactor:zoomFactor]; + [m_wkView _setCustomRepresentationZoomFactor:zoomFactor]; } void PageClientImpl::findStringInCustomRepresentation(const String& string, FindOptions options, unsigned maxMatchCount) { - [m_wkView _wk_findStringInCustomRepresentation:string withFindOptions:options maxMatchCount:maxMatchCount]; + [m_wkView _findStringInCustomRepresentation:string withFindOptions:options maxMatchCount:maxMatchCount]; } void PageClientImpl::countStringMatchesInCustomRepresentation(const String& string, FindOptions options, unsigned maxMatchCount) { - [m_wkView _wk_countStringMatchesInCustomRepresentation:string withFindOptions:options maxMatchCount:maxMatchCount]; + [m_wkView _countStringMatchesInCustomRepresentation:string withFindOptions:options maxMatchCount:maxMatchCount]; } void PageClientImpl::flashBackingStoreUpdates(const Vector<IntRect>&) @@ -555,11 +555,10 @@ void PageClientImpl::recommendedScrollbarStyleDidChange(int32_t newStyle) bool PageClientImpl::executeSavedCommandBySelector(const String& selectorString) { - return [m_wkView _wk_executeSavedCommandBySelector:NSSelectorFromString(selectorString)]; + return [m_wkView _executeSavedCommandBySelector:NSSelectorFromString(selectorString)]; } #if USE(DICTATION_ALTERNATIVES) - uint64_t PageClientImpl::addDictationAlternatives(const RetainPtr<NSTextAlternatives>& alternatives) { return m_alternativeTextUIController->addAlternatives(alternatives); @@ -575,7 +574,7 @@ void PageClientImpl::showDictationAlternativeUI(const WebCore::FloatRect& boundi if (!isViewVisible() || !isViewInWindow()) return; m_alternativeTextUIController->showAlternatives(m_wkView, boundingBoxOfDictatedText, dictationContext, ^(NSString* acceptedAlternative){ - [m_wkView _wk_handleAcceptedAlternativeText:acceptedAlternative]; + [m_wkView handleAcceptedAlternativeText:acceptedAlternative]; }); } @@ -588,7 +587,6 @@ void PageClientImpl::dismissDictationAlternativeUI() { m_alternativeTextUIController->dismissAlternatives(); } - #endif } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/API/mac/WKConnection.h b/Source/WebKit2/UIProcess/API/mac/WKConnection.h index bf582b303..52bd85c66 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKConnection.h +++ b/Source/WebKit2/UIProcess/API/mac/WKConnection.h @@ -41,6 +41,8 @@ WK_EXPORT WKConnectionData *_data; } +- (void)sendMessageWithName:(NSString *)messageName body:(id)messageBody; + #pragma mark Delegates @property(assign) id<WKConnectionDelegate> delegate; diff --git a/Source/WebKit2/UIProcess/API/mac/WKConnection.mm b/Source/WebKit2/UIProcess/API/mac/WKConnection.mm index 626ec85e6..8040a6781 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKConnection.mm +++ b/Source/WebKit2/UIProcess/API/mac/WKConnection.mm @@ -27,11 +27,18 @@ #import "WKConnection.h" #import "WKConnectionInternal.h" +#import "ArgumentCodersMac.h" +#import "ArgumentDecoder.h" +#import "ArgumentEncoder.h" #import "WKConnectionRef.h" +#import "WKData.h" #import "WKRetainPtr.h" +#import "WKString.h" #import "WKStringCF.h" #import <wtf/RetainPtr.h> +using namespace WebKit; + @interface WKConnectionData : NSObject { @public // Underlying connection object. @@ -55,6 +62,17 @@ [super dealloc]; } +- (void)sendMessageWithName:(NSString *)messageName body:(id)messageBody +{ + OwnPtr<CoreIPC::ArgumentEncoder> messageData = CoreIPC::ArgumentEncoder::create(); + encode(*messageData, messageBody); + + WKRetainPtr<WKStringRef> wkMessageName = adoptWK(WKStringCreateWithCFString((CFStringRef)messageName)); + WKRetainPtr<WKDataRef> wkMessageBody = adoptWK(WKDataCreate(messageData->buffer(), messageData->bufferSize())); + + WKConnectionPostMessage(_data->_connectionRef.get(), wkMessageName.get(), wkMessageBody.get()); +} + #pragma mark Delegates - (id<WKConnectionDelegate>)delegate @@ -75,9 +93,17 @@ static void didReceiveMessage(WKConnectionRef, WKStringRef messageName, WKTypeRe { WKConnection *connection = (WKConnection *)clientInfo; if ([connection.delegate respondsToSelector:@selector(connection:didReceiveMessageWithName:body:)]) { - // FIXME: Add messageBody conversion. RetainPtr<CFStringRef> cfMessageName = adoptCF(WKStringCopyCFString(kCFAllocatorDefault, messageName)); - [connection.delegate connection:connection didReceiveMessageWithName:(NSString *)cfMessageName.get() body:nil]; + + WKDataRef messageData = (WKDataRef)messageBody; + OwnPtr<CoreIPC::ArgumentDecoder> decoder = CoreIPC::ArgumentDecoder::create(WKDataGetBytes(messageData), WKDataGetSize(messageData)); + + RetainPtr<id> messageDictionary; + // FIXME: Don't just silently drop decoding failures on the ground. + if (!decode(decoder.get(), messageDictionary)) + return; + + [connection.delegate connection:connection didReceiveMessageWithName:(NSString *)cfMessageName.get() body:messageDictionary.get()]; } } diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.mm b/Source/WebKit2/UIProcess/API/mac/WKView.mm index ac037fb30..5fd169c84 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKView.mm +++ b/Source/WebKit2/UIProcess/API/mac/WKView.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved. + * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,6 +26,11 @@ #import "config.h" #import "WKView.h" +#if USE(DICTATION_ALTERNATIVES) +#import <AppKit/NSTextAlternatives.h> +#import <AppKit/NSAttributedString.h> +#endif + #import "AttributedString.h" #import "ColorSpaceData.h" #import "DataReference.h" @@ -41,16 +46,14 @@ #import "PDFViewController.h" #import "PageClientImpl.h" #import "PasteboardTypes.h" +#import "RemoteLayerTreeDrawingAreaProxy.h" #import "StringUtilities.h" #import "TextChecker.h" #import "TextCheckerState.h" #import "TiledCoreAnimationDrawingAreaProxy.h" #import "WKAPICast.h" -#import "WKBrowsingContextControllerInternal.h" -#import "WKBrowsingContextGroupInternal.h" #import "WKFullScreenWindowController.h" #import "WKPrintingView.h" -#import "WKProcessGroupInternal.h" #import "WKStringCF.h" #import "WKTextInputWindowController.h" #import "WKViewInternal.h" @@ -67,7 +70,6 @@ #import <WebCore/DragController.h> #import <WebCore/DragData.h> #import <WebCore/DragSession.h> -#import <WebCore/FileSystem.h> #import <WebCore/FloatRect.h> #import <WebCore/Image.h> #import <WebCore/IntRect.h> @@ -80,14 +82,17 @@ #import <WebCore/SharedBuffer.h> #import <WebCore/TextAlternativeWithRange.h> #import <WebCore/WebCoreNSStringExtras.h> +#import <WebCore/FileSystem.h> #import <WebKitSystemInterface.h> #import <sys/stat.h> #import <wtf/RefPtr.h> #import <wtf/RetainPtr.h> -#if USE(DICTATION_ALTERNATIVES) -#import <AppKit/NSTextAlternatives.h> -#endif +/* API internals. */ +#import "WKBrowsingContextControllerInternal.h" +#import "WKBrowsingContextGroupInternal.h" +#import "WKProcessGroupInternal.h" + @interface NSApplication (WKNSApplicationDetails) - (void)speakString:(NSString *)string; @@ -130,12 +135,13 @@ struct WKViewInterpretKeyEventsParameters { }; @interface WKView () -- (void)_wk_accessibilityRegisterUIProcessTokens; -- (void)_wk_disableComplexTextInputIfNecessary; -- (float)_wk_intrinsicDeviceScaleFactor; -- (void)_wk_postFakeMouseMovedEventForFlagsChangedEvent:(NSEvent *)flagsChangedEvent; -- (void)_wk_setDrawingAreaSize:(NSSize)size; -- (void)_wk_setPluginComplexTextInputState:(PluginComplexTextInputState)pluginComplexTextInputState; +- (void)_accessibilityRegisterUIProcessTokens; +- (void)_disableComplexTextInputIfNecessary; +- (float)_intrinsicDeviceScaleFactor; +- (void)_postFakeMouseMovedEventForFlagsChangedEvent:(NSEvent *)flagsChangedEvent; +- (void)_setDrawingAreaSize:(NSSize)size; +- (void)_setPluginComplexTextInputState:(PluginComplexTextInputState)pluginComplexTextInputState; +- (BOOL)_shouldUseTiledDrawingArea; @end @interface WKViewData : NSObject { @@ -209,8 +215,6 @@ struct WKViewInterpretKeyEventsParameters { RefPtr<WebCore::Image> _promisedImage; String _promisedFilename; String _promisedURL; - - RetainPtr<NSMutableArray> _observers; } @end @@ -218,6 +222,7 @@ struct WKViewInterpretKeyEventsParameters { @implementation WKViewData @end + @interface WKResponderChainSink : NSResponder { NSResponder *_lastResponderInChain; bool _didReceiveUnhandledCommand; @@ -303,7 +308,7 @@ struct WKViewInterpretKeyEventsParameters { _data->_inBecomeFirstResponder = true; - [self _wk_updateSecureInputState]; + [self _updateSecureInputState]; _data->_page->viewStateDidChange(WebPageProxy::ViewIsFocused); _data->_inBecomeFirstResponder = false; @@ -324,7 +329,7 @@ struct WKViewInterpretKeyEventsParameters { if (_data->_page->editorState().hasComposition && !_data->_page->editorState().shouldIgnoreCompositionSelectionChange) _data->_page->cancelComposition(); - [self _wk_resetTextInputState]; + [self _resetTextInputState]; if (!_data->_page->maintainsInactiveSelection()) _data->_page->clearSelection(); @@ -359,10 +364,10 @@ struct WKViewInterpretKeyEventsParameters { [super setFrameSize:size]; if (![self frameSizeUpdatesDisabled]) - [self _wk_setDrawingAreaSize:size]; + [self _setDrawingAreaSize:size]; } -- (void)_wk_updateWindowAndViewFrames +- (void)_updateWindowAndViewFrames { NSWindow *window = [self window]; ASSERT(window); @@ -381,12 +386,12 @@ struct WKViewInterpretKeyEventsParameters { // Update the view frame. if ([self window]) - [self _wk_updateWindowAndViewFrames]; + [self _updateWindowAndViewFrames]; [super renewGState]; } -- (void)_wk_setPluginComplexTextInputState:(PluginComplexTextInputState)pluginComplexTextInputState +- (void)_setPluginComplexTextInputState:(PluginComplexTextInputState)pluginComplexTextInputState { _data->_pluginComplexTextInputState = pluginComplexTextInputState; @@ -649,7 +654,7 @@ static void validateCommandCallback(WKStringRef commandName, bool isEnabled, int WKView* wkView = static_cast<WKView*>(context); ASSERT(wkView); - [wkView _wk_setUserInterfaceItemState:nsStringFromWebCoreString(toImpl(commandName)->string()) enabled:isEnabled state:state]; + [wkView _setUserInterfaceItemState:nsStringFromWebCoreString(toImpl(commandName)->string()) enabled:isEnabled state:state]; } - (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item @@ -960,7 +965,7 @@ static void speakString(WKStringRef string, WKErrorRef error, void*) { #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // FIXME: We should remove this code when <rdar://problem/9362085> is resolved. In the meantime, - // it is necessary to disable screen updates so we get a chance to redraw the corners before this + // it is necessary to disable scren updates so we get a chance to redraw the corners before this // display is visible. NSWindow *window = [self window]; BOOL shouldMaskWindow = window && !NSIsEmptyRect(_data->_windowBottomCornerIntersectionRect); @@ -988,7 +993,7 @@ static void speakString(WKStringRef string, WKErrorRef error, void*) return YES; } -- (void)_wk_setMouseDownEvent:(NSEvent *)event +- (void)_setMouseDownEvent:(NSEvent *)event { ASSERT(!event || [event type] == NSLeftMouseDown || [event type] == NSRightMouseDown || [event type] == NSOtherMouseDown); @@ -1012,10 +1017,10 @@ static void speakString(WKStringRef string, WKErrorRef error, void*) NATIVE_MOUSE_EVENT_HANDLER(mouseEntered) NATIVE_MOUSE_EVENT_HANDLER(mouseExited) -NATIVE_MOUSE_EVENT_HANDLER(_wk_mouseMovedInternal) -NATIVE_MOUSE_EVENT_HANDLER(_wk_mouseDownInternal) -NATIVE_MOUSE_EVENT_HANDLER(_wk_mouseUpInternal) -NATIVE_MOUSE_EVENT_HANDLER(_wk_mouseDraggedInternal) +NATIVE_MOUSE_EVENT_HANDLER(mouseMovedInternal) +NATIVE_MOUSE_EVENT_HANDLER(mouseDownInternal) +NATIVE_MOUSE_EVENT_HANDLER(mouseUpInternal) +NATIVE_MOUSE_EVENT_HANDLER(mouseDraggedInternal) NATIVE_MOUSE_EVENT_HANDLER(otherMouseDown) NATIVE_MOUSE_EVENT_HANDLER(otherMouseDragged) NATIVE_MOUSE_EVENT_HANDLER(otherMouseMoved) @@ -1043,27 +1048,27 @@ NATIVE_EVENT_HANDLER(scrollWheel, Wheel) if (self == [[self window] firstResponder] && !NSPointInRect([self convertPoint:[event locationInWindow] fromView:nil], [self visibleRect])) return; - [self _wk_mouseMovedInternal:event]; + [self mouseMovedInternal:event]; } - (void)mouseDown:(NSEvent *)event { - [self _wk_setMouseDownEvent:event]; + [self _setMouseDownEvent:event]; _data->_ignoringMouseDraggedEvents = NO; - [self _wk_mouseDownInternal:event]; + [self mouseDownInternal:event]; } - (void)mouseUp:(NSEvent *)event { - [self _wk_setMouseDownEvent:nil]; - [self _wk_mouseUpInternal:event]; + [self _setMouseDownEvent:nil]; + [self mouseUpInternal:event]; } - (void)mouseDragged:(NSEvent *)event { if (_data->_ignoringMouseDraggedEvents) return; - [self _wk_mouseDraggedInternal:event]; + [self mouseDraggedInternal:event]; } - (BOOL)acceptsFirstMouse:(NSEvent *)event @@ -1076,9 +1081,9 @@ NATIVE_EVENT_HANDLER(scrollWheel, Wheel) if (![self hitTest:[event locationInWindow]]) return NO; - [self _wk_setMouseDownEvent:event]; + [self _setMouseDownEvent:event]; bool result = _data->_page->acceptsFirstMouse([event eventNumber], WebEventFactory::createWebMouseEvent(event, self)); - [self _wk_setMouseDownEvent:nil]; + [self _setMouseDownEvent:nil]; return result; } @@ -1097,9 +1102,9 @@ NATIVE_EVENT_HANDLER(scrollWheel, Wheel) if (![self hitTest:[event locationInWindow]]) return NO; - [self _wk_setMouseDownEvent:event]; + [self _setMouseDownEvent:event]; bool result = _data->_page->shouldDelayWindowOrderingForEvent(WebEventFactory::createWebMouseEvent(event, self)); - [self _wk_setMouseDownEvent:nil]; + [self _setMouseDownEvent:nil]; return result; } @@ -1136,7 +1141,6 @@ static const short kIOHIDEventTypeScroll = 6; }]; } } - #endif - (void)doCommandBySelector:(SEL)selector @@ -1223,7 +1227,7 @@ static const short kIOHIDEventTypeScroll = 6; parameters->eventInterpretationHadSideEffects |= eventHandled; } -- (BOOL)_wk_handleStyleKeyEquivalent:(NSEvent *)event +- (BOOL)_handleStyleKeyEquivalent:(NSEvent *)event { if (!_data->_page->editorState().isContentEditable) return NO; @@ -1259,7 +1263,7 @@ static const short kIOHIDEventTypeScroll = 6; BOOL eventWasSentToWebCore = (_data->_keyDownEventBeingResent == event); if (!eventWasSentToWebCore) - [self _wk_disableComplexTextInputIfNecessary]; + [self _disableComplexTextInputIfNecessary]; // Pass key combos through WebCore if there is a key binding available for // this event. This lets web pages have a crack at intercepting key-modified keypresses. @@ -1270,7 +1274,7 @@ static const short kIOHIDEventTypeScroll = 6; return YES; } - return [self _wk_handleStyleKeyEquivalent:event] || [super performKeyEquivalent:event]; + return [self _handleStyleKeyEquivalent:event] || [super performKeyEquivalent:event]; } - (void)keyUp:(NSEvent *)theEvent @@ -1279,7 +1283,7 @@ static const short kIOHIDEventTypeScroll = 6; _data->_page->handleKeyboardEvent(NativeWebKeyboardEvent(theEvent, self)); } -- (void)_wk_disableComplexTextInputIfNecessary +- (void)_disableComplexTextInputIfNecessary { if (!_data->_pluginComplexTextInputIdentifier) return; @@ -1289,10 +1293,10 @@ static const short kIOHIDEventTypeScroll = 6; // Check if the text input window has been dismissed. if (![[WKTextInputWindowController sharedTextInputWindowController] hasMarkedText]) - [self _wk_setPluginComplexTextInputState:PluginComplexTextInputDisabled]; + [self _setPluginComplexTextInputState:PluginComplexTextInputDisabled]; } -- (BOOL)_wk_handlePluginComplexTextInputKeyDown:(NSEvent *)event +- (BOOL)_handlePluginComplexTextInputKeyDown:(NSEvent *)event { ASSERT(_data->_pluginComplexTextInputIdentifier); ASSERT(_data->_pluginComplexTextInputState != PluginComplexTextInputDisabled); @@ -1312,18 +1316,18 @@ static const short kIOHIDEventTypeScroll = 6; return didHandleEvent; } -- (BOOL)_wk_tryHandlePluginComplexTextInputKeyDown:(NSEvent *)event +- (BOOL)_tryHandlePluginComplexTextInputKeyDown:(NSEvent *)event { if (!_data->_pluginComplexTextInputIdentifier || _data->_pluginComplexTextInputState == PluginComplexTextInputDisabled) return NO; // Check if the text input window has been dismissed and let the plug-in process know. // This is only valid with the updated Cocoa text input spec. - [self _wk_disableComplexTextInputIfNecessary]; + [self _disableComplexTextInputIfNecessary]; // Try feeding the keyboard event directly to the plug-in. if (_data->_pluginComplexTextInputState == PluginComplexTextInputEnabledLegacy) - return [self _wk_handlePluginComplexTextInputKeyDown:event]; + return [self _handlePluginComplexTextInputKeyDown:event]; return NO; } @@ -1337,7 +1341,7 @@ static const short kIOHIDEventTypeScroll = 6; // the current event prevents that from causing a problem inside WebKit or AppKit code. [[theEvent retain] autorelease]; - if ([self _wk_tryHandlePluginComplexTextInputKeyDown:theEvent]) { + if ([self _tryHandlePluginComplexTextInputKeyDown:theEvent]) { LOG(TextInput, "...handled by plug-in"); return; } @@ -1371,7 +1375,7 @@ static const short kIOHIDEventTypeScroll = 6; _data->_page->handleKeyboardEvent(NativeWebKeyboardEvent(theEvent, self)); } -- (void)_wk_executeSavedKeypressCommands +- (void)_executeSavedKeypressCommands { WKViewInterpretKeyEventsParameters* parameters = _data->_interpretKeyEventsParameters; if (!parameters || parameters->commands->isEmpty()) @@ -1392,7 +1396,7 @@ static const short kIOHIDEventTypeScroll = 6; LOG(TextInput, "...done executing saved keypress commands."); } -- (void)_wk_notifyInputContextAboutDiscardedComposition +- (void)_notifyInputContextAboutDiscardedComposition { // <rdar://problem/9359055>: -discardMarkedText can only be called for active contexts. // FIXME: We fail to ever notify the input context if something (e.g. a navigation) happens while the window is not key. @@ -1420,7 +1424,7 @@ static const short kIOHIDEventTypeScroll = 6; - (NSRange)selectedRange { - [self _wk_executeSavedKeypressCommands]; + [self _executeSavedKeypressCommands]; uint64_t selectionStart; uint64_t selectionLength; @@ -1444,7 +1448,7 @@ static const short kIOHIDEventTypeScroll = 6; result = _data->_page->editorState().hasComposition; if (result) { // A saved command can confirm a composition, but it cannot start a new one. - [self _wk_executeSavedKeypressCommands]; + [self _executeSavedKeypressCommands]; result = _data->_page->editorState().hasComposition; } } else { @@ -1460,7 +1464,7 @@ static const short kIOHIDEventTypeScroll = 6; - (void)unmarkText { - [self _wk_executeSavedKeypressCommands]; + [self _executeSavedKeypressCommands]; LOG(TextInput, "unmarkText"); @@ -1519,7 +1523,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde - (void)setMarkedText:(id)string selectedRange:(NSRange)newSelRange replacementRange:(NSRange)replacementRange { - [self _wk_executeSavedKeypressCommands]; + [self _executeSavedKeypressCommands]; BOOL isAttributedString = [string isKindOfClass:[NSAttributedString class]]; ASSERT(isAttributedString || [string isKindOfClass:[NSString class]]); @@ -1548,7 +1552,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde // In password fields, we only allow ASCII dead keys, and don't allow inline input, matching NSSecureTextInputField. // Allowing ASCII dead keys is necessary to enable full Roman input when using a Vietnamese keyboard. ASSERT(!_data->_page->editorState().hasComposition); - [self _wk_notifyInputContextAboutDiscardedComposition]; + [self _notifyInputContextAboutDiscardedComposition]; if ([text length] == 1 && [[text decomposedStringWithCanonicalMapping] characterAtIndex:0] < 0x80) { _data->_page->insertText(text, replacementRange.location, NSMaxRange(replacementRange)); } else @@ -1561,7 +1565,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde - (NSRange)markedRange { - [self _wk_executeSavedKeypressCommands]; + [self _executeSavedKeypressCommands]; uint64_t location; uint64_t length; @@ -1573,7 +1577,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde - (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)nsRange actualRange:(NSRangePointer)actualRange { - [self _wk_executeSavedKeypressCommands]; + [self _executeSavedKeypressCommands]; if (!_data->_page->editorState().isContentEditable) { LOG(TextInput, "attributedSubstringFromRange:(%u, %u) -> nil", nsRange.location, nsRange.length); @@ -1597,7 +1601,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde - (NSUInteger)characterIndexForPoint:(NSPoint)thePoint { - [self _wk_executeSavedKeypressCommands]; + [self _executeSavedKeypressCommands]; NSWindow *window = [self window]; @@ -1612,7 +1616,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde - (NSRect)firstRectForCharacterRange:(NSRange)theRange actualRange:(NSRangePointer)actualRange { - [self _wk_executeSavedKeypressCommands]; + [self _executeSavedKeypressCommands]; // Just to match NSTextView's behavior. Regression tests cannot detect this; // to reproduce, use a test application from http://bugs.webkit.org/show_bug.cgi?id=4682 @@ -1637,7 +1641,6 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde } #if ENABLE(DRAG_SUPPORT) - - (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation { NSPoint windowImageLoc = [[self window] convertScreenToBase:aPoint]; @@ -1779,7 +1782,6 @@ static void createSandboxExtensionsForFileUpload(NSPasteboard *pasteboard, Sandb return self; return nil; } - #endif // ENABLE(DRAG_SUPPORT) - (BOOL)_windowResizeMouseLocationIsInVisibleScrollerThumb:(NSPoint)loc @@ -1789,14 +1791,13 @@ static void createSandboxExtensionsForFileUpload(NSPasteboard *pasteboard, Sandb return NSMouseInRect(localPoint, visibleThumbRect, [self isFlipped]); } -- (void)_wk_updateWindowVisibility +- (void)_updateWindowVisibility { _data->_page->updateWindowIsVisible([[self window] isVisible]); } #if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 - - (BOOL)_ownsWindowGrowBox { NSWindow* window = [self window]; @@ -1845,45 +1846,54 @@ static void createSandboxExtensionsForFileUpload(NSPasteboard *pasteboard, Sandb return ownsGrowBox; } - #endif // FIXME: Use AppKit constants for these when they are available. -static NSString * const windowDidBecomeVisibleNotification = @"_NSWindowDidBecomeVisible"; -static NSString * const windowDidOrderOffScreenNotification = @"NSWindowDidOrderOffScreenNotification"; static NSString * const windowDidChangeBackingPropertiesNotification = @"NSWindowDidChangeBackingPropertiesNotification"; static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOldScaleFactorKey"; -- (void)_wk_updateWindowObserversForWindow:(NSWindow *)window +- (void)addWindowObserversForWindow:(NSWindow *)window +{ + if (window) { + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidBecomeKey:) + name:NSWindowDidBecomeKeyNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidResignKey:) + name:NSWindowDidResignKeyNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidMiniaturize:) + name:NSWindowDidMiniaturizeNotification object:window]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidDeminiaturize:) + name:NSWindowDidDeminiaturizeNotification object:window]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidMove:) + name:NSWindowDidMoveNotification object:window]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidResize:) + name:NSWindowDidResizeNotification object:window]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidOrderOffScreen:) + name:@"NSWindowDidOrderOffScreenNotification" object:window]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidOrderOnScreen:) + name:@"_NSWindowDidBecomeVisible" object:window]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidChangeBackingProperties:) + name:windowDidChangeBackingPropertiesNotification object:window]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidChangeScreen:) + name:NSWindowDidChangeScreenNotification object:window]; + } +} + +- (void)removeWindowObservers { - for (id observer in _data->_observers.get()) - [[NSNotificationCenter defaultCenter] removeObserver:observer]; - [_data->_observers.get() removeAllObjects]; - + NSWindow *window = [self window]; if (!window) return; - if (!_data->_observers) - _data->_observers = adoptNS([[NSMutableArray alloc] init]); - - #define ADD_OBSERVER(selectorName, notificationName, notificationObject) \ - [_data->_observers.get() addObject:[[NSNotificationCenter defaultCenter] \ - addObserverForName:notificationName object:notificationObject queue:[NSOperationQueue mainQueue] \ - usingBlock:^(NSNotification *notification){ [self selectorName:notification]; }] \ - ]; - - ADD_OBSERVER(_wk_windowDidBecomeKey, NSWindowDidBecomeKeyNotification, nil); - ADD_OBSERVER(_wk_windowDidChangeBackingProperties, windowDidChangeBackingPropertiesNotification, window); - ADD_OBSERVER(_wk_windowDidChangeScreen, NSWindowDidChangeScreenNotification, window); - ADD_OBSERVER(_wk_windowDidDeminiaturize, NSWindowDidDeminiaturizeNotification, window); - ADD_OBSERVER(_wk_windowDidMiniaturize, NSWindowDidMiniaturizeNotification, window); - ADD_OBSERVER(_wk_windowDidMove, NSWindowDidMoveNotification, window); - ADD_OBSERVER(_wk_windowDidOrderOffScreen, windowDidOrderOffScreenNotification, window); - ADD_OBSERVER(_wk_windowDidOrderOnScreen, windowDidBecomeVisibleNotification, window); - ADD_OBSERVER(_wk_windowDidResignKey, NSWindowDidResignKeyNotification, nil); - ADD_OBSERVER(_wk_windowDidResize, NSWindowDidResizeNotification, window); - - #undef ADD_OBSERVER + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidBecomeKeyNotification object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidResignKeyNotification object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidMiniaturizeNotification object:window]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidDeminiaturizeNotification object:window]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidMoveNotification object:window]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidResizeNotification object:window]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:@"NSWindowDidOrderOffScreenNotification" object:window]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:@"_NSWindowDidBecomeVisible" object:window]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:windowDidChangeBackingPropertiesNotification object:window]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidChangeScreenNotification object:window]; } - (void)viewWillMoveToWindow:(NSWindow *)window @@ -1903,7 +1913,8 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl #endif _data->_pageClient->viewWillMoveToAnotherWindow(); - [self _wk_updateWindowObserversForWindow:window]; + [self removeWindowObservers]; + [self addWindowObserversForWindow:window]; #if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 if ([currentWindow _growBoxOwner] == self) @@ -1913,28 +1924,26 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl - (void)viewDidMoveToWindow { - [self removeAllToolTips]; - // We want to make sure to update the active state while hidden, so if the view is about to become visible, we // update the active state first and then make it visible. If the view is about to be hidden, we hide it first and then // update the active state. if ([self window]) { _data->_windowHasValidBackingStore = NO; - [self _wk_updateWindowVisibility]; + [self _updateWindowVisibility]; _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive); _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible | WebPageProxy::ViewIsInWindow); - [self _wk_updateWindowAndViewFrames]; + [self _updateWindowAndViewFrames]; if (!_data->_flagsChangedEventMonitor) { _data->_flagsChangedEventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSFlagsChangedMask handler:^(NSEvent *flagsChangedEvent) { - [self _wk_postFakeMouseMovedEventForFlagsChangedEvent:flagsChangedEvent]; + [self _postFakeMouseMovedEventForFlagsChangedEvent:flagsChangedEvent]; return flagsChangedEvent; }]; } - [self _wk_accessibilityRegisterUIProcessTokens]; + [self _accessibilityRegisterUIProcessTokens]; } else { - [self _wk_updateWindowVisibility]; + [self _updateWindowVisibility]; _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible); _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive | WebPageProxy::ViewIsInWindow); @@ -1952,67 +1961,67 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl #endif } - _data->_page->setIntrinsicDeviceScaleFactor([self _wk_intrinsicDeviceScaleFactor]); + _data->_page->setIntrinsicDeviceScaleFactor([self _intrinsicDeviceScaleFactor]); } -- (void)_wk_windowScreenDidChange +- (void)doWindowDidChangeScreen { _data->_page->windowScreenDidChange((PlatformDisplayID)[[[[[self window] screen] deviceDescription] objectForKey:@"NSScreenNumber"] intValue]); } -- (void)_wk_windowDidBecomeKey:(NSNotification *)notification +- (void)_windowDidBecomeKey:(NSNotification *)notification { NSWindow *keyWindow = [notification object]; if (keyWindow == [self window] || keyWindow == [[self window] attachedSheet]) { - [self _wk_updateSecureInputState]; + [self _updateSecureInputState]; _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive); } // Send a change screen to make sure the initial displayID is set - [self _wk_windowScreenDidChange]; + [self doWindowDidChangeScreen]; } -- (void)_wk_windowDidChangeScreen:(NSNotification *)notification +- (void)_windowDidChangeScreen:(NSNotification *)notification { - [self _wk_windowScreenDidChange]; + [self doWindowDidChangeScreen]; } -- (void)_wk_windowDidResignKey:(NSNotification *)notification +- (void)_windowDidResignKey:(NSNotification *)notification { NSWindow *formerKeyWindow = [notification object]; if (formerKeyWindow == [self window] || formerKeyWindow == [[self window] attachedSheet]) { - [self _wk_updateSecureInputState]; + [self _updateSecureInputState]; _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive); } } -- (void)_wk_windowDidMiniaturize:(NSNotification *)notification +- (void)_windowDidMiniaturize:(NSNotification *)notification { _data->_windowHasValidBackingStore = NO; - [self _wk_updateWindowVisibility]; + [self _updateWindowVisibility]; } -- (void)_wk_windowDidDeminiaturize:(NSNotification *)notification +- (void)_windowDidDeminiaturize:(NSNotification *)notification { - [self _wk_updateWindowVisibility]; + [self _updateWindowVisibility]; } -- (void)_wk_windowDidMove:(NSNotification *)notification +- (void)_windowDidMove:(NSNotification *)notification { - [self _wk_updateWindowAndViewFrames]; + [self _updateWindowAndViewFrames]; } -- (void)_wk_windowDidResize:(NSNotification *)notification +- (void)_windowDidResize:(NSNotification *)notification { _data->_windowHasValidBackingStore = NO; - [self _wk_updateWindowAndViewFrames]; + [self _updateWindowAndViewFrames]; } -- (void)_wk_windowDidOrderOffScreen:(NSNotification *)notification +- (void)_windowDidOrderOffScreen:(NSNotification *)notification { - [self _wk_updateWindowVisibility]; + [self _updateWindowVisibility]; // We want to make sure to update the active state while hidden, so since the view is about to be hidden, // we hide it first and then update the active state. @@ -2020,9 +2029,9 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive); } -- (void)_wk_windowDidOrderOnScreen:(NSNotification *)notification +- (void)_windowDidOrderOnScreen:(NSNotification *)notification { - [self _wk_updateWindowVisibility]; + [self _updateWindowVisibility]; // We want to make sure to update the active state while hidden, so since the view is about to become visible, // we update the active state first and then make it visible. @@ -2030,10 +2039,10 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible); } -- (void)_wk_windowDidChangeBackingProperties:(NSNotification *)notification +- (void)_windowDidChangeBackingProperties:(NSNotification *)notification { CGFloat oldBackingScaleFactor = [[notification.userInfo objectForKey:backingPropertyOldScaleFactorKey] doubleValue]; - CGFloat newBackingScaleFactor = [self _wk_intrinsicDeviceScaleFactor]; + CGFloat newBackingScaleFactor = [self _intrinsicDeviceScaleFactor]; if (oldBackingScaleFactor == newBackingScaleFactor) return; @@ -2130,7 +2139,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I drawingArea->colorSpaceDidChange(); } -- (void)_wk_accessibilityRegisterUIProcessTokens +- (void)_accessibilityRegisterUIProcessTokens { // Initialize remote accessibility when the window connection has been established. NSData *remoteElementToken = WKAXRemoteTokenForElement(self); @@ -2140,7 +2149,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I _data->_page->registerUIProcessAccessibilityTokens(elementToken, windowToken); } -- (void)_wk_updateRemoteAccessibilityRegistration:(BOOL)registerProcess +- (void)_updateRemoteAccessibilityRegistration:(BOOL)registerProcess { // When the tree is connected/disconnected, the remote accessibility registration // needs to be updated with the pid of the remote process. If the process is going @@ -2212,7 +2221,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I return hitView; } -- (void)_wk_postFakeMouseMovedEventForFlagsChangedEvent:(NSEvent *)flagsChangedEvent +- (void)_postFakeMouseMovedEventForFlagsChangedEvent:(NSEvent *)flagsChangedEvent { NSEvent *fakeEvent = [NSEvent mouseEventWithType:NSMouseMoved location:[[flagsChangedEvent window] convertScreenToBase:[NSEvent mouseLocation]] modifierFlags:[flagsChangedEvent modifierFlags] timestamp:[flagsChangedEvent timestamp] windowNumber:[flagsChangedEvent windowNumber] @@ -2226,7 +2235,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I return (NSInteger)self; } -- (float)_wk_intrinsicDeviceScaleFactor +- (float)_intrinsicDeviceScaleFactor { NSWindow *window = [self window]; #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 @@ -2240,7 +2249,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I #endif } -- (void)_wk_setDrawingAreaSize:(NSSize)size +- (void)_setDrawingAreaSize:(NSSize)size { if (!_data->_page->drawingArea()) return; @@ -2249,6 +2258,11 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I _data->_resizeScrollOffset = NSZeroSize; } +- (BOOL)_shouldUseTiledDrawingArea +{ + return NO; +} + #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 - (void)quickLookWithEvent:(NSEvent *)event { @@ -2261,17 +2275,21 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I @implementation WKView (Internal) -- (PassOwnPtr<WebKit::DrawingAreaProxy>)_wk_createDrawingAreaProxy +- (PassOwnPtr<WebKit::DrawingAreaProxy>)_createDrawingAreaProxy { #if ENABLE(THREADED_SCROLLING) - if ([self _shouldUseTiledDrawingArea]) + if ([self _shouldUseTiledDrawingArea]) { + if (getenv("WK_USE_REMOTE_LAYER_TREE_DRAWING_AREA")) + return RemoteLayerTreeDrawingAreaProxy::create(_data->_page.get()); + return TiledCoreAnimationDrawingAreaProxy::create(_data->_page.get()); + } #endif return DrawingAreaProxyImpl::create(_data->_page.get()); } -- (BOOL)_wk_isFocused +- (BOOL)_isFocused { if (_data->_inBecomeFirstResponder) return YES; @@ -2280,7 +2298,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I return [[self window] firstResponder] == self; } -- (WebKit::ColorSpaceData)_wk_colorSpace +- (WebKit::ColorSpaceData)_colorSpace { if (!_data->_colorSpace) { if ([self window]) @@ -2295,32 +2313,32 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I return colorSpaceData; } -- (void)_wk_processDidCrash +- (void)_processDidCrash { if (_data->_layerHostingView) - [self _wk_exitAcceleratedCompositingMode]; + [self _exitAcceleratedCompositingMode]; - [self _wk_updateRemoteAccessibilityRegistration:NO]; + [self _updateRemoteAccessibilityRegistration:NO]; } -- (void)_wk_pageClosed +- (void)_pageClosed { - [self _wk_updateRemoteAccessibilityRegistration:NO]; + [self _updateRemoteAccessibilityRegistration:NO]; } -- (void)_wk_didRelaunchProcess +- (void)_didRelaunchProcess { - [self _wk_accessibilityRegisterUIProcessTokens]; + [self _accessibilityRegisterUIProcessTokens]; } -- (void)_wk_setCursor:(NSCursor *)cursor +- (void)_setCursor:(NSCursor *)cursor { if ([NSCursor currentCursor] == cursor) return; [cursor set]; } -- (void)_wk_setUserInterfaceItemState:(NSString *)commandName enabled:(BOOL)isEnabled state:(int)newState +- (void)_setUserInterfaceItemState:(NSString *)commandName enabled:(BOOL)isEnabled state:(int)newState { ValidationVector items = _data->_validationMap.take(commandName); size_t size = items.size(); @@ -2333,7 +2351,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I } } -- (BOOL)_wk_tryPostProcessPluginComplexTextInputKeyDown:(NSEvent *)event +- (BOOL)_tryPostProcessPluginComplexTextInputKeyDown:(NSEvent *)event { if (!_data->_pluginComplexTextInputIdentifier || _data->_pluginComplexTextInputState == PluginComplexTextInputDisabled) return NO; @@ -2342,15 +2360,15 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I if (_data->_pluginComplexTextInputState == PluginComplexTextInputEnabledLegacy) return NO; - return [self _wk_handlePluginComplexTextInputKeyDown:event]; + return [self _handlePluginComplexTextInputKeyDown:event]; } -- (void)_wk_doneWithKeyEvent:(NSEvent *)event eventWasHandled:(BOOL)eventWasHandled +- (void)_doneWithKeyEvent:(NSEvent *)event eventWasHandled:(BOOL)eventWasHandled { if ([event type] != NSKeyDown) return; - if ([self _wk_tryPostProcessPluginComplexTextInputKeyDown:event]) + if ([self _tryPostProcessPluginComplexTextInputKeyDown:event]) return; if (eventWasHandled) { @@ -2369,7 +2387,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I _data->_keyDownEventBeingResent = nullptr; } -- (BOOL)_wk_interpretKeyEvent:(NSEvent *)event savingCommandsTo:(Vector<WebCore::KeypressCommand>&)commands +- (BOOL)_interpretKeyEvent:(NSEvent *)event savingCommandsTo:(Vector<WebCore::KeypressCommand>&)commands { ASSERT(!_data->_interpretKeyEventsParameters); ASSERT(commands.isEmpty()); @@ -2404,12 +2422,12 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I return parameters.eventInterpretationHadSideEffects; } -- (NSRect)_wk_convertToDeviceSpace:(NSRect)rect +- (NSRect)_convertToDeviceSpace:(NSRect)rect { return toDeviceSpace(rect, [self window]); } -- (NSRect)_wk_convertToUserSpace:(NSRect)rect +- (NSRect)_convertToUserSpace:(NSRect)rect { return toUserSpace(rect, [self window]); } @@ -2425,7 +2443,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I return TRACKING_RECT_TAG; } -- (NSTrackingRectTag)_wk_addTrackingRect:(NSRect)rect owner:(id)owner userData:(void *)data assumeInside:(BOOL)assumeInside useTrackingNum:(int)tag +- (NSTrackingRectTag)_addTrackingRect:(NSRect)rect owner:(id)owner userData:(void *)data assumeInside:(BOOL)assumeInside useTrackingNum:(int)tag { ASSERT(tag == 0 || tag == TRACKING_RECT_TAG); ASSERT(_data->_trackingRectOwner == nil); @@ -2434,7 +2452,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I return TRACKING_RECT_TAG; } -- (void)_wk_addTrackingRects:(NSRect *)rects owner:(id)owner userDataList:(void **)userDataList assumeInsideList:(BOOL *)assumeInsideList trackingNums:(NSTrackingRectTag *)trackingNums count:(int)count +- (void)_addTrackingRects:(NSRect *)rects owner:(id)owner userDataList:(void **)userDataList assumeInsideList:(BOOL *)assumeInsideList trackingNums:(NSTrackingRectTag *)trackingNums count:(int)count { ASSERT(count == 1); ASSERT(trackingNums[0] == 0 || trackingNums[0] == TRACKING_RECT_TAG); @@ -2468,7 +2486,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I ASSERT_NOT_REACHED(); } -- (void)_wk_removeTrackingRects:(NSTrackingRectTag *)tags count:(int)count +- (void)_removeTrackingRects:(NSTrackingRectTag *)tags count:(int)count { int i; for (i = 0; i < count; ++i) { @@ -2482,7 +2500,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I } } -- (void)_wk_sendToolTipMouseExited +- (void)_sendToolTipMouseExited { // Nothing matters except window, trackingNumber, and userData. NSEvent *fakeEvent = [NSEvent enterExitEventWithType:NSMouseExited @@ -2497,7 +2515,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I [_data->_trackingRectOwner mouseExited:fakeEvent]; } -- (void)_wk_sendToolTipMouseEntered +- (void)_sendToolTipMouseEntered { // Nothing matters except window, trackingNumber, and userData. NSEvent *fakeEvent = [NSEvent enterExitEventWithType:NSMouseEntered @@ -2517,21 +2535,21 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I return nsStringFromWebCoreString(_data->_page->toolTip()); } -- (void)_wk_toolTipChangedFrom:(NSString *)oldToolTip to:(NSString *)newToolTip +- (void)_toolTipChangedFrom:(NSString *)oldToolTip to:(NSString *)newToolTip { if (oldToolTip) - [self _wk_sendToolTipMouseExited]; + [self _sendToolTipMouseExited]; if (newToolTip && [newToolTip length] > 0) { // See radar 3500217 for why we remove all tooltips rather than just the single one we created. [self removeAllToolTips]; NSRect wideOpenRect = NSMakeRect(-100000, -100000, 200000, 200000); _data->_lastToolTipTag = [self addToolTipRect:wideOpenRect owner:self userData:NULL]; - [self _wk_sendToolTipMouseEntered]; + [self _sendToolTipMouseEntered]; } } -- (void)_wk_setFindIndicator:(PassRefPtr<FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate +- (void)_setFindIndicator:(PassRefPtr<FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate { if (!findIndicator) { _data->_findIndicatorWindow = nullptr; @@ -2544,7 +2562,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I _data->_findIndicatorWindow->setFindIndicator(findIndicator, fadeOut, animate); } -- (void)_wk_enterAcceleratedCompositingMode:(const LayerTreeContext&)layerTreeContext +- (void)_enterAcceleratedCompositingMode:(const LayerTreeContext&)layerTreeContext { ASSERT(!_data->_layerHostingView); ASSERT(!layerTreeContext.isEmpty()); @@ -2573,7 +2591,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I [CATransaction commit]; } -- (void)_wk_exitAcceleratedCompositingMode +- (void)_exitAcceleratedCompositingMode { ASSERT(_data->_layerHostingView); @@ -2584,7 +2602,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I _data->_layerHostingView = nullptr; } -- (void)_wk_updateAcceleratedCompositingMode:(const WebKit::LayerTreeContext&)layerTreeContext +- (void)_updateAcceleratedCompositingMode:(const WebKit::LayerTreeContext&)layerTreeContext { if (_data->_layerHostingView) { // Wrap the call to setSublayers: in a CATransaction with actions disabled to @@ -2597,18 +2615,18 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I [CATransaction commit]; } else { - [self _wk_exitAcceleratedCompositingMode]; - [self _wk_enterAcceleratedCompositingMode:layerTreeContext]; + [self _exitAcceleratedCompositingMode]; + [self _enterAcceleratedCompositingMode:layerTreeContext]; } } -- (void)_wk_setAccessibilityWebProcessToken:(NSData *)data +- (void)_setAccessibilityWebProcessToken:(NSData *)data { _data->_remoteAccessibilityChild = WKAXRemoteElementForToken(data); - [self _wk_updateRemoteAccessibilityRegistration:YES]; + [self _updateRemoteAccessibilityRegistration:YES]; } -- (void)_wk_pluginFocusOrWindowFocusChanged:(BOOL)pluginHasFocusAndWindowHasFocus pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier +- (void)_pluginFocusOrWindowFocusChanged:(BOOL)pluginHasFocusAndWindowHasFocus pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier { BOOL inputSourceChanged = _data->_pluginComplexTextInputIdentifier; @@ -2636,17 +2654,17 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I [NSApp updateWindows]; } -- (void)_wk_setPluginComplexTextInputState:(PluginComplexTextInputState)pluginComplexTextInputState pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier +- (void)_setPluginComplexTextInputState:(PluginComplexTextInputState)pluginComplexTextInputState pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier { if (pluginComplexTextInputIdentifier != _data->_pluginComplexTextInputIdentifier) { // We're asked to update the state for a plug-in that doesn't have focus. return; } - [self _wk_setPluginComplexTextInputState:pluginComplexTextInputState]; + [self _setPluginComplexTextInputState:pluginComplexTextInputState]; } -- (void)_wk_setPageHasCustomRepresentation:(BOOL)pageHasCustomRepresentation +- (void)_setPageHasCustomRepresentation:(BOOL)pageHasCustomRepresentation { bool hadPDFView = _data->_pdfViewController; _data->_pdfViewController = nullptr; @@ -2658,14 +2676,14 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I _data->_page->drawingArea()->pageCustomRepresentationChanged(); } -- (void)_wk_didFinishLoadingDataForCustomRepresentationWithSuggestedFilename:(const String&)suggestedFilename dataReference:(const CoreIPC::DataReference&)dataReference +- (void)_didFinishLoadingDataForCustomRepresentationWithSuggestedFilename:(const String&)suggestedFilename dataReference:(const CoreIPC::DataReference&)dataReference { ASSERT(_data->_pdfViewController); _data->_pdfViewController->setPDFDocumentData(_data->_page->mainFrame()->mimeType(), suggestedFilename, dataReference); } -- (double)_wk_customRepresentationZoomFactor +- (double)_customRepresentationZoomFactor { if (!_data->_pdfViewController) return 1; @@ -2673,7 +2691,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I return _data->_pdfViewController->zoomFactor(); } -- (void)_wk_setCustomRepresentationZoomFactor:(double)zoomFactor +- (void)_setCustomRepresentationZoomFactor:(double)zoomFactor { if (!_data->_pdfViewController) return; @@ -2681,7 +2699,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I _data->_pdfViewController->setZoomFactor(zoomFactor); } -- (void)_wk_findStringInCustomRepresentation:(NSString *)string withFindOptions:(WebKit::FindOptions)options maxMatchCount:(NSUInteger)count +- (void)_findStringInCustomRepresentation:(NSString *)string withFindOptions:(WebKit::FindOptions)options maxMatchCount:(NSUInteger)count { if (!_data->_pdfViewController) return; @@ -2689,7 +2707,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I _data->_pdfViewController->findString(string, options, count); } -- (void)_wk_countStringMatchesInCustomRepresentation:(NSString *)string withFindOptions:(WebKit::FindOptions)options maxMatchCount:(NSUInteger)count +- (void)_countStringMatchesInCustomRepresentation:(NSString *)string withFindOptions:(WebKit::FindOptions)options maxMatchCount:(NSUInteger)count { if (!_data->_pdfViewController) return; @@ -2697,7 +2715,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I _data->_pdfViewController->countStringMatches(string, options, count); } -- (void)_wk_setDragImage:(NSImage *)image at:(NSPoint)clientPoint linkDrag:(BOOL)linkDrag +- (void)_setDragImage:(NSImage *)image at:(NSPoint)clientPoint linkDrag:(BOOL)linkDrag { IntSize size([image size]); size.scale(1.0 / _data->_page->deviceScaleFactor()); @@ -2722,7 +2740,7 @@ static bool matchesExtensionOrEquivalent(NSString *filename, NSString *extension && hasCaseInsensitiveSuffix(filename, @".jpg")); } -- (void)_wk_setPromisedData:(WebCore::Image *)image withFileName:(NSString *)filename withExtension:(NSString *)extension withTitle:(NSString *)title withURL:(NSString *)url withVisibleURL:(NSString *)visibleUrl withArchive:(WebCore::SharedBuffer*) archiveBuffer forPasteboard:(NSString *)pasteboardName +- (void)_setPromisedData:(WebCore::Image *)image withFileName:(NSString *)filename withExtension:(NSString *)extension withTitle:(NSString *)title withURL:(NSString *)url withVisibleURL:(NSString *)visibleUrl withArchive:(WebCore::SharedBuffer*) archiveBuffer forPasteboard:(NSString *)pasteboardName { NSPasteboard *pasteboard = [NSPasteboard pasteboardWithName:pasteboardName]; @@ -2830,9 +2848,9 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) return [NSArray arrayWithObject:[path lastPathComponent]]; } -- (void)_wk_updateSecureInputState +- (void)_updateSecureInputState { - if (![[self window] isKeyWindow] || ![self _wk_isFocused]) { + if (![[self window] isKeyWindow] || ![self _isFocused]) { if (_data->_inSecureInputState) { DisableSecureEventInput(); _data->_inSecureInputState = NO; @@ -2858,13 +2876,13 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) _data->_inSecureInputState = isInPasswordField; } -- (void)_wk_updateTextInputStateIncludingSecureInputState:(BOOL)updateSecureInputState +- (void)_updateTextInputStateIncludingSecureInputState:(BOOL)updateSecureInputState { const EditorState& editorState = _data->_page->editorState(); if (updateSecureInputState) { // This is a temporary state when editing. Flipping secure input state too quickly can expose race conditions. if (!editorState.selectionIsNone) - [self _wk_updateSecureInputState]; + [self _updateSecureInputState]; } if (!editorState.hasComposition || editorState.shouldIgnoreCompositionSelectionChange) @@ -2872,12 +2890,12 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) _data->_page->cancelComposition(); - [self _wk_notifyInputContextAboutDiscardedComposition]; + [self _notifyInputContextAboutDiscardedComposition]; } -- (void)_wk_resetTextInputState +- (void)_resetTextInputState { - [self _wk_notifyInputContextAboutDiscardedComposition]; + [self _notifyInputContextAboutDiscardedComposition]; if (_data->_inSecureInputState) { DisableSecureEventInput(); @@ -2885,7 +2903,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) } } -- (void)_wk_didChangeScrollbarsForMainFrame +- (void)_didChangeScrollbarsForMainFrame { #if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 [self _updateGrowBoxForWindowFrameChange]; @@ -2893,13 +2911,12 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) } #if ENABLE(FULLSCREEN_API) - -- (BOOL)_wk_hasFullScreenWindowController +- (BOOL)hasFullScreenWindowController { return (bool)_data->_fullScreenWindowController; } -- (WKFullScreenWindowController*)_wk_fullScreenWindowController +- (WKFullScreenWindowController*)fullScreenWindowController { if (!_data->_fullScreenWindowController) { _data->_fullScreenWindowController.adoptNS([[WKFullScreenWindowController alloc] init]); @@ -2908,17 +2925,16 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) return _data->_fullScreenWindowController.get(); } -- (void)_wk_closeFullScreenWindowController +- (void)closeFullScreenWindowController { if (!_data->_fullScreenWindowController) return; [_data->_fullScreenWindowController.get() close]; _data->_fullScreenWindowController = nullptr; } - #endif -- (bool)_wk_executeSavedCommandBySelector:(SEL)selector +- (bool)_executeSavedCommandBySelector:(SEL)selector { // The sink does two things: 1) Tells us if the responder went unhandled, and // 2) prevents any NSBeep; we don't ever want to beep here. @@ -2928,7 +2944,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) return ![sink.get() didReceiveUnhandledCommand]; } -- (void)_wk_cacheWindowBottomCornerRect +- (void)_cacheWindowBottomCornerRect { #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // FIXME: We should remove this code when <rdar://problem/9362085> is resolved. @@ -2942,7 +2958,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) #endif } -- (NSInteger)_wk_spellCheckerDocumentTag +- (NSInteger)spellCheckerDocumentTag { if (!_data->_hasSpellCheckerDocumentTag) { _data->_spellCheckerDocumentTag = [NSSpellChecker uniqueSpellDocumentTag]; @@ -2951,17 +2967,17 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) return _data->_spellCheckerDocumentTag; } -- (void)_wk_handleAcceptedAlternativeText:(NSString*)text +- (void)handleAcceptedAlternativeText:(NSString*)text { _data->_page->handleAlternativeTextUIResult(text); } -- (void)_wk_setSuppressVisibilityUpdates:(BOOL)suppressVisibilityUpdates +- (void)_setSuppressVisibilityUpdates:(BOOL)suppressVisibilityUpdates { _data->_page->setSuppressVisibilityUpdates(suppressVisibilityUpdates); } -- (BOOL)_wk_suppressVisibilityUpdates +- (BOOL)_suppressVisibilityUpdates { return _data->_page->suppressVisibilityUpdates(); } @@ -2970,7 +2986,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) @implementation WKView (Private) -- (void)_wk_registerDraggedTypes +- (void)_registerDraggedTypes { NSMutableSet *types = [[NSMutableSet alloc] initWithArray:PasteboardTypes::forEditing()]; [types addObjectsFromArray:PasteboardTypes::forURL()]; @@ -3016,7 +3032,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) _data->_pageClient = PageClientImpl::create(self); _data->_page = toImpl(contextRef)->createWebPage(_data->_pageClient.get(), toImpl(pageGroupRef), toImpl(relatedPage)); - _data->_page->setIntrinsicDeviceScaleFactor([self _wk_intrinsicDeviceScaleFactor]); + _data->_page->setIntrinsicDeviceScaleFactor([self _intrinsicDeviceScaleFactor]); _data->_page->initializeWebPage(); #if ENABLE(FULLSCREEN_API) _data->_page->fullScreenManager()->setWebView(self); @@ -3024,7 +3040,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) _data->_mouseDownEvent = nil; _data->_ignoringMouseDraggedEvents = NO; - [self _wk_registerDraggedTypes]; + [self _registerDraggedTypes]; if ([self _shouldUseTiledDrawingArea]) { self.wantsLayer = YES; @@ -3039,7 +3055,6 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) } #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 - - (BOOL)wantsUpdateLayer { return [self _shouldUseTiledDrawingArea]; @@ -3052,7 +3067,6 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) if (DrawingAreaProxy* drawingArea = _data->_page->drawingArea()) drawingArea->waitForPossibleGeometryUpdate(); } - #endif - (WKPageRef)pageRef @@ -3107,7 +3121,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) return; if (!(--_data->_frameSizeUpdatesDisabledCount)) - [self _wk_setDrawingAreaSize:[self frame].size]; + [self _setDrawingAreaSize:[self frame].size]; } - (BOOL)frameSizeUpdatesDisabled @@ -3131,11 +3145,6 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) #endif } -- (BOOL)_shouldUseTiledDrawingArea -{ - return NO; -} - @end @implementation WKResponderChainSink diff --git a/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h b/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h index f2b681649..2e99e7976 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h +++ b/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved. + * Copyright (C) 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -50,59 +50,58 @@ namespace WebKit { @class WKFullScreenWindowController; @interface WKView (Internal) - -- (PassOwnPtr<WebKit::DrawingAreaProxy>)_wk_createDrawingAreaProxy; -- (BOOL)_wk_isFocused; -- (void)_wk_processDidCrash; -- (void)_wk_pageClosed; -- (void)_wk_didRelaunchProcess; -- (void)_wk_toolTipChangedFrom:(NSString *)oldToolTip to:(NSString *)newToolTip; -- (void)_wk_setCursor:(NSCursor *)cursor; -- (void)_wk_setUserInterfaceItemState:(NSString *)commandName enabled:(BOOL)isEnabled state:(int)newState; -- (BOOL)_wk_interpretKeyEvent:(NSEvent *)theEvent savingCommandsTo:(Vector<WebCore::KeypressCommand>&)commands; -- (void)_wk_doneWithKeyEvent:(NSEvent *)event eventWasHandled:(BOOL)eventWasHandled; -- (bool)_wk_executeSavedCommandBySelector:(SEL)selector; -- (NSRect)_wk_convertToDeviceSpace:(NSRect)rect; -- (NSRect)_wk_convertToUserSpace:(NSRect)rect; -- (void)_wk_setFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate; - -- (void)_wk_enterAcceleratedCompositingMode:(const WebKit::LayerTreeContext&)layerTreeContext; -- (void)_wk_exitAcceleratedCompositingMode; -- (void)_wk_updateAcceleratedCompositingMode:(const WebKit::LayerTreeContext&)layerTreeContext; - -- (void)_wk_setAccessibilityWebProcessToken:(NSData *)data; - -- (void)_wk_pluginFocusOrWindowFocusChanged:(BOOL)pluginHasFocusAndWindowHasFocus pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier; -- (void)_wk_setPluginComplexTextInputState:(WebKit::PluginComplexTextInputState)pluginComplexTextInputState pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier; - -- (void)_wk_setPageHasCustomRepresentation:(BOOL)pageHasCustomRepresentation; -- (void)_wk_didFinishLoadingDataForCustomRepresentationWithSuggestedFilename:(const String&)suggestedFilename dataReference:(const CoreIPC::DataReference&)dataReference; -- (double)_wk_customRepresentationZoomFactor; -- (void)_wk_setCustomRepresentationZoomFactor:(double)zoomFactor; -- (void)_wk_findStringInCustomRepresentation:(NSString *)string withFindOptions:(WebKit::FindOptions)options maxMatchCount:(NSUInteger)count; -- (void)_wk_countStringMatchesInCustomRepresentation:(NSString *)string withFindOptions:(WebKit::FindOptions)options maxMatchCount:(NSUInteger)count; -- (void)_wk_setDragImage:(NSImage *)image at:(NSPoint)clientPoint linkDrag:(BOOL)linkDrag; -- (void)_wk_setPromisedData:(WebCore::Image *)image withFileName:(NSString *)filename withExtension:(NSString *)extension withTitle:(NSString *)title withURL:(NSString *)url withVisibleURL:(NSString *)visibleUrl withArchive:(WebCore::SharedBuffer*) archiveBuffer forPasteboard:(NSString *)pasteboardName; -- (void)_wk_updateSecureInputState; -- (void)_wk_updateTextInputStateIncludingSecureInputState:(BOOL)updateSecureInputState; -- (void)_wk_resetTextInputState; - -- (void)_wk_didChangeScrollbarsForMainFrame; - -- (WebKit::ColorSpaceData)_wk_colorSpace; +- (PassOwnPtr<WebKit::DrawingAreaProxy>)_createDrawingAreaProxy; +- (BOOL)_isFocused; +- (void)_processDidCrash; +- (void)_pageClosed; +- (void)_didRelaunchProcess; +- (void)_toolTipChangedFrom:(NSString *)oldToolTip to:(NSString *)newToolTip; +- (void)_setCursor:(NSCursor *)cursor; +- (void)_setUserInterfaceItemState:(NSString *)commandName enabled:(BOOL)isEnabled state:(int)newState; +- (BOOL)_interpretKeyEvent:(NSEvent *)theEvent savingCommandsTo:(Vector<WebCore::KeypressCommand>&)commands; +- (void)_doneWithKeyEvent:(NSEvent *)event eventWasHandled:(BOOL)eventWasHandled; +- (bool)_executeSavedCommandBySelector:(SEL)selector; +- (NSRect)_convertToDeviceSpace:(NSRect)rect; +- (NSRect)_convertToUserSpace:(NSRect)rect; +- (void)_setFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate; + +- (void)_enterAcceleratedCompositingMode:(const WebKit::LayerTreeContext&)layerTreeContext; +- (void)_exitAcceleratedCompositingMode; +- (void)_updateAcceleratedCompositingMode:(const WebKit::LayerTreeContext&)layerTreeContext; + +- (void)_setAccessibilityWebProcessToken:(NSData *)data; + +- (void)_pluginFocusOrWindowFocusChanged:(BOOL)pluginHasFocusAndWindowHasFocus pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier; +- (void)_setPluginComplexTextInputState:(WebKit::PluginComplexTextInputState)pluginComplexTextInputState pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier; + +- (void)_setPageHasCustomRepresentation:(BOOL)pageHasCustomRepresentation; +- (void)_didFinishLoadingDataForCustomRepresentationWithSuggestedFilename:(const String&)suggestedFilename dataReference:(const CoreIPC::DataReference&)dataReference; +- (double)_customRepresentationZoomFactor; +- (void)_setCustomRepresentationZoomFactor:(double)zoomFactor; +- (void)_findStringInCustomRepresentation:(NSString *)string withFindOptions:(WebKit::FindOptions)options maxMatchCount:(NSUInteger)count; +- (void)_countStringMatchesInCustomRepresentation:(NSString *)string withFindOptions:(WebKit::FindOptions)options maxMatchCount:(NSUInteger)count; +- (void)_setDragImage:(NSImage *)image at:(NSPoint)clientPoint linkDrag:(BOOL)linkDrag; +- (void)_setPromisedData:(WebCore::Image *)image withFileName:(NSString *)filename withExtension:(NSString *)extension withTitle:(NSString *)title withURL:(NSString *)url withVisibleURL:(NSString *)visibleUrl withArchive:(WebCore::SharedBuffer*) archiveBuffer forPasteboard:(NSString *)pasteboardName; +- (void)_updateSecureInputState; +- (void)_updateTextInputStateIncludingSecureInputState:(BOOL)updateSecureInputState; +- (void)_resetTextInputState; + +- (void)_didChangeScrollbarsForMainFrame; + +- (WebKit::ColorSpaceData)_colorSpace; #if ENABLE(FULLSCREEN_API) -- (BOOL)_wk_hasFullScreenWindowController; -- (WKFullScreenWindowController*)_wk_fullScreenWindowController; -- (void)_wk_closeFullScreenWindowController; +- (BOOL)hasFullScreenWindowController; +- (WKFullScreenWindowController*)fullScreenWindowController; +- (void)closeFullScreenWindowController; #endif -- (void)_wk_cacheWindowBottomCornerRect; +- (void)_cacheWindowBottomCornerRect; -- (NSInteger)_wk_spellCheckerDocumentTag; -- (void)_wk_handleAcceptedAlternativeText:(NSString*)text; +- (NSInteger)spellCheckerDocumentTag; +- (void)handleAcceptedAlternativeText:(NSString*)text; -- (void)_wk_setSuppressVisibilityUpdates:(BOOL)suppressVisibilityUpdates; -- (BOOL)_wk_suppressVisibilityUpdates; +- (void)_setSuppressVisibilityUpdates:(BOOL)suppressVisibilityUpdates; +- (BOOL)_suppressVisibilityUpdates; @end diff --git a/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h b/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h index 035b1ea2c..51578764f 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h +++ b/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. + * Copyright (C) 2011 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -50,8 +50,4 @@ - (void)performDictionaryLookupAtCurrentMouseLocation; + (void)hideWordDefinitionWindow; -// FIXME: This method currently overridden by Safari to turn tiled drawing area on. -// We should come up with a cleaner SPI or API for this. -- (BOOL)_shouldUseTiledDrawingArea; - @end diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp index 9a0433b66..21ed5be10 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp @@ -258,6 +258,7 @@ QPointF QQuickWebViewPrivate::FlickableAxisLocker::adjust(const QPointF& positio QQuickWebViewPrivate::QQuickWebViewPrivate(QQuickWebView* viewport) : q_ptr(viewport) + , experimental(new QQuickWebViewExperimental(viewport, this)) , alertDialog(0) , confirmDialog(0) , promptDialog(0) @@ -321,6 +322,9 @@ void QQuickWebViewPrivate::initialize(WKContextRef contextRef, WKPageGroupRef pa pageClient.initialize(q_ptr, pageViewPrivate->eventHandler.data(), &undoController); webPageProxy->initializeWebPage(); + + q_ptr->setAcceptedMouseButtons(Qt::MouseButtonMask); + q_ptr->setAcceptHoverEvents(true); } void QQuickWebViewPrivate::loadDidStop() @@ -419,9 +423,6 @@ void QQuickWebViewPrivate::handleMouseEvent(QMouseEvent* event) { switch (event->type()) { case QEvent::MouseButtonPress: - case QEvent::MouseButtonDblClick: - // If a MouseButtonDblClick was received then we got a MouseButtonPress before - // handleMousePressEvent will take care of double clicks. pageView->eventHandler()->handleMousePressEvent(event); break; case QEvent::MouseMove: @@ -430,6 +431,11 @@ void QQuickWebViewPrivate::handleMouseEvent(QMouseEvent* event) case QEvent::MouseButtonRelease: pageView->eventHandler()->handleMouseReleaseEvent(event); break; + case QEvent::MouseButtonDblClick: + // If a MouseButtonDblClick was received then we got a MouseButtonPress before. + // WebCore will build double-clicks out of press events. + event->accept(); + break; default: ASSERT_NOT_REACHED(); break; @@ -503,7 +509,7 @@ void QQuickWebViewPrivate::handleDownloadRequest(DownloadProxy* download) downloadItem->d->downloadProxy = download; q->connect(downloadItem->d, SIGNAL(receivedResponse(QWebDownloadItem*)), q, SLOT(_q_onReceivedResponseFromDownload(QWebDownloadItem*))); - context->downloadManager()->addDownload(download, downloadItem); + QtWebContext::downloadManager()->addDownload(download, downloadItem); } void QQuickWebViewPrivate::_q_onVisibleChanged() @@ -805,12 +811,8 @@ QQuickWebViewLegacyPrivate::QQuickWebViewLegacyPrivate(QQuickWebView* viewport) void QQuickWebViewLegacyPrivate::initialize(WKContextRef contextRef, WKPageGroupRef pageGroupRef) { - Q_Q(QQuickWebView); QQuickWebViewPrivate::initialize(contextRef, pageGroupRef); - q->setAcceptedMouseButtons(Qt::MouseButtonMask); - q->setAcceptHoverEvents(true); - // Trigger setting of correct visibility flags after everything was allocated and initialized. _q_onVisibleChanged(); } @@ -847,7 +849,6 @@ void QQuickWebViewLegacyPrivate::setZoomFactor(qreal factor) QQuickWebViewFlickablePrivate::QQuickWebViewFlickablePrivate(QQuickWebView* viewport) : QQuickWebViewPrivate(viewport) { - viewport->setAcceptHoverEvents(false); } void QQuickWebViewFlickablePrivate::initialize(WKContextRef contextRef, WKPageGroupRef pageGroupRef) @@ -897,12 +898,12 @@ void QQuickWebViewFlickablePrivate::handleMouseEvent(QMouseEvent* event) pageView->eventHandler()->handleInputEvent(event); } -QQuickWebViewExperimental::QQuickWebViewExperimental(QQuickWebView *webView) +QQuickWebViewExperimental::QQuickWebViewExperimental(QQuickWebView *webView, QQuickWebViewPrivate* webViewPrivate) : QObject(webView) , q_ptr(webView) - , d_ptr(webView->d_ptr.data()) + , d_ptr(webViewPrivate) , schemeParent(new QObject(this)) - , m_test(new QWebKitTest(webView->d_ptr.data(), this)) + , m_test(new QWebKitTest(webViewPrivate, this)) { } @@ -1473,7 +1474,6 @@ QQuickWebPage* QQuickWebViewExperimental::page() QQuickWebView::QQuickWebView(QQuickItem* parent) : QQuickFlickable(parent) , d_ptr(createPrivateObject(this)) - , m_experimental(new QQuickWebViewExperimental(this)) { Q_D(QQuickWebView); d->initialize(); @@ -1482,7 +1482,6 @@ QQuickWebView::QQuickWebView(QQuickItem* parent) QQuickWebView::QQuickWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef, QQuickItem* parent) : QQuickFlickable(parent) , d_ptr(createPrivateObject(this)) - , m_experimental(new QQuickWebViewExperimental(this)) { Q_D(QQuickWebView); d->initialize(contextRef, pageGroupRef); @@ -1762,7 +1761,8 @@ QVariant QQuickWebView::inputMethodQuery(Qt::InputMethodQuery property) const */ QQuickWebViewExperimental* QQuickWebView::experimental() const { - return m_experimental; + Q_D(const QQuickWebView); + return d->experimental; } /*! diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h index 89e7fbc99..dfe7ad88e 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h @@ -213,9 +213,9 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_onUrlChanged()); Q_PRIVATE_SLOT(d_func(), void _q_onReceivedResponseFromDownload(QWebDownloadItem*)); Q_PRIVATE_SLOT(d_func(), void _q_onIconChangedForPageURL(const QString&)); + // Hides QObject::d_ptr allowing us to use the convenience macros. QScopedPointer<QQuickWebViewPrivate> d_ptr; - QQuickWebViewExperimental* m_experimental; friend class QWebKitTest; friend class WebKit::PageViewportControllerClientQt; @@ -284,7 +284,6 @@ public: DownloadRequest = QQuickWebView::IgnoreRequest - 1 }; - QQuickWebViewExperimental(QQuickWebView* webView); virtual ~QQuickWebViewExperimental(); QQmlComponent* alertDialog() const; @@ -380,6 +379,7 @@ Q_SIGNALS: void remoteInspectorUrlChanged(); private: + QQuickWebViewExperimental(QQuickWebView* webView, QQuickWebViewPrivate* webViewPrivate); QQuickWebView* q_ptr; QQuickWebViewPrivate* d_ptr; QObject* schemeParent; diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h index 15bf818d7..adedb6a31 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h @@ -171,6 +171,7 @@ protected: QScopedPointer<QQuickWebPage> pageView; QQuickWebView* q_ptr; + QQuickWebViewExperimental* experimental; FlickableAxisLocker axisLocker; diff --git a/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp b/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp index 63dce28d0..aa26c0737 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp @@ -49,13 +49,8 @@ WTF::String QWebIconImageProvider::iconURLForPageURLInContext(const WTF::String QUrl url; url.setScheme(QStringLiteral("image")); url.setHost(QWebIconImageProvider::identifier()); - - QString path; - path.append(QLatin1Char('/')); - path.append(QString::number(context->contextID())); - path.append(QLatin1Char('/')); - path.append(QString::number(WTF::StringHash::hash(iconURL))); - url.setPath(path); + // Make sure that QML doesn't show cached versions of the previous icon if the icon location changed. + url.setPath(QLatin1Char('/') + QString::number(WTF::StringHash::hash(iconURL))); // FIXME: Use QUrl::DecodedMode when landed in Qt url.setFragment(QString::fromLatin1(QByteArray(QString(pageURL).toUtf8()).toBase64())); @@ -70,21 +65,12 @@ WTF::String QWebIconImageProvider::iconURLForPageURLInContext(const WTF::String QImage QWebIconImageProvider::requestImage(const QString& id, QSize* size, const QSize& requestedSize) { - // The string identifier has the leading image://webicon/ already stripped, so we just - // need to truncate from the first slash to get the context id. - QString contextIDString = id.left(id.indexOf(QLatin1Char('/'))); - bool ok = false; - uint64_t contextId = contextIDString.toUInt(&ok); - if (!ok) - return QImage(); + QString pageURL = QString::fromUtf8(QByteArray::fromBase64(id.midRef(id.indexOf('#') + 1).toLatin1())); - QtWebContext* context = QtWebContext::contextByID(contextId); - if (!context) + QtWebIconDatabaseClient* iconDatabase = QtWebContext::iconDatabase(); + if (!iconDatabase) return QImage(); - QString pageURL = QString::fromUtf8(QByteArray::fromBase64(id.midRef(id.indexOf('#') + 1).toLatin1())); - - QtWebIconDatabaseClient* iconDatabase = context->iconDatabase(); QImage icon = requestedSize.isValid() ? iconDatabase->iconImageForPageURL(pageURL, requestedSize) : iconDatabase->iconImageForPageURL(pageURL); ASSERT(!icon.isNull()); diff --git a/Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp b/Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp index e27f51264..7ddfd9269 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp @@ -20,11 +20,8 @@ #include "config.h" #include "qwebpreferences_p.h" -#include "WKPageGroup.h" -#include "WKPreferences.h" -#include "WKPreferencesPrivate.h" -#include "WKRetainPtr.h" -#include "WKStringQt.h" +#include "WebPageGroup.h" +#include "WebPageProxy.h" #include "qquickwebview_p_p.h" #include "qwebpreferences_p_p.h" @@ -40,41 +37,49 @@ bool QWebPreferencesPrivate::testAttribute(QWebPreferencesPrivate::WebAttribute { switch (attr) { case AutoLoadImages: - return WKPreferencesGetLoadsImagesAutomatically(preferencesRef()); + return preferences()->loadsImagesAutomatically(); #if ENABLE(FULLSCREEN_API) case FullScreenEnabled: - return WKPreferencesGetFullScreenEnabled(preferencesRef()); + return preferences()->fullScreenEnabled(); #endif case JavascriptEnabled: - return WKPreferencesGetJavaScriptEnabled(preferencesRef()); + return preferences()->javaScriptEnabled(); case PluginsEnabled: - return WKPreferencesGetPluginsEnabled(preferencesRef()); + return preferences()->pluginsEnabled(); case OfflineWebApplicationCacheEnabled: - return WKPreferencesGetOfflineWebApplicationCacheEnabled(preferencesRef()); + return preferences()->offlineWebApplicationCacheEnabled(); case LocalStorageEnabled: - return WKPreferencesGetLocalStorageEnabled(preferencesRef()); + return preferences()->localStorageEnabled(); case XSSAuditingEnabled: - return WKPreferencesGetXSSAuditorEnabled(preferencesRef()); + return preferences()->xssAuditorEnabled(); case PrivateBrowsingEnabled: - return WKPreferencesGetPrivateBrowsingEnabled(preferencesRef()); + return preferences()->privateBrowsingEnabled(); case DnsPrefetchEnabled: - return WKPreferencesGetDNSPrefetchingEnabled(preferencesRef()); + return preferences()->dnsPrefetchingEnabled(); case FrameFlatteningEnabled: - return WKPreferencesGetFrameFlatteningEnabled(preferencesRef()); + return preferences()->frameFlatteningEnabled(); case DeveloperExtrasEnabled: - return WKPreferencesGetDeveloperExtrasEnabled(preferencesRef()); + return preferences()->developerExtrasEnabled(); #if ENABLE(WEBGL) case WebGLEnabled: - return WKPreferencesGetWebGLEnabled(preferencesRef()); + return preferences()->webGLEnabled(); #if ENABLE(CSS_SHADERS) case CSSCustomFilterEnabled: - return WKPreferencesGetCSSCustomFilterEnabled(preferencesRef()); + return preferences()->cssCustomFilterEnabled(); #endif #endif #if ENABLE(WEB_AUDIO) case WebAudioEnabled: - return WKPreferencesGetWebAudioEnabled(preferencesRef()); + return preferences()->webAudioEnabled(); #endif +#if ENABLE(SMOOTH_SCROLLING) + case ScrollAnimatorEnabled: + return preferences()->scrollAnimatorEnabled(); +#endif + case CaretBrowsingEnabled: + return preferences()->caretBrowsingEnabled(); + case NotificationsEnabled: + return preferences()->notificationsEnabled(); default: ASSERT_NOT_REACHED(); return false; @@ -85,54 +90,66 @@ void QWebPreferencesPrivate::setAttribute(QWebPreferencesPrivate::WebAttribute a { switch (attr) { case AutoLoadImages: - WKPreferencesSetLoadsImagesAutomatically(preferencesRef(), enable); + preferences()->setLoadsImagesAutomatically(enable); break; #if ENABLE(FULLSCREEN_API) case FullScreenEnabled: - WKPreferencesSetFullScreenEnabled(preferencesRef(), enable); + preferences()->setFullScreenEnabled(enable); break; #endif case JavascriptEnabled: - WKPreferencesSetJavaScriptEnabled(preferencesRef(), enable); + preferences()->setJavaScriptEnabled(enable); break; case PluginsEnabled: - WKPreferencesSetPluginsEnabled(preferencesRef(), enable); + preferences()->setPluginsEnabled(enable); break; case OfflineWebApplicationCacheEnabled: - WKPreferencesSetOfflineWebApplicationCacheEnabled(preferencesRef(), enable); + preferences()->setOfflineWebApplicationCacheEnabled(enable); break; case LocalStorageEnabled: - WKPreferencesSetLocalStorageEnabled(preferencesRef(), enable); + preferences()->setLocalStorageEnabled(enable); break; case XSSAuditingEnabled: - WKPreferencesSetXSSAuditorEnabled(preferencesRef(), enable); + preferences()->setXSSAuditorEnabled(enable); break; case PrivateBrowsingEnabled: - WKPreferencesSetPrivateBrowsingEnabled(preferencesRef(), enable); + preferences()->setPrivateBrowsingEnabled(enable); break; case DnsPrefetchEnabled: - WKPreferencesSetDNSPrefetchingEnabled(preferencesRef(), enable); + preferences()->setDNSPrefetchingEnabled(enable); break; case FrameFlatteningEnabled: - WKPreferencesSetFrameFlatteningEnabled(preferencesRef(), enable); + preferences()->setFrameFlatteningEnabled(enable); case DeveloperExtrasEnabled: - WKPreferencesSetDeveloperExtrasEnabled(preferencesRef(), enable); + preferences()->setDeveloperExtrasEnabled(enable); break; #if ENABLE(WEBGL) case WebGLEnabled: - WKPreferencesSetWebGLEnabled(preferencesRef(), enable); + preferences()->setWebGLEnabled(enable); break; #if ENABLE(CSS_SHADERS) case CSSCustomFilterEnabled: - WKPreferencesSetCSSCustomFilterEnabled(preferencesRef(), enable); + preferences()->setCSSCustomFilterEnabled(enable); break; #endif #endif #if ENABLE(WEB_AUDIO) case WebAudioEnabled: - WKPreferencesSetWebAudioEnabled(preferencesRef(), enable); + preferences()->setWebAudioEnabled(enable); + break; +#endif +#if ENABLE(SMOOTH_SCROLLING) + case ScrollAnimatorEnabled: + preferences()->setScrollAnimatorEnabled(enable); break; #endif + case CaretBrowsingEnabled: + // FIXME: Caret browsing doesn't make much sense in touch mode. + preferences()->setCaretBrowsingEnabled(enable); + break; + case NotificationsEnabled: + preferences()->setNotificationsEnabled(enable); + break; default: ASSERT_NOT_REACHED(); } @@ -166,22 +183,22 @@ void QWebPreferencesPrivate::setFontFamily(QWebPreferencesPrivate::FontFamily wh { switch (which) { case StandardFont: - WKPreferencesSetStandardFontFamily(preferencesRef(), WKStringCreateWithQString(family)); + preferences()->setStandardFontFamily(family); break; case FixedFont: - WKPreferencesSetFixedFontFamily(preferencesRef(), WKStringCreateWithQString(family)); + preferences()->setFixedFontFamily(family); break; case SerifFont: - WKPreferencesSetSerifFontFamily(preferencesRef(), WKStringCreateWithQString(family)); + preferences()->setSerifFontFamily(family); break; case SansSerifFont: - WKPreferencesSetSansSerifFontFamily(preferencesRef(), WKStringCreateWithQString(family)); + preferences()->setSansSerifFontFamily(family); break; case CursiveFont: - WKPreferencesSetCursiveFontFamily(preferencesRef(), WKStringCreateWithQString(family)); + preferences()->setCursiveFontFamily(family); break; case FantasyFont: - WKPreferencesSetFantasyFontFamily(preferencesRef(), WKStringCreateWithQString(family)); + preferences()->setFantasyFontFamily(family); break; default: break; @@ -191,30 +208,18 @@ void QWebPreferencesPrivate::setFontFamily(QWebPreferencesPrivate::FontFamily wh QString QWebPreferencesPrivate::fontFamily(QWebPreferencesPrivate::FontFamily which) const { switch (which) { - case StandardFont: { - WKRetainPtr<WKStringRef> stringRef(AdoptWK, WKPreferencesCopyStandardFontFamily(preferencesRef())); - return WKStringCopyQString(stringRef.get()); - } - case FixedFont: { - WKRetainPtr<WKStringRef> stringRef(AdoptWK, WKPreferencesCopyFixedFontFamily(preferencesRef())); - return WKStringCopyQString(stringRef.get()); - } - case SerifFont: { - WKRetainPtr<WKStringRef> stringRef(AdoptWK, WKPreferencesCopySerifFontFamily(preferencesRef())); - return WKStringCopyQString(stringRef.get()); - } - case SansSerifFont: { - WKRetainPtr<WKStringRef> stringRef(AdoptWK, WKPreferencesCopySansSerifFontFamily(preferencesRef())); - return WKStringCopyQString(stringRef.get()); - } - case CursiveFont: { - WKRetainPtr<WKStringRef> stringRef(AdoptWK, WKPreferencesCopyCursiveFontFamily(preferencesRef())); - return WKStringCopyQString(stringRef.get()); - } - case FantasyFont: { - WKRetainPtr<WKStringRef> stringRef(AdoptWK, WKPreferencesCopyFantasyFontFamily(preferencesRef())); - return WKStringCopyQString(stringRef.get()); - } + case StandardFont: + return preferences()->standardFontFamily(); + case FixedFont: + return preferences()->fixedFontFamily(); + case SerifFont: + return preferences()->serifFontFamily(); + case SansSerifFont: + return preferences()->sansSerifFontFamily(); + case CursiveFont: + return preferences()->cursiveFontFamily(); + case FantasyFont: + return preferences()->fantasyFontFamily(); default: return QString(); } @@ -224,14 +229,14 @@ void QWebPreferencesPrivate::setFontSize(QWebPreferencesPrivate::FontSizeType ty { switch (type) { case MinimumFontSize: - WKPreferencesSetMinimumFontSize(preferencesRef(), size); - break; + preferences()->setMinimumFontSize(size); + break; case DefaultFontSize: - WKPreferencesSetDefaultFontSize(preferencesRef(), size); - break; + preferences()->setDefaultFontSize(size); + break; case DefaultFixedFontSize: - WKPreferencesSetDefaultFixedFontSize(preferencesRef(), size); - break; + preferences()->setDefaultFixedFontSize(size); + break; default: ASSERT_NOT_REACHED(); } @@ -241,11 +246,11 @@ unsigned QWebPreferencesPrivate::fontSize(QWebPreferencesPrivate::FontSizeType t { switch (type) { case MinimumFontSize: - return WKPreferencesGetMinimumFontSize(preferencesRef()); + return preferences()->minimumFontSize(); case DefaultFontSize: - return WKPreferencesGetDefaultFontSize(preferencesRef()); + return preferences()->defaultFontSize(); case DefaultFixedFontSize: - return WKPreferencesGetDefaultFixedFontSize(preferencesRef()); + return preferences()->defaultFixedFontSize(); default: ASSERT_NOT_REACHED(); return false; @@ -541,10 +546,50 @@ void QWebPreferences::setWebAudioEnabled(bool enable) #endif } -WKPreferencesRef QWebPreferencesPrivate::preferencesRef() const +bool QWebPreferences::scrollAnimatorEnabled() const +{ +#if ENABLE(SMOOTH_SCROLLING) + return d->testAttribute(QWebPreferencesPrivate::ScrollAnimatorEnabled); +#else + return false; +#endif +} + +void QWebPreferences::setScrollAnimatorEnabled(bool enable) +{ +#if ENABLE(SMOOTH_SCROLLING) + d->setAttribute(QWebPreferencesPrivate::ScrollAnimatorEnabled, enable); + emit scrollAnimatorEnabledChanged(); +#else + UNUSED_PARAM(enable); +#endif +} + +bool QWebPreferences::caretBrowsingEnabled() const +{ + return d->testAttribute(QWebPreferencesPrivate::CaretBrowsingEnabled); +} + +void QWebPreferences::setCaretBrowsingEnabled(bool enable) +{ + d->setAttribute(QWebPreferencesPrivate::CaretBrowsingEnabled, enable); + emit caretBrowsingEnabledChanged(); +} + +bool QWebPreferences::notificationsEnabled() const +{ + return d->testAttribute(QWebPreferencesPrivate::NotificationsEnabled); +} + +void QWebPreferences::setNotificationsEnabled(bool enable) +{ + d->setAttribute(QWebPreferencesPrivate::NotificationsEnabled, enable); + emit notificationsEnabledChanged(); +} + +WebKit::WebPreferences* QWebPreferencesPrivate::preferences() const { - WKPageGroupRef pageGroupRef = toAPI(webViewPrivate->webPageProxy->pageGroup()); - return WKPageGroupGetPreferences(pageGroupRef); + return webViewPrivate->webPageProxy->pageGroup()->preferences(); } QWebPreferencesPrivate* QWebPreferencesPrivate::get(QWebPreferences* preferences) diff --git a/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p.h b/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p.h index 373df7504..e3fab79ab 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p.h @@ -45,6 +45,9 @@ public: Q_PROPERTY(bool developerExtrasEnabled READ developerExtrasEnabled WRITE setDeveloperExtrasEnabled NOTIFY developerExtrasEnabledChanged FINAL) Q_PROPERTY(bool webGLEnabled READ webGLEnabled WRITE setWebGLEnabled NOTIFY webGLEnabledChanged FINAL) Q_PROPERTY(bool webAudioEnabled READ webAudioEnabled WRITE setWebAudioEnabled NOTIFY webAudioEnabledChanged FINAL) + Q_PROPERTY(bool scrollAnimatorEnabled READ scrollAnimatorEnabled WRITE setScrollAnimatorEnabled NOTIFY scrollAnimatorEnabledChanged FINAL) + Q_PROPERTY(bool caretBrowsingEnabled READ caretBrowsingEnabled WRITE setCaretBrowsingEnabled NOTIFY caretBrowsingEnabledChanged FINAL) + Q_PROPERTY(bool notificationsEnabled READ notificationsEnabled WRITE setNotificationsEnabled NOTIFY notificationsEnabledChanged FINAL) Q_PROPERTY(QString standardFontFamily READ standardFontFamily WRITE setStandardFontFamily NOTIFY standardFontFamilyChanged FINAL) Q_PROPERTY(QString fixedFontFamily READ fixedFontFamily WRITE setFixedFontFamily NOTIFY fixedFontFamilyChanged FINAL) @@ -99,6 +102,15 @@ public: bool webAudioEnabled() const; void setWebAudioEnabled(bool enable); + bool scrollAnimatorEnabled() const; + void setScrollAnimatorEnabled(bool enable); + + bool caretBrowsingEnabled() const; + void setCaretBrowsingEnabled(bool enable); + + bool notificationsEnabled() const; + void setNotificationsEnabled(bool enable); + QString standardFontFamily() const; void setStandardFontFamily(const QString& family); @@ -141,6 +153,9 @@ Q_SIGNALS: void developerExtrasEnabledChanged(); void webGLEnabledChanged(); void webAudioEnabledChanged(); + void scrollAnimatorEnabledChanged(); + void caretBrowsingEnabledChanged(); + void notificationsEnabledChanged(); void standardFontFamilyChanged(); void fixedFontFamilyChanged(); diff --git a/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p_p.h b/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p_p.h index c606bbe89..c8098b50e 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p_p.h @@ -20,7 +20,7 @@ #ifndef qwebpreferences_p_p_h #define qwebpreferences_p_p_h -#include "WKPreferences.h" +#include "WebPreferences.h" class QQuickWebViewPrivate; @@ -41,7 +41,10 @@ public: DeveloperExtrasEnabled, WebGLEnabled, CSSCustomFilterEnabled, - WebAudioEnabled + WebAudioEnabled, + ScrollAnimatorEnabled, + CaretBrowsingEnabled, + NotificationsEnabled }; enum FontFamily { @@ -71,7 +74,7 @@ public: void setFontSize(FontSizeType type, unsigned size); unsigned fontSize(FontSizeType type) const; - WKPreferencesRef preferencesRef() const; + WebKit::WebPreferences* preferences() const; QQuickWebViewPrivate* webViewPrivate; diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_fitToView.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_fitToView.qml index fcd3d9301..01192a8af 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_fitToView.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_fitToView.qml @@ -93,5 +93,39 @@ Item { compare(documentSize(), "960x1440") compare(test.contentsScale, 1.0) } + + function test_localPageDeviceWidth() { + webView.url = "about:blank" + verify(webView.waitForLoadSucceeded()) + + webView.url = "../common/test5.html" + verify(webView.waitForLoadSucceeded()) + compare(test.contentsScale, 0.5) + + // Add user interaction. + test.touchTap(webView, 10, 10) + + webView.reload() + verify(webView.waitForLoadSucceeded()) + // The page should still fit to view after a reload + compare(test.contentsScale, 0.5) + } + + function test_localPageInitialScale() { + webView.url = "about:blank" + verify(webView.waitForLoadSucceeded()) + + webView.url = "../common/test4.html" + verify(webView.waitForLoadSucceeded()) + + compare(test.contentsScale, 2.0) + + // Add user interaction. + test.touchTap(webView, 10, 10) + + webView.reload() + verify(webView.waitForLoadSucceeded()) + compare(test.contentsScale, 2.0) + } } } diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test4.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test4.html index e31d689d8..8f75af606 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test4.html +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test4.html @@ -9,6 +9,7 @@ font-size: 50px; } </style> + <meta name="viewport" content="initial-scale=2.0"/> </head> <body> <div id="content"> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test5.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test5.html new file mode 100644 index 000000000..3630ea6bd --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test5.html @@ -0,0 +1,10 @@ +<html> + <head> + <title>Local page with viewport meta tag: width=device-width</title> + <meta name="viewport" content="width=device-width"/> + </head> + <body> + <style type="text/css">body {width: 960px; height: 1440px; margin: 0; padding: 0;}</style> + <div>blah</div> + </body> +</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp index 558053729..6e2c342cb 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp @@ -258,11 +258,8 @@ void tst_QQuickWebView::show() void tst_QQuickWebView::showWebView() { - webView()->setSize(QSizeF(300, 400)); - webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/direct-image-compositing.html"))); QVERIFY(waitForLoadSucceeded(webView())); - m_window->show(); // This should not crash. webView()->setVisible(true); @@ -295,13 +292,11 @@ void tst_QQuickWebView::multipleWebViewWindows() QQuickWebView* webView2 = newWebView(); QScopedPointer<TestWindow> window2(new TestWindow(webView2)); - webView1->setSize(QSizeF(300, 400)); webView1->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/scroll.html"))); QVERIFY(waitForLoadSucceeded(webView1)); window1->show(); webView1->setVisible(true); - webView2->setSize(QSizeF(300, 400)); webView2->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html"))); QVERIFY(waitForLoadSucceeded(webView2)); window2->show(); @@ -334,14 +329,10 @@ void tst_QQuickWebView::multipleWebViews() void tst_QQuickWebView::basicRenderingSanity() { showWebView(); - webView()->setSize(QSizeF(300, 400)); webView()->setUrl(QUrl(QString::fromUtf8("data:text/html,<html><body bgcolor=\"#00ff00\"></body></html>"))); QVERIFY(waitForLoadSucceeded(webView())); - // We have to explicitly move the window into the screen, otherwise it's not rendered. - m_window->setGeometry(0, 0, 300, 400); - m_window->show(); // This should not crash. webView()->setVisible(true); QTest::qWait(200); diff --git a/Source/WebKit2/UIProcess/API/qt/tests/testwindow.h b/Source/WebKit2/UIProcess/API/qt/tests/testwindow.h index 4b2cfcf11..9d5d656e9 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/testwindow.h +++ b/Source/WebKit2/UIProcess/API/qt/tests/testwindow.h @@ -44,6 +44,7 @@ inline TestWindow::TestWindow(QQuickItem* webView) { Q_ASSERT(webView); webView->setParentItem(contentItem()); + resize(300, 400); } inline void TestWindow::resizeEvent(QResizeEvent* event) diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp index 1953afb61..4d43feb81 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp @@ -64,22 +64,9 @@ void LayerTreeCoordinatorProxy::createTileForLayer(int layerID, int tileID, cons void LayerTreeCoordinatorProxy::updateTileForLayer(int layerID, int tileID, const IntRect& targetRect, const WebKit::SurfaceUpdateInfo& updateInfo) { - RefPtr<ShareableSurface> surface; -#if USE(GRAPHICS_SURFACE) - GraphicsSurfaceToken token = updateInfo.surfaceHandle.graphicsSurfaceToken(); - if (token.isValid()) { - HashMap<GraphicsSurfaceToken::BufferHandle, RefPtr<ShareableSurface> >::iterator it = m_surfaces.find(token.frontBufferHandle); - if (it == m_surfaces.end()) { - surface = ShareableSurface::create(updateInfo.surfaceHandle); - m_surfaces.add(token.frontBufferHandle, surface); - } else - surface = it->value; - } else - surface = ShareableSurface::create(updateInfo.surfaceHandle); -#else - surface = ShareableSurface::create(updateInfo.surfaceHandle); -#endif - dispatchUpdate(bind(&LayerTreeRenderer::updateTile, m_renderer.get(), layerID, tileID, LayerTreeRenderer::TileUpdate(updateInfo.updateRect, targetRect, surface, updateInfo.surfaceOffset))); + SurfaceMap::iterator it = m_surfaces.find(updateInfo.atlasID); + ASSERT(it != m_surfaces.end()); + dispatchUpdate(bind(&LayerTreeRenderer::updateTile, m_renderer.get(), layerID, tileID, LayerTreeRenderer::TileUpdate(updateInfo.updateRect, targetRect, it->value, updateInfo.surfaceOffset))); } void LayerTreeCoordinatorProxy::removeTileForLayer(int layerID, int tileID) @@ -87,6 +74,18 @@ void LayerTreeCoordinatorProxy::removeTileForLayer(int layerID, int tileID) dispatchUpdate(bind(&LayerTreeRenderer::removeTile, m_renderer.get(), layerID, tileID)); } +void LayerTreeCoordinatorProxy::createUpdateAtlas(int atlasID, const ShareableSurface::Handle& handle) +{ + ASSERT(!m_surfaces.contains(atlasID)); + m_surfaces.add(atlasID, ShareableSurface::create(handle)); +} + +void LayerTreeCoordinatorProxy::removeUpdateAtlas(int atlasID) +{ + ASSERT(m_surfaces.contains(atlasID)); + m_surfaces.remove(atlasID); +} + void LayerTreeCoordinatorProxy::deleteCompositingLayer(WebLayerID id) { dispatchUpdate(bind(&LayerTreeRenderer::deleteLayer, m_renderer.get(), id)); @@ -120,7 +119,7 @@ void LayerTreeCoordinatorProxy::didRenderFrame(const WebCore::IntSize& contentsS { dispatchUpdate(bind(&LayerTreeRenderer::flushLayerChanges, m_renderer.get())); updateViewport(); -#if PLATFORM(QT) +#if USE(TILED_BACKING_STORE) m_drawingAreaProxy->page()->didRenderFrame(contentsSize, coveredRect); #else UNUSED_PARAM(contentsSize); @@ -144,14 +143,14 @@ void LayerTreeCoordinatorProxy::setContentsSize(const FloatSize& contentsSize) dispatchUpdate(bind(&LayerTreeRenderer::setContentsSize, m_renderer.get(), contentsSize)); } -void LayerTreeCoordinatorProxy::setLayerAnimatedOpacity(uint32_t id, float opacity) +void LayerTreeCoordinatorProxy::setLayerAnimations(WebLayerID id, const GraphicsLayerAnimations& animations) { - dispatchUpdate(bind(&LayerTreeRenderer::setAnimatedOpacity, m_renderer.get(), id, opacity)); + dispatchUpdate(bind(&LayerTreeRenderer::setLayerAnimations, m_renderer.get(), id, animations)); } -void LayerTreeCoordinatorProxy::setLayerAnimatedTransform(uint32_t id, const WebCore::TransformationMatrix& transform) +void LayerTreeCoordinatorProxy::setAnimationsLocked(bool locked) { - dispatchUpdate(bind(&LayerTreeRenderer::setAnimatedTransform, m_renderer.get(), id, transform)); + dispatchUpdate(bind(&LayerTreeRenderer::setAnimationsLocked, m_renderer.get(), locked)); } void LayerTreeCoordinatorProxy::setVisibleContentsRect(const FloatRect& rect, float scale, const FloatPoint& trajectoryVector) @@ -175,6 +174,19 @@ void LayerTreeCoordinatorProxy::renderNextFrame() m_drawingAreaProxy->page()->process()->send(Messages::LayerTreeCoordinator::RenderNextFrame(), m_drawingAreaProxy->page()->pageID()); } +#if ENABLE(REQUEST_ANIMATION_FRAME) +void LayerTreeCoordinatorProxy::requestAnimationFrame() +{ + dispatchUpdate(bind(&LayerTreeRenderer::requestAnimationFrame, m_renderer.get())); + updateViewport(); +} + +void LayerTreeCoordinatorProxy::animationFrameReady() +{ + m_drawingAreaProxy->page()->process()->send(Messages::LayerTreeCoordinator::AnimationFrameReady(), m_drawingAreaProxy->page()->pageID()); +} +#endif + void LayerTreeCoordinatorProxy::didChangeScrollPosition(const IntPoint& position) { dispatchUpdate(bind(&LayerTreeRenderer::didChangeScrollPosition, m_renderer.get(), position)); diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h index 3738ea4c3..646801168 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h @@ -26,10 +26,12 @@ #include "CoordinatedGraphicsArgumentCoders.h" #include "DrawingAreaProxy.h" #include "Region.h" +#include "ShareableSurface.h" #include "SurfaceUpdateInfo.h" #include "WebLayerTreeInfo.h" #include <WebCore/GraphicsContext.h> #include <WebCore/GraphicsLayer.h> +#include <WebCore/GraphicsLayerAnimation.h> #include <WebCore/GraphicsSurfaceToken.h> #include <WebCore/IntRect.h> #include <WebCore/IntSize.h> @@ -38,12 +40,6 @@ #include <wtf/Functional.h> #include <wtf/HashSet.h> -#if PLATFORM(QT) -QT_BEGIN_NAMESPACE -class QSGNode; -QT_END_NAMESPACE -#endif - namespace WebKit { class WebLayerInfo; @@ -51,9 +47,11 @@ class LayerTreeRenderer; class WebLayerUpdateInfo; class LayerTreeCoordinatorProxy { + WTF_MAKE_NONCOPYABLE(LayerTreeCoordinatorProxy); + WTF_MAKE_FAST_ALLOCATED; public: - LayerTreeCoordinatorProxy(DrawingAreaProxy*); - virtual ~LayerTreeCoordinatorProxy(); + explicit LayerTreeCoordinatorProxy(DrawingAreaProxy*); + ~LayerTreeCoordinatorProxy(); void setCompositingLayerState(WebLayerID, const WebLayerInfo&); void setCompositingLayerChildren(WebLayerID, const Vector<WebLayerID>&); #if ENABLE(CSS_FILTERS) @@ -61,14 +59,14 @@ public: #endif void deleteCompositingLayer(WebLayerID); void setRootCompositingLayer(WebLayerID); - void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); - void purgeGLResources(); void setContentsSize(const WebCore::FloatSize&); void setVisibleContentsRect(const WebCore::FloatRect&, float scale, const WebCore::FloatPoint& trajectoryVector); void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect); void createTileForLayer(int layerID, int tileID, const WebCore::IntRect&, const SurfaceUpdateInfo&); void updateTileForLayer(int layerID, int tileID, const WebCore::IntRect&, const SurfaceUpdateInfo&); void removeTileForLayer(int layerID, int tileID); + void createUpdateAtlas(int atlasID, const ShareableSurface::Handle&); + void removeUpdateAtlas(int atlasID); void createDirectlyCompositedImage(int64_t, const WebKit::ShareableBitmap::Handle&); void destroyDirectlyCompositedImage(int64_t); void didReceiveLayerTreeCoordinatorProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); @@ -80,8 +78,12 @@ public: #endif void purgeBackingStores(); LayerTreeRenderer* layerTreeRenderer() const { return m_renderer.get(); } - void setLayerAnimatedOpacity(uint32_t, float); - void setLayerAnimatedTransform(uint32_t, const WebCore::TransformationMatrix&); + void setLayerAnimations(WebLayerID, const WebCore::GraphicsLayerAnimations&); + void setAnimationsLocked(bool); +#if ENABLE(REQUEST_ANIMATION_FRAME) + void requestAnimationFrame(); + void animationFrameReady(); +#endif protected: void dispatchUpdate(const Function<void()>&); @@ -91,9 +93,8 @@ protected: WebCore::IntRect m_lastSentVisibleRect; float m_lastSentScale; WebCore::FloatPoint m_lastSentTrajectoryVector; -#if USE(GRAPHICS_SURFACE) - HashMap<WebCore::GraphicsSurfaceToken::BufferHandle, RefPtr<ShareableSurface> > m_surfaces; -#endif + typedef HashMap<int /* atlasID */, RefPtr<ShareableSurface> > SurfaceMap; + SurfaceMap m_surfaces; }; } diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in index b73960021..ba88de53f 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in @@ -29,14 +29,21 @@ messages -> LayerTreeCoordinatorProxy { CreateTileForLayer(uint32_t layerID, int tileID, WebCore::IntRect targetRect, WebKit::SurfaceUpdateInfo updateInfo) UpdateTileForLayer(uint32_t layerID, int tileID, WebCore::IntRect targetRect, WebKit::SurfaceUpdateInfo updateInfo) RemoveTileForLayer(uint32_t layerID, int tileID) + CreateUpdateAtlas(int atlasID, WebKit::ShareableSurface::Handle handle) + RemoveUpdateAtlas(int atlasID) CreateDirectlyCompositedImage(int64_t key, WebKit::ShareableBitmap::Handle handle) DestroyDirectlyCompositedImage(int64_t key) DidRenderFrame(WebCore::IntSize contentsSize, WebCore::IntRect coveredRect) DidChangeScrollPosition(WebCore::IntPoint position) + SetLayerAnimations(uint32_t id, WebCore::GraphicsLayerAnimations animations) + SetAnimationsLocked(bool locked) + +#if ENABLE(REQUEST_ANIMATION_FRAME) + RequestAnimationFrame() +#endif + #if USE(GRAPHICS_SURFACE) SyncCanvas(uint32_t id, WebCore::IntSize canvasSize, WebCore::GraphicsSurfaceToken token, uint32_t frontBuffer) #endif - SetLayerAnimatedOpacity(uint32_t id, float opacity) - SetLayerAnimatedTransform(uint32_t id, WebCore::TransformationMatrix transform) } #endif diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp index 82e58f3f2..bd92f7249 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp @@ -88,6 +88,10 @@ LayerTreeRenderer::LayerTreeRenderer(LayerTreeCoordinatorProxy* layerTreeCoordin : m_layerTreeCoordinatorProxy(layerTreeCoordinatorProxy) , m_rootLayerID(InvalidWebLayerID) , m_isActive(false) + , m_animationsLocked(false) +#if ENABLE(REQUEST_ANIMATION_FRAME) + , m_animationFrameRequested(false) +#endif { } @@ -120,6 +124,8 @@ void LayerTreeRenderer::paintToCurrentGLContext(const TransformationMatrix& matr return; layer->setTextureMapper(m_textureMapper.get()); + if (!m_animationsLocked) + layer->applyAnimationsRecursively(); m_textureMapper->beginPainting(PaintFlags); m_textureMapper->beginClip(TransformationMatrix(), clipRect); @@ -132,8 +138,31 @@ void LayerTreeRenderer::paintToCurrentGLContext(const TransformationMatrix& matr layer->paint(); m_textureMapper->endClip(); m_textureMapper->endPainting(); + + if (layer->descendantsOrSelfHaveRunningAnimations()) + dispatchOnMainThread(bind(&LayerTreeRenderer::updateViewport, this)); + +#if ENABLE(REQUEST_ANIMATION_FRAME) + if (m_animationFrameRequested) { + m_animationFrameRequested = false; + dispatchOnMainThread(bind(&LayerTreeRenderer::animationFrameReady, this)); + } +#endif +} + +#if ENABLE(REQUEST_ANIMATION_FRAME) +void LayerTreeRenderer::animationFrameReady() +{ + if (m_layerTreeCoordinatorProxy) + m_layerTreeCoordinatorProxy->animationFrameReady(); } +void LayerTreeRenderer::requestAnimationFrame() +{ + m_animationFrameRequested = true; +} +#endif + void LayerTreeRenderer::paintToGraphicsContext(BackingStore::PlatformGraphicsContext painter) { if (!m_textureMapper) @@ -393,6 +422,9 @@ void LayerTreeRenderer::flushLayerChanges() { m_renderedContentsScrollPosition = m_pendingRenderedContentsScrollPosition; + // Since the frame has now been rendered, we can safely unlock the animations until the next layout. + setAnimationsLocked(false); + m_rootLayer->flushCompositingState(FloatRect()); commitTileOperations(); @@ -430,8 +462,16 @@ void LayerTreeRenderer::syncRemoteContent() // We enqueue messages and execute them during paint, as they require an active GL context. ensureRootLayer(); - for (size_t i = 0; i < m_renderQueue.size(); ++i) - m_renderQueue[i](); + Vector<Function<void()> > renderQueue; + bool calledOnMainThread = WTF::isMainThread(); + if (!calledOnMainThread) + m_renderQueueMutex.lock(); + renderQueue.swap(m_renderQueue); + if (!calledOnMainThread) + m_renderQueueMutex.unlock(); + + for (size_t i = 0; i < renderQueue.size(); ++i) + renderQueue[i](); m_renderQueue.clear(); } @@ -461,20 +501,17 @@ void LayerTreeRenderer::purgeGLResources() dispatchOnMainThread(bind(&LayerTreeRenderer::purgeBackingStores, this)); } -void LayerTreeRenderer::setAnimatedOpacity(uint32_t id, float opacity) +void LayerTreeRenderer::setLayerAnimations(WebLayerID id, const GraphicsLayerAnimations& animations) { - GraphicsLayer* layer = layerByID(id); - ASSERT(layer); - - layer->setOpacity(opacity); + GraphicsLayerTextureMapper* layer = toGraphicsLayerTextureMapper(layerByID(id)); + if (!layer) + return; + layer->setAnimations(animations); } -void LayerTreeRenderer::setAnimatedTransform(uint32_t id, const WebCore::TransformationMatrix& transform) +void LayerTreeRenderer::setAnimationsLocked(bool locked) { - GraphicsLayer* layer = layerByID(id); - ASSERT(layer); - - layer->setTransform(transform); + m_animationsLocked = locked; } void LayerTreeRenderer::purgeBackingStores() @@ -493,6 +530,8 @@ void LayerTreeRenderer::appendUpdate(const Function<void()>& function) if (!m_isActive) return; + ASSERT(isMainThread()); + MutexLocker locker(m_renderQueueMutex); m_renderQueue.append(function); } diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h index 0a6ae3b88..ebe4ca391 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h @@ -28,6 +28,7 @@ #include "WebLayerTreeInfo.h" #include <WebCore/GraphicsContext.h> #include <WebCore/GraphicsLayer.h> +#include <WebCore/GraphicsLayerAnimation.h> #include <WebCore/GraphicsSurface.h> #include <WebCore/IntRect.h> #include <WebCore/IntSize.h> @@ -59,7 +60,7 @@ public: { } }; - LayerTreeRenderer(LayerTreeCoordinatorProxy*); + explicit LayerTreeRenderer(LayerTreeCoordinatorProxy*); virtual ~LayerTreeRenderer(); void purgeGLResources(); void paintToCurrentGLContext(const WebCore::TransformationMatrix&, float, const WebCore::FloatRect&, WebCore::TextureMapper::PaintFlags = 0); @@ -74,7 +75,6 @@ public: void detach(); void appendUpdate(const Function<void()>&); - void updateViewport(); void setActive(bool); void deleteLayer(WebLayerID); @@ -91,8 +91,13 @@ public: void flushLayerChanges(); void createImage(int64_t, PassRefPtr<ShareableBitmap>); void destroyImage(int64_t); - void setAnimatedOpacity(uint32_t, float); - void setAnimatedTransform(uint32_t, const WebCore::TransformationMatrix&); + void setLayerAnimations(WebLayerID, const WebCore::GraphicsLayerAnimations&); + void setAnimationsLocked(bool); + +#if ENABLE(REQUEST_ANIMATION_FRAME) + void requestAnimationFrame(); + void animationFrameReady(); +#endif private: PassOwnPtr<WebCore::GraphicsLayer> createLayer(WebLayerID); @@ -103,18 +108,25 @@ private: // Reimplementations from WebCore::GraphicsLayerClient. virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double) { } virtual void notifyFlushRequired(const WebCore::GraphicsLayer*) { } - virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const { return false; } - virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const { return false; } void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect&) { } + void updateViewport(); void dispatchOnMainThread(const Function<void()>&); void adjustPositionForFixedLayers(); + void assignImageToLayer(WebCore::GraphicsLayer*, int64_t imageID); + void ensureRootLayer(); + void ensureLayer(WebLayerID); + void commitTileOperations(); + void renderNextFrame(); + void purgeBackingStores(); + typedef HashMap<WebLayerID, WebCore::GraphicsLayer*> LayerMap; WebCore::FloatSize m_contentsSize; WebCore::FloatRect m_visibleContentsRect; // Render queue can be accessed ony from main thread or updatePaintNode call stack! Vector<Function<void()> > m_renderQueue; + Mutex m_renderQueueMutex; #if USE(TEXTURE_MAPPER) OwnPtr<WebCore::TextureMapper> m_textureMapper; @@ -127,19 +139,8 @@ private: SurfaceBackingStoreMap m_surfaceBackingStores; #endif - void scheduleWebViewUpdate(); - void synchronizeViewport(); - void assignImageToLayer(WebCore::GraphicsLayer*, int64_t imageID); - void ensureRootLayer(); - void ensureLayer(WebLayerID); - void commitTileOperations(); - void syncAnimations(); - void renderNextFrame(); - void purgeBackingStores(); - LayerTreeCoordinatorProxy* m_layerTreeCoordinatorProxy; OwnPtr<WebCore::GraphicsLayer> m_rootLayer; - Vector<WebLayerID> m_layersToDelete; LayerMap m_layers; LayerMap m_fixedLayers; @@ -147,6 +148,10 @@ private: WebCore::IntPoint m_renderedContentsScrollPosition; WebCore::IntPoint m_pendingRenderedContentsScrollPosition; bool m_isActive; + bool m_animationsLocked; +#if ENABLE(REQUEST_ANIMATION_FRAME) + bool m_animationFrameRequested; +#endif }; }; diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.h b/Source/WebKit2/UIProcess/DrawingAreaProxy.h index 450816a34..74a87a455 100644 --- a/Source/WebKit2/UIProcess/DrawingAreaProxy.h +++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.h @@ -35,14 +35,6 @@ #include <stdint.h> #include <wtf/Noncopyable.h> -#if PLATFORM(QT) -QT_BEGIN_NAMESPACE -class QPainter; -QT_END_NAMESPACE -#elif PLATFORM(GTK) -typedef struct _cairo cairo_t; -#endif - namespace CoreIPC { class Connection; class MessageDecoder; @@ -94,12 +86,8 @@ public: virtual void updateViewport(); virtual WebCore::IntRect viewportVisibleRect() const { return contentsRect(); } virtual WebCore::IntRect contentsRect() const; - virtual bool isBackingStoreReady() const { return true; } LayerTreeCoordinatorProxy* layerTreeCoordinatorProxy() const { return m_layerTreeCoordinatorProxy.get(); } virtual void setVisibleContentsRect(const WebCore::FloatRect& /* visibleContentsRect */, float /* scale */, const WebCore::FloatPoint& /* trajectoryVector */) { } - virtual void createTileForLayer(int /* layerID */, int /* tileID */, const WebKit::UpdateInfo&) { } - virtual void updateTileForLayer(int /* layerID */, int /* tileID */, const WebKit::UpdateInfo&) { } - virtual void removeTileForLayer(int /* layerID */, int /* tileID */) { } virtual void didReceiveLayerTreeCoordinatorProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); WebPageProxy* page() { return m_webPageProxy; } diff --git a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp index ee4e3c38b..31f0de425 100644 --- a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp +++ b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp @@ -77,8 +77,10 @@ const char* ProcessLauncher::processTypeAsString(ProcessType processType) case PluginProcess: return "pluginprocess"; #endif +#if ENABLE(NETWORK_PROCESS) case NetworkProcess: return "networkprocess"; +#endif #if ENABLE(SHARED_WORKER_PROCESS) case SharedWorkerProcess: return "sharedworkerprocess"; @@ -103,10 +105,12 @@ bool ProcessLauncher::getProcessTypeFromString(const char* string, ProcessType& } #endif +#if ENABLE(NETWORK_PROCESS) if (!strcmp(string, "networkprocess")) { processType = NetworkProcess; return true; } +#endif #if ENABLE(SHARED_WORKER_PROCESS) if (!strcmp(string, "sharedworkerprocess")) { diff --git a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h index dd4f45d39..3ccdf6c7c 100644 --- a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h +++ b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h @@ -51,7 +51,9 @@ public: #if ENABLE(PLUGIN_PROCESS) PluginProcess, #endif +#if ENABLE(NETWORK_PROCESS) NetworkProcess, +#endif #if ENABLE(SHARED_WORKER_PROCESS) SharedWorkerProcess #endif diff --git a/Source/WebKit2/UIProcess/Network/NetworkProcessManager.cpp b/Source/WebKit2/UIProcess/Network/NetworkProcessManager.cpp index 00f16f457..4340da394 100644 --- a/Source/WebKit2/UIProcess/Network/NetworkProcessManager.cpp +++ b/Source/WebKit2/UIProcess/Network/NetworkProcessManager.cpp @@ -28,6 +28,8 @@ #include "NetworkProcessProxy.h" +#if ENABLE(NETWORK_PROCESS) + namespace WebKit { NetworkProcessManager& NetworkProcessManager::shared() @@ -68,3 +70,5 @@ void NetworkProcessManager::removeNetworkProcessProxy(NetworkProcessProxy* netwo } // namespace WebKit + +#endif // ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/UIProcess/Network/NetworkProcessManager.h b/Source/WebKit2/UIProcess/Network/NetworkProcessManager.h index 08d422b25..957e45f3e 100644 --- a/Source/WebKit2/UIProcess/Network/NetworkProcessManager.h +++ b/Source/WebKit2/UIProcess/Network/NetworkProcessManager.h @@ -26,6 +26,8 @@ #ifndef NetworkProcessManager_h #define NetworkProcessManager_h +#if ENABLE(NETWORK_PROCESS) + #include "Connection.h" #include "WebProcessProxyMessages.h" #include <wtf/RefCounted.h> @@ -48,6 +50,10 @@ public: void removeNetworkProcessProxy(NetworkProcessProxy*); +#if PLATFORM(MAC) + void setApplicationIsOccluded(bool); +#endif + private: NetworkProcessManager(); @@ -56,4 +62,6 @@ private: } // namespace WebKit +#endif // ENABLE(NETWORK_PROCESS) + #endif // NetworkProcessManager_h diff --git a/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp b/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp index d1a0135f5..1f9ce89ed 100644 --- a/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp +++ b/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp @@ -112,7 +112,7 @@ void NetworkProcessProxy::didClose(CoreIPC::Connection*) networkProcessCrashedOrFailedToLaunch(); } -void NetworkProcessProxy::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID) +void NetworkProcessProxy::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference, CoreIPC::StringReference) { } @@ -162,6 +162,11 @@ void NetworkProcessProxy::didFinishLaunching(ProcessLauncher*, CoreIPC::Connecti m_connection->send(Messages::NetworkProcess::CreateNetworkConnectionToWebProcess(), 0); m_numPendingConnectionRequests = 0; + +#if PLATFORM(MAC) + if (WebContext::applicationIsOccluded()) + m_connection->send(Messages::NetworkProcess::SetApplicationIsOccluded(true), 0); +#endif } } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h b/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h index 1840a8e91..13fdfd89a 100644 --- a/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h +++ b/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h @@ -45,6 +45,12 @@ public: void getNetworkProcessConnection(PassRefPtr<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply>); + bool isValid() const { return m_connection; } + +#if PLATFORM(MAC) + void setApplicationIsOccluded(bool); +#endif + private: NetworkProcessProxy(NetworkProcessManager*); @@ -55,7 +61,7 @@ private: // CoreIPC::Connection::Client virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); virtual void didClose(CoreIPC::Connection*); - virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID); + virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName); virtual void syncMessageSendTimedOut(CoreIPC::Connection*); // Message handlers diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_form_client_private.h b/Source/WebKit2/UIProcess/Network/mac/NetworkProcessManagerMac.mm index 9feb4a138..eaf9888a5 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_form_client_private.h +++ b/Source/WebKit2/UIProcess/Network/mac/NetworkProcessManagerMac.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Intel Corporation. All rights reserved. + * Copyright (C) 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,12 +23,21 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ewk_view_form_client_private_h -#define ewk_view_form_client_private_h +#import "config.h" +#import "NetworkProcessManager.h" -#include <Evas.h> -#include <WebKit2/WKBase.h> +#if ENABLE(NETWORK_PROCESS) -void ewk_view_form_client_attach(WKPageRef pageRef, Evas_Object* ewkView); +#import "NetworkProcessProxy.h" -#endif // ewk_view_form_client_private_h +namespace WebKit { + +void NetworkProcessManager::setApplicationIsOccluded(bool applicationIsOccluded) +{ + if (m_networkProcess) + return m_networkProcess->setApplicationIsOccluded(applicationIsOccluded); +} + +} // namespace WebKit + +#endif // ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/UIProcess/Network/mac/NetworkProcessProxyMac.mm b/Source/WebKit2/UIProcess/Network/mac/NetworkProcessProxyMac.mm index 440cc429f..02534e9b9 100644 --- a/Source/WebKit2/UIProcess/Network/mac/NetworkProcessProxyMac.mm +++ b/Source/WebKit2/UIProcess/Network/mac/NetworkProcessProxyMac.mm @@ -27,6 +27,7 @@ #import "NetworkProcessProxy.h" #import "NetworkProcessCreationParameters.h" +#import "NetworkProcessMessages.h" #if ENABLE(NETWORK_PROCESS) @@ -39,6 +40,14 @@ void NetworkProcessProxy::platformInitializeNetworkProcess(NetworkProcessCreatio parameters.parentProcessName = [[NSProcessInfo processInfo] processName]; } +void NetworkProcessProxy::setApplicationIsOccluded(bool applicationIsOccluded) +{ + if (!isValid()) + return; + + m_connection->send(Messages::NetworkProcess::SetApplicationIsOccluded(applicationIsOccluded), 0); +} + } // namespace WebKit #endif // ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/UIProcess/PageClient.h b/Source/WebKit2/UIProcess/PageClient.h index c6fb91882..9552aa1c5 100644 --- a/Source/WebKit2/UIProcess/PageClient.h +++ b/Source/WebKit2/UIProcess/PageClient.h @@ -116,22 +116,25 @@ public: #if USE(TILED_BACKING_STORE) virtual void pageDidRequestScroll(const WebCore::IntPoint&) = 0; -#endif -#if PLATFORM(QT) virtual void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect) = 0; virtual void pageTransitionViewportReady() = 0; +#endif +#if PLATFORM(QT) virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&) = 0; virtual void didReceiveMessageFromNavigatorQtObject(const String&) = 0; - virtual void updateTextInputState() = 0; virtual void handleAuthenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password) = 0; virtual void handleCertificateVerificationRequest(const String& hostname, bool& ignoreErrors) = 0; virtual void handleProxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password) = 0; #endif // PLATFORM(QT). #if PLATFORM(QT) || PLATFORM(EFL) - virtual void handleDownloadRequest(DownloadProxy*) = 0; + virtual void updateTextInputState() = 0; #endif // PLATFORM(QT) || PLATFORM(EFL) +#if PLATFORM(QT) || PLATFORM(EFL) || PLATFORM(GTK) + virtual void handleDownloadRequest(DownloadProxy*) = 0; +#endif // PLATFORM(QT) || PLATFORM(EFL) || PLATFORM(GTK) + #if PLATFORM(QT) || PLATFORM(EFL) virtual void didChangeContentsSize(const WebCore::IntSize&) = 0; #endif diff --git a/Source/WebKit2/UIProcess/PageViewportController.cpp b/Source/WebKit2/UIProcess/PageViewportController.cpp index 88d52ba62..92091632f 100644 --- a/Source/WebKit2/UIProcess/PageViewportController.cpp +++ b/Source/WebKit2/UIProcess/PageViewportController.cpp @@ -22,6 +22,8 @@ #include "config.h" #include "PageViewportController.h" +#if USE(TILED_BACKING_STORE) + #include "PageViewportControllerClient.h" #include "WebPageProxy.h" #include <WebCore/FloatRect.h> @@ -37,34 +39,16 @@ bool fuzzyCompare(float a, float b, float epsilon) return std::abs(a - b) < epsilon; } -ViewportUpdateDeferrer::ViewportUpdateDeferrer(PageViewportController* PageViewportController, SuspendContentFlag suspendContentFlag) - : m_controller(PageViewportController) -{ - m_controller->m_activeDeferrerCount++; - - // There is no need to suspend content for immediate updates - // only during animations or longer gestures. - if (suspendContentFlag == DeferUpdateAndSuspendContent) - m_controller->suspendContent(); -} - -ViewportUpdateDeferrer::~ViewportUpdateDeferrer() -{ - if (--(m_controller->m_activeDeferrerCount)) - return; - - m_controller->resumeContent(); -} - PageViewportController::PageViewportController(WebKit::WebPageProxy* proxy, PageViewportControllerClient* client) : m_webPageProxy(proxy) , m_client(client) , m_allowsUserScaling(false) , m_minimumScaleToFit(1) - , m_activeDeferrerCount(0) , m_hasSuspendedContent(false) , m_hadUserInteraction(false) , m_effectiveScale(1) + , m_viewportPosIsLocked(false) + , m_effectiveScaleIsLocked(false) { // Initializing Viewport Raw Attributes to avoid random negative or infinity scale factors // if there is a race condition between the first layout and setting the viewport attributes for the first time. @@ -72,6 +56,7 @@ PageViewportController::PageViewportController(WebKit::WebPageProxy* proxy, Page m_rawAttributes.minimumScale = 1; m_rawAttributes.maximumScale = 1; m_rawAttributes.userScalable = m_allowsUserScaling; + m_rawAttributes.initiallyFitToViewport = true; ASSERT(m_client); m_client->setController(this); @@ -111,6 +96,9 @@ void PageViewportController::didCommitLoad() // Do not count the previous committed page contents as covered. m_lastFrameCoveredRect = FloatRect(); + // Do not continue to use the content size of the previous page. + m_contentsSize = IntSize(); + // Reset the position to the top, page/history scroll requests may override this before we re-enable rendering. applyPositionAfterRenderingContents(FloatPoint()); } @@ -157,7 +145,8 @@ void PageViewportController::pageTransitionViewportReady() { if (!m_rawAttributes.layoutSize.isEmpty()) { m_hadUserInteraction = false; - applyScaleAfterRenderingContents(innerBoundedViewportScale(toViewportScale(m_rawAttributes.initialScale))); + float initialScale = m_rawAttributes.initiallyFitToViewport ? m_minimumScaleToFit : m_rawAttributes.initialScale; + applyScaleAfterRenderingContents(innerBoundedViewportScale(toViewportScale(initialScale))); } // At this point we should already have received the first viewport arguments and the requested scroll @@ -170,7 +159,7 @@ void PageViewportController::pageTransitionViewportReady() void PageViewportController::pageDidRequestScroll(const IntPoint& cssPosition) { // Ignore the request if suspended. Can only happen due to delay in event delivery. - if (m_activeDeferrerCount) + if (m_hasSuspendedContent) return; FloatRect endVisibleContentRect(clampViewportToContents(cssPosition, m_effectiveScale), viewportSizeInContentsCoordinates()); @@ -289,3 +278,5 @@ void PageViewportController::updateMinimumScaleToFit() } } // namespace WebKit + +#endif diff --git a/Source/WebKit2/UIProcess/PageViewportController.h b/Source/WebKit2/UIProcess/PageViewportController.h index d38ddb914..97463216b 100644 --- a/Source/WebKit2/UIProcess/PageViewportController.h +++ b/Source/WebKit2/UIProcess/PageViewportController.h @@ -22,6 +22,8 @@ #ifndef PageViewportController_h #define PageViewportController_h +#if USE(TILED_BACKING_STORE) + #include <WebCore/FloatPoint.h> #include <WebCore/FloatRect.h> #include <WebCore/FloatSize.h> @@ -38,32 +40,6 @@ class WebPageProxy; class PageViewportController; class PageViewportControllerClient; -// When interacting with the content, either by animating or by the hand of the user, -// it is important to ensure smooth animations of at least 60fps in order to give a -// good user experience. -// -// In order to do this we need to get rid of unknown factors. These include device -// sensors (geolocation, orientation updates etc), CSS3 animations, JavaScript -// exectution, sub resource loads etc. -// We do this by sending suspend and resume notifications to the web process. -// -// For this purpose the ViewportUpdateDeferrer guard can be used when interacting -// with or animating the content to scope suspend / resume and defer update -// notifications. -// -// If something should only be executed when the content is suspended, it is possible -// to check for that using ASSERT(hasSuspendedContent()). - -class ViewportUpdateDeferrer { -public: - enum SuspendContentFlag { DeferUpdate, DeferUpdateAndSuspendContent }; - ViewportUpdateDeferrer(PageViewportController*, SuspendContentFlag = DeferUpdate); - ~ViewportUpdateDeferrer(); - -private: - PageViewportController* const m_controller; -}; - class PageViewportController { WTF_MAKE_NONCOPYABLE(PageViewportController); @@ -119,7 +95,6 @@ private: bool m_allowsUserScaling; float m_minimumScaleToFit; - int m_activeDeferrerCount; bool m_hasSuspendedContent; bool m_hadUserInteraction; @@ -132,12 +107,12 @@ private: bool m_viewportPosIsLocked; bool m_effectiveScaleIsLocked; WebCore::FloatRect m_lastFrameCoveredRect; - - friend class ViewportUpdateDeferrer; }; bool fuzzyCompare(float, float, float epsilon); } // namespace WebKit +#endif + #endif // PageViewportController_h diff --git a/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp b/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp index 804455490..95f589b5f 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp +++ b/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp @@ -189,7 +189,12 @@ static inline String pathExtension(const KURL& url) } #if !PLATFORM(MAC) -bool PluginInfoStore::shouldBlockPlugin(const PluginModuleInfo&) +PluginModuleLoadPolicy PluginInfoStore::policyForPlugin(const PluginModuleInfo&) +{ + return PluginModuleLoadNormally; +} + +bool PluginInfoStore::reactivateInactivePlugin(const PluginModuleInfo&) { return false; } diff --git a/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h b/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h index 287ec9262..9a6bd9f5c 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h +++ b/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h @@ -56,9 +56,8 @@ public: // Returns the info for the plug-in with the given path. PluginModuleInfo infoForPluginWithPath(const String& pluginPath) const; - // Return whether this plug-in should be blocked from being instantiated. - // Note that the plug-in will still be seen by e.g. navigator.plugins - static bool shouldBlockPlugin(const PluginModuleInfo&); + static PluginModuleLoadPolicy policyForPlugin(const PluginModuleInfo&); + static bool reactivateInactivePlugin(const PluginModuleInfo&); private: PluginModuleInfo findPluginForMIMEType(const String& mimeType) const; diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h index 37824c4aa..5e519427b 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h @@ -56,6 +56,10 @@ public: void getSitesWithData(const PluginModuleInfo&, WebPluginSiteDataManager*, uint64_t callbackID); void clearSiteData(const PluginModuleInfo&, WebPluginSiteDataManager*, const Vector<String>& sites, uint64_t flags, uint64_t maxAgeInSeconds, uint64_t callbackID); +#if PLATFORM(MAC) + void setApplicationIsOccluded(bool); +#endif + private: PluginProcessManager(); diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp index e51eed7df..0c2e8689e 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp @@ -179,7 +179,7 @@ void PluginProcessProxy::didClose(CoreIPC::Connection*) pluginProcessCrashedOrFailedToLaunch(); } -void PluginProcessProxy::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID) +void PluginProcessProxy::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference, CoreIPC::StringReference) { } @@ -228,6 +228,11 @@ void PluginProcessProxy::didFinishLaunching(ProcessLauncher*, CoreIPC::Connectio m_connection->send(Messages::PluginProcess::CreateWebProcessConnection(), 0); m_numPendingConnectionRequests = 0; + +#if PLATFORM(MAC) + if (WebContext::applicationIsOccluded()) + m_connection->send(Messages::PluginProcess::SetApplicationIsOccluded(true), 0); +#endif } void PluginProcessProxy::didCreateWebProcessConnection(const CoreIPC::Attachment& connectionIdentifier, bool supportsAsynchronousPluginInitialization) diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h index bdade27e5..1357e6c7f 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h @@ -80,7 +80,11 @@ public: // Terminates the plug-in process. void terminate(); + bool isValid() const { return m_connection; } + #if PLATFORM(MAC) + void setApplicationIsOccluded(bool); + // Returns whether the plug-in needs the heap to be marked executable. static bool pluginNeedsExecutableHeap(const PluginModuleInfo&); @@ -100,7 +104,7 @@ private: // CoreIPC::Connection::Client virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE; virtual void didClose(CoreIPC::Connection*) OVERRIDE; - virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID) OVERRIDE; + virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName) OVERRIDE; // ProcessLauncher::Client virtual void didFinishLaunching(ProcessLauncher*, CoreIPC::Connection::Identifier); diff --git a/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm b/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm index 5bacc2c2a..6ebde6476 100644 --- a/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm +++ b/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm @@ -36,6 +36,8 @@ using namespace WebCore; +static const char* const oracleJavaAppletPluginBundleIdentifier = "com.oracle.java.JavaAppletPlugin"; + namespace WebKit { Vector<String> PluginInfoStore::pluginsDirectories() @@ -105,6 +107,11 @@ static bool checkForPreferredPlugin(Vector<PluginModuleInfo>& alreadyLoadedPlugi return true; } +static bool shouldBlockPlugin(const PluginModuleInfo& plugin) +{ + return PluginInfoStore::policyForPlugin(plugin) == PluginModuleBlocked; +} + bool PluginInfoStore::shouldUsePlugin(Vector<PluginModuleInfo>& alreadyLoadedPlugins, const PluginModuleInfo& plugin) { for (size_t i = 0; i < alreadyLoadedPlugins.size(); ++i) { @@ -122,11 +129,11 @@ bool PluginInfoStore::shouldUsePlugin(Vector<PluginModuleInfo>& alreadyLoadedPlu } // Prefer the Oracle Java plug-in over the Apple java plug-in. - if (!checkForPreferredPlugin(alreadyLoadedPlugins, plugin, "com.apple.java.JavaAppletPlugin", "com.oracle.java.JavaAppletPlugin")) + if (!checkForPreferredPlugin(alreadyLoadedPlugins, plugin, "com.apple.java.JavaAppletPlugin", oracleJavaAppletPluginBundleIdentifier)) return false; #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 - if (plugin.bundleIdentifier == "com.apple.java.JavaAppletPlugin" && shouldBlockPlugin(plugin) && !WKJLIsRuntimeAndWebComponentsInstalled()) { + if (plugin.bundleIdentifier == "com.apple.java.JavaAppletPlugin" && shouldBlockPlugin(plugin) && !WKIsJavaPlugInActive()) { // If the Apple Java plug-in is blocked and there's no Java runtime installed, just pretend that the plug-in doesn't exist. return false; } @@ -135,9 +142,27 @@ bool PluginInfoStore::shouldUsePlugin(Vector<PluginModuleInfo>& alreadyLoadedPlu return true; } -bool PluginInfoStore::shouldBlockPlugin(const PluginModuleInfo& plugin) +PluginModuleLoadPolicy PluginInfoStore::policyForPlugin(const PluginModuleInfo& plugin) { - return WKShouldBlockPlugin(plugin.bundleIdentifier, plugin.versionString); + if (WKShouldBlockPlugin(plugin.bundleIdentifier, plugin.versionString)) + return PluginModuleBlocked; + + if (plugin.bundleIdentifier == oracleJavaAppletPluginBundleIdentifier && !WKIsJavaPlugInActive()) + return PluginModuleInactive; + + return PluginModuleLoadNormally; +} + +bool PluginInfoStore::reactivateInactivePlugin(const PluginModuleInfo& plugin) +{ +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 + if (plugin.bundleIdentifier == oracleJavaAppletPluginBundleIdentifier) { + WKActivateJavaPlugIn(); + return true; + } +#endif + + return false; } String PluginInfoStore::getMIMETypeForExtension(const String& extension) diff --git a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessManagerMac.mm b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessManagerMac.mm new file mode 100644 index 000000000..6a974dad7 --- /dev/null +++ b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessManagerMac.mm @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2012 Apple Inc. 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. + */ + +#import "config.h" +#import "PluginProcessManager.h" + +#if ENABLE(PLUGIN_PROCESS) + +#import "PluginProcessProxy.h" + +namespace WebKit { + +void PluginProcessManager::setApplicationIsOccluded(bool applicationIsOccluded) +{ + size_t processCount = m_pluginProcesses.size(); + for (size_t i = 0; i < processCount; ++i) + m_pluginProcesses[i]->setApplicationIsOccluded(applicationIsOccluded); +} + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) diff --git a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm index 207eca2c9..e92ef9e76 100644 --- a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm +++ b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm @@ -30,6 +30,7 @@ #import "EnvironmentVariables.h" #import "PluginProcessCreationParameters.h" +#import "PluginProcessMessages.h" #import "WebKitSystemInterface.h" #import <WebCore/FileSystem.h> #import <spawn.h> @@ -315,6 +316,13 @@ void PluginProcessProxy::applicationDidBecomeActive() makePluginProcessTheFrontProcess(); } +void PluginProcessProxy::setApplicationIsOccluded(bool applicationIsOccluded) +{ + if (!isValid()) + return; + + m_connection->send(Messages::PluginProcess::SetApplicationIsOccluded(applicationIsOccluded), 0); +} } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp b/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp index 64c7bc485..189e21379 100644 --- a/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp +++ b/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp @@ -43,8 +43,15 @@ using namespace WebCore; namespace WebKit { -void PluginProcessProxy::platformInitializeLaunchOptions(ProcessLauncher::LaunchOptions&, const PluginModuleInfo&) +void PluginProcessProxy::platformInitializeLaunchOptions(ProcessLauncher::LaunchOptions& launchOptions, const PluginModuleInfo&) { +#if PLATFORM(EFL) && !defined(NDEBUG) + const char* commandPrefix = getenv("PLUGIN_PROCESS_COMMAND_PREFIX"); + if (commandPrefix && *commandPrefix) + launchOptions.processCmdPrefix = String::fromUTF8(commandPrefix); +#else + UNUSED_PARAM(launchOptions); +#endif } void PluginProcessProxy::platformInitializePluginProcess(PluginProcessCreationParameters&) diff --git a/Source/WebKit2/UIProcess/SharedWorkers/SharedWorkerProcessManager.h b/Source/WebKit2/UIProcess/SharedWorkers/SharedWorkerProcessManager.h index ba06c7cbb..c2555ea4e 100644 --- a/Source/WebKit2/UIProcess/SharedWorkers/SharedWorkerProcessManager.h +++ b/Source/WebKit2/UIProcess/SharedWorkers/SharedWorkerProcessManager.h @@ -53,6 +53,10 @@ public: void getSharedWorkerProcessConnection(const String& url, const String& name, PassRefPtr<Messages::WebProcessProxy::GetSharedWorkerProcessConnection::DelayedReply>); void removeSharedWorkerProcessProxy(SharedWorkerProcessProxy*); +#if PLATFORM(MAC) + void setApplicationIsOccluded(bool); +#endif + private: SharedWorkerProcessManager(); diff --git a/Source/WebKit2/UIProcess/SharedWorkers/SharedWorkerProcessProxy.cpp b/Source/WebKit2/UIProcess/SharedWorkers/SharedWorkerProcessProxy.cpp index 3247dc131..b808efbac 100644 --- a/Source/WebKit2/UIProcess/SharedWorkers/SharedWorkerProcessProxy.cpp +++ b/Source/WebKit2/UIProcess/SharedWorkers/SharedWorkerProcessProxy.cpp @@ -128,7 +128,7 @@ void SharedWorkerProcessProxy::didClose(CoreIPC::Connection*) sharedWorkerProcessCrashedOrFailedToLaunch(); } -void SharedWorkerProcessProxy::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID) +void SharedWorkerProcessProxy::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference, CoreIPC::StringReference) { } @@ -164,6 +164,11 @@ void SharedWorkerProcessProxy::didFinishLaunching(ProcessLauncher*, CoreIPC::Con m_connection->send(Messages::SharedWorkerProcess::CreateWebProcessConnection(), 0); m_numPendingConnectionRequests = 0; + +#if PLATFORM(MAC) + if (WebContext::applicationIsOccluded()) + m_connection->send(Messages::SharedWorkerProcess::SetApplicationIsOccluded(true), 0); +#endif } void SharedWorkerProcessProxy::didCreateWebProcessConnection(const CoreIPC::Attachment& connectionIdentifier) diff --git a/Source/WebKit2/UIProcess/SharedWorkers/SharedWorkerProcessProxy.h b/Source/WebKit2/UIProcess/SharedWorkers/SharedWorkerProcessProxy.h index f20551425..6e9f20a86 100644 --- a/Source/WebKit2/UIProcess/SharedWorkers/SharedWorkerProcessProxy.h +++ b/Source/WebKit2/UIProcess/SharedWorkers/SharedWorkerProcessProxy.h @@ -56,6 +56,12 @@ public: // Terminates the shared worker process. void terminate(); + bool isValid() const { return m_connection; } + +#if PLATFORM(MAC) + void setApplicationIsOccluded(bool); +#endif + private: SharedWorkerProcessProxy(SharedWorkerProcessManager*, const String& url, const String& name); @@ -64,7 +70,7 @@ private: // CoreIPC::Connection::Client virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); virtual void didClose(CoreIPC::Connection*); - virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID); + virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName); // ProcessLauncher::Client virtual void didFinishLaunching(ProcessLauncher*, CoreIPC::Connection::Identifier); diff --git a/Source/WebKit2/UIProcess/SharedWorkers/mac/SharedWorkerProcessManagerMac.mm b/Source/WebKit2/UIProcess/SharedWorkers/mac/SharedWorkerProcessManagerMac.mm new file mode 100644 index 000000000..e63907ce6 --- /dev/null +++ b/Source/WebKit2/UIProcess/SharedWorkers/mac/SharedWorkerProcessManagerMac.mm @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2012 Apple Inc. 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. + */ + +#import "config.h" +#import "SharedWorkerProcessManager.h" + +#if ENABLE(SHARED_WORKER_PROCESS) + +#import "SharedWorkerProcessProxy.h" + +namespace WebKit { + +void SharedWorkerProcessManager::setApplicationIsOccluded(bool applicationIsOccluded) +{ + size_t processCount = m_sharedWorkerProcesses.size(); + for (size_t i = 0; i < processCount; ++i) + m_sharedWorkerProcesses[i]->setApplicationIsOccluded(applicationIsOccluded); +} + +} // namespace WebKit + +#endif // ENABLE(SHARED_WORKER_PROCESS) diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_find_client_private.h b/Source/WebKit2/UIProcess/SharedWorkers/mac/SharedWorkerProcessProxyMac.mm index c17143360..5b3dd4639 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_find_client_private.h +++ b/Source/WebKit2/UIProcess/SharedWorkers/mac/SharedWorkerProcessProxyMac.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Samsung Electronics. All rights reserved. + * Copyright (C) 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,12 +23,23 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ewk_view_find_client_private_h -#define ewk_view_find_client_private_h +#import "config.h" +#import "SharedWorkerProcessProxy.h" -#include <Evas.h> -#include <WebKit2/WKBase.h> +#if ENABLE(SHARED_WORKER_PROCESS) -void ewk_view_find_client_attach(WKPageRef pageRef, Evas_Object* ewkView); +#import "SharedWorkerProcessMessages.h" -#endif // ewk_view_find_client_private_h +namespace WebKit { + +void SharedWorkerProcessProxy::setApplicationIsOccluded(bool applicationIsOccluded) +{ + if (!isValid()) + return; + + m_connection->send(Messages::SharedWorkerProcess::SetApplicationIsOccluded(applicationIsOccluded), 0); +} + +} // namespace WebKit + +#endif // ENABLE(SHARED_WORKER_PROCESS) diff --git a/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp b/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp index 6202608bd..a80cfbc30 100644 --- a/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp +++ b/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp @@ -54,7 +54,7 @@ WebConnectionToWebProcess::WebConnectionToWebProcess(WebProcessProxy* process, C void WebConnectionToWebProcess::encodeMessageBody(CoreIPC::ArgumentEncoder& encoder, APIObject* messageBody) { - encoder.encode(WebContextUserMessageEncoder(messageBody)); + encoder << WebContextUserMessageEncoder(messageBody); } bool WebConnectionToWebProcess::decodeMessageBody(CoreIPC::ArgumentDecoder& decoder, RefPtr<APIObject>& messageBody) @@ -94,14 +94,14 @@ void WebConnectionToWebProcess::didClose(CoreIPC::Connection* connection) m_client.didClose(this); } -void WebConnectionToWebProcess::didReceiveInvalidMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID) +void WebConnectionToWebProcess::didReceiveInvalidMessage(CoreIPC::Connection* connection, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName) { RefPtr<WebConnectionToWebProcess> protector = this; RefPtr<WebProcessProxy> process = m_process; // This will invalidate the CoreIPC::Connection and the WebProcessProxy member // variables, so we should be careful not to use them after this call. - process->didReceiveInvalidMessage(connection, messageID); + process->didReceiveInvalidMessage(connection, messageReceiverName, messageName); // Since we've invalidated the connection we'll never get a CoreIPC::Connection::Client::didClose // callback so we'll explicitly call it here instead. diff --git a/Source/WebKit2/UIProcess/WebConnectionToWebProcess.h b/Source/WebKit2/UIProcess/WebConnectionToWebProcess.h index 0b1fc09f8..b601283cf 100644 --- a/Source/WebKit2/UIProcess/WebConnectionToWebProcess.h +++ b/Source/WebKit2/UIProcess/WebConnectionToWebProcess.h @@ -49,7 +49,7 @@ private: virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&, OwnPtr<CoreIPC::MessageEncoder>&); virtual void didClose(CoreIPC::Connection*); - virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID); + virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName); #if PLATFORM(WIN) virtual Vector<HWND> windowsToReceiveSentMessagesWhileWaitingForSyncReply(); #endif diff --git a/Source/WebKit2/UIProcess/WebContext.cpp b/Source/WebKit2/UIProcess/WebContext.cpp index 56a017c6f..8ddc93d83 100644 --- a/Source/WebKit2/UIProcess/WebContext.cpp +++ b/Source/WebKit2/UIProcess/WebContext.cpp @@ -100,6 +100,9 @@ PassRefPtr<WebContext> WebContext::create(const String& injectedBundlePath) JSC::initializeThreading(); WTF::initializeMainThread(); RunLoop::initializeMainRunLoop(); +#if PLATFORM(MAC) + WebContext::initializeProcessSuppressionSupport(); +#endif return adoptRef(new WebContext(ProcessModelSharedSecondaryProcess, injectedBundlePath)); } @@ -136,7 +139,6 @@ WebContext::WebContext(ProcessModel processModel, const String& injectedBundlePa #endif { addMessageReceiver(Messages::WebContext::messageReceiverName(), this); - addMessageReceiver(Messages::DownloadProxy::messageReceiverName(), this); addMessageReceiver(CoreIPC::MessageKindTraits<WebContextLegacyMessage::Kind>::messageReceiverName(), this); // NOTE: These sub-objects must be initialized after m_messageReceiverMap.. @@ -498,7 +500,7 @@ void WebContext::processDidFinishLaunching(WebProcessProxy* process) if (m_memorySamplerEnabled) { SandboxExtension::Handle sampleLogSandboxHandle; double now = WTF::currentTime(); - String sampleLogFilePath = String::format("WebProcess%llu", static_cast<unsigned long long>(now)); + String sampleLogFilePath = String::format("WebProcess%llupid%d", static_cast<unsigned long long>(now), process->processIdentifier()); sampleLogFilePath = SandboxExtension::createHandleForTemporaryFile(sampleLogFilePath, SandboxExtension::WriteOnly, sampleLogSandboxHandle); process->send(Messages::WebProcess::StartMemorySampler(sampleLogSandboxHandle, sampleLogFilePath, m_memorySamplerInterval), 0); @@ -762,6 +764,7 @@ DownloadProxy* WebContext::createDownloadProxy() { RefPtr<DownloadProxy> downloadProxy = DownloadProxy::create(this); m_downloads.set(downloadProxy->downloadID(), downloadProxy); + addMessageReceiver(Messages::DownloadProxy::messageReceiverName(), downloadProxy->downloadID(), this); return downloadProxy.get(); } @@ -770,6 +773,7 @@ void WebContext::downloadFinished(DownloadProxy* downloadProxy) ASSERT(m_downloads.contains(downloadProxy->downloadID())); downloadProxy->invalidate(); + removeMessageReceiver(Messages::DownloadProxy::messageReceiverName(), downloadProxy->downloadID()); m_downloads.remove(downloadProxy->downloadID()); } @@ -790,6 +794,16 @@ void WebContext::addMessageReceiver(CoreIPC::StringReference messageReceiverName m_messageReceiverMap.addMessageReceiver(messageReceiverName, messageReceiver); } +void WebContext::addMessageReceiver(CoreIPC::StringReference messageReceiverName, uint64_t destinationID, CoreIPC::MessageReceiver* messageReceiver) +{ + m_messageReceiverMap.addMessageReceiver(messageReceiverName, destinationID, messageReceiver); +} + +void WebContext::removeMessageReceiver(CoreIPC::StringReference messageReceiverName, uint64_t destinationID) +{ + m_messageReceiverMap.removeMessageReceiver(messageReceiverName, destinationID); +} + bool WebContext::dispatchMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder) { return m_messageReceiverMap.dispatchMessage(connection, messageID, decoder); diff --git a/Source/WebKit2/UIProcess/WebContext.h b/Source/WebKit2/UIProcess/WebContext.h index 93dc68e70..7a55023f0 100644 --- a/Source/WebKit2/UIProcess/WebContext.h +++ b/Source/WebKit2/UIProcess/WebContext.h @@ -87,6 +87,9 @@ public: static const Vector<WebContext*>& allContexts(); void addMessageReceiver(CoreIPC::StringReference messageReceiverName, CoreIPC::MessageReceiver*); + void addMessageReceiver(CoreIPC::StringReference messageReceiverName, uint64_t destinationID, CoreIPC::MessageReceiver*); + void removeMessageReceiver(CoreIPC::StringReference messageReceiverName, uint64_t destinationID); + bool dispatchMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); bool dispatchSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&, OwnPtr<CoreIPC::MessageEncoder>&); @@ -245,6 +248,10 @@ public: void setUsesNetworkProcess(bool); +#if PLATFORM(MAC) + static bool applicationIsOccluded() { return s_applicationIsOccluded; } +#endif + private: WebContext(ProcessModel, const String& injectedBundlePath); @@ -299,6 +306,13 @@ private: String cookieStorageDirectory() const; String platformDefaultCookieStorageDirectory() const; +#if PLATFORM(MAC) + static void applicationBecameVisible(uint32_t, void*, uint32_t, void*, uint32_t); + static void applicationBecameOccluded(uint32_t, void*, uint32_t, void*, uint32_t); + static void initializeProcessSuppressionSupport(); + static void registerOcclusionNotificationHandlers(); +#endif + ProcessModel m_processModel; Vector<RefPtr<WebProcessProxy> > m_processes; @@ -393,6 +407,10 @@ private: HashMap<uint64_t, RefPtr<DictionaryCallback> > m_dictionaryCallbacks; CoreIPC::MessageReceiverMap m_messageReceiverMap; + +#if PLATFORM(MAC) + static bool s_applicationIsOccluded; +#endif }; template<typename U> inline void WebContext::sendToAllProcesses(const U& message) diff --git a/Source/WebKit2/UIProcess/WebContextUserMessageCoders.h b/Source/WebKit2/UIProcess/WebContextUserMessageCoders.h index ffe322811..761c4a49c 100644 --- a/Source/WebKit2/UIProcess/WebContextUserMessageCoders.h +++ b/Source/WebKit2/UIProcess/WebContextUserMessageCoders.h @@ -46,7 +46,7 @@ public: { } - void encode(CoreIPC::ArgumentEncoder* encoder) const + void encode(CoreIPC::ArgumentEncoder& encoder) const { APIObject::Type type = APIObject::TypeNull; if (baseEncode(encoder, type)) @@ -55,17 +55,17 @@ public: switch (type) { case APIObject::TypePage: { WebPageProxy* page = static_cast<WebPageProxy*>(m_root); - encoder->encode(page->pageID()); + encoder << page->pageID(); break; } case APIObject::TypeFrame: { WebFrameProxy* frame = static_cast<WebFrameProxy*>(m_root); - encoder->encode(frame->frameID()); + encoder << frame->frameID(); break; } case APIObject::TypePageGroup: { WebPageGroup* pageGroup = static_cast<WebPageGroup*>(m_root); - encoder->encode(pageGroup->data()); + encoder << pageGroup->data(); break; } default: diff --git a/Source/WebKit2/UIProcess/WebIconDatabase.cpp b/Source/WebKit2/UIProcess/WebIconDatabase.cpp index 40158f4a0..655921084 100644 --- a/Source/WebKit2/UIProcess/WebIconDatabase.cpp +++ b/Source/WebKit2/UIProcess/WebIconDatabase.cpp @@ -60,6 +60,7 @@ WebIconDatabase::WebIconDatabase(WebContext* context) void WebIconDatabase::invalidate() { + setGlobalIconDatabase(0); } void WebIconDatabase::setDatabasePath(const String& path) diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.cpp b/Source/WebKit2/UIProcess/WebInspectorProxy.cpp index 4ef85f25a..345ceca80 100644 --- a/Source/WebKit2/UIProcess/WebInspectorProxy.cpp +++ b/Source/WebKit2/UIProcess/WebInspectorProxy.cpp @@ -328,8 +328,8 @@ void WebInspectorProxy::createInspectorPage(uint64_t& inspectorPageID, WebPageCr inspectorPage->initializePolicyClient(&policyClient); String url = inspectorPageURL(); - if (m_isAttached) - url.append("?docked=true"); + url.append("?dockSide="); + url.append(m_isAttached ? "bottom" : "undocked"); m_page->process()->assumeReadAccessToBaseURL(inspectorBaseURL()); diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp index 56c7cfea5..24d326853 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.cpp +++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp @@ -1283,7 +1283,7 @@ void WebPageProxy::receivedPolicyDecision(PolicyAction action, WebFrameProxy* fr // Create a download proxy. DownloadProxy* download = m_process->context()->createDownloadProxy(); downloadID = download->downloadID(); -#if PLATFORM(QT) || PLATFORM(EFL) +#if PLATFORM(QT) || PLATFORM(EFL) || PLATFORM(GTK) // Our design does not suppport downloads without a WebPage. handleDownloadRequest(download); #endif @@ -2592,6 +2592,19 @@ void WebPageProxy::unavailablePluginButtonClicked(uint32_t opaquePluginUnavailab pluginUnavailabilityReason = kWKPluginUnavailabilityReasonPluginCrashed; break; + case RenderEmbeddedObject::PluginInactive: { +#if ENABLE(NETSCAPE_PLUGIN_API) + String newMimeType = mimeType; + PluginModuleInfo plugin = m_process->context()->pluginInfoStore().findPlugin(newMimeType, KURL(KURL(), url)); + + if (!plugin.path.isEmpty() && PluginInfoStore::reactivateInactivePlugin(plugin)) { + // The plug-in has been reactivated now; reload the page so it'll be instantiated. + reload(false); + } + return; +#endif + } + case RenderEmbeddedObject::PluginBlockedByContentSecurityPolicy: ASSERT_NOT_REACHED(); } @@ -2675,6 +2688,17 @@ void WebPageProxy::pageDidRequestScroll(const IntPoint& point) { m_pageClient->pageDidRequestScroll(point); } + +void WebPageProxy::pageTransitionViewportReady() +{ + m_pageClient->pageTransitionViewportReady(); +} + +void WebPageProxy::didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect) +{ + m_pageClient->didRenderFrame(contentsSize, coveredRect); +} + #endif void WebPageProxy::didChangeViewportProperties(const ViewportAttributes& attr) @@ -2742,12 +2766,12 @@ void WebPageProxy::setMediaVolume(float volume) m_process->send(Messages::WebPage::SetMediaVolume(volume), m_pageID); } -#if PLATFORM(QT) || PLATFORM(EFL) +#if PLATFORM(QT) || PLATFORM(EFL) || PLATFORM(GTK) void WebPageProxy::handleDownloadRequest(DownloadProxy* download) { m_pageClient->handleDownloadRequest(download); } -#endif // PLATFORM(QT) || PLATFORM(EFL) +#endif // PLATFORM(QT) || PLATFORM(EFL) || PLATFORM(GTK) #if PLATFORM(QT) || PLATFORM(EFL) void WebPageProxy::didChangeContentsSize(const IntSize& size) @@ -2899,7 +2923,7 @@ void WebPageProxy::editorStateChanged(const EditorState& editorState) #if PLATFORM(MAC) m_pageClient->updateTextInputState(couldChangeSecureInputState); -#elif PLATFORM(QT) +#elif PLATFORM(QT) || PLATFORM(EFL) m_pageClient->updateTextInputState(); #endif } diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h index 95528ab7f..b8e34bc90 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.h +++ b/Source/WebKit2/UIProcess/WebPageProxy.h @@ -355,8 +355,10 @@ public: bool maintainsInactiveSelection() const { return m_maintainsInactiveSelection; } void setMaintainsInactiveSelection(bool); -#if PLATFORM(QT) +#if USE(TILED_BACKING_STORE) void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect); +#endif +#if PLATFORM(QT) void registerApplicationScheme(const String& scheme); void resolveApplicationSchemeRequest(QtNetworkRequestData); void sendApplicationSchemeReply(const QQuickNetworkReply*); @@ -414,6 +416,12 @@ public: HWND nativeWindow() const; #endif +#if PLATFORM(EFL) + void handleInputMethodKeydown(bool& handled); + void confirmComposition(const String&); + void setComposition(const String&, Vector<WebCore::CompositionUnderline>&, int); + void cancelComposition(); +#endif #if USE(CAIRO) && !PLATFORM(WIN_CAIRO) PlatformWidget viewWidget(); #endif @@ -653,7 +661,7 @@ public: void didReceiveMessageFromNavigatorQtObject(const String&); #endif -#if PLATFORM(QT) || PLATFORM(EFL) +#if PLATFORM(QT) || PLATFORM(EFL) || PLATFORM(GTK) void handleDownloadRequest(DownloadProxy*); #endif @@ -852,10 +860,9 @@ private: #if USE(TILED_BACKING_STORE) void pageDidRequestScroll(const WebCore::IntPoint&); + void pageTransitionViewportReady(); #endif - #if PLATFORM(QT) - void pageTransitionViewportReady(); void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&); #endif diff --git a/Source/WebKit2/UIProcess/WebPageProxy.messages.in b/Source/WebKit2/UIProcess/WebPageProxy.messages.in index 77ac830f2..197f20d9d 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.messages.in +++ b/Source/WebKit2/UIProcess/WebPageProxy.messages.in @@ -69,11 +69,15 @@ messages -> WebPageProxy { DidBlockInsecurePluginVersion(WTF::String mimeType, WTF::String urlString) SetCanShortCircuitHorizontalWheelEvents(bool canShortCircuitHorizontalWheelEvents) +#if PLATFORM(EFL) + HandleInputMethodKeydown() -> (bool handled) +#endif + #if USE(TILED_BACKING_STORE) PageDidRequestScroll(WebCore::IntPoint point) + PageTransitionViewportReady() #endif #if PLATFORM(QT) - PageTransitionViewportReady() DidFindZoomableArea(WebCore::IntPoint target, WebCore::IntRect area) AuthenticationRequiredRequest(WTF::String hostname, WTF::String realm, WTF::String prefilledUsername) -> (WTF::String username, WTF::String password) CertificateVerificationRequest(WTF::String hostname) -> (bool ignoreErrors) diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.cpp b/Source/WebKit2/UIProcess/WebProcessProxy.cpp index f75616563..39b699ae6 100644 --- a/Source/WebKit2/UIProcess/WebProcessProxy.cpp +++ b/Source/WebKit2/UIProcess/WebProcessProxy.cpp @@ -359,21 +359,20 @@ void WebProcessProxy::getPlugins(CoreIPC::Connection*, uint64_t requestID, bool pluginWorkQueue().dispatch(bind(&WebProcessProxy::handleGetPlugins, this, requestID, refresh)); } -void WebProcessProxy::getPluginPath(const String& mimeType, const String& urlString, String& pluginPath, bool& blocked) +void WebProcessProxy::getPluginPath(const String& mimeType, const String& urlString, String& pluginPath, uint32_t& pluginLoadPolicy) { MESSAGE_CHECK_URL(urlString); String newMimeType = mimeType.lower(); - blocked = false; + pluginLoadPolicy = PluginModuleLoadNormally; PluginModuleInfo plugin = m_context->pluginInfoStore().findPlugin(newMimeType, KURL(KURL(), urlString)); if (!plugin.path) return; - if (m_context->pluginInfoStore().shouldBlockPlugin(plugin)) { - blocked = true; + pluginLoadPolicy = PluginInfoStore::policyForPlugin(plugin); + if (pluginLoadPolicy != PluginModuleLoadNormally) return; - } pluginPath = plugin.path; } @@ -477,9 +476,9 @@ void WebProcessProxy::didClose(CoreIPC::Connection*) pages[i]->processDidCrash(); } -void WebProcessProxy::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID) +void WebProcessProxy::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName) { - WTFLogAlways("Received an invalid message from the web process with message ID %x\n", messageID.toInt()); + WTFLogAlways("Received an invalid message \"%s.%s\" from the web process.\n", messageReceiverName.toString().data(), messageName.toString().data()); // Terminate the WebProcesses. terminate(); @@ -532,6 +531,11 @@ void WebProcessProxy::didFinishLaunching(CoreIPC::Connection::Identifier connect // Tell the context that we finished launching. m_context->processDidFinishLaunching(this); + +#if PLATFORM(MAC) + if (WebContext::applicationIsOccluded()) + connection()->send(Messages::WebProcess::SetApplicationIsOccluded(true), 0); +#endif } WebFrameProxy* WebProcessProxy::webFrame(uint64_t frameID) const diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.h b/Source/WebKit2/UIProcess/WebProcessProxy.h index afa5bd4b2..a0120ef5a 100644 --- a/Source/WebKit2/UIProcess/WebProcessProxy.h +++ b/Source/WebKit2/UIProcess/WebProcessProxy.h @@ -118,9 +118,6 @@ public: static bool fullKeyboardAccessEnabled(); - // FIXME: This variant of send is deprecated. All clients should move to an overload that take a message type. - template<typename E, typename T> bool deprecatedSend(E messageID, uint64_t destinationID, const T& arguments); - private: explicit WebProcessProxy(PassRefPtr<WebContext>); @@ -143,7 +140,7 @@ private: // Plugins #if ENABLE(NETSCAPE_PLUGIN_API) void getPlugins(CoreIPC::Connection*, uint64_t requestID, bool refresh); - void getPluginPath(const String& mimeType, const String& urlString, String& pluginPath, bool& blocked); + void getPluginPath(const String& mimeType, const String& urlString, String& pluginPath, uint32_t& pluginLoadPolicy); void handleGetPlugins(uint64_t requestID, bool refresh); void sendDidGetPlugins(uint64_t requestID, PassOwnPtr<Vector<WebCore::PluginInfo> >); #endif // ENABLE(NETSCAPE_PLUGIN_API) @@ -170,7 +167,7 @@ private: virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&, OwnPtr<CoreIPC::MessageEncoder>&); virtual void didClose(CoreIPC::Connection*); - virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID); + virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName); #if PLATFORM(WIN) virtual Vector<HWND> windowsToReceiveSentMessagesWhileWaitingForSyncReply(); #endif @@ -218,19 +215,12 @@ private: WebBackForwardListItemMap m_backForwardListItemMap; }; -template<typename E, typename T> -bool WebProcessProxy::deprecatedSend(E messageID, uint64_t destinationID, const T& arguments) -{ - OwnPtr<CoreIPC::MessageEncoder> encoder = CoreIPC::MessageEncoder::create(CoreIPC::MessageKindTraits<E>::messageReceiverName(), "", destinationID); - encoder->encode(arguments); - - return sendMessage(CoreIPC::MessageID(messageID), encoder.release(), 0); -} - template<typename T> bool WebProcessProxy::send(const T& message, uint64_t destinationID, unsigned messageSendFlags) { - OwnPtr<CoreIPC::MessageEncoder> encoder = CoreIPC::MessageEncoder::create(T::receiverName(), "", destinationID); + COMPILE_ASSERT(!T::isSync, AsyncMessageExpected); + + OwnPtr<CoreIPC::MessageEncoder> encoder = CoreIPC::MessageEncoder::create(T::receiverName(), T::name(), destinationID); encoder->encode(message); return sendMessage(CoreIPC::MessageID(T::messageID), encoder.release(), messageSendFlags); @@ -239,6 +229,8 @@ bool WebProcessProxy::send(const T& message, uint64_t destinationID, unsigned me template<typename U> bool WebProcessProxy::sendSync(const U& message, const typename U::Reply& reply, uint64_t destinationID, double timeout) { + COMPILE_ASSERT(U::isSync, SyncMessageExpected); + if (!m_connection) return false; diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.messages.in b/Source/WebKit2/UIProcess/WebProcessProxy.messages.in index e72138893..22e2f08ea 100644 --- a/Source/WebKit2/UIProcess/WebProcessProxy.messages.in +++ b/Source/WebKit2/UIProcess/WebProcessProxy.messages.in @@ -36,7 +36,7 @@ messages -> WebProcessProxy { # Plugin messages. #if ENABLE(NETSCAPE_PLUGIN_API) GetPlugins(uint64_t requestID, bool refresh) DispatchOnConnectionQueue - GetPluginPath(WTF::String mimeType, WTF::String urlString) -> (WTF::String pluginPath, bool blocked) + GetPluginPath(WTF::String mimeType, WTF::String urlString) -> (WTF::String pluginPath, uint32_t pluginLoadPolicy) #endif // ENABLE(NETSCAPE_PLUGIN_API) #if ENABLE(PLUGIN_PROCESS) GetPluginProcessConnection(WTF::String pluginPath) -> (CoreIPC::Attachment connectionHandle, bool supportsAsynchronousInitialization) Delayed diff --git a/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp b/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp index 4d98f9f0c..71f48e7f0 100644 --- a/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp +++ b/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp @@ -34,7 +34,7 @@ #include <cairo.h> #if PLATFORM(EFL) -#include "ewk_view_private.h" +#include "EwkViewImpl.h" #endif using namespace WebCore; @@ -71,7 +71,8 @@ void BackingStore::incorporateUpdate(ShareableBitmap* bitmap, const UpdateInfo& #if PLATFORM(EFL) // Update ewk_view with new backingStore image. - ewk_view_image_data_set(m_webPageProxy->viewWidget(), cairo_image_surface_get_data(m_backingStore->cairoSurface()), m_size); + EwkViewImpl* viewImpl = EwkViewImpl::fromEvasObject(m_webPageProxy->viewWidget()); + viewImpl->setImageData(cairo_image_surface_get_data(m_backingStore->cairoSurface()), m_size); #endif } diff --git a/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp b/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp index cdff34469..7c1f240ec 100644 --- a/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp +++ b/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp @@ -94,9 +94,9 @@ CFDictionaryRef WebBackForwardList::createCFDictionaryRepresentation(WebPageProx continue; } - RetainPtr<CFStringRef> url(AdoptCF, m_entries[i]->url().createCFString()); - RetainPtr<CFStringRef> title(AdoptCF, m_entries[i]->title().createCFString()); - RetainPtr<CFStringRef> originalURL(AdoptCF, m_entries[i]->originalURL().createCFString()); + RetainPtr<CFStringRef> url = m_entries[i]->url().createCFString(); + RetainPtr<CFStringRef> title = m_entries[i]->title().createCFString(); + RetainPtr<CFStringRef> originalURL = m_entries[i]->originalURL().createCFString(); // FIXME: This uses the CoreIPC data encoding format, which means that whenever we change the CoreIPC encoding we need to bump the CurrentSessionStateDataVersion // constant in WebPageProxyCF.cpp. The CoreIPC data format is meant to be an implementation detail, and not something that should be written to disk. diff --git a/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp b/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp index 79dd8ced0..fac02c1b4 100644 --- a/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp +++ b/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp @@ -65,7 +65,7 @@ PassRefPtr<WebData> WebPageProxy::sessionStateData(WebPageProxySessionStateFilte if (provisionalURL.isEmpty()) provisionalURL = m_mainFrame->provisionalURL(); if (!provisionalURL.isEmpty()) { - provisionalURLString.adoptCF(provisionalURL.createCFString()); + provisionalURLString = provisionalURL.createCFString(); keys[numValues] = ProvisionalURLKey(); values[numValues] = provisionalURLString.get(); ++numValues; @@ -179,8 +179,7 @@ void WebPageProxy::restoreFromSessionStateData(WebData* webData) static RetainPtr<CFStringRef> autosaveKey(const String& name) { - String key = "com.apple.WebKit.searchField:" + name; - return RetainPtr<CFStringRef>(AdoptCF, key.createCFString()); + return String("com.apple.WebKit.searchField:" + name).createCFString(); } void WebPageProxy::saveRecentSearches(const String& name, const Vector<String>& searchItems) @@ -192,10 +191,8 @@ void WebPageProxy::saveRecentSearches(const String& name, const Vector<String>& if (size_t size = searchItems.size()) { items.adoptCF(CFArrayCreateMutable(0, size, &kCFTypeArrayCallBacks)); - for (size_t i = 0; i < size; ++i) { - RetainPtr<CFStringRef> item(AdoptCF, searchItems[i].createCFString()); - CFArrayAppendValue(items.get(), item.get()); - } + for (size_t i = 0; i < size; ++i) + CFArrayAppendValue(items.get(), searchItems[i].createCFString().get()); } CFPreferencesSetAppValue(autosaveKey(name).get(), items.get(), kCFPreferencesCurrentApplication); diff --git a/Source/WebKit2/UIProcess/API/efl/BatteryProvider.cpp b/Source/WebKit2/UIProcess/efl/BatteryProvider.cpp index 810711597..810711597 100644 --- a/Source/WebKit2/UIProcess/API/efl/BatteryProvider.cpp +++ b/Source/WebKit2/UIProcess/efl/BatteryProvider.cpp diff --git a/Source/WebKit2/UIProcess/API/efl/BatteryProvider.h b/Source/WebKit2/UIProcess/efl/BatteryProvider.h index c54414e68..b829d7ed5 100644 --- a/Source/WebKit2/UIProcess/API/efl/BatteryProvider.h +++ b/Source/WebKit2/UIProcess/efl/BatteryProvider.h @@ -35,6 +35,8 @@ #include <WebKit2/WKBase.h> #include <wtf/PassRefPtr.h> +namespace WebKit { + class BatteryProvider : public RefCounted<BatteryProvider>, public WebCore::BatteryProviderEflClient { public: virtual ~BatteryProvider(); @@ -53,6 +55,8 @@ private: WebCore::BatteryProviderEfl m_provider; }; +} // namespace WebKit + #endif // ENABLE(BATTERY_STATUS) #endif // BatteryProvider_h diff --git a/Source/WebKit2/UIProcess/efl/ContextHistoryClientEfl.cpp b/Source/WebKit2/UIProcess/efl/ContextHistoryClientEfl.cpp new file mode 100644 index 000000000..c008a6395 --- /dev/null +++ b/Source/WebKit2/UIProcess/efl/ContextHistoryClientEfl.cpp @@ -0,0 +1,144 @@ +/* + * 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 "ContextHistoryClientEfl.h" + +#include "DownloadProxy.h" +#include "EwkViewImpl.h" +#include "WKAPICast.h" +#include "WKContext.h" +#include "WKEinaSharedString.h" +#include "WKString.h" +#include "ewk_context_private.h" +#include "ewk_navigation_data.h" +#include "ewk_navigation_data_private.h" +#include "ewk_url_response.h" +#include "ewk_url_response_private.h" + +namespace WebKit { + +static inline const ContextHistoryClientEfl* toContextHistoryClientEfl(const void* clientInfo) +{ + ASSERT(clientInfo); + return static_cast<const ContextHistoryClientEfl*>(clientInfo); +} + +void ContextHistoryClientEfl::didNavigateWithNavigationData(WKContextRef, WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef, const void* clientInfo) +{ + const ContextHistoryClientEfl* historyClient = toContextHistoryClientEfl(clientInfo); + + if (!historyClient->m_navigate) + return; + + RefPtr<Ewk_Navigation_Data> navigationDataEwk = EwkNavigationData::create(navigationData); + historyClient->m_navigate(EwkViewImpl::viewFromPageViewMap(page), navigationDataEwk.get(), historyClient->m_userData); +} + +void ContextHistoryClientEfl::didPerformClientRedirect(WKContextRef, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef, const void* clientInfo) +{ + const ContextHistoryClientEfl* historyClient = toContextHistoryClientEfl(clientInfo); + + if (!historyClient->m_clientRedirect) + return; + + WKEinaSharedString sourceURLString(sourceURL); + WKEinaSharedString destinationURLString(destinationURL); + + historyClient->m_clientRedirect(EwkViewImpl::viewFromPageViewMap(page), sourceURLString, destinationURLString, historyClient->m_userData); +} + +void ContextHistoryClientEfl::didPerformServerRedirect(WKContextRef, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef, const void* clientInfo) +{ + const ContextHistoryClientEfl* historyClient = toContextHistoryClientEfl(clientInfo); + + if (!historyClient->m_serverRedirect) + return; + + WKEinaSharedString sourceURLString(sourceURL); + WKEinaSharedString destinationURLString(destinationURL); + + historyClient->m_serverRedirect(EwkViewImpl::viewFromPageViewMap(page), sourceURLString, destinationURLString, historyClient->m_userData); +} + +void ContextHistoryClientEfl::didUpdateHistoryTitle(WKContextRef, WKPageRef page, WKStringRef title, WKURLRef URL, WKFrameRef, const void* clientInfo) +{ + const ContextHistoryClientEfl* historyClient = toContextHistoryClientEfl(clientInfo); + + if (!historyClient->m_titleUpdated) + return; + + WKEinaSharedString titleString(title); + WKEinaSharedString stringURL(URL); + + historyClient->m_titleUpdated(EwkViewImpl::viewFromPageViewMap(page), titleString, stringURL, historyClient->m_userData); +} + +void ContextHistoryClientEfl::populateVisitedLinks(WKContextRef, const void* clientInfo) +{ + const ContextHistoryClientEfl* historyClient = toContextHistoryClientEfl(clientInfo); + + if (!historyClient->m_populateVisitedLinks) + return; + + historyClient->m_populateVisitedLinks(historyClient->m_userData); +} + +ContextHistoryClientEfl::ContextHistoryClientEfl(WKContextRef context) + : m_userData(0) + , m_navigate(0) + , m_clientRedirect(0) + , m_serverRedirect(0) + , m_titleUpdated(0) + , m_populateVisitedLinks(0) +{ + ASSERT(context); + + WKContextHistoryClient wkHistoryClient; + memset(&wkHistoryClient, 0, sizeof(WKContextHistoryClient)); + + wkHistoryClient.version = kWKContextHistoryClientCurrentVersion; + wkHistoryClient.clientInfo = this; + + wkHistoryClient.didNavigateWithNavigationData = didNavigateWithNavigationData; + wkHistoryClient.didPerformClientRedirect = didPerformClientRedirect; + wkHistoryClient.didPerformServerRedirect = didPerformServerRedirect; + wkHistoryClient.didUpdateHistoryTitle = didUpdateHistoryTitle; + wkHistoryClient.populateVisitedLinks = populateVisitedLinks; + + WKContextSetHistoryClient(context, &wkHistoryClient); +} + +void ContextHistoryClientEfl::setCallbacks(Ewk_History_Navigation_Cb navigate, Ewk_History_Client_Redirection_Cb clientRedirect, Ewk_History_Server_Redirection_Cb serverRedirect, Ewk_History_Title_Update_Cb titleUpdate, Ewk_History_Populate_Visited_Links_Cb populateVisitedLinks, void* data) +{ + m_navigate = navigate; + m_clientRedirect = clientRedirect; + m_serverRedirect = serverRedirect; + m_titleUpdated = titleUpdate; + m_populateVisitedLinks = populateVisitedLinks; + m_userData = data; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/efl/ContextHistoryClientEfl.h b/Source/WebKit2/UIProcess/efl/ContextHistoryClientEfl.h new file mode 100644 index 000000000..32032565a --- /dev/null +++ b/Source/WebKit2/UIProcess/efl/ContextHistoryClientEfl.h @@ -0,0 +1,63 @@ +/* + * 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 ContextHistoryClientEfl_h +#define ContextHistoryClientEfl_h + +#include "ewk_context.h" +#include <WebKit2/WKBase.h> +#include <wtf/PassOwnPtr.h> + +namespace WebKit { + +class ContextHistoryClientEfl { +public: + static PassOwnPtr<ContextHistoryClientEfl> create(WKContextRef context) + { + return adoptPtr(new ContextHistoryClientEfl(context)); + } + + void setCallbacks(Ewk_History_Navigation_Cb, Ewk_History_Client_Redirection_Cb, Ewk_History_Server_Redirection_Cb, Ewk_History_Title_Update_Cb, Ewk_History_Populate_Visited_Links_Cb, void*); + +private: + explicit ContextHistoryClientEfl(WKContextRef); + + static void didNavigateWithNavigationData(WKContextRef, WKPageRef, WKNavigationDataRef, WKFrameRef, const void*); + static void didPerformClientRedirect(WKContextRef, WKPageRef, WKURLRef sourceURL, WKURLRef, WKFrameRef, const void*); + static void didPerformServerRedirect(WKContextRef, WKPageRef, WKURLRef sourceURL, WKURLRef, WKFrameRef, const void*); + static void didUpdateHistoryTitle(WKContextRef, WKPageRef, WKStringRef, WKURLRef, WKFrameRef, const void*); + static void populateVisitedLinks(WKContextRef, const void*); + + void* m_userData; + Ewk_History_Navigation_Cb m_navigate; + Ewk_History_Client_Redirection_Cb m_clientRedirect; + Ewk_History_Server_Redirection_Cb m_serverRedirect; + Ewk_History_Title_Update_Cb m_titleUpdated; + Ewk_History_Populate_Visited_Links_Cb m_populateVisitedLinks; +}; + +} // namespace WebKit + +#endif // ContextHistoryClientEfl_h diff --git a/Source/WebKit2/UIProcess/efl/DownloadManagerEfl.cpp b/Source/WebKit2/UIProcess/efl/DownloadManagerEfl.cpp new file mode 100644 index 000000000..869e44f3a --- /dev/null +++ b/Source/WebKit2/UIProcess/efl/DownloadManagerEfl.cpp @@ -0,0 +1,162 @@ +/* + * 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 "DownloadManagerEfl.h" + +#include "DownloadProxy.h" +#include "EwkViewImpl.h" +#include "WKContext.h" +#include "WKString.h" +#include "ewk_context_private.h" +#include "ewk_error_private.h" +#include "ewk_view.h" + +using namespace EwkViewCallbacks; + +namespace WebKit { + +static inline DownloadManagerEfl* toDownloadManagerEfl(const void* clientInfo) +{ + return static_cast<DownloadManagerEfl*>(const_cast<void*>(clientInfo)); +} + +WKStringRef DownloadManagerEfl::decideDestinationWithSuggestedFilename(WKContextRef, WKDownloadRef wkDownload, WKStringRef filename, bool* /*allowOverwrite*/, const void* clientInfo) +{ + EwkDownloadJob* download = toDownloadManagerEfl(clientInfo)->downloadJob(toImpl(wkDownload)->downloadID()); + ASSERT(download); + + download->setSuggestedFileName(toImpl(filename)->string().utf8().data()); + + // We send the new download signal on the Ewk_View only once we have received the response + // and the suggested file name. + download->viewImpl()->smartCallback<DownloadJobRequested>().call(download); + + // DownloadSoup expects the destination to be a URL. + String destination = ASCIILiteral("file://") + String::fromUTF8(download->destination()); + + return WKStringCreateWithUTF8CString(destination.utf8().data()); +} + +void DownloadManagerEfl::didReceiveResponse(WKContextRef, WKDownloadRef wkDownload, WKURLResponseRef wkResponse, const void* clientInfo) +{ + EwkDownloadJob* download = toDownloadManagerEfl(clientInfo)->downloadJob(toImpl(wkDownload)->downloadID()); + ASSERT(download); + download->setResponse(EwkUrlResponse::create(wkResponse)); +} + +void DownloadManagerEfl::didCreateDestination(WKContextRef, WKDownloadRef wkDownload, WKStringRef /*path*/, const void* clientInfo) +{ + EwkDownloadJob* download = toDownloadManagerEfl(clientInfo)->downloadJob(toImpl(wkDownload)->downloadID()); + ASSERT(download); + + download->setState(EWK_DOWNLOAD_JOB_STATE_DOWNLOADING); +} + +void DownloadManagerEfl::didReceiveData(WKContextRef, WKDownloadRef wkDownload, uint64_t length, const void* clientInfo) +{ + EwkDownloadJob* download = toDownloadManagerEfl(clientInfo)->downloadJob(toImpl(wkDownload)->downloadID()); + ASSERT(download); + download->incrementReceivedData(length); +} + +void DownloadManagerEfl::didFail(WKContextRef, WKDownloadRef wkDownload, WKErrorRef error, const void* clientInfo) +{ + DownloadManagerEfl* downloadManager = toDownloadManagerEfl(clientInfo); + uint64_t downloadId = toImpl(wkDownload)->downloadID(); + EwkDownloadJob* download = downloadManager->downloadJob(downloadId); + ASSERT(download); + + OwnPtr<Ewk_Error> ewkError = Ewk_Error::create(error); + download->setState(EWK_DOWNLOAD_JOB_STATE_FAILED); + Ewk_Download_Job_Error downloadError = { download, ewkError.get() }; + download->viewImpl()->smartCallback<DownloadJobFailed>().call(&downloadError); + downloadManager->unregisterDownloadJob(downloadId); +} + +void DownloadManagerEfl::didCancel(WKContextRef, WKDownloadRef wkDownload, const void* clientInfo) +{ + DownloadManagerEfl* downloadManager = toDownloadManagerEfl(clientInfo); + uint64_t downloadId = toImpl(wkDownload)->downloadID(); + EwkDownloadJob* download = downloadManager->downloadJob(downloadId); + ASSERT(download); + + download->setState(EWK_DOWNLOAD_JOB_STATE_CANCELLED); + download->viewImpl()->smartCallback<DownloadJobCancelled>().call(download); + downloadManager->unregisterDownloadJob(downloadId); +} + +void DownloadManagerEfl::didFinish(WKContextRef, WKDownloadRef wkDownload, const void* clientInfo) +{ + DownloadManagerEfl* downloadManager = toDownloadManagerEfl(clientInfo); + uint64_t downloadId = toImpl(wkDownload)->downloadID(); + EwkDownloadJob* download = downloadManager->downloadJob(downloadId); + ASSERT(download); + + download->setState(EWK_DOWNLOAD_JOB_STATE_FINISHED); + download->viewImpl()->smartCallback<DownloadJobFinished>().call(download); + downloadManager->unregisterDownloadJob(downloadId); +} + +DownloadManagerEfl::DownloadManagerEfl(EwkContext* context) + : m_context(context) +{ + WKContextDownloadClient wkDownloadClient; + memset(&wkDownloadClient, 0, sizeof(WKContextDownloadClient)); + + wkDownloadClient.version = kWKContextDownloadClientCurrentVersion; + wkDownloadClient.clientInfo = this; + wkDownloadClient.didCancel = didCancel; + wkDownloadClient.decideDestinationWithSuggestedFilename = decideDestinationWithSuggestedFilename; + wkDownloadClient.didCreateDestination = didCreateDestination; + wkDownloadClient.didReceiveResponse = didReceiveResponse; + wkDownloadClient.didReceiveData = didReceiveData; + wkDownloadClient.didFail = didFail; + wkDownloadClient.didFinish = didFinish; + + WKContextSetDownloadClient(context->wkContext(), &wkDownloadClient); +} + +void DownloadManagerEfl::registerDownload(DownloadProxy* download, EwkViewImpl* viewImpl) +{ + uint64_t downloadId = download->downloadID(); + if (m_downloadJobs.contains(downloadId)) + return; + + RefPtr<EwkDownloadJob> ewkDownload = EwkDownloadJob::create(download, viewImpl); + m_downloadJobs.add(downloadId, ewkDownload); +} + +EwkDownloadJob* DownloadManagerEfl::downloadJob(uint64_t id) const +{ + return m_downloadJobs.get(id).get(); +} + +void DownloadManagerEfl::unregisterDownloadJob(uint64_t id) +{ + m_downloadJobs.remove(id); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/efl/DownloadManagerEfl.h b/Source/WebKit2/UIProcess/efl/DownloadManagerEfl.h new file mode 100644 index 000000000..dfc627a62 --- /dev/null +++ b/Source/WebKit2/UIProcess/efl/DownloadManagerEfl.h @@ -0,0 +1,68 @@ +/* + * 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 DownloadManagerEfl_h +#define DownloadManagerEfl_h + +#include "ewk_download_job_private.h" +#include <wtf/HashMap.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/RefPtr.h> + +class EwkContext; +class EwkDownloadJob; + +namespace WebKit { + +class DownloadManagerEfl { +public: + static PassOwnPtr<DownloadManagerEfl> create(EwkContext* context) + { + return adoptPtr(new DownloadManagerEfl(context)); + } + + void registerDownload(DownloadProxy*, EwkViewImpl*); + +private: + DownloadManagerEfl(EwkContext*); + + EwkDownloadJob* downloadJob(uint64_t id) const; + void unregisterDownloadJob(uint64_t id); + + static WKStringRef decideDestinationWithSuggestedFilename(WKContextRef, WKDownloadRef, WKStringRef filename, bool* allowOverwrite, const void* clientInfo); + static void didReceiveResponse(WKContextRef, WKDownloadRef, WKURLResponseRef, const void* clientInfo); + static void didCreateDestination(WKContextRef, WKDownloadRef, WKStringRef path, const void* clientInfo); + static void didReceiveData(WKContextRef, WKDownloadRef, uint64_t length, const void* clientInfo); + static void didFail(WKContextRef, WKDownloadRef, WKErrorRef, const void* clientInfo); + static void didCancel(WKContextRef, WKDownloadRef, const void* clientInfo); + static void didFinish(WKContextRef, WKDownloadRef, const void* clientInfo); + + EwkContext* m_context; + HashMap<uint64_t, RefPtr<EwkDownloadJob> > m_downloadJobs; +}; + +} // namespace WebKit + +#endif // DownloadManagerEfl_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_find_client.cpp b/Source/WebKit2/UIProcess/efl/FindClientEfl.cpp index 1edc3cbfd..5b2e88ea2 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_find_client.cpp +++ b/Source/WebKit2/UIProcess/efl/FindClientEfl.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2012 Samsung Electronics. All rights reserved. + * 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 @@ -24,39 +25,47 @@ */ #include "config.h" +#include "FindClientEfl.h" +#include "EwkViewImpl.h" #include "WKPage.h" -#include "ewk_view_find_client_private.h" -#include "ewk_view_private.h" -static inline Evas_Object* toEwkView(const void* clientInfo) -{ - return static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); -} +using namespace EwkViewCallbacks; + +namespace WebKit { -static void didFindString(WKPageRef, WKStringRef, unsigned matchCount, const void* clientInfo) +static inline FindClientEfl* toFindClientEfl(const void* clientInfo) { - ewk_view_text_found(toEwkView(clientInfo), matchCount); + return static_cast<FindClientEfl*>(const_cast<void*>(clientInfo)); } -static void didFailToFindString(WKPageRef, WKStringRef, const void* clientInfo) +void FindClientEfl::didFindString(WKPageRef, WKStringRef, unsigned matchCount, const void* clientInfo) { - ewk_view_text_found(toEwkView(clientInfo), 0); + FindClientEfl* findClient = toFindClientEfl(clientInfo); + findClient->m_viewImpl->smartCallback<TextFound>().call(&matchCount); } -static void didCountStringMatches(WKPageRef, WKStringRef, unsigned matchCount, const void* clientInfo) +void FindClientEfl::didFailToFindString(WKPageRef, WKStringRef, const void* clientInfo) { - ewk_view_text_found(toEwkView(clientInfo), matchCount); + FindClientEfl* findClient = toFindClientEfl(clientInfo); + unsigned matchCount = 0; + findClient->m_viewImpl->smartCallback<TextFound>().call(&matchCount); } -void ewk_view_find_client_attach(WKPageRef pageRef, Evas_Object* ewkView) +FindClientEfl::FindClientEfl(EwkViewImpl* viewImpl) + : m_viewImpl(viewImpl) { + WKPageRef pageRef = m_viewImpl->wkPage(); + ASSERT(pageRef); + WKPageFindClient findClient; memset(&findClient, 0, sizeof(WKPageFindClient)); findClient.version = kWKPageFindClientCurrentVersion; - findClient.clientInfo = ewkView; + findClient.clientInfo = this; findClient.didFindString = didFindString; findClient.didFailToFindString = didFailToFindString; - findClient.didCountStringMatches = didCountStringMatches; + findClient.didCountStringMatches = didFindString; WKPageSetPageFindClient(pageRef, &findClient); } + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_ui_client_private.h b/Source/WebKit2/UIProcess/efl/FindClientEfl.h index 4c9c492a5..274460b1a 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_ui_client_private.h +++ b/Source/WebKit2/UIProcess/efl/FindClientEfl.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2012 Samsung Electronics. All rights reserved. + * 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 @@ -23,12 +24,32 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ewk_view_ui_client_private_h -#define ewk_view_ui_client_private_h +#ifndef FindClientEfl_h +#define FindClientEfl_h -#include <Evas.h> #include <WebKit2/WKBase.h> +#include <wtf/PassOwnPtr.h> -void ewk_view_ui_client_attach(WKPageRef pageRef, Evas_Object* ewkView); +class EwkViewImpl; -#endif // ewk_view_ui_client_private_h +namespace WebKit { + +class FindClientEfl { +public: + static PassOwnPtr<FindClientEfl> create(EwkViewImpl* viewImpl) + { + return adoptPtr(new FindClientEfl(viewImpl)); + } + +private: + explicit FindClientEfl(EwkViewImpl*); + + static void didFindString(WKPageRef, WKStringRef, unsigned matchCount, const void* clientInfo); + static void didFailToFindString(WKPageRef, WKStringRef, const void* clientInfo); + + EwkViewImpl* m_viewImpl; +}; + +} // namespace WebKit + +#endif // FindClientEfl_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_form_client.cpp b/Source/WebKit2/UIProcess/efl/FormClientEfl.cpp index 7509ed96d..5b893092d 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_form_client.cpp +++ b/Source/WebKit2/UIProcess/efl/FormClientEfl.cpp @@ -24,27 +24,41 @@ */ #include "config.h" +#include "FormClientEfl.h" +#include "EwkViewImpl.h" #include "WKPage.h" -#include "ewk_form_submission_request.h" #include "ewk_form_submission_request_private.h" -#include "ewk_view_form_client_private.h" -#include "ewk_view_private.h" -static void willSubmitForm(WKPageRef, WKFrameRef /*frame*/, WKFrameRef /*sourceFrame*/, WKDictionaryRef values, WKTypeRef /*userData*/, WKFormSubmissionListenerRef listener, const void* clientInfo) +using namespace EwkViewCallbacks; + +namespace WebKit { + +static inline FormClientEfl* toFormClientEfl(const void* clientInfo) { - Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); + return static_cast<FormClientEfl*>(const_cast<void*>(clientInfo)); +} + +void FormClientEfl::willSubmitForm(WKPageRef, WKFrameRef /*frame*/, WKFrameRef /*sourceFrame*/, WKDictionaryRef values, WKTypeRef /*userData*/, WKFormSubmissionListenerRef listener, const void* clientInfo) +{ + FormClientEfl* formClient = toFormClientEfl(clientInfo); RefPtr<Ewk_Form_Submission_Request> request = Ewk_Form_Submission_Request::create(values, listener); - ewk_view_form_submission_request_new(ewkView, request.get()); + formClient->m_viewImpl->smartCallback<NewFormSubmissionRequest>().call(request.get()); } -void ewk_view_form_client_attach(WKPageRef pageRef, Evas_Object* ewkView) +FormClientEfl::FormClientEfl(EwkViewImpl* viewImpl) + : m_viewImpl(viewImpl) { + WKPageRef pageRef = m_viewImpl->wkPage(); + ASSERT(pageRef); + WKPageFormClient formClient; memset(&formClient, 0, sizeof(WKPageFormClient)); formClient.version = kWKPageFormClientCurrentVersion; - formClient.clientInfo = ewkView; + formClient.clientInfo = this; formClient.willSubmitForm = willSubmitForm; WKPageSetPageFormClient(pageRef, &formClient); } + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_history_client_private.h b/Source/WebKit2/UIProcess/efl/FormClientEfl.h index 0b470dcaf..66e060c14 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_context_history_client_private.h +++ b/Source/WebKit2/UIProcess/efl/FormClientEfl.h @@ -23,20 +23,31 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ewk_context_history_client_private_h -#define ewk_context_history_client_private_h - -#include "ewk_context.h" - -struct Ewk_Context_History_Client { - void* user_data; - Ewk_History_Navigation_Cb navigate_func; - Ewk_History_Client_Redirection_Cb client_redirect_func; - Ewk_History_Server_Redirection_Cb server_redirect_func; - Ewk_History_Title_Update_Cb title_update_func; - Ewk_History_Populate_Visited_Links_Cb populate_visited_links_func; +#ifndef FormClientEfl_h +#define FormClientEfl_h + +#include <WebKit2/WKBase.h> +#include <wtf/PassOwnPtr.h> + +class EwkViewImpl; + +namespace WebKit { + +class FormClientEfl { +public: + static PassOwnPtr<FormClientEfl> create(EwkViewImpl* viewImpl) + { + return adoptPtr(new FormClientEfl(viewImpl)); + } + +private: + explicit FormClientEfl(EwkViewImpl*); + + static void willSubmitForm(WKPageRef, WKFrameRef, WKFrameRef, WKDictionaryRef values, WKTypeRef userData, WKFormSubmissionListenerRef, const void* clientInfo); + + EwkViewImpl* m_viewImpl; }; -void ewk_context_history_client_attach(Ewk_Context*); +} // namespace WebKit -#endif // ewk_context_history_client_private_h +#endif // FormClientEfl_h diff --git a/Source/WebKit2/UIProcess/efl/InputMethodContextEfl.cpp b/Source/WebKit2/UIProcess/efl/InputMethodContextEfl.cpp new file mode 100644 index 000000000..531e3bead --- /dev/null +++ b/Source/WebKit2/UIProcess/efl/InputMethodContextEfl.cpp @@ -0,0 +1,132 @@ +/* + * Copyright (C) 2011 Samsung Electronics + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * 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 "InputMethodContextEfl.h" + +#include "EwkViewImpl.h" +#include "WebPageProxy.h" +#include <Ecore_Evas.h> +#include <Ecore_IMF_Evas.h> + +using namespace WebCore; + +namespace WebKit { + +InputMethodContextEfl::InputMethodContextEfl(EwkViewImpl* viewImpl, PassOwnPtr<Ecore_IMF_Context> context) + : m_viewImpl(viewImpl) + , m_context(context) + , m_focused(false) +{ + ASSERT(m_context); + ecore_imf_context_event_callback_add(m_context.get(), ECORE_IMF_CALLBACK_PREEDIT_CHANGED, onIMFPreeditSequenceChanged, this); + ecore_imf_context_event_callback_add(m_context.get(), ECORE_IMF_CALLBACK_COMMIT, onIMFInputSequenceComplete, this); +} + +InputMethodContextEfl::~InputMethodContextEfl() +{ +} + +void InputMethodContextEfl::onIMFInputSequenceComplete(void* data, Ecore_IMF_Context*, void* eventInfo) +{ + InputMethodContextEfl* inputMethodContext = static_cast<InputMethodContextEfl*>(data); + if (!eventInfo || !inputMethodContext->m_focused) + return; + + inputMethodContext->m_viewImpl->page()->confirmComposition(String::fromUTF8(static_cast<char*>(eventInfo))); +} + +void InputMethodContextEfl::onIMFPreeditSequenceChanged(void* data, Ecore_IMF_Context* context, void*) +{ + InputMethodContextEfl* inputMethodContext = static_cast<InputMethodContextEfl*>(data); + + if (!inputMethodContext->m_viewImpl->page()->focusedFrame() || !inputMethodContext->m_focused) + return; + + char* buffer = 0; + ecore_imf_context_preedit_string_get(context, &buffer, 0); + if (!buffer) + return; + + String preeditString = String::fromUTF8(buffer); + free(buffer); + Vector<CompositionUnderline> underlines; + underlines.append(CompositionUnderline(0, preeditString.length(), Color(0, 0, 0), false)); + inputMethodContext->m_viewImpl->page()->setComposition(preeditString, underlines, 0); +} + +PassOwnPtr<Ecore_IMF_Context> InputMethodContextEfl::createIMFContext(Evas* canvas) +{ + const char* defaultContextID = ecore_imf_context_default_id_get(); + if (!defaultContextID) + return nullptr; + + OwnPtr<Ecore_IMF_Context> imfContext = adoptPtr(ecore_imf_context_add(defaultContextID)); + if (!imfContext) + return nullptr; + + Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(canvas); + ecore_imf_context_client_window_set(imfContext.get(), reinterpret_cast<void*>(ecore_evas_window_get(ecoreEvas))); + ecore_imf_context_client_canvas_set(imfContext.get(), canvas); + + return imfContext.release(); +} + +void InputMethodContextEfl::handleMouseUpEvent(const Evas_Event_Mouse_Up*) +{ + ecore_imf_context_reset(m_context.get()); +} + +void InputMethodContextEfl::handleKeyDownEvent(const Evas_Event_Key_Down* downEvent, bool* isFiltered) +{ + Ecore_IMF_Event inputMethodEvent; + ecore_imf_evas_event_key_down_wrap(const_cast<Evas_Event_Key_Down*>(downEvent), &inputMethodEvent.key_down); + + *isFiltered = ecore_imf_context_filter_event(m_context.get(), ECORE_IMF_EVENT_KEY_DOWN, &inputMethodEvent); +} + +void InputMethodContextEfl::updateTextInputState() +{ + if (!m_context) + return; + + const EditorState& editor = m_viewImpl->page()->editorState(); + + if (editor.isContentEditable) { + if (m_focused) + return; + + ecore_imf_context_reset(m_context.get()); + ecore_imf_context_focus_in(m_context.get()); + m_focused = true; + } else { + if (!m_focused) + return; + + if (editor.hasComposition) + m_viewImpl->page()->cancelComposition(); + + m_focused = false; + ecore_imf_context_reset(m_context.get()); + ecore_imf_context_focus_out(m_context.get()); + } +} + +} diff --git a/Source/WebKit2/UIProcess/efl/InputMethodContextEfl.h b/Source/WebKit2/UIProcess/efl/InputMethodContextEfl.h new file mode 100644 index 000000000..aaf51b936 --- /dev/null +++ b/Source/WebKit2/UIProcess/efl/InputMethodContextEfl.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2011 Samsung Electronics + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * 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 InputMethodContextEfl_h +#define InputMethodContextEfl_h + +#include <Ecore_IMF.h> +#include <Evas.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> + +class EwkViewImpl; + +namespace WebKit { + +class WebPageProxy; + +class InputMethodContextEfl { +public: + static PassOwnPtr<InputMethodContextEfl> create(EwkViewImpl* viewImpl, Evas* canvas) + { + OwnPtr<Ecore_IMF_Context> context = createIMFContext(canvas); + if (!context) + return nullptr; + + return adoptPtr(new InputMethodContextEfl(viewImpl, context.release())); + } + ~InputMethodContextEfl(); + + void handleMouseUpEvent(const Evas_Event_Mouse_Up* upEvent); + void handleKeyDownEvent(const Evas_Event_Key_Down* downEvent, bool* isFiltered); + void updateTextInputState(); + +private: + InputMethodContextEfl(EwkViewImpl*, PassOwnPtr<Ecore_IMF_Context>); + + static PassOwnPtr<Ecore_IMF_Context> createIMFContext(Evas* canvas); + static void onIMFInputSequenceComplete(void* data, Ecore_IMF_Context*, void* eventInfo); + static void onIMFPreeditSequenceChanged(void* data, Ecore_IMF_Context*, void* eventInfo); + + EwkViewImpl* m_viewImpl; + OwnPtr<Ecore_IMF_Context> m_context; + bool m_focused; +}; + +} // namespace WebKit + +#endif // InputMethodContextEfl_h diff --git a/Source/WebKit2/UIProcess/API/efl/NetworkInfoProvider.cpp b/Source/WebKit2/UIProcess/efl/NetworkInfoProvider.cpp index 1431c83a7..f5456f9b8 100644 --- a/Source/WebKit2/UIProcess/API/efl/NetworkInfoProvider.cpp +++ b/Source/WebKit2/UIProcess/efl/NetworkInfoProvider.cpp @@ -32,6 +32,8 @@ #include "WKNetworkInfoManager.h" #include <NotImplemented.h> +using namespace WebKit; + static inline NetworkInfoProvider* toNetworkInfoProvider(const void* clientInfo) { return static_cast<NetworkInfoProvider*>(const_cast<void*>(clientInfo)); diff --git a/Source/WebKit2/UIProcess/API/efl/NetworkInfoProvider.h b/Source/WebKit2/UIProcess/efl/NetworkInfoProvider.h index 0a5d60e4f..57631193f 100644 --- a/Source/WebKit2/UIProcess/API/efl/NetworkInfoProvider.h +++ b/Source/WebKit2/UIProcess/efl/NetworkInfoProvider.h @@ -34,6 +34,8 @@ #include <WebKit2/WKRetainPtr.h> #include <wtf/PassRefPtr.h> +namespace WebKit { + class NetworkInfoProvider : public RefCounted<NetworkInfoProvider>, public WebCore::NetworkInfoClient { public: virtual ~NetworkInfoProvider(); @@ -53,6 +55,8 @@ private: WebCore::NetworkInfoProviderEfl m_provider; }; +} // namespace WebKit + #endif // ENABLE(NETWORK_INFO) #endif // NetworkInfoProvider_h diff --git a/Source/WebKit2/UIProcess/efl/PageClientBase.cpp b/Source/WebKit2/UIProcess/efl/PageClientBase.cpp new file mode 100644 index 000000000..b597d29e0 --- /dev/null +++ b/Source/WebKit2/UIProcess/efl/PageClientBase.cpp @@ -0,0 +1,316 @@ +/* + * Copyright (C) 2011 Samsung Electronics + * + * 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 "PageClientBase.h" + +#include "DrawingAreaProxyImpl.h" +#include "EwkViewImpl.h" +#include "InputMethodContextEfl.h" +#include "NativeWebKeyboardEvent.h" +#include "NotImplemented.h" +#include "WebContext.h" +#include "WebContextMenuProxy.h" +#include "WebPageGroup.h" +#include "WebPageProxy.h" +#include "WebPopupMenuProxyEfl.h" +#include "WebPreferences.h" +#include "ewk_context.h" +#include "ewk_context_private.h" +#include "ewk_download_job.h" +#include "ewk_download_job_private.h" +#include "ewk_private.h" +#include "ewk_view.h" + +using namespace WebCore; +using namespace EwkViewCallbacks; + +namespace WebKit { + +PageClientBase::PageClientBase(EwkViewImpl* viewImpl) + : m_viewImpl(viewImpl) +{ +} + +PageClientBase::~PageClientBase() +{ +} + +EwkViewImpl* PageClientBase::viewImpl() const +{ + return m_viewImpl; +} + +// PageClient +PassOwnPtr<DrawingAreaProxy> PageClientBase::createDrawingAreaProxy() +{ + return DrawingAreaProxyImpl::create(m_viewImpl->page()); +} + +void PageClientBase::setViewNeedsDisplay(const WebCore::IntRect& rect) +{ + m_viewImpl->update(rect); +} + +void PageClientBase::displayView() +{ + notImplemented(); +} + +void PageClientBase::scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize&) +{ + setViewNeedsDisplay(scrollRect); +} + +WebCore::IntSize PageClientBase::viewSize() +{ + return m_viewImpl->size(); +} + +bool PageClientBase::isViewWindowActive() +{ + notImplemented(); + return true; +} + +bool PageClientBase::isViewFocused() +{ + return m_viewImpl->isFocused(); +} + +bool PageClientBase::isViewVisible() +{ + return m_viewImpl->isVisible(); +} + +bool PageClientBase::isViewInWindow() +{ + notImplemented(); + return true; +} + +void PageClientBase::processDidCrash() +{ + // Check if loading was ongoing, when web process crashed. + double loadProgress = ewk_view_load_progress_get(m_viewImpl->view()); + if (loadProgress >= 0 && loadProgress < 1) { + loadProgress = 1; + m_viewImpl->smartCallback<LoadProgress>().call(&loadProgress); + } + + bool handled = false; + m_viewImpl->smartCallback<WebProcessCrashed>().call(&handled); + + if (!handled) { + CString url = m_viewImpl->page()->urlAtProcessExit().utf8(); + WARN("WARNING: The web process experienced a crash on '%s'.\n", url.data()); + + // Display an error page + ewk_view_html_string_load(m_viewImpl->view(), "The web process has crashed.", 0, url.data()); + } +} + +void PageClientBase::didRelaunchProcess() +{ + const char* themePath = m_viewImpl->themePath(); + if (themePath) + m_viewImpl->page()->setThemePath(themePath); +} + +void PageClientBase::pageClosed() +{ + notImplemented(); +} + +void PageClientBase::toolTipChanged(const String&, const String& newToolTip) +{ + if (newToolTip.isEmpty()) + m_viewImpl->smartCallback<TooltipTextUnset>().call(); + else + m_viewImpl->smartCallback<TooltipTextSet>().call(newToolTip); +} + +void PageClientBase::setCursor(const Cursor& cursor) +{ + m_viewImpl->setCursor(cursor); +} + +void PageClientBase::setCursorHiddenUntilMouseMoves(bool) +{ + notImplemented(); +} + +void PageClientBase::registerEditCommand(PassRefPtr<WebEditCommandProxy> command, WebPageProxy::UndoOrRedo undoOrRedo) +{ + m_undoController.registerEditCommand(command, undoOrRedo); +} + +void PageClientBase::clearAllEditCommands() +{ + m_undoController.clearAllEditCommands(); +} + +bool PageClientBase::canUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo) +{ + return m_undoController.canUndoRedo(undoOrRedo); +} + +void PageClientBase::executeUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo) +{ + m_undoController.executeUndoRedo(undoOrRedo); +} + +FloatRect PageClientBase::convertToDeviceSpace(const FloatRect& viewRect) +{ + notImplemented(); + return viewRect; +} + +FloatRect PageClientBase::convertToUserSpace(const FloatRect& viewRect) +{ + notImplemented(); + return viewRect; +} + +IntPoint PageClientBase::screenToWindow(const IntPoint& point) +{ + notImplemented(); + return point; +} + +IntRect PageClientBase::windowToScreen(const IntRect&) +{ + notImplemented(); + return IntRect(); +} + +void PageClientBase::doneWithKeyEvent(const NativeWebKeyboardEvent&, bool) +{ + notImplemented(); +} + +#if ENABLE(TOUCH_EVENTS) +void PageClientBase::doneWithTouchEvent(const NativeWebTouchEvent&, bool /*wasEventHandled*/) +{ + notImplemented(); +} +#endif + +PassRefPtr<WebPopupMenuProxy> PageClientBase::createPopupMenuProxy(WebPageProxy* page) +{ + return WebPopupMenuProxyEfl::create(m_viewImpl, page); +} + +PassRefPtr<WebContextMenuProxy> PageClientBase::createContextMenuProxy(WebPageProxy*) +{ + notImplemented(); + return 0; +} + +#if ENABLE(INPUT_TYPE_COLOR) +PassRefPtr<WebColorChooserProxy> PageClientBase::createColorChooserProxy(WebPageProxy*, const WebCore::Color&, const WebCore::IntRect&) +{ + notImplemented(); + return 0; +} +#endif + +void PageClientBase::setFindIndicator(PassRefPtr<FindIndicator>, bool, bool) +{ + notImplemented(); +} + +#if USE(ACCELERATED_COMPOSITING) +void PageClientBase::enterAcceleratedCompositingMode(const LayerTreeContext&) +{ + m_viewImpl->enterAcceleratedCompositingMode(); +} + +void PageClientBase::exitAcceleratedCompositingMode() +{ + m_viewImpl->exitAcceleratedCompositingMode(); +} + +void PageClientBase::updateAcceleratedCompositingMode(const LayerTreeContext&) +{ + notImplemented(); +} +#endif // USE(ACCELERATED_COMPOSITING) + +void PageClientBase::didChangeScrollbarsForMainFrame() const +{ + notImplemented(); +} + +void PageClientBase::didCommitLoadForMainFrame(bool) +{ + notImplemented(); +} + +void PageClientBase::didFinishLoadingDataForCustomRepresentation(const String&, const CoreIPC::DataReference&) +{ + notImplemented(); +} + +double PageClientBase::customRepresentationZoomFactor() +{ + notImplemented(); + return 0; +} + +void PageClientBase::setCustomRepresentationZoomFactor(double) +{ + notImplemented(); +} + +void PageClientBase::flashBackingStoreUpdates(const Vector<IntRect>&) +{ + notImplemented(); +} + +void PageClientBase::findStringInCustomRepresentation(const String&, FindOptions, unsigned) +{ + notImplemented(); +} + +void PageClientBase::countStringMatchesInCustomRepresentation(const String&, FindOptions, unsigned) +{ + notImplemented(); +} + +void PageClientBase::updateTextInputState() +{ + InputMethodContextEfl* inputMethodContext = m_viewImpl->inputMethodContext(); + if (inputMethodContext) + inputMethodContext->updateTextInputState(); +} + +void PageClientBase::handleDownloadRequest(DownloadProxy* download) +{ + EwkContext* context = m_viewImpl->ewkContext(); + context->downloadManager()->registerDownload(download, m_viewImpl); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h b/Source/WebKit2/UIProcess/efl/PageClientBase.h index 8f03b09f4..6ea7405e8 100644 --- a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h +++ b/Source/WebKit2/UIProcess/efl/PageClientBase.h @@ -23,28 +23,30 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef PageClientImpl_h -#define PageClientImpl_h +#ifndef PageClientBase_h +#define PageClientBase_h #include "DefaultUndoController.h" #include "PageClient.h" #include <Evas.h> +class EwkViewImpl; + namespace WebKit { -class PageClientImpl : public PageClient { +class PageClientBase : public PageClient { public: - static PassOwnPtr<PageClientImpl> create(Evas_Object* viewWidget) - { - return adoptPtr(new PageClientImpl(viewWidget)); - } - ~PageClientImpl(); + virtual ~PageClientBase(); - Evas_Object* viewWidget() const { return m_viewWidget; } + // Called from the view + virtual void didCommitLoad() = 0; + virtual void updateViewportSize(const WebCore::IntSize&) = 0; + virtual void didChangeContentsSize(const WebCore::IntSize&) = 0; + EwkViewImpl* viewImpl() const; -private: - explicit PageClientImpl(Evas_Object*); +protected: + explicit PageClientBase(EwkViewImpl*); // PageClient virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy(); @@ -65,7 +67,7 @@ private: virtual void setCursor(const WebCore::Cursor&); virtual void setCursorHiddenUntilMouseMoves(bool); - virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&); + virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&) = 0; virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo); virtual void clearAllEditCommands(); @@ -76,6 +78,7 @@ private: virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&); virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&); + void updateTextInputState(); virtual void handleDownloadRequest(DownloadProxy*); virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool); @@ -109,16 +112,16 @@ private: virtual void countStringMatchesInCustomRepresentation(const String&, FindOptions, unsigned); #if USE(TILED_BACKING_STORE) - virtual void pageDidRequestScroll(const WebCore::IntPoint&); + virtual void pageDidRequestScroll(const WebCore::IntPoint&) = 0; + virtual void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect) = 0; + virtual void pageTransitionViewportReady() = 0; #endif - virtual void didChangeContentsSize(const WebCore::IntSize&); - -private: - Evas_Object* m_viewWidget; +protected: + EwkViewImpl* m_viewImpl; DefaultUndoController m_undoController; }; } // namespace WebKit -#endif // PageClientImpl_h +#endif // PageClientBase_h diff --git a/Source/WebKit2/UIProcess/efl/PageClientDefaultImpl.cpp b/Source/WebKit2/UIProcess/efl/PageClientDefaultImpl.cpp new file mode 100644 index 000000000..7a470ff84 --- /dev/null +++ b/Source/WebKit2/UIProcess/efl/PageClientDefaultImpl.cpp @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2011 Samsung Electronics + * 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 "PageClientDefaultImpl.h" + +#include "EwkViewImpl.h" + +#if USE(TILED_BACKING_STORE) +#include "PageViewportController.h" +#include "PageViewportControllerClientEfl.h" +#endif + +using namespace WebCore; +using namespace EwkViewCallbacks; + +namespace WebKit { + +PageClientDefaultImpl::PageClientDefaultImpl(EwkViewImpl* viewImpl) + : PageClientBase(viewImpl) +{ +} + +void PageClientDefaultImpl::didCommitLoad() +{ +#if USE(TILED_BACKING_STORE) + ASSERT(m_pageViewportController); + m_pageViewportController->didCommitLoad(); +#endif +} + +void PageClientDefaultImpl::updateViewportSize(const WebCore::IntSize& size) +{ +#if USE(TILED_BACKING_STORE) + if (!m_pageViewportControllerClient) { + m_pageViewportControllerClient = PageViewportControllerClientEfl::create(m_viewImpl); + m_pageViewportController = adoptPtr(new PageViewportController(m_viewImpl->page(), m_pageViewportControllerClient.get())); + } + m_pageViewportControllerClient->updateViewportSize(size); +#else + UNUSED_PARAM(size); +#endif +} + +void PageClientDefaultImpl::didChangeViewportProperties(const WebCore::ViewportAttributes& attr) +{ +#if USE(TILED_BACKING_STORE) + ASSERT(m_pageViewportController); + m_pageViewportController->didChangeViewportAttributes(attr); +#else + UNUSED_PARAM(attr); +#endif +} + +void PageClientDefaultImpl::didChangeContentsSize(const WebCore::IntSize& size) +{ +#if USE(TILED_BACKING_STORE) + ASSERT(m_pageViewportController); + m_pageViewportController->didChangeContentsSize(size); +#else + m_viewImpl->informContentsSizeChange(size); +#endif +} + +#if USE(TILED_BACKING_STORE) +void PageClientDefaultImpl::pageDidRequestScroll(const IntPoint& position) +{ + ASSERT(m_pageViewportController); + m_pageViewportController->pageDidRequestScroll(position); +} + +void PageClientDefaultImpl::didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect) +{ + ASSERT(m_pageViewportController); + m_pageViewportController->didRenderFrame(contentsSize, coveredRect); +} + +void PageClientDefaultImpl::pageTransitionViewportReady() +{ + ASSERT(m_pageViewportController); + m_pageViewportController->pageTransitionViewportReady(); +} +#endif + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/efl/PageClientDefaultImpl.h b/Source/WebKit2/UIProcess/efl/PageClientDefaultImpl.h new file mode 100644 index 000000000..b69703411 --- /dev/null +++ b/Source/WebKit2/UIProcess/efl/PageClientDefaultImpl.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2011 Samsung Electronics + * 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 PageClientDefaultImpl_h +#define PageClientDefaultImpl_h + +#include "PageClientBase.h" +#include "PageViewportController.h" +#include "PageViewportControllerClientEfl.h" + + +namespace WebKit { + +class PageClientDefaultImpl : public PageClientBase { +public: + static PassOwnPtr<PageClientBase> create(EwkViewImpl* viewImpl) + { + return adoptPtr(new PageClientDefaultImpl(viewImpl)); + } + + virtual ~PageClientDefaultImpl() { } + + virtual void didCommitLoad(); + virtual void updateViewportSize(const WebCore::IntSize&); + +private: + explicit PageClientDefaultImpl(EwkViewImpl*); + + virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&); + virtual void didChangeContentsSize(const WebCore::IntSize&); +#if USE(TILED_BACKING_STORE) + virtual void pageDidRequestScroll(const WebCore::IntPoint&); + virtual void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect); + virtual void pageTransitionViewportReady(); + + OwnPtr<WebKit::PageViewportControllerClientEfl> m_pageViewportControllerClient; + OwnPtr<WebKit::PageViewportController> m_pageViewportController; +#endif +}; + +} // namespace WebKit + +#endif // PageClientDefaultImpl_h diff --git a/Source/WebKit2/UIProcess/efl/PageClientLegacyImpl.cpp b/Source/WebKit2/UIProcess/efl/PageClientLegacyImpl.cpp new file mode 100644 index 000000000..2e0a5b26e --- /dev/null +++ b/Source/WebKit2/UIProcess/efl/PageClientLegacyImpl.cpp @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2011 Samsung Electronics + * 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 "PageClientLegacyImpl.h" + +#include "EwkViewImpl.h" +#include "LayerTreeCoordinatorProxy.h" + +using namespace WebCore; +using namespace EwkViewCallbacks; + +namespace WebKit { + +PageClientLegacyImpl::PageClientLegacyImpl(EwkViewImpl* viewImpl) + : PageClientBase(viewImpl) +{ +} + +void PageClientLegacyImpl::didCommitLoad() +{ + m_viewImpl->update(); +} + +void PageClientLegacyImpl::updateViewportSize(const WebCore::IntSize& size) +{ +#if USE(TILED_BACKING_STORE) + m_viewImpl->page()->drawingArea()->setVisibleContentsRect(IntRect(m_viewImpl->scrollPosition(), size), m_viewImpl->scaleFactor(), FloatPoint()); +#else + UNUSED_PARAM(size); +#endif +} + +void PageClientLegacyImpl::didChangeViewportProperties(const WebCore::ViewportAttributes&) +{ + m_viewImpl->update(); +} + +void PageClientLegacyImpl::didChangeContentsSize(const WebCore::IntSize& size) +{ +#if USE(TILED_BACKING_STORE) + // m_viewImpl->informContentSizeChanged will be called as a result of setContentsSize + m_viewImpl->page()->drawingArea()->layerTreeCoordinatorProxy()->setContentsSize(FloatSize(size.width(), size.height())); + m_viewImpl->update(); +#else + m_viewImpl->informContentsSizeChange(size); +#endif +} + +#if USE(TILED_BACKING_STORE) +void PageClientLegacyImpl::pageDidRequestScroll(const IntPoint& position) +{ + m_viewImpl->setScrollPosition(position); + m_viewImpl->update(); +} + +void PageClientLegacyImpl::didRenderFrame(const WebCore::IntSize&, const WebCore::IntRect&) +{ + m_viewImpl->update(); +} + +void PageClientLegacyImpl::pageTransitionViewportReady() +{ + m_viewImpl->update(); +} +#endif + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/efl/PageClientLegacyImpl.h b/Source/WebKit2/UIProcess/efl/PageClientLegacyImpl.h new file mode 100644 index 000000000..e098aa47c --- /dev/null +++ b/Source/WebKit2/UIProcess/efl/PageClientLegacyImpl.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2011 Samsung Electronics + * 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 PageClientLegacyImpl_h +#define PageClientLegacyImpl_h + +#include "PageClientBase.h" + +namespace WebKit { + +class PageClientLegacyImpl : public PageClientBase { +public: + static PassOwnPtr<PageClientBase> create(EwkViewImpl* viewImpl) + { + return adoptPtr(new PageClientLegacyImpl(viewImpl)); + } + + virtual ~PageClientLegacyImpl() { } + + virtual void didCommitLoad(); + virtual void updateViewportSize(const WebCore::IntSize&); + +private: + explicit PageClientLegacyImpl(EwkViewImpl*); + + virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&); + virtual void didChangeContentsSize(const WebCore::IntSize&); +#if USE(TILED_BACKING_STORE) + virtual void pageDidRequestScroll(const WebCore::IntPoint&); + virtual void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect); + virtual void pageTransitionViewportReady(); +#endif +}; + +} // namespace WebKit + +#endif // PageClientLegacyImpl_h diff --git a/Source/WebKit2/UIProcess/efl/PageLoadClientEfl.cpp b/Source/WebKit2/UIProcess/efl/PageLoadClientEfl.cpp index 2425b157d..f1b49b780 100644 --- a/Source/WebKit2/UIProcess/efl/PageLoadClientEfl.cpp +++ b/Source/WebKit2/UIProcess/efl/PageLoadClientEfl.cpp @@ -26,14 +26,19 @@ #include "config.h" #include "PageLoadClientEfl.h" +#include "EwkViewImpl.h" +#include "WKAPICast.h" #include "WKFrame.h" #include "WKPage.h" +#include "ewk_auth_request_private.h" #include "ewk_back_forward_list_private.h" #include "ewk_error_private.h" #include "ewk_intent_private.h" #include "ewk_intent_service_private.h" #include "ewk_view.h" +using namespace EwkViewCallbacks; + namespace WebKit { static inline PageLoadClientEfl* toPageLoadClientEfl(const void* clientInfo) @@ -46,32 +51,33 @@ void PageLoadClientEfl::didReceiveTitleForFrame(WKPageRef, WKStringRef title, WK if (!WKFrameIsMainFrame(frame)) return; - Evas_Object* ewkView = toPageLoadClientEfl(clientInfo)->view(); - ewk_view_title_changed(ewkView, toImpl(title)->string().utf8().data()); + EwkViewImpl* viewImpl = toPageLoadClientEfl(clientInfo)->viewImpl(); + viewImpl->smartCallback<TitleChange>().call(toImpl(title)->string()); } #if ENABLE(WEB_INTENTS) void PageLoadClientEfl::didReceiveIntentForFrame(WKPageRef, WKFrameRef, WKIntentDataRef intent, WKTypeRef, const void* clientInfo) { - Evas_Object* ewkView = toPageLoadClientEfl(clientInfo)->view(); + EwkViewImpl* viewImpl = toPageLoadClientEfl(clientInfo)->viewImpl(); RefPtr<Ewk_Intent> ewkIntent = Ewk_Intent::create(intent); - ewk_view_intent_request_new(ewkView, ewkIntent.get()); + viewImpl->smartCallback<IntentRequest>().call(ewkIntent.get()); } #endif #if ENABLE(WEB_INTENTS_TAG) void PageLoadClientEfl::registerIntentServiceForFrame(WKPageRef, WKFrameRef, WKIntentServiceInfoRef serviceInfo, WKTypeRef, const void* clientInfo) { - Evas_Object* ewkView = toPageLoadClientEfl(clientInfo)->view(); + EwkViewImpl* viewImpl = toPageLoadClientEfl(clientInfo)->viewImpl(); RefPtr<Ewk_Intent_Service> ewkIntentService = Ewk_Intent_Service::create(serviceInfo); - ewk_view_intent_service_register(ewkView, ewkIntentService.get()); + viewImpl->smartCallback<IntentServiceRegistration>().call(ewkIntentService.get()); } #endif void PageLoadClientEfl::didChangeProgress(WKPageRef page, const void* clientInfo) { - Evas_Object* ewkView = toPageLoadClientEfl(clientInfo)->view(); - ewk_view_load_progress_changed(ewkView, WKPageGetEstimatedProgress(page)); + EwkViewImpl* viewImpl = toPageLoadClientEfl(clientInfo)->viewImpl(); + double progress = WKPageGetEstimatedProgress(page); + viewImpl->smartCallback<LoadProgress>().call(&progress); } void PageLoadClientEfl::didFinishLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef /*userData*/, const void* clientInfo) @@ -79,8 +85,8 @@ void PageLoadClientEfl::didFinishLoadForFrame(WKPageRef, WKFrameRef frame, WKTyp if (!WKFrameIsMainFrame(frame)) return; - Evas_Object* ewkView = toPageLoadClientEfl(clientInfo)->view(); - ewk_view_load_finished(ewkView); + EwkViewImpl* viewImpl = toPageLoadClientEfl(clientInfo)->viewImpl(); + viewImpl->smartCallback<LoadFinished>().call(); } void PageLoadClientEfl::didFailLoadWithErrorForFrame(WKPageRef, WKFrameRef frame, WKErrorRef error, WKTypeRef, const void* clientInfo) @@ -88,10 +94,10 @@ void PageLoadClientEfl::didFailLoadWithErrorForFrame(WKPageRef, WKFrameRef frame if (!WKFrameIsMainFrame(frame)) return; - Evas_Object* ewkView = toPageLoadClientEfl(clientInfo)->view(); + EwkViewImpl* viewImpl = toPageLoadClientEfl(clientInfo)->viewImpl(); OwnPtr<Ewk_Error> ewkError = Ewk_Error::create(error); - ewk_view_load_error(ewkView, ewkError.get()); - ewk_view_load_finished(ewkView); + viewImpl->smartCallback<LoadError>().call(ewkError.get()); + viewImpl->smartCallback<LoadFinished>().call(); } void PageLoadClientEfl::didStartProvisionalLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef /*userData*/, const void* clientInfo) @@ -99,8 +105,9 @@ void PageLoadClientEfl::didStartProvisionalLoadForFrame(WKPageRef, WKFrameRef fr if (!WKFrameIsMainFrame(frame)) return; - Evas_Object* ewkView = toPageLoadClientEfl(clientInfo)->view(); - ewk_view_load_provisional_started(ewkView); + EwkViewImpl* viewImpl = toPageLoadClientEfl(clientInfo)->viewImpl(); + viewImpl->informURLChange(); + viewImpl->smartCallback<ProvisionalLoadStarted>().call(); } void PageLoadClientEfl::didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef /*userData*/, const void* clientInfo) @@ -108,8 +115,9 @@ void PageLoadClientEfl::didReceiveServerRedirectForProvisionalLoadForFrame(WKPag if (!WKFrameIsMainFrame(frame)) return; - Evas_Object* ewkView = toPageLoadClientEfl(clientInfo)->view(); - ewk_view_load_provisional_redirect(ewkView); + EwkViewImpl* viewImpl = toPageLoadClientEfl(clientInfo)->viewImpl(); + viewImpl->informURLChange(); + viewImpl->smartCallback<ProvisionalLoadRedirect>().call(); } void PageLoadClientEfl::didFailProvisionalLoadWithErrorForFrame(WKPageRef, WKFrameRef frame, WKErrorRef error, WKTypeRef, const void* clientInfo) @@ -117,21 +125,32 @@ void PageLoadClientEfl::didFailProvisionalLoadWithErrorForFrame(WKPageRef, WKFra if (!WKFrameIsMainFrame(frame)) return; - Evas_Object* ewkView = toPageLoadClientEfl(clientInfo)->view(); + EwkViewImpl* viewImpl = toPageLoadClientEfl(clientInfo)->viewImpl(); OwnPtr<Ewk_Error> ewkError = Ewk_Error::create(error); - ewk_view_load_provisional_failed(ewkView, ewkError.get()); + viewImpl->smartCallback<ProvisionalLoadFailed>().call(ewkError.get()); } +#if USE(TILED_BACKING_STORE) +void PageLoadClientEfl::didCommitLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef, const void* clientInfo) +{ + if (!WKFrameIsMainFrame(frame)) + return; + + EwkViewImpl* viewImpl = toPageLoadClientEfl(clientInfo)->viewImpl(); + viewImpl->informLoadCommitted(); +} +#endif + void PageLoadClientEfl::didChangeBackForwardList(WKPageRef, WKBackForwardListItemRef addedItem, WKArrayRef removedItems, const void* clientInfo) { - Evas_Object* ewkView = toPageLoadClientEfl(clientInfo)->view(); - ASSERT(ewkView); + EwkViewImpl* viewImpl = toPageLoadClientEfl(clientInfo)->viewImpl(); + ASSERT(viewImpl); - Ewk_Back_Forward_List* list = ewk_view_back_forward_list_get(ewkView); + Ewk_Back_Forward_List* list = ewk_view_back_forward_list_get(viewImpl->view()); ASSERT(list); list->update(addedItem, removedItems); - ewk_view_back_forward_list_changed(ewkView); + viewImpl->smartCallback<BackForwardListChange>().call(); } void PageLoadClientEfl::didSameDocumentNavigationForFrame(WKPageRef, WKFrameRef frame, WKSameDocumentNavigationType, WKTypeRef, const void* clientInfo) @@ -139,14 +158,22 @@ void PageLoadClientEfl::didSameDocumentNavigationForFrame(WKPageRef, WKFrameRef if (!WKFrameIsMainFrame(frame)) return; - Evas_Object* ewkView = toPageLoadClientEfl(clientInfo)->view(); - ewk_view_url_update(ewkView); + EwkViewImpl* viewImpl = toPageLoadClientEfl(clientInfo)->viewImpl(); + viewImpl->informURLChange(); +} + +void PageLoadClientEfl::didReceiveAuthenticationChallengeInFrame(WKPageRef, WKFrameRef, WKAuthenticationChallengeRef authenticationChallenge, const void* clientInfo) +{ + EwkViewImpl* viewImpl = toPageLoadClientEfl(clientInfo)->viewImpl(); + + RefPtr<Ewk_Auth_Request> authenticationRequest = EwkAuthRequest::create(toImpl(authenticationChallenge)); + viewImpl->smartCallback<AuthenticationRequest>().call(authenticationRequest.get()); } -PageLoadClientEfl::PageLoadClientEfl(Evas_Object* view) - : m_view(view) +PageLoadClientEfl::PageLoadClientEfl(EwkViewImpl* viewImpl) + : m_viewImpl(viewImpl) { - WKPageRef pageRef = ewk_view_wkpage_get(m_view); + WKPageRef pageRef = m_viewImpl->wkPage(); ASSERT(pageRef); WKPageLoaderClient loadClient; @@ -168,8 +195,12 @@ PageLoadClientEfl::PageLoadClientEfl(Evas_Object* view) loadClient.didStartProvisionalLoadForFrame = didStartProvisionalLoadForFrame; loadClient.didReceiveServerRedirectForProvisionalLoadForFrame = didReceiveServerRedirectForProvisionalLoadForFrame; loadClient.didFailProvisionalLoadWithErrorForFrame = didFailProvisionalLoadWithErrorForFrame; +#if USE(TILED_BACKING_STORE) + loadClient.didCommitLoadForFrame = didCommitLoadForFrame; +#endif loadClient.didChangeBackForwardList = didChangeBackForwardList; loadClient.didSameDocumentNavigationForFrame = didSameDocumentNavigationForFrame; + loadClient.didReceiveAuthenticationChallengeInFrame = didReceiveAuthenticationChallengeInFrame; WKPageSetPageLoaderClient(pageRef, &loadClient); } diff --git a/Source/WebKit2/UIProcess/efl/PageLoadClientEfl.h b/Source/WebKit2/UIProcess/efl/PageLoadClientEfl.h index 68cc17d6a..cd713a3cd 100644 --- a/Source/WebKit2/UIProcess/efl/PageLoadClientEfl.h +++ b/Source/WebKit2/UIProcess/efl/PageLoadClientEfl.h @@ -26,22 +26,25 @@ #ifndef PageLoadClientEfl_h #define PageLoadClientEfl_h -#include "ewk_view_private.h" +#include "WKPageLoadTypes.h" +#include <WebKit2/WKBase.h> #include <wtf/PassOwnPtr.h> +class EwkViewImpl; + namespace WebKit { class PageLoadClientEfl { public: - static PassOwnPtr<PageLoadClientEfl> create(Evas_Object* view) + static PassOwnPtr<PageLoadClientEfl> create(EwkViewImpl* viewImpl) { - return adoptPtr(new PageLoadClientEfl(view)); + return adoptPtr(new PageLoadClientEfl(viewImpl)); } private: - explicit PageLoadClientEfl(Evas_Object* view); + explicit PageLoadClientEfl(EwkViewImpl*); - inline Evas_Object* view() const { return m_view; } + inline EwkViewImpl* viewImpl() const { return m_viewImpl; } static void didReceiveTitleForFrame(WKPageRef, WKStringRef title, WKFrameRef, WKTypeRef, const void* clientInfo); #if ENABLE(WEB_INTENTS) @@ -56,10 +59,14 @@ private: static void didStartProvisionalLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo); static void didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo); static void didFailProvisionalLoadWithErrorForFrame(WKPageRef, WKFrameRef, WKErrorRef, WKTypeRef userData, const void* clientInfo); +#if USE(TILED_BACKING_STORE) + static void didCommitLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo); +#endif static void didChangeBackForwardList(WKPageRef, WKBackForwardListItemRef addedItem, WKArrayRef removedItems, const void* clientInfo); static void didSameDocumentNavigationForFrame(WKPageRef, WKFrameRef, WKSameDocumentNavigationType, WKTypeRef, const void* clientInfo); + static void didReceiveAuthenticationChallengeInFrame(WKPageRef, WKFrameRef, WKAuthenticationChallengeRef, const void* clientInfo); - Evas_Object* m_view; + EwkViewImpl* m_viewImpl; }; } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_policy_client.cpp b/Source/WebKit2/UIProcess/efl/PagePolicyClientEfl.cpp index bdec9f625..254f29a6e 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_policy_client.cpp +++ b/Source/WebKit2/UIProcess/efl/PagePolicyClientEfl.cpp @@ -24,38 +24,46 @@ */ #include "config.h" +#include "PagePolicyClientEfl.h" +#include "EwkViewImpl.h" #include "WKFrame.h" #include "WKFramePolicyListener.h" +#include "WebFrameProxy.h" #include "ewk_navigation_policy_decision.h" #include "ewk_navigation_policy_decision_private.h" -#include "ewk_view_policy_client_private.h" -#include "ewk_view_private.h" #include <WebCore/HTTPStatusCodes.h> #include <wtf/text/CString.h> -using namespace WebCore; -using namespace WebKit; +using namespace EwkViewCallbacks; -static inline Evas_Object* toEwkView(const void* clientInfo) +namespace WebKit { + +static inline PagePolicyClientEfl* toPagePolicyClientEfl(const void* clientInfo) { - return static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); + return static_cast<PagePolicyClientEfl*>(const_cast<void*>(clientInfo)); } -static void decidePolicyForNavigationAction(WKPageRef, WKFrameRef, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef /*userData*/, const void* clientInfo) +void PagePolicyClientEfl::decidePolicyForNavigationAction(WKPageRef, WKFrameRef, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef /*userData*/, const void* clientInfo) { + PagePolicyClientEfl* policyClient = toPagePolicyClientEfl(clientInfo); + RefPtr<Ewk_Navigation_Policy_Decision> decision = Ewk_Navigation_Policy_Decision::create(navigationType, mouseButton, modifiers, request, 0, listener); - ewk_view_navigation_policy_decision(toEwkView(clientInfo), decision.get()); + policyClient->m_viewImpl->smartCallback<NavigationPolicyDecision>().call(decision.get()); } -static void decidePolicyForNewWindowAction(WKPageRef, WKFrameRef, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKStringRef frameName, WKFramePolicyListenerRef listener, WKTypeRef /*userData*/, const void* clientInfo) +void PagePolicyClientEfl::decidePolicyForNewWindowAction(WKPageRef, WKFrameRef, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKStringRef frameName, WKFramePolicyListenerRef listener, WKTypeRef /*userData*/, const void* clientInfo) { + PagePolicyClientEfl* policyClient = toPagePolicyClientEfl(clientInfo); + RefPtr<Ewk_Navigation_Policy_Decision> decision = Ewk_Navigation_Policy_Decision::create(navigationType, mouseButton, modifiers, request, toImpl(frameName)->string().utf8().data(), listener); - ewk_view_new_window_policy_decision(toEwkView(clientInfo), decision.get()); + policyClient->m_viewImpl->smartCallback<NewWindowPolicyDecision>().call(decision.get()); } -static void decidePolicyForResponseCallback(WKPageRef, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef, WKFramePolicyListenerRef listener, WKTypeRef /*userData*/, const void* /*clientInfo*/) +void PagePolicyClientEfl::decidePolicyForResponseCallback(WKPageRef, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef, WKFramePolicyListenerRef listener, WKTypeRef /*userData*/, const void* /*clientInfo*/) { + using namespace WebCore; + const ResourceResponse resourceResponse = toImpl(response)->resourceResponse(); // Ignore responses with an HTTP status code of 204 (No Content) @@ -94,15 +102,21 @@ static void decidePolicyForResponseCallback(WKPageRef, WKFrameRef frame, WKURLRe WKFramePolicyListenerUse(listener); } -void ewk_view_policy_client_attach(WKPageRef pageRef, Evas_Object* ewkView) +PagePolicyClientEfl::PagePolicyClientEfl(EwkViewImpl* viewImpl) + : m_viewImpl(viewImpl) { + WKPageRef pageRef = m_viewImpl->wkPage(); + ASSERT(pageRef); + WKPagePolicyClient policyClient; memset(&policyClient, 0, sizeof(WKPagePolicyClient)); policyClient.version = kWKPagePolicyClientCurrentVersion; - policyClient.clientInfo = ewkView; + policyClient.clientInfo = this; policyClient.decidePolicyForNavigationAction = decidePolicyForNavigationAction; policyClient.decidePolicyForNewWindowAction = decidePolicyForNewWindowAction; policyClient.decidePolicyForResponse = decidePolicyForResponseCallback; WKPageSetPagePolicyClient(pageRef, &policyClient); } + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/efl/PagePolicyClientEfl.h b/Source/WebKit2/UIProcess/efl/PagePolicyClientEfl.h new file mode 100644 index 000000000..68d9a9ee9 --- /dev/null +++ b/Source/WebKit2/UIProcess/efl/PagePolicyClientEfl.h @@ -0,0 +1,57 @@ +/* + * 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 PagePolicyClientEfl_h +#define PagePolicyClientEfl_h + +#include "WKEvent.h" +#include "WKPageLoadTypes.h" +#include <WebKit2/WKBase.h> +#include <wtf/PassOwnPtr.h> + +class EwkViewImpl; + +namespace WebKit { + +class PagePolicyClientEfl { +public: + static PassOwnPtr<PagePolicyClientEfl> create(EwkViewImpl* viewImpl) + { + return adoptPtr(new PagePolicyClientEfl(viewImpl)); + } + +private: + explicit PagePolicyClientEfl(EwkViewImpl*); + + static void decidePolicyForNavigationAction(WKPageRef, WKFrameRef, WKFrameNavigationType, WKEventModifiers, WKEventMouseButton, WKURLRequestRef, WKFramePolicyListenerRef, WKTypeRef, const void*); + static void decidePolicyForNewWindowAction(WKPageRef, WKFrameRef, WKFrameNavigationType, WKEventModifiers, WKEventMouseButton, WKURLRequestRef, WKStringRef, WKFramePolicyListenerRef, WKTypeRef, const void*); + static void decidePolicyForResponseCallback(WKPageRef, WKFrameRef, WKURLResponseRef, WKURLRequestRef, WKFramePolicyListenerRef, WKTypeRef, const void*); + + EwkViewImpl* m_viewImpl; +}; + +} // namespace WebKit + +#endif // PagePolicyClientEfl_h diff --git a/Source/WebKit2/UIProcess/efl/PageUIClientEfl.cpp b/Source/WebKit2/UIProcess/efl/PageUIClientEfl.cpp new file mode 100644 index 000000000..4110b6b96 --- /dev/null +++ b/Source/WebKit2/UIProcess/efl/PageUIClientEfl.cpp @@ -0,0 +1,168 @@ +/* + * Copyright (C) 2012 Samsung Electronics. All rights reserved. + * 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 "PageUIClientEfl.h" + +#include "EwkViewImpl.h" +#include "WKAPICast.h" +#include "WKEvent.h" +#include "WKString.h" +#include "ewk_file_chooser_request_private.h" +#include <Ecore_Evas.h> +#include <WebCore/Color.h> + +using namespace EwkViewCallbacks; + +namespace WebKit { + +static inline PageUIClientEfl* toPageUIClientEfl(const void* clientInfo) +{ + return static_cast<PageUIClientEfl*>(const_cast<void*>(clientInfo)); +} + +void PageUIClientEfl::closePage(WKPageRef, const void* clientInfo) +{ + toPageUIClientEfl(clientInfo)->m_viewImpl->closePage(); +} + +WKPageRef PageUIClientEfl::createNewPage(WKPageRef, WKURLRequestRef, WKDictionaryRef, WKEventModifiers, WKEventMouseButton, const void* clientInfo) +{ + return toPageUIClientEfl(clientInfo)->m_viewImpl->createNewPage(); +} + +void PageUIClientEfl::runJavaScriptAlert(WKPageRef, WKStringRef alertText, WKFrameRef, const void* clientInfo) +{ + toPageUIClientEfl(clientInfo)->m_viewImpl->requestJSAlertPopup(WKEinaSharedString(alertText)); +} + +bool PageUIClientEfl::runJavaScriptConfirm(WKPageRef, WKStringRef message, WKFrameRef, const void* clientInfo) +{ + return toPageUIClientEfl(clientInfo)->m_viewImpl->requestJSConfirmPopup(WKEinaSharedString(message)); +} + +WKStringRef PageUIClientEfl::runJavaScriptPrompt(WKPageRef, WKStringRef message, WKStringRef defaultValue, WKFrameRef, const void* clientInfo) +{ + WKEinaSharedString value = toPageUIClientEfl(clientInfo)->m_viewImpl->requestJSPromptPopup(WKEinaSharedString(message), WKEinaSharedString(defaultValue)); + return value ? WKStringCreateWithUTF8CString(value) : 0; +} + +#if ENABLE(INPUT_TYPE_COLOR) +void PageUIClientEfl::showColorPicker(WKPageRef, WKStringRef initialColor, WKColorPickerResultListenerRef listener, const void* clientInfo) +{ + PageUIClientEfl* pageUIClient = toPageUIClientEfl(clientInfo); + WebCore::Color color = WebCore::Color(WebKit::toWTFString(initialColor)); + pageUIClient->m_viewImpl->requestColorPicker(listener, color); +} + +void PageUIClientEfl::hideColorPicker(WKPageRef, const void* clientInfo) +{ + PageUIClientEfl* pageUIClient = toPageUIClientEfl(clientInfo); + pageUIClient->m_viewImpl->dismissColorPicker(); +} +#endif + +#if ENABLE(SQL_DATABASE) +unsigned long long PageUIClientEfl::exceededDatabaseQuota(WKPageRef, WKFrameRef, WKSecurityOriginRef, WKStringRef databaseName, WKStringRef displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage, const void* clientInfo) +{ + EwkViewImpl* viewImpl = toPageUIClientEfl(clientInfo)->m_viewImpl; + return viewImpl->informDatabaseQuotaReached(toImpl(databaseName)->string(), toImpl(displayName)->string(), currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage); +} +#endif + +void PageUIClientEfl::focus(WKPageRef, const void* clientInfo) +{ + evas_object_focus_set(toPageUIClientEfl(clientInfo)->m_viewImpl->view(), true); +} + +void PageUIClientEfl::unfocus(WKPageRef, const void* clientInfo) +{ + evas_object_focus_set(toPageUIClientEfl(clientInfo)->m_viewImpl->view(), false); +} + +void PageUIClientEfl::takeFocus(WKPageRef, WKFocusDirection, const void* clientInfo) +{ + // FIXME: this is only a partial implementation. + evas_object_focus_set(toPageUIClientEfl(clientInfo)->m_viewImpl->view(), false); +} + +WKRect PageUIClientEfl::getWindowFrame(WKPageRef, const void* clientInfo) +{ + int x, y, width, height; + + Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_object_evas_get(toPageUIClientEfl(clientInfo)->m_viewImpl->view())); + ecore_evas_request_geometry_get(ee, &x, &y, &width, &height); + + return WKRectMake(x, y, width, height); +} + +void PageUIClientEfl::setWindowFrame(WKPageRef, WKRect frame, const void* clientInfo) +{ + Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_object_evas_get(toPageUIClientEfl(clientInfo)->m_viewImpl->view())); + ecore_evas_move_resize(ee, frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); +} + +void PageUIClientEfl::runOpenPanel(WKPageRef, WKFrameRef, WKOpenPanelParametersRef parameters, WKOpenPanelResultListenerRef listener, const void* clientInfo) +{ + EwkViewImpl* viewImpl = toPageUIClientEfl(clientInfo)->m_viewImpl; + RefPtr<Ewk_File_Chooser_Request> fileChooserRequest = Ewk_File_Chooser_Request::create(toImpl(parameters), toImpl(listener)); + viewImpl->smartCallback<FileChooserRequest>().call(fileChooserRequest.get()); +} + +PageUIClientEfl::PageUIClientEfl(EwkViewImpl* viewImpl) + : m_viewImpl(viewImpl) +{ + WKPageRef pageRef = m_viewImpl->wkPage(); + ASSERT(pageRef); + + WKPageUIClient uiClient; + memset(&uiClient, 0, sizeof(WKPageUIClient)); + uiClient.version = kWKPageUIClientCurrentVersion; + uiClient.clientInfo = this; + uiClient.close = closePage; + uiClient.createNewPage = createNewPage; + uiClient.runJavaScriptAlert = runJavaScriptAlert; + uiClient.runJavaScriptConfirm = runJavaScriptConfirm; + uiClient.runJavaScriptPrompt = runJavaScriptPrompt; + uiClient.takeFocus = takeFocus; + uiClient.focus = focus; + uiClient.unfocus = unfocus; + uiClient.getWindowFrame = getWindowFrame; + uiClient.setWindowFrame = setWindowFrame; + uiClient.runOpenPanel = runOpenPanel; +#if ENABLE(SQL_DATABASE) + uiClient.exceededDatabaseQuota = exceededDatabaseQuota; +#endif + +#if ENABLE(INPUT_TYPE_COLOR) + uiClient.showColorPicker = showColorPicker; + uiClient.hideColorPicker = hideColorPicker; +#endif + + WKPageSetPageUIClient(pageRef, &uiClient); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/efl/PageUIClientEfl.h b/Source/WebKit2/UIProcess/efl/PageUIClientEfl.h new file mode 100644 index 000000000..2f54192a2 --- /dev/null +++ b/Source/WebKit2/UIProcess/efl/PageUIClientEfl.h @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2012 Samsung Electronics. All rights reserved. + * 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 PageUIClientEfl_h +#define PageUIClientEfl_h + +#include "WKPage.h" +#include <WebKit2/WKBase.h> +#include <wtf/PassOwnPtr.h> + +class EwkViewImpl; + +namespace WebKit { + +class PageUIClientEfl { +public: + static PassOwnPtr<PageUIClientEfl> create(EwkViewImpl* viewImpl) + { + return adoptPtr(new PageUIClientEfl(viewImpl)); + } + +private: + explicit PageUIClientEfl(EwkViewImpl*); + + static void closePage(WKPageRef, const void*); + static WKPageRef createNewPage(WKPageRef, WKURLRequestRef, WKDictionaryRef, WKEventModifiers, WKEventMouseButton, const void*); + static void runJavaScriptAlert(WKPageRef, WKStringRef, WKFrameRef, const void*); + static bool runJavaScriptConfirm(WKPageRef, WKStringRef, WKFrameRef, const void*); + static WKStringRef runJavaScriptPrompt(WKPageRef, WKStringRef, WKStringRef, WKFrameRef, const void*); +#if ENABLE(INPUT_TYPE_COLOR) + static void showColorPicker(WKPageRef, WKStringRef initialColor, WKColorPickerResultListenerRef, const void*); + static void hideColorPicker(WKPageRef, const void*); +#endif +#if ENABLE(SQL_DATABASE) + static unsigned long long exceededDatabaseQuota(WKPageRef, WKFrameRef, WKSecurityOriginRef, WKStringRef, WKStringRef, unsigned long long currentQuota, unsigned long long, unsigned long long, unsigned long long, const void*); +#endif + static void focus(WKPageRef, const void*); + static void unfocus(WKPageRef, const void*); + static void takeFocus(WKPageRef, WKFocusDirection, const void*); + static WKRect getWindowFrame(WKPageRef, const void*); + static void setWindowFrame(WKPageRef, WKRect, const void*); + static void runOpenPanel(WKPageRef, WKFrameRef, WKOpenPanelParametersRef, WKOpenPanelResultListenerRef, const void*); + + EwkViewImpl* m_viewImpl; +}; + +} // namespace WebKit + +#endif // PageUIClientEfl_h diff --git a/Source/WebKit2/UIProcess/API/efl/PageViewportControllerClientEfl.cpp b/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.cpp index 99160c4a3..65006c288 100644 --- a/Source/WebKit2/UIProcess/API/efl/PageViewportControllerClientEfl.cpp +++ b/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.cpp @@ -26,10 +26,12 @@ #include "config.h" #include "PageViewportControllerClientEfl.h" -#if USE(COORDINATED_GRAPHICS) +#if USE(TILED_BACKING_STORE) +#include "EwkViewImpl.h" #include "LayerTreeCoordinatorProxy.h" #include "LayerTreeRenderer.h" +#include "PageViewportController.h" #include "TransformationMatrix.h" #include "ewk_view_private.h" @@ -37,11 +39,12 @@ using namespace WebCore; namespace WebKit { -PageViewportControllerClientEfl::PageViewportControllerClientEfl(Evas_Object* viewWidget) - : m_viewWidget(viewWidget) +PageViewportControllerClientEfl::PageViewportControllerClientEfl(EwkViewImpl* viewImpl) + : m_viewImpl(viewImpl) , m_scaleFactor(1) + , m_controller(0) { - ASSERT(m_viewWidget); + ASSERT(m_viewImpl); } PageViewportControllerClientEfl::~PageViewportControllerClientEfl() @@ -50,7 +53,7 @@ PageViewportControllerClientEfl::~PageViewportControllerClientEfl() DrawingAreaProxy* PageViewportControllerClientEfl::drawingArea() const { - return ewk_view_page_get(m_viewWidget)->drawingArea(); + return m_viewImpl->page()->drawingArea(); } void PageViewportControllerClientEfl::setRendererActive(bool active) @@ -58,79 +61,65 @@ void PageViewportControllerClientEfl::setRendererActive(bool active) drawingArea()->layerTreeCoordinatorProxy()->layerTreeRenderer()->setActive(active); } -void PageViewportControllerClientEfl::display(const IntRect& rect, const IntPoint& viewPosition) -{ - WebCore::TransformationMatrix matrix; - matrix.setMatrix(m_scaleFactor, 0, 0, m_scaleFactor, -m_visibleContentRect.x() + viewPosition.x(), -m_visibleContentRect.y() + viewPosition.y()); - - LayerTreeRenderer* renderer = drawingArea()->layerTreeCoordinatorProxy()->layerTreeRenderer(); - renderer->setActive(true); - renderer->syncRemoteContent(); - IntRect clipRect(rect); - clipRect.move(viewPosition.x(), viewPosition.y()); - renderer->paintToCurrentGLContext(matrix, 1, clipRect); -} - void PageViewportControllerClientEfl::updateViewportSize(const IntSize& viewportSize) { m_viewportSize = viewportSize; - ewk_view_page_get(m_viewWidget)->setViewportSize(viewportSize); - setVisibleContentsRect(m_visibleContentRect.location(), m_scaleFactor, FloatPoint()); + + ASSERT(m_controller); + m_controller->didChangeViewportSize(viewportSize); } void PageViewportControllerClientEfl::setVisibleContentsRect(const IntPoint& newScrollPosition, float newScale, const FloatPoint& trajectory) { m_scaleFactor = newScale; - m_visibleContentRect = IntRect(newScrollPosition, m_viewportSize); - - // Move visibleContentRect inside contentsRect when visibleContentRect goes outside contentsRect. - IntSize contentsSize = m_contentsSize; - contentsSize.scale(m_scaleFactor); - if (m_visibleContentRect.x() > contentsSize.width() - m_visibleContentRect.width()) - m_visibleContentRect.setX(contentsSize.width() - m_visibleContentRect.width()); - if (m_visibleContentRect.x() < 0) - m_visibleContentRect.setX(0); - if (m_visibleContentRect.y() > contentsSize.height() - m_visibleContentRect.height()) - m_visibleContentRect.setY(contentsSize.height() - m_visibleContentRect.height()); - if (m_visibleContentRect.y() < 0) - m_visibleContentRect.setY(0); - - FloatRect mapRectToWebContent = m_visibleContentRect; - mapRectToWebContent.scale(1 / m_scaleFactor); - drawingArea()->setVisibleContentsRect(enclosingIntRect(mapRectToWebContent), m_scaleFactor, trajectory); + m_scrollPosition = newScrollPosition; + + ASSERT(m_controller); + m_controller->didChangeContentsVisibility(m_scrollPosition, m_scaleFactor, trajectory); } -void PageViewportControllerClientEfl::didChangeContentsSize(const WebCore::IntSize& size) +void PageViewportControllerClientEfl::didChangeContentsSize(const WebCore::IntSize&) { - m_contentsSize = size; - setVisibleContentsRect(m_visibleContentRect.location(), m_scaleFactor, FloatPoint()); - drawingArea()->layerTreeCoordinatorProxy()->setContentsSize(WebCore::FloatSize(size.width(), size.height())); + m_viewImpl->update(); } -void PageViewportControllerClientEfl::setViewportPosition(const WebCore::FloatPoint& /*contentsPoint*/) +void PageViewportControllerClientEfl::setViewportPosition(const WebCore::FloatPoint& contentsPoint) { + IntPoint position(contentsPoint.x(), contentsPoint.y()); + setVisibleContentsRect(position, m_scaleFactor, FloatPoint()); + m_viewImpl->setScrollPosition(position); } -void PageViewportControllerClientEfl::setContentsScale(float, bool /*treatAsInitialValue*/) +void PageViewportControllerClientEfl::setContentsScale(float newScale, bool treatAsInitialValue) { + if (treatAsInitialValue) { + m_scrollPosition = IntPoint(); + m_viewImpl->setScrollPosition(IntPoint()); + } + m_scaleFactor = newScale; + m_viewImpl->setScaleFactor(newScale); } void PageViewportControllerClientEfl::didResumeContent() { + ASSERT(m_controller); + m_controller->didChangeContentsVisibility(m_scrollPosition, m_scaleFactor); } void PageViewportControllerClientEfl::didChangeVisibleContents() { + m_viewImpl->update(); } void PageViewportControllerClientEfl::didChangeViewportAttributes() { } -void PageViewportControllerClientEfl::setController(PageViewportController* pageViewportController) +void PageViewportControllerClientEfl::setController(PageViewportController* controller) { + m_controller = controller; } } // namespace WebKit -#endif // USE(COORDINATED_GRAPHICS) +#endif // USE(TILED_BACKING_STORE) diff --git a/Source/WebKit2/UIProcess/API/efl/PageViewportControllerClientEfl.h b/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.h index 943452651..ee9d37690 100644 --- a/Source/WebKit2/UIProcess/API/efl/PageViewportControllerClientEfl.h +++ b/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.h @@ -26,26 +26,29 @@ #ifndef PageViewportControllerClientEfl_h #define PageViewportControllerClientEfl_h -#if USE(COORDINATED_GRAPHICS) +#if USE(TILED_BACKING_STORE) -#include "PageClientImpl.h" +#include "PageClientBase.h" #include "PageViewportControllerClient.h" #include <wtf/PassOwnPtr.h> +class EwkViewImpl; + namespace WebKit { class PageViewportControllerClientEfl : public PageViewportControllerClient { public: - static PassOwnPtr<PageViewportControllerClientEfl> create(Evas_Object* viewWidget) + static PassOwnPtr<PageViewportControllerClientEfl> create(EwkViewImpl* viewImpl) { - return adoptPtr(new PageViewportControllerClientEfl(viewWidget)); + return adoptPtr(new PageViewportControllerClientEfl(viewImpl)); } ~PageViewportControllerClientEfl(); DrawingAreaProxy* drawingArea() const; WebCore::IntSize viewSize() { return m_viewportSize; } + float scaleFactor() const { return m_scaleFactor; } + WebCore::IntPoint scrollPosition() { return m_scrollPosition; } - void display(const WebCore::IntRect& rect, const WebCore::IntPoint& viewPosition); void updateViewportSize(const WebCore::IntSize& viewportSize); void setVisibleContentsRect(const WebCore::IntPoint&, float, const WebCore::FloatPoint&); void setRendererActive(bool); @@ -61,13 +64,13 @@ public: virtual void setController(PageViewportController*); private: - explicit PageViewportControllerClientEfl(Evas_Object*); + explicit PageViewportControllerClientEfl(EwkViewImpl*); - Evas_Object* m_viewWidget; - WebCore::IntRect m_visibleContentRect; - WebCore::IntSize m_contentsSize; + EwkViewImpl* m_viewImpl; WebCore::IntSize m_viewportSize; + WebCore::IntPoint m_scrollPosition; float m_scaleFactor; + PageViewportController* m_controller; }; } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/efl/RequestManagerClientEfl.cpp b/Source/WebKit2/UIProcess/efl/RequestManagerClientEfl.cpp new file mode 100644 index 000000000..3fb32c647 --- /dev/null +++ b/Source/WebKit2/UIProcess/efl/RequestManagerClientEfl.cpp @@ -0,0 +1,96 @@ +/* + * 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 "RequestManagerClientEfl.h" + +#include "WKContextSoup.h" +#include "WKSoupRequestManager.h" +#include "WebSoupRequestManagerProxy.h" +#include "ewk_context_private.h" +#include "ewk_url_scheme_request_private.h" + +namespace WebKit { + +struct Ewk_Url_Scheme_Handler { + Ewk_Url_Scheme_Request_Cb callback; + void* userData; + + Ewk_Url_Scheme_Handler() + : callback(0) + , userData(0) + { } + + Ewk_Url_Scheme_Handler(Ewk_Url_Scheme_Request_Cb callback, void* userData) + : callback(callback) + , userData(userData) + { } +}; + +static inline RequestManagerClientEfl* toRequestManagerClientEfl(const void* clientInfo) +{ + return static_cast<RequestManagerClientEfl*>(const_cast<void*>(clientInfo)); +} + +void RequestManagerClientEfl::didReceiveURIRequest(WKSoupRequestManagerRef soupRequestManagerRef, WKURLRef urlRef, WKPageRef, uint64_t requestID, const void* clientInfo) +{ + RequestManagerClientEfl* requestManager = toRequestManagerClientEfl(clientInfo); + + RefPtr<EwkUrlSchemeRequest> schemeRequest = EwkUrlSchemeRequest::create(soupRequestManagerRef, urlRef, requestID); + Ewk_Url_Scheme_Handler handler = requestManager->m_urlSchemeHandlers.get(schemeRequest->scheme()); + if (!handler.callback) + return; + + handler.callback(schemeRequest.get(), handler.userData); +} + +RequestManagerClientEfl::RequestManagerClientEfl(EwkContext* context) + : m_soupRequestManager(WKContextGetSoupRequestManager(context->wkContext())) +{ + ASSERT(context); + + WKSoupRequestManagerClient wkRequestManagerClient; + memset(&wkRequestManagerClient, 0, sizeof(WKSoupRequestManagerClient)); + + wkRequestManagerClient.version = kWKSoupRequestManagerClientCurrentVersion; + wkRequestManagerClient.clientInfo = this; + wkRequestManagerClient.didReceiveURIRequest = didReceiveURIRequest; + + WKSoupRequestManagerSetClient(m_soupRequestManager.get(), &wkRequestManagerClient); +} + +RequestManagerClientEfl::~RequestManagerClientEfl() +{ +} + +void RequestManagerClientEfl::registerURLSchemeHandler(const String& scheme, Ewk_Url_Scheme_Request_Cb callback, void* userData) +{ + ASSERT(callback); + + m_urlSchemeHandlers.set(scheme, Ewk_Url_Scheme_Handler(callback, userData)); + toImpl(m_soupRequestManager.get())->registerURIScheme(scheme); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/efl/RequestManagerClientEfl.h b/Source/WebKit2/UIProcess/efl/RequestManagerClientEfl.h new file mode 100644 index 000000000..71aaedf7c --- /dev/null +++ b/Source/WebKit2/UIProcess/efl/RequestManagerClientEfl.h @@ -0,0 +1,59 @@ +/* + * 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 RequestManagerClientEfl_h +#define RequestManagerClientEfl_h + +#include "WKRetainPtr.h" +#include "ewk_context_private.h" +#include <WebKit2/WKBase.h> +#include <wtf/HashMap.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/text/WTFString.h> + +namespace WebKit { + +class RequestManagerClientEfl { +public: + ~RequestManagerClientEfl(); + static PassOwnPtr<RequestManagerClientEfl> create(EwkContext* context) + { + return adoptPtr(new RequestManagerClientEfl(context)); + } + + void registerURLSchemeHandler(const String& scheme, Ewk_Url_Scheme_Request_Cb callback, void* userData); + +private: + explicit RequestManagerClientEfl(EwkContext*); + + static void didReceiveURIRequest(WKSoupRequestManagerRef, WKURLRef, WKPageRef, uint64_t requestID, const void* clientInfo); + + WKRetainPtr<WKSoupRequestManagerRef> m_soupRequestManager; + HashMap<String, class Ewk_Url_Scheme_Handler> m_urlSchemeHandlers; +}; + +} // namespace WebKit + +#endif // RequestManagerClientEfl_h diff --git a/Source/WebKit2/UIProcess/efl/ResourceLoadClientEfl.cpp b/Source/WebKit2/UIProcess/efl/ResourceLoadClientEfl.cpp index 6539cce36..a5b689813 100644 --- a/Source/WebKit2/UIProcess/efl/ResourceLoadClientEfl.cpp +++ b/Source/WebKit2/UIProcess/efl/ResourceLoadClientEfl.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "ResourceLoadClientEfl.h" +#include "EwkViewImpl.h" #include "WKAPICast.h" #include "WKFrame.h" #include "WKPage.h" @@ -33,8 +34,10 @@ #include "ewk_error_private.h" #include "ewk_url_request_private.h" #include "ewk_url_response_private.h" +#include "ewk_view.h" using namespace WebCore; +using namespace EwkViewCallbacks; namespace WebKit { @@ -54,8 +57,9 @@ void ResourceLoadClientEfl::didInitiateLoadForResource(WKPageRef, WKFrameRef wkF // Keep the resource internally to reuse it later. resourceLoadClient->m_loadingResourcesMap.add(resourceIdentifier, resource); - RefPtr<Ewk_Url_Request> request = Ewk_Url_Request::create(wkRequest); - ewk_view_resource_load_initiated(resourceLoadClient->m_view, resource.get(), request.get()); + RefPtr<Ewk_Url_Request> request = EwkUrlRequest::create(wkRequest); + Ewk_Resource_Request resourceRequest = {resource.get(), request.get(), 0}; + resourceLoadClient->m_viewImpl->smartCallback<ResourceLoadStarted>().call(&resourceRequest); } void ResourceLoadClientEfl::didSendRequestForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, WKURLRequestRef wkRequest, WKURLResponseRef wkRedirectResponse, const void* clientInfo) @@ -67,9 +71,10 @@ void ResourceLoadClientEfl::didSendRequestForResource(WKPageRef, WKFrameRef, uin if (!resource) return; - RefPtr<Ewk_Url_Request> request = Ewk_Url_Request::create(wkRequest); - RefPtr<Ewk_Url_Response> redirectResponse = Ewk_Url_Response::create(wkRedirectResponse); - ewk_view_resource_request_sent(resourceLoadClient->m_view, resource.get(), request.get(), redirectResponse.get()); + RefPtr<Ewk_Url_Request> request = EwkUrlRequest::create(wkRequest); + RefPtr<Ewk_Url_Response> redirectResponse = EwkUrlResponse::create(wkRedirectResponse); + Ewk_Resource_Request resourceRequest = {resource.get(), request.get(), redirectResponse.get()}; + resourceLoadClient->m_viewImpl->smartCallback<ResourceRequestSent>().call(&resourceRequest); } void ResourceLoadClientEfl::didReceiveResponseForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, WKURLResponseRef wkResponse, const void* clientInfo) @@ -81,8 +86,9 @@ void ResourceLoadClientEfl::didReceiveResponseForResource(WKPageRef, WKFrameRef, if (!resource) return; - RefPtr<Ewk_Url_Response> response = Ewk_Url_Response::create(wkResponse); - ewk_view_resource_load_response(resourceLoadClient->m_view, resource.get(), response.get()); + RefPtr<Ewk_Url_Response> response = EwkUrlResponse::create(wkResponse); + Ewk_Resource_Load_Response resourceLoadResponse = {resource.get(), response.get()}; + resourceLoadClient->m_viewImpl->smartCallback<ResourceLoadResponse>().call(&resourceLoadResponse); } void ResourceLoadClientEfl::didFinishLoadForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, const void* clientInfo) @@ -94,7 +100,7 @@ void ResourceLoadClientEfl::didFinishLoadForResource(WKPageRef, WKFrameRef, uint if (!resource) return; - ewk_view_resource_load_finished(resourceLoadClient->m_view, resource.get()); + resourceLoadClient->m_viewImpl->smartCallback<ResourceLoadFinished>().call(resource.get()); } void ResourceLoadClientEfl::didFailLoadForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, WKErrorRef wkError, const void* clientInfo) @@ -107,8 +113,9 @@ void ResourceLoadClientEfl::didFailLoadForResource(WKPageRef, WKFrameRef, uint64 return; OwnPtr<Ewk_Error> ewkError = Ewk_Error::create(wkError); - ewk_view_resource_load_failed(resourceLoadClient->m_view, resource.get(), ewkError.get()); - ewk_view_resource_load_finished(resourceLoadClient->m_view, resource.get()); + Ewk_Resource_Load_Error resourceLoadError = {resource.get(), ewkError.get()}; + resourceLoadClient->m_viewImpl->smartCallback<ResourceLoadFailed>().call(&resourceLoadError); + resourceLoadClient->m_viewImpl->smartCallback<ResourceLoadFinished>().call(resource.get()); } void ResourceLoadClientEfl::onViewProvisionalLoadStarted(void* userData, Evas_Object*, void*) @@ -119,13 +126,13 @@ void ResourceLoadClientEfl::onViewProvisionalLoadStarted(void* userData, Evas_Ob resourceLoadClient->m_loadingResourcesMap.clear(); } -ResourceLoadClientEfl::ResourceLoadClientEfl(Evas_Object* view) - : m_view(view) +ResourceLoadClientEfl::ResourceLoadClientEfl(EwkViewImpl* viewImpl) + : m_viewImpl(viewImpl) { // Listen for "load,provisional,started" on the view to clear internal resources map. - evas_object_smart_callback_add(m_view, "load,provisional,started", onViewProvisionalLoadStarted, this); + evas_object_smart_callback_add(m_viewImpl->view(), CallBackInfo<ProvisionalLoadStarted>::name(), onViewProvisionalLoadStarted, this); - WKPageRef pageRef = ewk_view_wkpage_get(m_view); + WKPageRef pageRef = m_viewImpl->wkPage(); ASSERT(pageRef); WKPageResourceLoadClient wkResourceLoadClient; @@ -143,7 +150,7 @@ ResourceLoadClientEfl::ResourceLoadClientEfl(Evas_Object* view) ResourceLoadClientEfl::~ResourceLoadClientEfl() { - evas_object_smart_callback_del(m_view, "load,provisional,started", onViewProvisionalLoadStarted); + evas_object_smart_callback_del(m_viewImpl->view(), CallBackInfo<ProvisionalLoadStarted>::name(), onViewProvisionalLoadStarted); } } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/efl/ResourceLoadClientEfl.h b/Source/WebKit2/UIProcess/efl/ResourceLoadClientEfl.h index 58f52b4b7..7a5525b6a 100644 --- a/Source/WebKit2/UIProcess/efl/ResourceLoadClientEfl.h +++ b/Source/WebKit2/UIProcess/efl/ResourceLoadClientEfl.h @@ -27,23 +27,24 @@ #define ResourceLoadClientEfl_h #include "ewk_resource_private.h" -#include "ewk_view_private.h" #include <wtf/HashMap.h> #include <wtf/PassOwnPtr.h> +class EwkViewImpl; + namespace WebKit { class ResourceLoadClientEfl { public: ~ResourceLoadClientEfl(); - static PassOwnPtr<ResourceLoadClientEfl> create(Evas_Object* view) + static PassOwnPtr<ResourceLoadClientEfl> create(EwkViewImpl* viewImpl) { - return adoptPtr(new ResourceLoadClientEfl(view)); + return adoptPtr(new ResourceLoadClientEfl(viewImpl)); } private: - explicit ResourceLoadClientEfl(Evas_Object* view); + explicit ResourceLoadClientEfl(EwkViewImpl*); static void didInitiateLoadForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, WKURLRequestRef, bool pageIsProvisionallyLoading, const void* clientInfo); static void didSendRequestForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, WKURLRequestRef, WKURLResponseRef, const void* clientInfo); @@ -53,7 +54,7 @@ private: static void onViewProvisionalLoadStarted(void* userData, Evas_Object* view, void* clientInfo); - Evas_Object* m_view; + EwkViewImpl* m_viewImpl; HashMap< uint64_t, RefPtr<Ewk_Resource> > m_loadingResourcesMap; }; diff --git a/Source/WebKit2/UIProcess/API/efl/VibrationProvider.cpp b/Source/WebKit2/UIProcess/efl/VibrationProvider.cpp index 9d8feb1fe..2de62968c 100644 --- a/Source/WebKit2/UIProcess/API/efl/VibrationProvider.cpp +++ b/Source/WebKit2/UIProcess/efl/VibrationProvider.cpp @@ -34,6 +34,7 @@ #include <Evas.h> using namespace WebCore; +using namespace WebKit; /** * \struct Ewk_Vibration_Client diff --git a/Source/WebKit2/UIProcess/API/efl/VibrationProvider.h b/Source/WebKit2/UIProcess/efl/VibrationProvider.h index fadd58a1b..5810393de 100644 --- a/Source/WebKit2/UIProcess/API/efl/VibrationProvider.h +++ b/Source/WebKit2/UIProcess/efl/VibrationProvider.h @@ -35,6 +35,8 @@ typedef struct Ewk_Vibration_Client Ewk_Vibration_Client; +namespace WebKit { + class VibrationProvider : public RefCounted<VibrationProvider> { public: static PassRefPtr<VibrationProvider> create(WKContextRef); @@ -51,6 +53,8 @@ private: OwnPtr<Ewk_Vibration_Client> m_vibrationClient; }; +} // namespace WebKit + #endif // ENABLE(VIBRATION) #endif // VibrationProvider_h diff --git a/Source/WebKit2/UIProcess/efl/WebContextEfl.cpp b/Source/WebKit2/UIProcess/efl/WebContextEfl.cpp index d53f83560..d43145caf 100644 --- a/Source/WebKit2/UIProcess/efl/WebContextEfl.cpp +++ b/Source/WebKit2/UIProcess/efl/WebContextEfl.cpp @@ -28,6 +28,7 @@ #include <Efreet.h> #include <WebCore/ApplicationCacheStorage.h> +#include <WebCore/IconDatabase.h> #include <WebCore/NotImplemented.h> namespace WebKit { @@ -54,7 +55,7 @@ String WebContext::platformDefaultDatabaseDirectory() const String WebContext::platformDefaultIconDatabasePath() const { - return String::fromUTF8(efreet_data_home_get()) + "/WebKitEfl/IconDatabase"; + return String::fromUTF8(efreet_data_home_get()) + "/WebKitEfl/IconDatabase/" + WebCore::IconDatabase::defaultDatabaseFilename(); } String WebContext::platformDefaultLocalStorageDirectory() const diff --git a/Source/WebKit2/UIProcess/efl/WebFullScreenManagerProxyEfl.cpp b/Source/WebKit2/UIProcess/efl/WebFullScreenManagerProxyEfl.cpp index 254340de5..468cbf884 100644 --- a/Source/WebKit2/UIProcess/efl/WebFullScreenManagerProxyEfl.cpp +++ b/Source/WebKit2/UIProcess/efl/WebFullScreenManagerProxyEfl.cpp @@ -25,10 +25,10 @@ #include "config.h" #include "WebFullScreenManagerProxy.h" -#include "ewk_view_private.h" #if ENABLE(FULLSCREEN_API) +#include "EwkViewImpl.h" #include <WebCore/NotImplemented.h> using namespace WebCore; @@ -57,7 +57,7 @@ void WebFullScreenManagerProxy::enterFullScreen() return; willEnterFullScreen(); - ewk_view_full_screen_enter(m_webView); + EwkViewImpl::fromEvasObject(m_webView)->enterFullScreen(); didEnterFullScreen(); } @@ -66,8 +66,9 @@ void WebFullScreenManagerProxy::exitFullScreen() if (!m_webView) return; + willExitFullScreen(); - ewk_view_full_screen_exit(m_webView); + EwkViewImpl::fromEvasObject(m_webView)->exitFullScreen(); didExitFullScreen(); } diff --git a/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp b/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp index ffd6aa5f9..82f83c86d 100644 --- a/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp +++ b/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp @@ -28,6 +28,7 @@ #if ENABLE(INSPECTOR) +#include "EwkViewImpl.h" #include "WebProcessProxy.h" #include "ewk_settings.h" #include "ewk_view.h" @@ -86,17 +87,23 @@ WebPageProxy* WebInspectorProxy::platformCreateInspectorPage() { ASSERT(m_page); +#if USE(ACCELERATED_COMPOSITING) && defined HAVE_ECORE_X + const char* engine = "opengl_x11"; + m_inspectorWindow = ecore_evas_new(engine, 0, 0, initialWindowWidth, initialWindowHeight, 0); +#else m_inspectorWindow = ecore_evas_new(0, 0, 0, initialWindowWidth, initialWindowHeight, 0); +#endif if (!m_inspectorWindow) return 0; m_inspectorView = ewk_view_base_add(ecore_evas_get(m_inspectorWindow), toAPI(page()->process()->context()), toAPI(inspectorPageGroup())); - ewk_view_theme_set(m_inspectorView, TEST_THEME_DIR"/default.edj"); + EwkViewImpl* inspectorViewImpl = EwkViewImpl::fromEvasObject(m_inspectorView); + inspectorViewImpl->setThemePath(TEST_THEME_DIR "/default.edj"); - Ewk_Settings* settings = ewk_view_settings_get(m_inspectorView); + Ewk_Settings* settings = inspectorViewImpl->settings(); ewk_settings_file_access_from_file_urls_allowed_set(settings, true); - return ewk_view_page_get(m_inspectorView); + return inspectorViewImpl->page(); } void WebInspectorProxy::platformOpen() diff --git a/Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp b/Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp index 8981ceeb1..befa247c2 100644 --- a/Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp +++ b/Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp @@ -26,8 +26,10 @@ #include "config.h" #include "WebPageProxy.h" +#include "EwkViewImpl.h" +#include "NativeWebKeyboardEvent.h" #include "NotImplemented.h" -#include "PageClientImpl.h" +#include "PageClientBase.h" #include "WebKitVersion.h" #include "WebPageMessages.h" #include "WebProcessProxy.h" @@ -38,7 +40,7 @@ namespace WebKit { Evas_Object* WebPageProxy::viewWidget() { - return static_cast<PageClientImpl*>(m_pageClient)->viewWidget(); + return static_cast<PageClientBase*>(m_pageClient)->viewImpl()->view(); } String WebPageProxy::standardUserAgent(const String& /*applicationNameForUserAgent*/) @@ -93,4 +95,33 @@ void WebPageProxy::windowedPluginGeometryDidChange(const WebCore::IntRect&, cons notImplemented(); } +void WebPageProxy::handleInputMethodKeydown(bool& handled) +{ + handled = m_keyEventQueue.first().isFiltered(); +} + +void WebPageProxy::confirmComposition(const String& compositionString) +{ + if (!isValid()) + return; + + process()->send(Messages::WebPage::ConfirmComposition(compositionString), m_pageID, 0); +} + +void WebPageProxy::setComposition(const String& compositionString, Vector<WebCore::CompositionUnderline>& underlines, int cursorPosition) +{ + if (!isValid()) + return; + + process()->send(Messages::WebPage::SetComposition(compositionString, underlines, cursorPosition), m_pageID, 0); +} + +void WebPageProxy::cancelComposition() +{ + if (!isValid()) + return; + + process()->send(Messages::WebPage::CancelComposition(), m_pageID, 0); +} + } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/efl/WebPopupMenuProxyEfl.cpp b/Source/WebKit2/UIProcess/efl/WebPopupMenuProxyEfl.cpp index 03d504ba4..f5b104d9f 100644 --- a/Source/WebKit2/UIProcess/efl/WebPopupMenuProxyEfl.cpp +++ b/Source/WebKit2/UIProcess/efl/WebPopupMenuProxyEfl.cpp @@ -26,30 +26,30 @@ #include "config.h" #include "WebPopupMenuProxyEfl.h" +#include "EwkViewImpl.h" #include "NativeWebMouseEvent.h" #include "WebPopupItem.h" #include "ewk_view.h" -#include "ewk_view_private.h" #include <wtf/text/CString.h> using namespace WebCore; namespace WebKit { -WebPopupMenuProxyEfl::WebPopupMenuProxyEfl(Evas_Object* webView, WebPopupMenuProxy::Client* client) +WebPopupMenuProxyEfl::WebPopupMenuProxyEfl(EwkViewImpl* viewImpl, WebPopupMenuProxy::Client* client) : WebPopupMenuProxy(client) - , m_webView(webView) + , m_viewImpl(viewImpl) { } void WebPopupMenuProxyEfl::showPopupMenu(const IntRect& rect, TextDirection textDirection, double pageScaleFactor, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex) { - ewk_view_popup_menu_request(m_webView, this, rect, textDirection, pageScaleFactor, items, selectedIndex); + m_viewImpl->requestPopupMenu(this, rect, textDirection, pageScaleFactor, items, selectedIndex); } void WebPopupMenuProxyEfl::hidePopupMenu() { - ewk_view_popup_menu_close(m_webView); + m_viewImpl->closePopupMenu(); } void WebPopupMenuProxyEfl::valueChanged(int newSelectedIndex) diff --git a/Source/WebKit2/UIProcess/efl/WebPopupMenuProxyEfl.h b/Source/WebKit2/UIProcess/efl/WebPopupMenuProxyEfl.h index ab4074ab2..e4edb9635 100644 --- a/Source/WebKit2/UIProcess/efl/WebPopupMenuProxyEfl.h +++ b/Source/WebKit2/UIProcess/efl/WebPopupMenuProxyEfl.h @@ -34,15 +34,17 @@ namespace WebCore { class IntRect; } +class EwkViewImpl; + namespace WebKit { class WebPageProxy; class WebPopupMenuProxyEfl : public WebPopupMenuProxy { public: - static PassRefPtr<WebPopupMenuProxyEfl> create(Evas_Object* webView, WebPopupMenuProxy::Client* client) + static PassRefPtr<WebPopupMenuProxyEfl> create(EwkViewImpl* viewImpl, WebPopupMenuProxy::Client* client) { - return adoptRef(new WebPopupMenuProxyEfl(webView, client)); + return adoptRef(new WebPopupMenuProxyEfl(viewImpl, client)); } void showPopupMenu(const WebCore::IntRect&, WebCore::TextDirection, double pageScaleFactor, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex); @@ -51,9 +53,9 @@ public: void valueChanged(int newSelectedIndex); private: - WebPopupMenuProxyEfl(Evas_Object*, WebPopupMenuProxy::Client*); + WebPopupMenuProxyEfl(EwkViewImpl*, WebPopupMenuProxy::Client*); - Evas_Object* m_webView; + EwkViewImpl* m_viewImpl; }; } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/mac/CorrectionPanel.mm b/Source/WebKit2/UIProcess/mac/CorrectionPanel.mm index 79053ed70..33f3fe982 100644 --- a/Source/WebKit2/UIProcess/mac/CorrectionPanel.mm +++ b/Source/WebKit2/UIProcess/mac/CorrectionPanel.mm @@ -109,7 +109,7 @@ String CorrectionPanel::dismissInternal(ReasonForDismissingAlternativeText reaso void CorrectionPanel::recordAutocorrectionResponse(WKView* view, NSCorrectionResponse response, const String& replacedString, const String& replacementString) { - [[NSSpellChecker sharedSpellChecker] recordResponse:response toCorrection:replacementString forWord:replacedString language:nil inSpellDocumentWithTag:[view _wk_spellCheckerDocumentTag]]; + [[NSSpellChecker sharedSpellChecker] recordResponse:response toCorrection:replacementString forWord:replacedString language:nil inSpellDocumentWithTag:[view spellCheckerDocumentTag]]; } void CorrectionPanel::handleAcceptedReplacement(NSString* acceptedReplacement, NSString* replaced, NSString* proposedReplacement, NSCorrectionIndicatorType correctionIndicatorType) @@ -118,7 +118,7 @@ void CorrectionPanel::handleAcceptedReplacement(NSString* acceptedReplacement, N return; NSSpellChecker* spellChecker = [NSSpellChecker sharedSpellChecker]; - NSInteger documentTag = [m_view.get() _wk_spellCheckerDocumentTag]; + NSInteger documentTag = [m_view.get() spellCheckerDocumentTag]; switch (correctionIndicatorType) { case NSCorrectionIndicatorTypeDefault: @@ -141,7 +141,7 @@ void CorrectionPanel::handleAcceptedReplacement(NSString* acceptedReplacement, N break; } - [m_view.get() _wk_handleAcceptedAlternativeText:acceptedReplacement]; + [m_view.get() handleAcceptedAlternativeText:acceptedReplacement]; m_view.clear(); if (acceptedReplacement) m_resultForDismissal.adoptNS([acceptedReplacement copy]); diff --git a/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h b/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h new file mode 100644 index 000000000..4f7ca6647 --- /dev/null +++ b/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2012 Apple Inc. 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 RemoteLayerTreeDrawingAreaProxy_h +#define RemoteLayerTreeDrawingAreaProxy_h + +#include "DrawingAreaProxy.h" + +namespace WebKit { + +class RemoteLayerTreeDrawingAreaProxy : public DrawingAreaProxy { +public: + static PassOwnPtr<RemoteLayerTreeDrawingAreaProxy> create(WebPageProxy*); + virtual ~RemoteLayerTreeDrawingAreaProxy(); + +private: + explicit RemoteLayerTreeDrawingAreaProxy(WebPageProxy*); + + virtual void sizeDidChange() OVERRIDE; + virtual void deviceScaleFactorDidChange() OVERRIDE; +}; + +} // namespace WebKit + +#endif // RemoteLayerTreeDrawingAreaProxy_h diff --git a/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm b/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm new file mode 100644 index 000000000..d8720a100 --- /dev/null +++ b/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2012 Apple Inc. 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 "RemoteLayerTreeDrawingAreaProxy.h" + +namespace WebKit { + +PassOwnPtr<RemoteLayerTreeDrawingAreaProxy> RemoteLayerTreeDrawingAreaProxy::create(WebPageProxy* webPageProxy) +{ + return adoptPtr(new RemoteLayerTreeDrawingAreaProxy(webPageProxy)); +} + +RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy(WebPageProxy* webPageProxy) + : DrawingAreaProxy(DrawingAreaTypeRemoteLayerTree, webPageProxy) +{ +} + +RemoteLayerTreeDrawingAreaProxy::~RemoteLayerTreeDrawingAreaProxy() +{ +} + +void RemoteLayerTreeDrawingAreaProxy::sizeDidChange() +{ +} + +void RemoteLayerTreeDrawingAreaProxy::deviceScaleFactorDidChange() +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm b/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm index eb82134ef..238a67516 100644 --- a/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm +++ b/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm @@ -242,7 +242,7 @@ static RetainPtr<CGImageRef> createImageWithCopiedData(CGImageRef sourceImage) // unnecessary in the full-screen animation case, and can cause bugs; see // https://bugs.webkit.org/show_bug.cgi?id=88940 and https://bugs.webkit.org/show_bug.cgi?id=88374 // We will resume the normal behavior in _startEnterFullScreenAnimationWithDuration: - [_webView _wk_setSuppressVisibilityUpdates:YES]; + [_webView _setSuppressVisibilityUpdates:YES]; // Swap the webView placeholder into place. if (!_webViewPlaceholder) { @@ -334,7 +334,7 @@ static RetainPtr<CGImageRef> createImageWithCopiedData(CGImageRef sourceImage) // See the related comment in enterFullScreen: // We will resume the normal behavior in _startExitFullScreenAnimationWithDuration: - [_webView _wk_setSuppressVisibilityUpdates:YES]; + [_webView _setSuppressVisibilityUpdates:YES]; [self _manager]->setAnimatingFullScreen(true); [self _manager]->willExitFullScreen(); @@ -581,7 +581,7 @@ static NSRect windowFrameFromApparentFrames(NSRect screenFrame, NSRect initialFr [_backgroundWindow.get() orderWindow:NSWindowBelow relativeTo:[[self window] windowNumber]]; - [_webView _wk_setSuppressVisibilityUpdates:NO]; + [_webView _setSuppressVisibilityUpdates:NO]; [[self window] setAutodisplay:YES]; [[self window] displayIfNeeded]; NSEnableScreenUpdates(); @@ -626,7 +626,7 @@ static NSRect windowFrameFromApparentFrames(NSRect screenFrame, NSRect initialFr finalBounds.origin = [[self window] convertScreenToBase:finalBounds.origin]; WKWindowSetClipRect([self window], finalBounds); - [_webView _wk_setSuppressVisibilityUpdates:NO]; + [_webView _setSuppressVisibilityUpdates:NO]; [[self window] setAutodisplay:YES]; [[self window] displayIfNeeded]; NSEnableScreenUpdates(); diff --git a/Source/WebKit2/UIProcess/mac/WebContextMac.mm b/Source/WebKit2/UIProcess/mac/WebContextMac.mm index 9a9232cb0..11b75c9d0 100644 --- a/Source/WebKit2/UIProcess/mac/WebContextMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebContextMac.mm @@ -26,8 +26,12 @@ #import "config.h" #import "WebContext.h" +#import "NetworkProcessManager.h" +#import "PluginProcessManager.h" +#import "SharedWorkerProcessManager.h" #import "WebKitSystemInterface.h" #import "WebProcessCreationParameters.h" +#import "WebProcessMessages.h" #import <WebCore/Color.h> #import <WebCore/FileSystem.h> #include <WebCore/NotImplemented.h> @@ -43,6 +47,7 @@ using namespace WebCore; NSString *WebDatabaseDirectoryDefaultsKey = @"WebDatabaseDirectory"; NSString *WebKitLocalCacheDefaultsKey = @"WebKitLocalCache"; NSString *WebStorageDirectoryDefaultsKey = @"WebKitLocalStorageDatabasePathPreferenceKey"; +NSString *WebKitKerningAndLigaturesEnabledByDefaultDefaultsKey = @"WebKitKerningAndLigaturesEnabledByDefault"; static NSString *WebKitApplicationDidChangeAccessibilityEnhancedUserInterfaceNotification = @"NSApplicationDidChangeAccessibilityEnhancedUserInterfaceNotification"; @@ -51,6 +56,8 @@ NSString *WebIconDatabaseDirectoryDefaultsKey = @"WebIconDatabaseDirectoryDefaul namespace WebKit { +bool WebContext::s_applicationIsOccluded = false; + String WebContext::applicationCacheDirectory() { NSString *appName = [[NSBundle mainBundle] bundleIdentifier]; @@ -73,6 +80,17 @@ String WebContext::applicationCacheDirectory() return [cacheDir stringByAppendingPathComponent:appName]; } +static void registerUserDefaultsIfNeeded() +{ + static bool didRegister; + if (didRegister) + return; + + didRegister = true; +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 + [[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:WebKitKerningAndLigaturesEnabledByDefaultDefaultsKey]]; +#endif +} void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& parameters) { @@ -84,10 +102,11 @@ void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& para parameters.nsURLCacheMemoryCapacity = [urlCache memoryCapacity]; parameters.nsURLCacheDiskCapacity = [urlCache diskCapacity]; + registerUserDefaultsIfNeeded(); #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 parameters.shouldForceScreenFontSubstitution = [[NSUserDefaults standardUserDefaults] boolForKey:@"NSFontDefaultScreenFontSubstitutionEnabled"]; #endif - parameters.shouldEnableKerningAndLigaturesByDefault = [[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitKerningAndLigaturesEnabledByDefault"]; + parameters.shouldEnableKerningAndLigaturesByDefault = [[NSUserDefaults standardUserDefaults] boolForKey:WebKitKerningAndLigaturesEnabledByDefaultDefaultsKey]; #if USE(ACCELERATED_COMPOSITING) && HAVE(HOSTED_CORE_ANIMATION) #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 @@ -244,5 +263,72 @@ void WebContext::setPasteboardBufferForType(const String& pasteboardName, const PlatformPasteboard(pasteboardName).setBufferForType(buffer, pasteboardType); } -} // namespace WebKit +void WebContext::applicationBecameVisible(uint32_t, void*, uint32_t, void*, uint32_t) +{ + if (s_applicationIsOccluded) { + s_applicationIsOccluded = false; + + const Vector<WebContext*>& contexts = WebContext::allContexts(); + for (size_t i = 0, count = contexts.size(); i < count; ++i) + contexts[i]->sendToAllProcesses(Messages::WebProcess::SetApplicationIsOccluded(false)); +#if ENABLE(PLUGIN_PROCESS) + PluginProcessManager::shared().setApplicationIsOccluded(false); +#endif +#if ENABLE(NETWORK_PROCESS) + NetworkProcessManager::shared().setApplicationIsOccluded(false); +#endif +#if ENABLE(SHARED_WORKER_PROCESS) + SharedWorkerProcessManager::shared().setApplicationIsOccluded(false); +#endif + } +} + +void WebContext::applicationBecameOccluded(uint32_t, void*, uint32_t, void*, uint32_t) +{ + if (!s_applicationIsOccluded) { + s_applicationIsOccluded = true; + const Vector<WebContext*>& contexts = WebContext::allContexts(); + for (size_t i = 0, count = contexts.size(); i < count; ++i) + contexts[i]->sendToAllProcesses(Messages::WebProcess::SetApplicationIsOccluded(true)); + +#if ENABLE(PLUGIN_PROCESS) + PluginProcessManager::shared().setApplicationIsOccluded(true); +#endif +#if ENABLE(NETWORK_PROCESS) + NetworkProcessManager::shared().setApplicationIsOccluded(true); +#endif +#if ENABLE(SHARED_WORKER_PROCESS) + SharedWorkerProcessManager::shared().setApplicationIsOccluded(true); +#endif + } +} + +void WebContext::initializeProcessSuppressionSupport() +{ + static bool didInitialize = false; + if (didInitialize) + return; + + didInitialize = true; + // A temporary default until process suppression is enabled by default, at which point a context setting can be added with the + // interpretation that any context disabling process suppression disables it for plugin/network and shared worker processes. + bool processSuppressionSupportEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitProcessSuppressionSupportEnabled"]; + if (processSuppressionSupportEnabled) + registerOcclusionNotificationHandlers(); +} + +void WebContext::registerOcclusionNotificationHandlers() +{ +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 + if (!WKRegisterOcclusionNotificationHandler(WKOcclusionNotificationTypeApplicationBecameVisible, applicationBecameVisible)) { + WTFLogAlways("Registeration of \"App Became Visible\" notification handler failed.\n"); + return; + } + + if (!WKRegisterOcclusionNotificationHandler(WKOcclusionNotificationTypeApplicationBecameOccluded, applicationBecameOccluded)) + WTFLogAlways("Registeration of \"App Became Occluded\" notification handler failed.\n"); +#endif +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/mac/WebCookieManagerProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebCookieManagerProxyMac.mm index 6a3134647..6fd2f9a7b 100644 --- a/Source/WebKit2/UIProcess/mac/WebCookieManagerProxyMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebCookieManagerProxyMac.mm @@ -33,7 +33,7 @@ void WebCookieManagerProxy::persistHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy // FIXME: The sandbox appears to prevent persisting the new policy to disk, so we must set the // policy in the UI Process as well as in the Web Process (to make sure it gets set on any // Private Browsing Cookie Storage). - [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:policy]; + [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:static_cast<NSHTTPCookieAcceptPolicy>(policy)]; } } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/mac/WebFullScreenManagerProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebFullScreenManagerProxyMac.mm index 581a74d03..b8427d56f 100644 --- a/Source/WebKit2/UIProcess/mac/WebFullScreenManagerProxyMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebFullScreenManagerProxyMac.mm @@ -42,7 +42,7 @@ void WebFullScreenManagerProxy::invalidate() if (!m_webView) return; - [m_webView _wk_closeFullScreenWindowController]; + [m_webView closeFullScreenWindowController]; m_webView = 0; } @@ -50,43 +50,43 @@ void WebFullScreenManagerProxy::close() { if (!m_webView) return; - [[m_webView _wk_fullScreenWindowController] close]; + [[m_webView fullScreenWindowController] close]; } bool WebFullScreenManagerProxy::isFullScreen() { if (!m_webView) return false; - if (![m_webView _wk_hasFullScreenWindowController]) + if (![m_webView hasFullScreenWindowController]) return false; - return [[m_webView _wk_fullScreenWindowController] isFullScreen]; + return [[m_webView fullScreenWindowController] isFullScreen]; } void WebFullScreenManagerProxy::enterFullScreen() { if (!m_webView) return; - [[m_webView _wk_fullScreenWindowController] enterFullScreen:nil]; + [[m_webView fullScreenWindowController] enterFullScreen:nil]; } void WebFullScreenManagerProxy::exitFullScreen() { if (!m_webView) return; - [[m_webView _wk_fullScreenWindowController] exitFullScreen]; + [[m_webView fullScreenWindowController] exitFullScreen]; } void WebFullScreenManagerProxy::beganEnterFullScreen(const IntRect& initialFrame, const IntRect& finalFrame) { if (m_webView) - [[m_webView _wk_fullScreenWindowController] beganEnterFullScreenWithInitialFrame:initialFrame finalFrame:finalFrame]; + [[m_webView fullScreenWindowController] beganEnterFullScreenWithInitialFrame:initialFrame finalFrame:finalFrame]; } void WebFullScreenManagerProxy::beganExitFullScreen(const IntRect& initialFrame, const IntRect& finalFrame) { if (m_webView) - [[m_webView _wk_fullScreenWindowController] beganExitFullScreenWithInitialFrame:initialFrame finalFrame:finalFrame]; + [[m_webView fullScreenWindowController] beganExitFullScreenWithInitialFrame:initialFrame finalFrame:finalFrame]; } } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm index 530a2f587..0a2b9b0c3 100644 --- a/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm @@ -230,6 +230,7 @@ void WebInspectorProxy::platformBringToFront() { // FIXME <rdar://problem/10937688>: this will not bring a background tab in Safari to the front, only its window. [m_inspectorView.get().window makeKeyAndOrderFront:nil]; + [m_inspectorView.get().window makeFirstResponder:m_inspectorView.get()]; } bool WebInspectorProxy::platformIsFront() diff --git a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp index bfb87abc3..a55fd9197 100644 --- a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp +++ b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp @@ -45,6 +45,7 @@ PageViewportControllerClientQt::PageViewportControllerClientQt(QQuickWebView* vi , m_pinchStartScale(-1) , m_lastCommittedScale(-1) , m_zoomOutScale(0) + , m_isUserInteracting(false) , m_ignoreViewportChanges(true) { m_scaleAnimation->setDuration(kScaleAnimationDurationMillis); @@ -102,7 +103,7 @@ void PageViewportControllerClientQt::animateContentRectVisible(const QRectF& con QRectF viewportRectInContentCoords = m_viewportItem->mapRectToWebContent(m_viewportItem->boundingRect()); if (contentRect == viewportRectInContentCoords) { - updateViewportController(); + m_controller->resumeContent(); return; } @@ -120,8 +121,7 @@ void PageViewportControllerClientQt::animateContentRectVisible(const QRectF& con void PageViewportControllerClientQt::flickMoveStarted() { - Q_ASSERT(m_viewportItem->isMoving()); - m_scrollUpdateDeferrer.reset(new ViewportUpdateDeferrer(m_controller, ViewportUpdateDeferrer::DeferUpdateAndSuspendContent)); + m_controller->suspendContent(); m_lastScrollPosition = m_viewportItem->contentPos(); @@ -130,12 +130,11 @@ void PageViewportControllerClientQt::flickMoveStarted() void PageViewportControllerClientQt::flickMoveEnded() { - Q_ASSERT(!m_viewportItem->isMoving()); // This method is called on the end of the pan or pan kinetic animation. m_ignoreViewportChanges = true; - - m_scrollUpdateDeferrer.reset(); + if (!m_isUserInteracting) + m_controller->resumeContent(); } void PageViewportControllerClientQt::pageItemPositionChanged() @@ -155,11 +154,10 @@ void PageViewportControllerClientQt::scaleAnimationStateChanged(QAbstractAnimati switch (newState) { case QAbstractAnimation::Running: m_viewportItem->cancelFlick(); - ASSERT(!m_animationUpdateDeferrer); - m_animationUpdateDeferrer.reset(new ViewportUpdateDeferrer(m_controller, ViewportUpdateDeferrer::DeferUpdateAndSuspendContent)); + m_controller->suspendContent(); break; case QAbstractAnimation::Stopped: - m_animationUpdateDeferrer.reset(); + m_controller->resumeContent(); break; default: break; @@ -170,14 +168,13 @@ void PageViewportControllerClientQt::touchBegin() { m_controller->setHadUserInteraction(true); - // Prevents resuming the page between the user's flicks of the page while the animation is running. - if (scrollAnimationActive()) - m_touchUpdateDeferrer.reset(new ViewportUpdateDeferrer(m_controller, ViewportUpdateDeferrer::DeferUpdateAndSuspendContent)); + // Prevents resuming the page between the user's flicks of the page. + m_isUserInteracting = true; } void PageViewportControllerClientQt::touchEnd() { - m_touchUpdateDeferrer.reset(); + m_isUserInteracting = false; } void PageViewportControllerClientQt::focusEditableArea(const QRectF& caretArea, const QRectF& targetArea) @@ -326,9 +323,9 @@ void PageViewportControllerClientQt::setContentsScale(float localScale, bool tre void PageViewportControllerClientQt::setContentsRectToNearestValidBounds() { - ViewportUpdateDeferrer guard(m_controller); float targetScale = m_controller->innerBoundedViewportScale(m_pageItem->contentsScale()); setContentRectVisiblePositionAtScale(nearestValidVisibleContentsRect().topLeft(), targetScale); + updateViewportController(); } void PageViewportControllerClientQt::didResumeContent() @@ -421,7 +418,7 @@ void PageViewportControllerClientQt::pinchGestureStarted(const QPointF& pinchCen m_scaleStack.clear(); m_zoomOutScale = 0.0; - m_scaleUpdateDeferrer.reset(new ViewportUpdateDeferrer(m_controller, ViewportUpdateDeferrer::DeferUpdateAndSuspendContent)); + m_controller->suspendContent(); m_lastPinchCenterInViewportCoordinates = pinchCenterInViewportCoordinates; m_pinchStartScale = m_pageItem->contentsScale(); @@ -457,14 +454,14 @@ void PageViewportControllerClientQt::pinchGestureEnded() m_pinchStartScale = -1; + // This will take care of resuming the content, even if no animation was performed. animateContentRectVisible(nearestValidVisibleContentsRect()); - m_scaleUpdateDeferrer.reset(); // Clear after starting potential animation, which takes over deferring. } void PageViewportControllerClientQt::pinchGestureCancelled() { m_pinchStartScale = -1; - m_scaleUpdateDeferrer.reset(); + m_controller->resumeContent(); } void PageViewportControllerClientQt::didChangeContentsSize(const IntSize& newSize) diff --git a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.h b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.h index 7c5ceea58..6255f9429 100644 --- a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.h +++ b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.h @@ -129,11 +129,6 @@ private: void animateContentRectVisible(const QRectF& contentRect); void scaleContent(qreal itemScale, const QPointF& centerInCSSCoordinates = QPointF()); - QScopedPointer<ViewportUpdateDeferrer> m_scaleUpdateDeferrer; - QScopedPointer<ViewportUpdateDeferrer> m_scrollUpdateDeferrer; - QScopedPointer<ViewportUpdateDeferrer> m_touchUpdateDeferrer; - QScopedPointer<ViewportUpdateDeferrer> m_animationUpdateDeferrer; - ScaleAnimation* m_scaleAnimation; QPointF m_lastPinchCenterInViewportCoordinates; QPointF m_lastScrollPosition; @@ -141,6 +136,7 @@ private: qreal m_lastCommittedScale; qreal m_zoomOutScale; QList<ScaleStackItem> m_scaleStack; + bool m_isUserInteracting; bool m_ignoreViewportChanges; }; diff --git a/Source/WebKit2/UIProcess/qt/QtWebContext.cpp b/Source/WebKit2/UIProcess/qt/QtWebContext.cpp index f8d384cc2..7eb3b7196 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebContext.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebContext.cpp @@ -35,15 +35,10 @@ namespace WebKit { -static uint64_t generateContextID() -{ - static uint64_t uniqueContextID = 1; - return uniqueContextID++; -} - -static HashMap<uint64_t, QtWebContext*> contextMap; - -QtWebContext* QtWebContext::s_defaultContext = 0; +static WebContext* s_defaultWebContext = 0; +static QtWebContext* s_defaultQtWebContext = 0; +static OwnPtr<QtDownloadManager> s_downloadManager; +static OwnPtr<QtWebIconDatabaseClient> s_iconDatabase; static void initInspectorServer() { @@ -87,44 +82,86 @@ static void globalInitialization() initialized = true; } +static void didReceiveMessageFromInjectedBundle(WKContextRef, WKStringRef messageName, WKTypeRef messageBody, const void*) +{ + if (!WKStringIsEqualToUTF8CString(messageName, "MessageFromNavigatorQtObject")) + return; + + ASSERT(messageBody); + ASSERT(WKGetTypeID(messageBody) == WKArrayGetTypeID()); + + WKArrayRef body = static_cast<WKArrayRef>(messageBody); + ASSERT(WKArrayGetSize(body) == 2); + ASSERT(WKGetTypeID(WKArrayGetItemAtIndex(body, 0)) == WKPageGetTypeID()); + ASSERT(WKGetTypeID(WKArrayGetItemAtIndex(body, 1)) == WKStringGetTypeID()); + + WKPageRef page = static_cast<WKPageRef>(WKArrayGetItemAtIndex(body, 0)); + WKStringRef str = static_cast<WKStringRef>(WKArrayGetItemAtIndex(body, 1)); + + toImpl(page)->didReceiveMessageFromNavigatorQtObject(toImpl(str)->string()); +} + +static void initializeContextInjectedBundleClient(WebContext* context) +{ + WKContextInjectedBundleClient injectedBundleClient; + memset(&injectedBundleClient, 0, sizeof(WKContextInjectedBundleClient)); + injectedBundleClient.version = kWKContextInjectedBundleClientCurrentVersion; + injectedBundleClient.didReceiveMessageFromInjectedBundle = didReceiveMessageFromInjectedBundle; + WKContextSetInjectedBundleClient(toAPI(context), &injectedBundleClient); +} + QtWebContext::QtWebContext(WebContext* context) - : m_contextID(generateContextID()) - , m_context(context) - , m_downloadManager(adoptPtr(new QtDownloadManager(context))) - , m_iconDatabase(adoptPtr(new QtWebIconDatabaseClient(this))) + : m_context(context) { - contextMap.set(m_contextID, this); } QtWebContext::~QtWebContext() { - if (s_defaultContext == this) - s_defaultContext = 0; - contextMap.remove(m_contextID); + ASSERT(!s_defaultQtWebContext || s_defaultQtWebContext == this); + s_defaultQtWebContext = 0; } -// Used only by WebKitTestRunner. It avoids calling initialize(), so that we don't register any clients. +// Used directly only by WebKitTestRunner. PassRefPtr<QtWebContext> QtWebContext::create(WebContext* context) { globalInitialization(); + // The lifetime of WebContext is a bit special, it is bound to the reference held + // by QtWebContext at first and then enters a circular dependency with WebProcessProxy + // once the first page is created until the web process exits. Because of this we can't + // assume that destroying the last QtWebContext will destroy the WebContext and we + // have to make sure that WebContext's clients follow its lifetime and aren't attached + // to QtWebContext. QtWebContext itself is only attached to QQuickWebView. + // Since we only support one WebContext at a time, initialize those clients globally + // here. They have to be available to views spawned by WebKitTestRunner as well. + if (!s_downloadManager) + s_downloadManager = adoptPtr(new QtDownloadManager(context)); + if (!s_iconDatabase) + s_iconDatabase = adoptPtr(new QtWebIconDatabaseClient(context)); return adoptRef(new QtWebContext(context)); } PassRefPtr<QtWebContext> QtWebContext::defaultContext() { - if (s_defaultContext) - return PassRefPtr<QtWebContext>(s_defaultContext); - - RefPtr<WebContext> context = WebContext::create(String()); - // A good all-around default. - context->setCacheModel(CacheModelDocumentBrowser); + // Keep local references until we can return a ref to QtWebContext holding the WebContext. + RefPtr<WebContext> webContext(s_defaultWebContext); + RefPtr<QtWebContext> qtWebContext(s_defaultQtWebContext); + + if (!webContext) { + webContext = WebContext::create(String()); + s_defaultWebContext = webContext.get(); + // Make sure for WebKitTestRunner that the injected bundle client isn't initialized + // and that the page cache isn't enabled (defaultContext isn't used there). + initializeContextInjectedBundleClient(webContext.get()); + // A good all-around default. + webContext->setCacheModel(CacheModelDocumentBrowser); + } - RefPtr<QtWebContext> defaultContext = QtWebContext::create(context.get()); - s_defaultContext = defaultContext.get(); - // Make sure that this doesn't get called in WebKitTestRunner (defaultContext isn't used there). - defaultContext->initializeContextInjectedBundleClient(); + if (!qtWebContext) { + qtWebContext = QtWebContext::create(webContext.get()); + s_defaultQtWebContext = qtWebContext.get(); + } - return defaultContext.release(); + return qtWebContext.release(); } PassRefPtr<WebPageProxy> QtWebContext::createWebPage(PageClient* client, WebPageGroup* pageGroup) @@ -152,49 +189,26 @@ void QtWebContext::postMessageToNavigatorQtObject(WebPageProxy* webPageProxy, co m_context->postMessageToInjectedBundle(messageName, body.get()); } -QtWebContext* QtWebContext::contextByID(uint64_t id) -{ - return contextMap.get(id); -} - -void QtWebContext::initializeContextInjectedBundleClient() -{ - WKContextInjectedBundleClient injectedBundleClient; - memset(&injectedBundleClient, 0, sizeof(WKContextInjectedBundleClient)); - injectedBundleClient.version = kWKContextInjectedBundleClientCurrentVersion; - injectedBundleClient.clientInfo = this; - injectedBundleClient.didReceiveMessageFromInjectedBundle = didReceiveMessageFromInjectedBundle; - WKContextSetInjectedBundleClient(toAPI(m_context.get()), &injectedBundleClient); -} - -static QtWebContext* toQtWebContext(const void* clientInfo) +QtDownloadManager* QtWebContext::downloadManager() { - ASSERT(clientInfo); - return reinterpret_cast<QtWebContext*>(const_cast<void*>(clientInfo)); + ASSERT(s_downloadManager); + return s_downloadManager.get(); } -void QtWebContext::didReceiveMessageFromInjectedBundle(WKContextRef, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo) +QtWebIconDatabaseClient* QtWebContext::iconDatabase() { - toQtWebContext(clientInfo)->didReceiveMessageFromInjectedBundle(messageName, messageBody); + ASSERT(s_iconDatabase); + return s_iconDatabase.get(); } -void QtWebContext::didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody) +void QtWebContext::invalidateContext(WebContext* context) { - if (!WKStringIsEqualToUTF8CString(messageName, "MessageFromNavigatorQtObject")) - return; - - ASSERT(messageBody); - ASSERT(WKGetTypeID(messageBody) == WKArrayGetTypeID()); - - WKArrayRef body = static_cast<WKArrayRef>(messageBody); - ASSERT(WKArrayGetSize(body) == 2); - ASSERT(WKGetTypeID(WKArrayGetItemAtIndex(body, 0)) == WKPageGetTypeID()); - ASSERT(WKGetTypeID(WKArrayGetItemAtIndex(body, 1)) == WKStringGetTypeID()); - - WKPageRef page = static_cast<WKPageRef>(WKArrayGetItemAtIndex(body, 0)); - WKStringRef str = static_cast<WKStringRef>(WKArrayGetItemAtIndex(body, 1)); - - toImpl(page)->didReceiveMessageFromNavigatorQtObject(toImpl(str)->string()); + UNUSED_PARAM(context); + ASSERT(!s_defaultQtWebContext); + ASSERT(!s_defaultWebContext || s_defaultWebContext == context); + s_downloadManager.clear(); + s_iconDatabase.clear(); + s_defaultWebContext = 0; } } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/QtWebContext.h b/Source/WebKit2/UIProcess/qt/QtWebContext.h index a1e12ff0f..2fa39f8c0 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebContext.h +++ b/Source/WebKit2/UIProcess/qt/QtWebContext.h @@ -51,30 +51,18 @@ public: PassRefPtr<WebPageProxy> createWebPage(PageClient*, WebPageGroup*); WebContext* context() { return m_context.get(); } - QtDownloadManager* downloadManager() { return m_downloadManager.get(); } - QtWebIconDatabaseClient* iconDatabase() { return m_iconDatabase.get(); } void setNavigatorQtObjectEnabled(WebPageProxy*, bool); void postMessageToNavigatorQtObject(WebPageProxy*, const QString&); - uint64_t contextID() const { return m_contextID; } - - static QtWebContext* contextByID(uint64_t id); + static QtDownloadManager* downloadManager(); + static QtWebIconDatabaseClient* iconDatabase(); + static void invalidateContext(WebContext*); private: explicit QtWebContext(WebContext*); - void initializeContextInjectedBundleClient(); - - static void didReceiveMessageFromInjectedBundle(WKContextRef, WKStringRef messageName, WKTypeRef messageBody, const void*); - void didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody); - - static QtWebContext* s_defaultContext; - - uint64_t m_contextID; RefPtr<WebContext> m_context; - OwnPtr<QtDownloadManager> m_downloadManager; - OwnPtr<QtWebIconDatabaseClient> m_iconDatabase; }; } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp index 592bb371c..7dbb273fd 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp @@ -22,7 +22,6 @@ #include "Image.h" #include "KURL.h" -#include "QtWebContext.h" #include "SharedBuffer.h" #include "WKURLQt.h" #include "WebContext.h" @@ -40,11 +39,9 @@ static inline QtWebIconDatabaseClient* toQtWebIconDatabaseClient(const void* cli return reinterpret_cast<QtWebIconDatabaseClient*>(const_cast<void*>(clientInfo)); } -QtWebIconDatabaseClient::QtWebIconDatabaseClient(QtWebContext *qtWebContext) +QtWebIconDatabaseClient::QtWebIconDatabaseClient(WebContext *context) { - m_contextId = qtWebContext->contextID(); // The setter calls the getter here as it triggers the startup of the icon database. - WebContext* context = qtWebContext->context(); if (!context->iconDatabase()->isOpen()) context->setIconDatabasePath(context->iconDatabasePath()); m_iconDatabase = context->iconDatabase(); @@ -59,6 +56,7 @@ QtWebIconDatabaseClient::QtWebIconDatabaseClient(QtWebContext *qtWebContext) QtWebIconDatabaseClient::~QtWebIconDatabaseClient() { + m_iconDatabase->close(); WKIconDatabaseSetIconDatabaseClient(toAPI(m_iconDatabase.get()), 0); } diff --git a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h index 65e86e18c..97197d8d6 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h +++ b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h @@ -39,14 +39,14 @@ class String; namespace WebKit { -class QtWebContext; +class WebContext; class WebIconDatabase; class QtWebIconDatabaseClient : public QObject { Q_OBJECT public: - QtWebIconDatabaseClient(QtWebContext*); + QtWebIconDatabaseClient(WebContext*); ~QtWebIconDatabaseClient(); WTF::String iconForPageURL(const WTF::String& pageURL); @@ -60,7 +60,6 @@ public: private: static void didChangeIconForPageURL(WKIconDatabaseRef, WKURLRef pageURL, const void* clientInfo); - uint64_t m_contextId; RefPtr<WebKit::WebIconDatabase> m_iconDatabase; Mutex m_imageLock; }; diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp index fdc92355f..88dae15b8 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp @@ -500,6 +500,7 @@ void QtWebPageEventHandler::handleInputEvent(const QInputEvent* event) m_isMouseButtonPressed = false; break; case QEvent::MouseButtonDblClick: + ASSERT_NOT_REACHED(); return; default: break; diff --git a/Source/WebKit2/UIProcess/qt/WebContextQt.cpp b/Source/WebKit2/UIProcess/qt/WebContextQt.cpp index 45329db44..157e67a7d 100644 --- a/Source/WebKit2/UIProcess/qt/WebContextQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebContextQt.cpp @@ -30,6 +30,7 @@ #include "ApplicationCacheStorage.h" #include "FileSystem.h" #include "QtDefaultDataLocation.h" +#include "QtWebContext.h" #include "WKSharedAPICast.h" #if ENABLE(GEOLOCATION) #include "WebGeolocationProviderQt.h" @@ -78,6 +79,7 @@ void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& para void WebContext::platformInvalidateContext() { + QtWebContext::invalidateContext(this); } String WebContext::platformDefaultDatabaseDirectory() const diff --git a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp index e5a7829c0..46429461f 100644 --- a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp @@ -85,11 +85,6 @@ void WebPageProxy::cancelComposition() process()->send(Messages::WebPage::CancelComposition(), m_pageID); } -void WebPageProxy::didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect) -{ - m_pageClient->didRenderFrame(contentsSize, coveredRect); -} - void WebPageProxy::registerApplicationScheme(const String& scheme) { process()->send(Messages::WebPage::RegisterApplicationScheme(scheme), m_pageID); @@ -121,11 +116,6 @@ void WebPageProxy::setUserScripts(const Vector<String>& scripts) process()->send(Messages::WebPage::SetUserScripts(scripts), m_pageID); } -void WebPageProxy::pageTransitionViewportReady() -{ - m_pageClient->pageTransitionViewportReady(); -} - void WebPageProxy::didFindZoomableArea(const IntPoint& target, const IntRect& area) { m_pageClient->didFindZoomableArea(target, area); diff --git a/Source/WebKit2/UIProcess/win/WebContextWin.cpp b/Source/WebKit2/UIProcess/win/WebContextWin.cpp index 9dd056820..0d2e9542e 100644 --- a/Source/WebKit2/UIProcess/win/WebContextWin.cpp +++ b/Source/WebKit2/UIProcess/win/WebContextWin.cpp @@ -68,10 +68,8 @@ void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& para if (parameters.diskCacheDirectory.endsWith(UChar('\\'))) parameters.diskCacheDirectory.remove(parameters.diskCacheDirectory.length() - 1); -#if USE(CFURLSTORAGESESSIONS) parameters.uiProcessBundleIdentifier = String(reinterpret_cast<CFStringRef>(CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), kCFBundleIdentifierKey))); parameters.serializedDefaultStorageSession.adoptCF(wkCopySerializedDefaultStorageSession()); -#endif // USE(CFURLSTORAGESESSIONS) parameters.initialHTTPCookieAcceptPolicy = m_initialHTTPCookieAcceptPolicy; diff --git a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj index 9b5ac7bcc..7bca663ed 100644 --- a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj +++ b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj @@ -216,6 +216,10 @@ 1AAF0C4B12B16334008E49E2 /* ArgumentCodersCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AAF0C4912B16334008E49E2 /* ArgumentCodersCF.cpp */; }; 1AAF263814687C39004A1E8A /* TiledCoreAnimationDrawingArea.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AAF263614687C39004A1E8A /* TiledCoreAnimationDrawingArea.mm */; }; 1AAF263914687C39004A1E8A /* TiledCoreAnimationDrawingArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AAF263714687C39004A1E8A /* TiledCoreAnimationDrawingArea.h */; }; + 1AB16ADD1648598400290D62 /* RemoteLayerTreeDrawingArea.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AB16ADB1648598400290D62 /* RemoteLayerTreeDrawingArea.mm */; }; + 1AB16ADE1648598400290D62 /* RemoteLayerTreeDrawingArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB16ADC1648598400290D62 /* RemoteLayerTreeDrawingArea.h */; }; + 1AB16AE11648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AB16ADF1648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.mm */; }; + 1AB16AE21648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB16AE01648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.h */; }; 1AB7D4CA1288AAA700CFD08C /* DownloadProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB7D4C81288AAA700CFD08C /* DownloadProxy.h */; }; 1AB7D4CB1288AAA700CFD08C /* DownloadProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB7D4C91288AAA700CFD08C /* DownloadProxy.cpp */; }; 1AB7D6191288B9D900CFD08C /* DownloadProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB7D6171288B9D900CFD08C /* DownloadProxyMessageReceiver.cpp */; }; @@ -269,6 +273,9 @@ 29CD55AB128E294F00133C85 /* WKAccessibilityWebPageObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29CD55A9128E294F00133C85 /* WKAccessibilityWebPageObject.mm */; }; 29D55DF1161BF9F10031A2E3 /* WebPageGroupProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29D55DEF161BF9F10031A2E3 /* WebPageGroupProxyMessageReceiver.cpp */; }; 29D55DF2161BF9F10031A2E3 /* WebPageGroupProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 29D55DF0161BF9F10031A2E3 /* WebPageGroupProxyMessages.h */; }; + 2D2ADF0916362DD500197E47 /* PDFPluginTextAnnotation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D2ADF0616362DC700197E47 /* PDFPluginTextAnnotation.mm */; }; + 2D2ADF0B16362DDB00197E47 /* PDFPluginAnnotation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D2ADF031636243500197E47 /* PDFPluginAnnotation.mm */; }; + 2D2ADF1016364D8200197E47 /* PDFPluginChoiceAnnotation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D2ADF0E16364D8200197E47 /* PDFPluginChoiceAnnotation.mm */; }; 2D870D1016234FFE000A3F20 /* PDFPlugin.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D870D0E1622B7F9000A3F20 /* PDFPlugin.mm */; }; 31099973146C75A20029DEB9 /* WebNotificationClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31099971146C759B0029DEB9 /* WebNotificationClient.cpp */; }; 310999C7146C9E3D0029DEB9 /* WebNotificationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 31099968146C71F50029DEB9 /* WebNotificationClient.h */; }; @@ -372,6 +379,9 @@ 512935D81288D19400A4B695 /* WebContextMenuItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 512935D61288D19400A4B695 /* WebContextMenuItem.h */; }; 512935E31288D97800A4B695 /* InjectedBundlePageContextMenuClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512935E11288D97800A4B695 /* InjectedBundlePageContextMenuClient.cpp */; }; 512935E41288D97800A4B695 /* InjectedBundlePageContextMenuClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 512935E21288D97800A4B695 /* InjectedBundlePageContextMenuClient.h */; }; + 512C06881638F67E00ABB911 /* HostRecord.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512C06861638F67E00ABB911 /* HostRecord.cpp */; }; + 512C06891638F67E00ABB911 /* HostRecord.h in Headers */ = {isa = PBXBuildFile; fileRef = 512C06871638F67E00ABB911 /* HostRecord.h */; }; + 512C069016390E6900ABB911 /* NetworkResourceLoadSchedulerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 512C068F16390E6900ABB911 /* NetworkResourceLoadSchedulerMac.mm */; }; 512DF6D8138C181A00A22FC6 /* KeychainItemShimMethods.h in Headers */ = {isa = PBXBuildFile; fileRef = 512DF6D6138C181A00A22FC6 /* KeychainItemShimMethods.h */; }; 512DF6D9138C181A00A22FC6 /* KeychainItemShimMethods.mm in Sources */ = {isa = PBXBuildFile; fileRef = 512DF6D7138C181A00A22FC6 /* KeychainItemShimMethods.mm */; }; 512DF6FE138C254600A22FC6 /* SecKeychainItemRequestData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5112CA4713858D4B0030867D /* SecKeychainItemRequestData.cpp */; }; @@ -433,6 +443,12 @@ 5179556E162877B300FA43B6 /* NetworkProcessProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 510CC7EB16138E7200D03ED3 /* NetworkProcessProxy.h */; }; 51795570162877CF00FA43B6 /* NetworkProcessCreationParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51A8A6121627F325000D90E9 /* NetworkProcessCreationParameters.cpp */; }; 51795571162877D200FA43B6 /* NetworkProcessCreationParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 51A8A60F1627F2BD000D90E9 /* NetworkProcessCreationParameters.h */; }; + 517CF0DF163A444C00C2950E /* NetworkRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517CF0DD163A444C00C2950E /* NetworkRequest.cpp */; }; + 517CF0E0163A444C00C2950E /* NetworkRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 517CF0DE163A444C00C2950E /* NetworkRequest.h */; }; + 517CF0E3163A486C00C2950E /* NetworkProcessConnectionMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517CF0E1163A486C00C2950E /* NetworkProcessConnectionMessageReceiver.cpp */; }; + 517CF0E4163A486C00C2950E /* NetworkProcessConnectionMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 517CF0E2163A486C00C2950E /* NetworkProcessConnectionMessages.h */; }; + 51829DA51637C70C000953D6 /* NetworkResourceLoadScheduler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51829DA31637C70C000953D6 /* NetworkResourceLoadScheduler.cpp */; }; + 51829DA61637C70C000953D6 /* NetworkResourceLoadScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = 51829DA41637C70C000953D6 /* NetworkResourceLoadScheduler.h */; }; 51834592134532E90092B696 /* WebIconDatabaseClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51834590134532E80092B696 /* WebIconDatabaseClient.cpp */; }; 51834593134532E90092B696 /* WebIconDatabaseClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 51834591134532E80092B696 /* WebIconDatabaseClient.h */; }; 5183B3921379F7B800E8754E /* WebProcessShim.dylib in Copy Web Process Shim */ = {isa = PBXBuildFile; fileRef = 510031F61379CACB00C8DFE4 /* WebProcessShim.dylib */; }; @@ -479,9 +495,12 @@ 51D130551382EAC000351EDD /* SecItemResponseData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51D130511382EAC000351EDD /* SecItemResponseData.cpp */; }; 51D130561382EAC000351EDD /* SecItemResponseData.h in Headers */ = {isa = PBXBuildFile; fileRef = 51D130521382EAC000351EDD /* SecItemResponseData.h */; }; 51D130581382F10500351EDD /* WebProcessProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51D130571382F10500351EDD /* WebProcessProxyMac.mm */; }; + 51DD9F2816367DA2001578E9 /* NetworkConnectionToWebProcessMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51DD9F2616367DA2001578E9 /* NetworkConnectionToWebProcessMessageReceiver.cpp */; }; + 51DD9F2916367DA2001578E9 /* NetworkConnectionToWebProcessMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 51DD9F2716367DA2001578E9 /* NetworkConnectionToWebProcessMessages.h */; }; 51EFC1CF1524E62500C9A938 /* WKBundleDOMWindowExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FA2D541521118600C1BA0B /* WKBundleDOMWindowExtension.h */; settings = {ATTRIBUTES = (Private, ); }; }; 51FA2D7415212DF100C1BA0B /* InjectedBundleDOMWindowExtension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51FA2D5C15211A5000C1BA0B /* InjectedBundleDOMWindowExtension.cpp */; }; 51FA2D7715212E2600C1BA0B /* WKBundleDOMWindowExtension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51FA2D7515212E1E00C1BA0B /* WKBundleDOMWindowExtension.cpp */; }; + 51FB08FF1639DE1A00EC324A /* WebResourceLoadScheduler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51ABF65616392F1500132A7A /* WebResourceLoadScheduler.cpp */; }; 5272B28A1406985D0096A5D0 /* StatisticsData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5272B2881406985D0096A5D0 /* StatisticsData.cpp */; }; 5272B28B1406985D0096A5D0 /* StatisticsData.h in Headers */ = {isa = PBXBuildFile; fileRef = 5272B2891406985D0096A5D0 /* StatisticsData.h */; }; 5D1A239115E75B220023E981 /* webkit2 in Copy Message Generation Scripts */ = {isa = PBXBuildFile; fileRef = 5D1A238E15E75AD50023E981 /* webkit2 */; }; @@ -516,6 +535,11 @@ 93FC67BE12D3CCF200A60610 /* DecoderAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = 93FC679E12D3CC7400A60610 /* DecoderAdapter.h */; }; 93FC67BF12D3CCF200A60610 /* EncoderAdapter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93FC679F12D3CC7400A60610 /* EncoderAdapter.cpp */; }; 93FC67C012D3CCF200A60610 /* EncoderAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = 93FC67A012D3CC7400A60610 /* EncoderAdapter.h */; }; + 9F4F59421648B40700493B7E /* SharedWorkerProcessManagerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9F4F59411648B40700493B7E /* SharedWorkerProcessManagerMac.mm */; }; + 9F4F59441648B67F00493B7E /* SharedWorkerProcessProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9F4F59431648B67F00493B7E /* SharedWorkerProcessProxyMac.mm */; }; + 9F4F59461648BA8E00493B7E /* NetworkProcessManagerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9F4F59451648BA8E00493B7E /* NetworkProcessManagerMac.mm */; }; + 9F54F88F16488E87007DF81A /* ChildProcessMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9F54F88E16488E87007DF81A /* ChildProcessMac.mm */; }; + 9F54F8951648AE0F007DF81A /* PluginProcessManagerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9F54F8941648AE0E007DF81A /* PluginProcessManagerMac.mm */; }; B62E7310143047A60069EC35 /* WKHitTestResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B62E730F143047A60069EC35 /* WKHitTestResult.cpp */; }; B62E7312143047B00069EC35 /* WKHitTestResult.h in Headers */ = {isa = PBXBuildFile; fileRef = B62E7311143047B00069EC35 /* WKHitTestResult.h */; settings = {ATTRIBUTES = (Private, ); }; }; B63403F914910D57001070B5 /* APIObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B63403F814910D57001070B5 /* APIObject.cpp */; }; @@ -978,6 +1002,8 @@ E1A31735134CEA80007C9A4F /* AttributedString.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1A31734134CEA80007C9A4F /* AttributedString.mm */; }; E1AEA22F14687BDB00804569 /* WKFullKeyboardAccessWatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = E1AEA22D14687BDB00804569 /* WKFullKeyboardAccessWatcher.h */; }; E1AEA23014687BDB00804569 /* WKFullKeyboardAccessWatcher.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1AEA22E14687BDB00804569 /* WKFullKeyboardAccessWatcher.mm */; }; + E1B78471163F24690007B692 /* RemoteNetworkingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = E1B78470163F24690007B692 /* RemoteNetworkingContext.h */; }; + E1B78473163F253E0007B692 /* RemoteNetworkingContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1B78472163F253E0007B692 /* RemoteNetworkingContext.mm */; }; E1CC1B9012D7EADF00625838 /* PrintInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = E1CC1B8E12D7EADF00625838 /* PrintInfo.h */; }; E1CC1B9112D7EADF00625838 /* PrintInfoMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1CC1B8F12D7EADF00625838 /* PrintInfoMac.mm */; }; E1EDFDA61628868E0039ECDA /* MainMacProcess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6FA31011E3921E00DB1371 /* MainMacProcess.cpp */; }; @@ -1366,6 +1392,10 @@ 1AAF0C4912B16334008E49E2 /* ArgumentCodersCF.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = ArgumentCodersCF.cpp; sourceTree = "<group>"; }; 1AAF263614687C39004A1E8A /* TiledCoreAnimationDrawingArea.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TiledCoreAnimationDrawingArea.mm; sourceTree = "<group>"; }; 1AAF263714687C39004A1E8A /* TiledCoreAnimationDrawingArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TiledCoreAnimationDrawingArea.h; sourceTree = "<group>"; }; + 1AB16ADB1648598400290D62 /* RemoteLayerTreeDrawingArea.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteLayerTreeDrawingArea.mm; sourceTree = "<group>"; }; + 1AB16ADC1648598400290D62 /* RemoteLayerTreeDrawingArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteLayerTreeDrawingArea.h; sourceTree = "<group>"; }; + 1AB16ADF1648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteLayerTreeDrawingAreaProxy.mm; sourceTree = "<group>"; }; + 1AB16AE01648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteLayerTreeDrawingAreaProxy.h; sourceTree = "<group>"; }; 1AB7D4C81288AAA700CFD08C /* DownloadProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DownloadProxy.h; sourceTree = "<group>"; }; 1AB7D4C91288AAA700CFD08C /* DownloadProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DownloadProxy.cpp; sourceTree = "<group>"; }; 1AB7D5E91288B8C000CFD08C /* DownloadProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DownloadProxy.messages.in; sourceTree = "<group>"; }; @@ -1425,6 +1455,13 @@ 29D55DEE161BF8780031A2E3 /* WebPageGroupProxy.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebPageGroupProxy.messages.in; sourceTree = "<group>"; }; 29D55DEF161BF9F10031A2E3 /* WebPageGroupProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageGroupProxyMessageReceiver.cpp; sourceTree = "<group>"; }; 29D55DF0161BF9F10031A2E3 /* WebPageGroupProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageGroupProxyMessages.h; sourceTree = "<group>"; }; + 2D2ADF021636243500197E47 /* PDFPluginAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PDFPluginAnnotation.h; path = PDF/PDFPluginAnnotation.h; sourceTree = "<group>"; }; + 2D2ADF031636243500197E47 /* PDFPluginAnnotation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PDFPluginAnnotation.mm; path = PDF/PDFPluginAnnotation.mm; sourceTree = "<group>"; }; + 2D2ADF0516362DC700197E47 /* PDFPluginTextAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PDFPluginTextAnnotation.h; path = PDF/PDFPluginTextAnnotation.h; sourceTree = "<group>"; }; + 2D2ADF0616362DC700197E47 /* PDFPluginTextAnnotation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PDFPluginTextAnnotation.mm; path = PDF/PDFPluginTextAnnotation.mm; sourceTree = "<group>"; }; + 2D2ADF0C16363DEC00197E47 /* PDFLayerControllerDetails.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PDFLayerControllerDetails.h; path = PDF/PDFLayerControllerDetails.h; sourceTree = "<group>"; }; + 2D2ADF0D16364D8200197E47 /* PDFPluginChoiceAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PDFPluginChoiceAnnotation.h; path = PDF/PDFPluginChoiceAnnotation.h; sourceTree = "<group>"; }; + 2D2ADF0E16364D8200197E47 /* PDFPluginChoiceAnnotation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PDFPluginChoiceAnnotation.mm; path = PDF/PDFPluginChoiceAnnotation.mm; sourceTree = "<group>"; }; 2D870D0D1622B7F9000A3F20 /* PDFPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PDFPlugin.h; path = PDF/PDFPlugin.h; sourceTree = "<group>"; }; 2D870D0E1622B7F9000A3F20 /* PDFPlugin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PDFPlugin.mm; path = PDF/PDFPlugin.mm; sourceTree = "<group>"; }; 31099968146C71F50029DEB9 /* WebNotificationClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebNotificationClient.h; sourceTree = "<group>"; }; @@ -1554,6 +1591,9 @@ 512935D61288D19400A4B695 /* WebContextMenuItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenuItem.h; sourceTree = "<group>"; }; 512935E11288D97800A4B695 /* InjectedBundlePageContextMenuClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundlePageContextMenuClient.cpp; sourceTree = "<group>"; }; 512935E21288D97800A4B695 /* InjectedBundlePageContextMenuClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundlePageContextMenuClient.h; sourceTree = "<group>"; }; + 512C06861638F67E00ABB911 /* HostRecord.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HostRecord.cpp; path = NetworkProcess/HostRecord.cpp; sourceTree = "<group>"; }; + 512C06871638F67E00ABB911 /* HostRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HostRecord.h; path = NetworkProcess/HostRecord.h; sourceTree = "<group>"; }; + 512C068F16390E6900ABB911 /* NetworkResourceLoadSchedulerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkResourceLoadSchedulerMac.mm; sourceTree = "<group>"; }; 512DF6D6138C181A00A22FC6 /* KeychainItemShimMethods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeychainItemShimMethods.h; sourceTree = "<group>"; }; 512DF6D7138C181A00A22FC6 /* KeychainItemShimMethods.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KeychainItemShimMethods.mm; sourceTree = "<group>"; }; 512E3520130B550100ABD19A /* WebApplicationCacheManagerProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebApplicationCacheManagerProxy.cpp; sourceTree = "<group>"; }; @@ -1602,6 +1642,12 @@ 516A4A5B120A2CCD00C05B7F /* WebError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebError.h; sourceTree = "<group>"; }; 517A33B3130B308C00F80CB5 /* WKApplicationCacheManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKApplicationCacheManager.cpp; sourceTree = "<group>"; }; 517A33B4130B308C00F80CB5 /* WKApplicationCacheManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKApplicationCacheManager.h; sourceTree = "<group>"; }; + 517CF0DD163A444C00C2950E /* NetworkRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkRequest.cpp; path = NetworkProcess/NetworkRequest.cpp; sourceTree = "<group>"; }; + 517CF0DE163A444C00C2950E /* NetworkRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkRequest.h; path = NetworkProcess/NetworkRequest.h; sourceTree = "<group>"; }; + 517CF0E1163A486C00C2950E /* NetworkProcessConnectionMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkProcessConnectionMessageReceiver.cpp; sourceTree = "<group>"; }; + 517CF0E2163A486C00C2950E /* NetworkProcessConnectionMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkProcessConnectionMessages.h; sourceTree = "<group>"; }; + 51829DA31637C70C000953D6 /* NetworkResourceLoadScheduler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkResourceLoadScheduler.cpp; path = NetworkProcess/NetworkResourceLoadScheduler.cpp; sourceTree = "<group>"; }; + 51829DA41637C70C000953D6 /* NetworkResourceLoadScheduler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkResourceLoadScheduler.h; path = NetworkProcess/NetworkResourceLoadScheduler.h; sourceTree = "<group>"; }; 51834590134532E80092B696 /* WebIconDatabaseClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebIconDatabaseClient.cpp; sourceTree = "<group>"; }; 51834591134532E80092B696 /* WebIconDatabaseClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebIconDatabaseClient.h; sourceTree = "<group>"; }; 5183B3931379F85C00E8754E /* Shim.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Shim.xcconfig; sourceTree = "<group>"; }; @@ -1636,6 +1682,8 @@ 51A9E1251315ED35009E7031 /* WebKeyValueStorageManagerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKeyValueStorageManagerMessages.h; sourceTree = "<group>"; }; 51A9E1261315ED35009E7031 /* WebKeyValueStorageManagerProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKeyValueStorageManagerProxyMessageReceiver.cpp; sourceTree = "<group>"; }; 51A9E1271315ED35009E7031 /* WebKeyValueStorageManagerProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKeyValueStorageManagerProxyMessages.h; sourceTree = "<group>"; }; + 51ABF65616392F1500132A7A /* WebResourceLoadScheduler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebResourceLoadScheduler.cpp; path = Network/WebResourceLoadScheduler.cpp; sourceTree = "<group>"; }; + 51ABF65716392F1500132A7A /* WebResourceLoadScheduler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebResourceLoadScheduler.h; path = Network/WebResourceLoadScheduler.h; sourceTree = "<group>"; }; 51ACBB81127A8BAD00D203B9 /* WebContextMenuProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenuProxy.h; sourceTree = "<group>"; }; 51ACBB9E127A8F2C00D203B9 /* WebContextMenuProxyMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenuProxyMac.h; sourceTree = "<group>"; }; 51ACBB9F127A8F2C00D203B9 /* WebContextMenuProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebContextMenuProxyMac.mm; sourceTree = "<group>"; }; @@ -1656,10 +1704,13 @@ 51D130511382EAC000351EDD /* SecItemResponseData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SecItemResponseData.cpp; sourceTree = "<group>"; }; 51D130521382EAC000351EDD /* SecItemResponseData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecItemResponseData.h; sourceTree = "<group>"; }; 51D130571382F10500351EDD /* WebProcessProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessProxyMac.mm; sourceTree = "<group>"; }; + 51DD9F2616367DA2001578E9 /* NetworkConnectionToWebProcessMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkConnectionToWebProcessMessageReceiver.cpp; sourceTree = "<group>"; }; + 51DD9F2716367DA2001578E9 /* NetworkConnectionToWebProcessMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkConnectionToWebProcessMessages.h; sourceTree = "<group>"; }; 51FA2D541521118600C1BA0B /* WKBundleDOMWindowExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleDOMWindowExtension.h; sourceTree = "<group>"; }; 51FA2D5A15211A1E00C1BA0B /* InjectedBundleDOMWindowExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleDOMWindowExtension.h; sourceTree = "<group>"; }; 51FA2D5C15211A5000C1BA0B /* InjectedBundleDOMWindowExtension.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleDOMWindowExtension.cpp; sourceTree = "<group>"; }; 51FA2D7515212E1E00C1BA0B /* WKBundleDOMWindowExtension.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleDOMWindowExtension.cpp; sourceTree = "<group>"; }; + 51FB0902163A3B1C00EC324A /* NetworkProcessConnection.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; name = NetworkProcessConnection.messages.in; path = Network/NetworkProcessConnection.messages.in; sourceTree = "<group>"; }; 5272B2881406985D0096A5D0 /* StatisticsData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StatisticsData.cpp; sourceTree = "<group>"; }; 5272B2891406985D0096A5D0 /* StatisticsData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StatisticsData.h; sourceTree = "<group>"; }; 5D1A238E15E75AD50023E981 /* webkit2 */ = {isa = PBXFileReference; lastKnownFileType = folder; path = webkit2; sourceTree = "<group>"; }; @@ -1700,6 +1751,11 @@ 93FC679E12D3CC7400A60610 /* DecoderAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DecoderAdapter.h; sourceTree = "<group>"; }; 93FC679F12D3CC7400A60610 /* EncoderAdapter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EncoderAdapter.cpp; sourceTree = "<group>"; }; 93FC67A012D3CC7400A60610 /* EncoderAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EncoderAdapter.h; sourceTree = "<group>"; }; + 9F4F59411648B40700493B7E /* SharedWorkerProcessManagerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SharedWorkerProcessManagerMac.mm; sourceTree = "<group>"; }; + 9F4F59431648B67F00493B7E /* SharedWorkerProcessProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SharedWorkerProcessProxyMac.mm; sourceTree = "<group>"; }; + 9F4F59451648BA8E00493B7E /* NetworkProcessManagerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = NetworkProcessManagerMac.mm; path = mac/NetworkProcessManagerMac.mm; sourceTree = "<group>"; }; + 9F54F88E16488E87007DF81A /* ChildProcessMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ChildProcessMac.mm; sourceTree = "<group>"; }; + 9F54F8941648AE0E007DF81A /* PluginProcessManagerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginProcessManagerMac.mm; sourceTree = "<group>"; }; A72D5D7F1236CBA800A88B15 /* WebSerializedScriptValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSerializedScriptValue.h; sourceTree = "<group>"; }; B396EA5512E0ED2D00F4FEB7 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; }; B62E730F143047A60069EC35 /* WKHitTestResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKHitTestResult.cpp; sourceTree = "<group>"; }; @@ -1985,7 +2041,6 @@ BCAC111E12C92C1F00B08EEE /* WebDatabaseManagerProxyClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebDatabaseManagerProxyClient.cpp; sourceTree = "<group>"; }; BCAE9DE9160C097400A33217 /* com.apple.WebKit2.WebProcessServiceForWebKitDevelopment.xpc */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = com.apple.WebKit2.WebProcessServiceForWebKitDevelopment.xpc; sourceTree = BUILT_PRODUCTS_DIR; }; BCAE9DEF160C097500A33217 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; - BCAE9DFF160C0B4100A33217 /* CompilerVersion.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = CompilerVersion.xcconfig; sourceTree = "<group>"; }; BCAE9E00160C0B4100A33217 /* WebProcessServiceForWebKitDevelopment.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = WebProcessServiceForWebKitDevelopment.xcconfig; sourceTree = "<group>"; }; BCAE9E01160C12DA00A33217 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = WebProcessService/Info.plist; sourceTree = "<group>"; }; BCAE9E04160C137800A33217 /* WebProcessServiceForWebKitDevelopmentMain.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessServiceForWebKitDevelopmentMain.mm; sourceTree = "<group>"; }; @@ -2204,6 +2259,8 @@ E1A31734134CEA80007C9A4F /* AttributedString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AttributedString.mm; sourceTree = "<group>"; }; E1AEA22D14687BDB00804569 /* WKFullKeyboardAccessWatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFullKeyboardAccessWatcher.h; sourceTree = "<group>"; }; E1AEA22E14687BDB00804569 /* WKFullKeyboardAccessWatcher.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKFullKeyboardAccessWatcher.mm; sourceTree = "<group>"; }; + E1B78470163F24690007B692 /* RemoteNetworkingContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteNetworkingContext.h; sourceTree = "<group>"; }; + E1B78472163F253E0007B692 /* RemoteNetworkingContext.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteNetworkingContext.mm; sourceTree = "<group>"; }; E1CC1B8E12D7EADF00625838 /* PrintInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrintInfo.h; sourceTree = "<group>"; }; E1CC1B8F12D7EADF00625838 /* PrintInfoMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PrintInfoMac.mm; sourceTree = "<group>"; }; E1EDFD9816287BD10039ECDA /* SharedWorkerProcessMain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SharedWorkerProcessMain.h; sourceTree = "<group>"; }; @@ -2468,7 +2525,6 @@ children = ( 1A4F976A100E7B6600637A18 /* Base.xcconfig */, 5DAD73F1116FF90C00EE5396 /* BaseTarget.xcconfig */, - BCAE9DFF160C0B4100A33217 /* CompilerVersion.xcconfig */, 1A4F976B100E7B6600637A18 /* DebugRelease.xcconfig */, 1A4F976C100E7B6600637A18 /* FeatureDefines.xcconfig */, 510CC8461613C7C600D03ED3 /* NetworkProcess.xcconfig */, @@ -2860,6 +2916,7 @@ 1AEFCC0D11D01F41008219D3 /* mac */ = { isa = PBXGroup; children = ( + 9F54F8941648AE0E007DF81A /* PluginProcessManagerMac.mm */, 1AEFCCBC11D02C5E008219D3 /* PluginInfoStoreMac.mm */, 1A2D90BA1281C931001EB962 /* PluginProcessProxyMac.mm */, ); @@ -2952,6 +3009,9 @@ children = ( 5105B0D4162F7A7A00E27709 /* NetworkProcessConnection.cpp */, 5105B0D5162F7A7A00E27709 /* NetworkProcessConnection.h */, + 51FB0902163A3B1C00EC324A /* NetworkProcessConnection.messages.in */, + 51ABF65616392F1500132A7A /* WebResourceLoadScheduler.cpp */, + 51ABF65716392F1500132A7A /* WebResourceLoadScheduler.h */, ); name = Network; sourceTree = "<group>"; @@ -2960,6 +3020,8 @@ isa = PBXGroup; children = ( 510CC7DC16138E2900D03ED3 /* mac */, + 512C06861638F67E00ABB911 /* HostRecord.cpp */, + 512C06871638F67E00ABB911 /* HostRecord.h */, 513A16491630A9BF005D7D22 /* NetworkConnectionToWebProcess.cpp */, 513A164A1630A9BF005D7D22 /* NetworkConnectionToWebProcess.h */, 513A164B1630A9BF005D7D22 /* NetworkConnectionToWebProcess.messages.in */, @@ -2967,6 +3029,10 @@ 510CC7E016138E2900D03ED3 /* NetworkProcess.h */, 51A8A6171627F5BB000D90E9 /* NetworkProcess.messages.in */, 510CC7E116138E2900D03ED3 /* NetworkProcessMain.h */, + 517CF0DD163A444C00C2950E /* NetworkRequest.cpp */, + 517CF0DE163A444C00C2950E /* NetworkRequest.h */, + 51829DA31637C70C000953D6 /* NetworkResourceLoadScheduler.cpp */, + 51829DA41637C70C000953D6 /* NetworkResourceLoadScheduler.h */, ); name = NetworkProcess; sourceTree = "<group>"; @@ -2976,6 +3042,9 @@ children = ( 51A8A6151627F3F9000D90E9 /* NetworkProcessMac.mm */, 510CC7DD16138E2900D03ED3 /* NetworkProcessMainMac.mm */, + 512C068F16390E6900ABB911 /* NetworkResourceLoadSchedulerMac.mm */, + E1B78470163F24690007B692 /* RemoteNetworkingContext.h */, + E1B78472163F253E0007B692 /* RemoteNetworkingContext.mm */, ); name = mac; path = NetworkProcess/mac; @@ -3050,6 +3119,7 @@ 516319931628980E00E22F00 /* mac */ = { isa = PBXGroup; children = ( + 9F4F59451648BA8E00493B7E /* NetworkProcessManagerMac.mm */, 516319911628980A00E22F00 /* NetworkProcessProxyMac.mm */, ); name = mac; @@ -3121,6 +3191,15 @@ name = mac; sourceTree = "<group>"; }; + 9F4F59401648B40700493B7E /* mac */ = { + isa = PBXGroup; + children = ( + 9F4F59411648B40700493B7E /* SharedWorkerProcessManagerMac.mm */, + 9F4F59431648B67F00493B7E /* SharedWorkerProcessProxyMac.mm */, + ); + path = mac; + sourceTree = "<group>"; + }; BC017D1016260FFD007054F5 /* DOM */ = { isa = PBXGroup; children = ( @@ -3580,6 +3659,7 @@ E179FD9E134D38250015B883 /* ArgumentCodersMac.mm */, E1A31731134CEA6C007C9A4F /* AttributedString.h */, E1A31734134CEA80007C9A4F /* AttributedString.mm */, + 9F54F88E16488E87007DF81A /* ChildProcessMac.mm */, 1A2A4AFE158693920090C9E9 /* ColorSpaceData.h */, 1A2A4AFD158693920090C9E9 /* ColorSpaceData.mm */, 1A6F9FB611E1408500DB1371 /* CommandLineMac.cpp */, @@ -3830,6 +3910,8 @@ BC963D6C113DD19500574BE2 /* mac */ = { isa = PBXGroup; children = ( + 1AB16ADC1648598400290D62 /* RemoteLayerTreeDrawingArea.h */, + 1AB16ADB1648598400290D62 /* RemoteLayerTreeDrawingArea.mm */, 1AAF263714687C39004A1E8A /* TiledCoreAnimationDrawingArea.h */, 1AAF263614687C39004A1E8A /* TiledCoreAnimationDrawingArea.mm */, 1C8E2DAD1278C5B200BC7BD0 /* WebInspectorMac.mm */, @@ -3896,6 +3978,8 @@ 1A64292C12DE5F9800CAAE2C /* BackingStoreMac.mm */, B878B613133428DC006888E9 /* CorrectionPanel.h */, B878B614133428DC006888E9 /* CorrectionPanel.mm */, + 1AB16AE01648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.h */, + 1AB16ADF1648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.mm */, 1AA417ED12C00D87002BE67B /* TextCheckerMac.mm */, 1AF05D8514688348008B1E81 /* TiledCoreAnimationDrawingAreaProxy.h */, 1AF05D8414688348008B1E81 /* TiledCoreAnimationDrawingAreaProxy.mm */, @@ -4044,6 +4128,10 @@ 1A64230712DD09EB00CAAE2C /* DrawingAreaProxyMessages.h */, 1AA575FF1496B7C000A4EE06 /* EventDispatcherMessageReceiver.cpp */, 1AA576001496B7C000A4EE06 /* EventDispatcherMessages.h */, + 51DD9F2616367DA2001578E9 /* NetworkConnectionToWebProcessMessageReceiver.cpp */, + 51DD9F2716367DA2001578E9 /* NetworkConnectionToWebProcessMessages.h */, + 517CF0E1163A486C00C2950E /* NetworkProcessConnectionMessageReceiver.cpp */, + 517CF0E2163A486C00C2950E /* NetworkProcessConnectionMessages.h */, 51ACC9341628064800342550 /* NetworkProcessMessageReceiver.cpp */, 51ACC9351628064800342550 /* NetworkProcessMessages.h */, 513A163A163088F6005D7D22 /* NetworkProcessProxyMessageReceiver.cpp */, @@ -4196,6 +4284,13 @@ E199875B142BF9CF00BB2DE7 /* PDF */ = { isa = PBXGroup; children = ( + 2D2ADF0D16364D8200197E47 /* PDFPluginChoiceAnnotation.h */, + 2D2ADF0E16364D8200197E47 /* PDFPluginChoiceAnnotation.mm */, + 2D2ADF0C16363DEC00197E47 /* PDFLayerControllerDetails.h */, + 2D2ADF021636243500197E47 /* PDFPluginAnnotation.h */, + 2D2ADF031636243500197E47 /* PDFPluginAnnotation.mm */, + 2D2ADF0516362DC700197E47 /* PDFPluginTextAnnotation.h */, + 2D2ADF0616362DC700197E47 /* PDFPluginTextAnnotation.mm */, 2D870D0D1622B7F9000A3F20 /* PDFPlugin.h */, 2D870D0E1622B7F9000A3F20 /* PDFPlugin.mm */, E199875C142BFC9700BB2DE7 /* SimplePDFPlugin.mm */, @@ -4225,6 +4320,7 @@ E1EDFDAA1628878E0039ECDA /* SharedWorkers */ = { isa = PBXGroup; children = ( + 9F4F59401648B40700493B7E /* mac */, E1EDFE0F1628CF4E0039ECDA /* SharedWorkerProcessManager.h */, E1EDFE111628CFB20039ECDA /* SharedWorkerProcessManager.cpp */, E1EDFDAB162887B00039ECDA /* SharedWorkerProcessProxy.messages.in */, @@ -4743,6 +4839,14 @@ 513A163D163088F6005D7D22 /* NetworkProcessProxyMessages.h in Headers */, 513A164D1630A9BF005D7D22 /* NetworkConnectionToWebProcess.h in Headers */, 1A13BEB41635A9C800F19C03 /* StringReference.h in Headers */, + 51DD9F2916367DA2001578E9 /* NetworkConnectionToWebProcessMessages.h in Headers */, + 51829DA61637C70C000953D6 /* NetworkResourceLoadScheduler.h in Headers */, + 512C06891638F67E00ABB911 /* HostRecord.h in Headers */, + 517CF0E0163A444C00C2950E /* NetworkRequest.h in Headers */, + 517CF0E4163A486C00C2950E /* NetworkProcessConnectionMessages.h in Headers */, + E1B78471163F24690007B692 /* RemoteNetworkingContext.h in Headers */, + 1AB16ADE1648598400290D62 /* RemoteLayerTreeDrawingArea.h in Headers */, + 1AB16AE21648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -4829,8 +4933,6 @@ 5D1A239215E760590023E981 /* Remove Compiled Python Files */, 8DC2EF540486A6940098B216 /* Sources */, 8DC2EF560486A6940098B216 /* Frameworks */, - 5DF408C0131DD37C00130071 /* Check For Global Initializers */, - 5DF408C4131DD3DB00130071 /* Check For Exit Time Destructors */, 5DF408C5131DD46700130071 /* Check For Weak VTables and Externals */, 3713F0231429063D0036387F /* Check For Inappropriate Objective-C Class Names */, 5DF408C6131DD49700130071 /* Check For Framework Include Consistency */, @@ -5048,36 +5150,6 @@ shellPath = /bin/sh; shellScript = "find \"${BUILT_PRODUCTS_DIR}/${PRIVATE_HEADERS_FOLDER_PATH}\" -name '*.pyc' -delete"; }; - 5DF408C0131DD37C00130071 /* Check For Global Initializers */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)", - ); - name = "Check For Global Initializers"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "if [ \"${TARGET_GCC_VERSION}\" = \"LLVM_COMPILER\" ]; then\n exit 0;\nfi\n\nif [ \"${ACTION}\" = \"installhdrs\" ]; then\n exit 0;\nfi\n\nif [ -f ../../Tools/Scripts/check-for-global-initializers ]; then\n ../../Tools/Scripts/check-for-global-initializers || exit $?\nfi"; - }; - 5DF408C4131DD3DB00130071 /* Check For Exit Time Destructors */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)", - ); - name = "Check For Exit Time Destructors"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "if [ \"${TARGET_GCC_VERSION}\" = \"LLVM_COMPILER\" ]; then\n exit 0;\nfi\n\nif [ \"${ACTION}\" = \"installhdrs\" ]; then\n exit 0;\nfi\n\nif [ -f ../../Tools/Scripts/check-for-exit-time-destructors ]; then\n ../../Tools/Scripts/check-for-exit-time-destructors || exit $?\nfi"; - }; 5DF408C5131DD46700130071 /* Check For Weak VTables and Externals */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -5166,7 +5238,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "mkdir -p \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit2\"\ncd \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit2\"\n\nexport WebKit2=\"${SRCROOT}\"\n\nif [ ! $CC ]; then\n case $TARGET_GCC_VERSION in\n (LLVM_GCC_42)\n export CC=\"`xcrun -find llvm-gcc-4.2`\";;\n (LLVM_COMPILER)\n export CC=\"`xcrun -find clang`\";;\n esac\nfi\n\nif [ \"${ACTION}\" = \"build\" -o \"${ACTION}\" = \"install\" -o \"${ACTION}\" = \"installhdrs\" ]; then\n make --no-builtin-rules -f \"${WebKit2}/DerivedSources.make\" -j `/usr/sbin/sysctl -n hw.availcpu`\nfi\n"; + shellScript = "mkdir -p \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit2\"\ncd \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit2\"\n\nexport WebKit2=\"${SRCROOT}\"\n\nif [ ! $CC ]; then\n export CC=\"`xcrun -find clang`\"\nfi\n\nif [ \"${ACTION}\" = \"build\" -o \"${ACTION}\" = \"install\" -o \"${ACTION}\" = \"installhdrs\" ]; then\n make --no-builtin-rules -f \"${WebKit2}/DerivedSources.make\" -j `/usr/sbin/sysctl -n hw.availcpu`\nfi\n"; }; E14E99FA14D879DB001D221F /* Add Entitlements */ = { isa = PBXShellScriptBuildPhase; @@ -5694,6 +5766,24 @@ 513A164C1630A9BF005D7D22 /* NetworkConnectionToWebProcess.cpp in Sources */, 5183DDEC1630BDFC008BE5C7 /* NetworkProcessConnection.cpp in Sources */, 1A13BEB31635A9C800F19C03 /* StringReference.cpp in Sources */, + 51DD9F2816367DA2001578E9 /* NetworkConnectionToWebProcessMessageReceiver.cpp in Sources */, + 51829DA51637C70C000953D6 /* NetworkResourceLoadScheduler.cpp in Sources */, + 512C06881638F67E00ABB911 /* HostRecord.cpp in Sources */, + 512C069016390E6900ABB911 /* NetworkResourceLoadSchedulerMac.mm in Sources */, + 51FB08FF1639DE1A00EC324A /* WebResourceLoadScheduler.cpp in Sources */, + 517CF0DF163A444C00C2950E /* NetworkRequest.cpp in Sources */, + 517CF0E3163A486C00C2950E /* NetworkProcessConnectionMessageReceiver.cpp in Sources */, + E1B78473163F253E0007B692 /* RemoteNetworkingContext.mm in Sources */, + 2D2ADF0916362DD500197E47 /* PDFPluginTextAnnotation.mm in Sources */, + 2D2ADF0B16362DDB00197E47 /* PDFPluginAnnotation.mm in Sources */, + 2D2ADF1016364D8200197E47 /* PDFPluginChoiceAnnotation.mm in Sources */, + 1AB16ADD1648598400290D62 /* RemoteLayerTreeDrawingArea.mm in Sources */, + 1AB16AE11648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.mm in Sources */, + 9F54F88F16488E87007DF81A /* ChildProcessMac.mm in Sources */, + 9F54F8951648AE0F007DF81A /* PluginProcessManagerMac.mm in Sources */, + 9F4F59421648B40700493B7E /* SharedWorkerProcessManagerMac.mm in Sources */, + 9F4F59441648B67F00493B7E /* SharedWorkerProcessProxyMac.mm in Sources */, + 9F4F59461648BA8E00493B7E /* NetworkProcessManagerMac.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Source/WebKit2/WebKit2Prefix.h b/Source/WebKit2/WebKit2Prefix.h index 8f6b099f1..0673ec86d 100644 --- a/Source/WebKit2/WebKit2Prefix.h +++ b/Source/WebKit2/WebKit2Prefix.h @@ -55,10 +55,6 @@ #endif #endif -#endif // PLATFORM(MAC) - -#if PLATFORM(MAC) - #if ENABLE(PLUGIN_PROCESS) #define ENABLE_SHARED_WORKER_PROCESS 1 #endif diff --git a/Source/WebKit2/WebProcess/Battery/WebBatteryManager.cpp b/Source/WebKit2/WebProcess/Battery/WebBatteryManager.cpp index 0892f2178..3cb06b398 100644 --- a/Source/WebKit2/WebProcess/Battery/WebBatteryManager.cpp +++ b/Source/WebKit2/WebProcess/Battery/WebBatteryManager.cpp @@ -28,6 +28,7 @@ #if ENABLE(BATTERY_STATUS) +#include "WebBatteryManagerMessages.h" #include "WebBatteryManagerProxyMessages.h" #include "WebPage.h" #include "WebProcess.h" @@ -42,6 +43,7 @@ namespace WebKit { WebBatteryManager::WebBatteryManager(WebProcess* process) : m_process(process) { + m_process->addMessageReceiver(Messages::WebBatteryManager::messageReceiverName(), this); } WebBatteryManager::~WebBatteryManager() diff --git a/Source/WebKit2/WebProcess/Battery/WebBatteryManager.h b/Source/WebKit2/WebProcess/Battery/WebBatteryManager.h index 45fab18c1..d47dea4d1 100644 --- a/Source/WebKit2/WebProcess/Battery/WebBatteryManager.h +++ b/Source/WebKit2/WebProcess/Battery/WebBatteryManager.h @@ -28,24 +28,19 @@ #if ENABLE(BATTERY_STATUS) -#include "MessageID.h" +#include "MessageReceiver.h" #include "WebBatteryStatus.h" #include "WebCoreArgumentCoders.h" #include <wtf/HashSet.h> #include <wtf/Noncopyable.h> #include <wtf/text/AtomicString.h> -namespace CoreIPC { -class Connection; -class MessageDecoder; -} - namespace WebKit { class WebPage; class WebProcess; -class WebBatteryManager { +class WebBatteryManager : private CoreIPC::MessageReceiver { WTF_MAKE_NONCOPYABLE(WebBatteryManager); public: @@ -58,9 +53,10 @@ public: void didChangeBatteryStatus(const WTF::AtomicString& eventType, const WebBatteryStatus::Data&); void updateBatteryStatus(const WebBatteryStatus::Data&); - void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); - private: + // CoreIPC::MessageReceiver + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE; + // Implemented in generated WebBatteryManagerMessageReceiver.cpp void didReceiveWebBatteryManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); diff --git a/Source/WebKit2/WebProcess/Cookies/mac/WebCookieManagerMac.mm b/Source/WebKit2/WebProcess/Cookies/mac/WebCookieManagerMac.mm index daf39cdc7..0584307d6 100644 --- a/Source/WebKit2/WebProcess/Cookies/mac/WebCookieManagerMac.mm +++ b/Source/WebKit2/WebProcess/Cookies/mac/WebCookieManagerMac.mm @@ -34,12 +34,10 @@ namespace WebKit { void WebCookieManager::platformSetHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy policy) { - [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:policy]; + [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:static_cast<NSHTTPCookieAcceptPolicy>(policy)]; -#if USE(CFURLSTORAGESESSIONS) if (RetainPtr<CFHTTPCookieStorageRef> cookieStorage = currentCFHTTPCookieStorage()) WKSetHTTPCookieAcceptPolicy(cookieStorage.get(), policy); -#endif } HTTPCookieAcceptPolicy WebCookieManager::platformGetHTTPCookieAcceptPolicy() diff --git a/Source/WebKit2/WebProcess/IconDatabase/WebIconDatabaseProxy.cpp b/Source/WebKit2/WebProcess/IconDatabase/WebIconDatabaseProxy.cpp index a04793eb4..c9360b3ee 100644 --- a/Source/WebKit2/WebProcess/IconDatabase/WebIconDatabaseProxy.cpp +++ b/Source/WebKit2/WebProcess/IconDatabase/WebIconDatabaseProxy.cpp @@ -27,8 +27,8 @@ #include "WebIconDatabaseProxy.h" #include "DataReference.h" -#include "MessageID.h" #include "WebIconDatabaseMessages.h" +#include "WebIconDatabaseProxyMessages.h" #include "WebProcess.h" #include <WebCore/SharedBuffer.h> #include <wtf/text/WTFString.h> @@ -45,6 +45,7 @@ WebIconDatabaseProxy::WebIconDatabaseProxy(WebProcess* process) : m_isEnabled(false) , m_process(process) { + m_process->addMessageReceiver(Messages::WebIconDatabaseProxy::messageReceiverName(), this); } bool WebIconDatabaseProxy::isEnabled() const @@ -61,7 +62,6 @@ void WebIconDatabaseProxy::setEnabled(bool enabled) setGlobalIconDatabase(enabled ? this : 0); } - void WebIconDatabaseProxy::retainIconForPageURL(const String& pageURL) { m_process->connection()->send(Messages::WebIconDatabase::RetainIconForPageURL(pageURL), 0); diff --git a/Source/WebKit2/WebProcess/IconDatabase/WebIconDatabaseProxy.h b/Source/WebKit2/WebProcess/IconDatabase/WebIconDatabaseProxy.h index cd9f7176e..16f8ea7a1 100644 --- a/Source/WebKit2/WebProcess/IconDatabase/WebIconDatabaseProxy.h +++ b/Source/WebKit2/WebProcess/IconDatabase/WebIconDatabaseProxy.h @@ -27,33 +27,25 @@ #define WebIconDatabaseProxy_h #include "APIObject.h" - +#include "MessageReceiver.h" #include <WebCore/IconDatabaseBase.h> - #include <wtf/HashMap.h> #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> #include <wtf/Vector.h> -namespace CoreIPC { -class Connection; -class MessageDecoder; -class MessageID; -} - namespace WebKit { class WebProcess; -class WebIconDatabaseProxy : public WebCore::IconDatabaseBase { +class WebIconDatabaseProxy : public WebCore::IconDatabaseBase, private CoreIPC::MessageReceiver { public: explicit WebIconDatabaseProxy(WebProcess*); virtual ~WebIconDatabaseProxy(); virtual bool isEnabled() const; void setEnabled(bool); - - + virtual void retainIconForPageURL(const String&); virtual void releaseIconForPageURL(const String&); virtual void setIconURLForPageURL(const String&, const String&); @@ -69,10 +61,12 @@ public: virtual void loadDecisionForIconURL(const String&, PassRefPtr<WebCore::IconLoadDecisionCallback>); void receivedIconLoadDecision(int decision, uint64_t callbackID); virtual void iconDataForIconURL(const String&, PassRefPtr<WebCore::IconDataCallback>); - - void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); - + private: + // CoreIPC::MessageReceiver + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE; + + // Implemented in generated WebIconDatabaseProxyMessageReceiver.cpp void didReceiveWebIconDatabaseProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); // Callbacks from the UIProcess diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp index 7210a9d9e..95273a704 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp @@ -329,6 +329,11 @@ void WKBundleSetSerialLoadingEnabled(WKBundleRef bundleRef, bool enabled) toImpl(bundleRef)->setSerialLoadingEnabled(enabled); } +void WKBundleSetShadowDOMEnabled(WKBundleRef bundleRef, bool enabled) +{ + toImpl(bundleRef)->setShadowDOMEnabled(enabled); +} + void WKBundleDispatchPendingLoadRequests(WKBundleRef bundleRef) { toImpl(bundleRef)->dispatchPendingLoadRequests(); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp index 24188fff2..f00e03539 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp @@ -32,6 +32,7 @@ #include "WKBundleAPICast.h" #include "WKData.h" #include "WebFrame.h" +#include "WebSecurityOrigin.h" #include <WebCore/Frame.h> #include <WebCore/FrameView.h> @@ -286,3 +287,12 @@ WKBundleHitTestResultRef WKBundleFrameCreateHitTestResult(WKBundleFrameRef frame { return toAPI(toImpl(frameRef)->hitTest(toIntPoint(point)).leakRef()); } + +WKSecurityOriginRef WKBundleFrameCopySecurityOrigin(WKBundleFrameRef frameRef) +{ + Frame* coreFrame = toImpl(frameRef)->coreFrame(); + if (!coreFrame) + return 0; + + return toCopiedAPI(coreFrame->document()->securityOrigin()); +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h index 021aec0ed..8c2b875f5 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h @@ -44,6 +44,7 @@ WK_EXPORT WKArrayRef WKBundleFrameCopyChildFrames(WKBundleFrameRef frame); WK_EXPORT WKStringRef WKBundleFrameCopyName(WKBundleFrameRef frame); WK_EXPORT WKURLRef WKBundleFrameCopyURL(WKBundleFrameRef frame); WK_EXPORT WKURLRef WKBundleFrameCopyProvisionalURL(WKBundleFrameRef frame); +WK_EXPORT WKSecurityOriginRef WKBundleFrameCopySecurityOrigin(WKBundleFrameRef frame); WK_EXPORT WKFrameLoadState WKBundleFrameGetFrameLoadState(WKBundleFrameRef frame); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h index 369c4302f..15b2e7c85 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h @@ -102,6 +102,7 @@ WK_EXPORT size_t WKBundleGetWorkerThreadCount(WKBundleRef bundle); WK_EXPORT void WKBundleSetTabKeyCyclesThroughElements(WKBundleRef bundle, WKBundlePageRef page, bool enabled); WK_EXPORT void WKBundleSetSerialLoadingEnabled(WKBundleRef bundle, bool enabled); +WK_EXPORT void WKBundleSetShadowDOMEnabled(WKBundleRef bundle, bool enabled); WK_EXPORT void WKBundleDispatchPendingLoadRequests(WKBundleRef bundle); #ifdef __cplusplus diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.h b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.h index f33e454cd..7407a9137 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.h @@ -111,6 +111,10 @@ WKDOMText *toWKDOMText(WebCore::Text*); WebCore::Range* toWebCoreRange(WKDOMRange *); WKDOMRange *toWKDOMRange(WebCore::Range*); +// -- Helpers -- + +NSArray *toNSArray(const Vector<WebCore::IntRect>&); + } // namespace WebKit #endif // defined(__LP64__) && defined(__clang__) diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm index ab9046613..70369afb6 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm @@ -165,6 +165,15 @@ static WKDOMType toWKDOMType(WebCoreType impl, DOMCache<WebCoreType, WKDOMType>& return [wrapper autorelease]; } +NSArray *toNSArray(const Vector<WebCore::IntRect>& rects) +{ + size_t size = rects.size(); + NSMutableArray *array = [NSMutableArray arrayWithCapacity:size]; + for (size_t i = 0; i < size; ++i) + [array addObject:[NSValue valueWithRect:rects[i]]]; + return array; +} + } // namespace WebKit #endif // defined(__LP64__) && defined(__clang__) diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.h b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.h index 40a8f9c90..d804d9641 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.h @@ -43,6 +43,7 @@ WK_EXPORT @property(readonly) WKDOMNode *lastChild; @property(readonly) WKDOMNode *previousSibling; @property(readonly) WKDOMNode *nextSibling; +@property(readonly) NSArray *textRects; @end diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.mm b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.mm index a3296bfc0..5b86f746d 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.mm +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.mm @@ -30,6 +30,7 @@ #import "WKDOMNode.h" #import "WKDOMInternals.h" +#import <WebCore/Document.h> @implementation WKDOMNode @@ -102,6 +103,16 @@ return WebKit::toWKDOMNode(_impl->nextSibling()); } +- (NSArray *)textRects +{ + _impl->document()->updateLayoutIgnorePendingStylesheets(); + if (!_impl->renderer()) + return nil; + Vector<WebCore::IntRect> rects; + _impl->textRects(rects); + return WebKit::toNSArray(rects); +} + @end #endif // defined(__LP64__) && defined(__clang__) diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.h b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.h index 64ed00ce2..43b9a1c43 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.h @@ -47,6 +47,7 @@ WK_EXPORT @property(readonly) NSInteger endOffset; @property(readonly, copy) NSString *text; @property(readonly) BOOL isCollapsed; +@property(readonly) NSArray *textRects; @end diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.mm b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.mm index 1cc408408..81f066ca1 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.mm +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.mm @@ -137,6 +137,14 @@ return _impl->collapsed(ec); } +- (NSArray *)textRects +{ + _impl->ownerDocument()->updateLayoutIgnorePendingStylesheets(); + Vector<WebCore::IntRect> rects; + _impl->textRects(rects); + return WebKit::toNSArray(rects); +} + @end #endif // defined(__LP64__) && defined(__clang__) diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h index 4a7cc50a6..f65e73b35 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h @@ -28,6 +28,7 @@ #import <Foundation/Foundation.h> #import <WebKit2/WKBase.h> +@class WKConnection; @class WKWebProcessPlugInController; @class WKWebProcessPlugInBrowserContextController; @@ -40,6 +41,9 @@ WK_EXPORT @interface WKWebProcessPlugInController : NSObject + +@property(readonly) WKConnection *connection; + @end #endif // defined(__LP64__) && defined(__clang__) diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm index d967ec29b..cbcc8492e 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm @@ -31,6 +31,7 @@ #import "WKWebProcessPlugInInternal.h" #import "InjectedBundle.h" +#import "WKConnectionInternal.h" #import "WKBundle.h" #import "WKBundleAPICast.h" #import "WKRetainPtr.h" @@ -43,6 +44,7 @@ typedef HashMap<WKBundlePageRef, RetainPtr<WKWebProcessPlugInBrowserContextContr RetainPtr<id<WKWebProcessPlugIn> > _principalClassInstance; WKRetainPtr<WKBundleRef> _bundleRef; BundlePageWrapperCache _bundlePageWrapperCache; + RetainPtr<WKConnection *> _connectionWrapper; } @end @@ -111,6 +113,7 @@ static WKWebProcessPlugInController *sharedInstance; _principalClassInstance = principalClassInstance; _bundleRef = bundleRef; + _connectionWrapper = adoptNS([[WKConnection alloc] _initWithConnectionRef:WKBundleGetApplicationConnection(_bundleRef.get())]); ASSERT_WITH_MESSAGE(!sharedInstance, "WKWebProcessPlugInController initialized multiple times."); sharedInstance = self; @@ -124,6 +127,11 @@ static WKWebProcessPlugInController *sharedInstance; @implementation WKWebProcessPlugInController +- (WKConnection *)connection +{ + return _connectionWrapper.get(); +} + @end #endif // defined(__LP64__) && defined(__clang__) diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp index 4d0aa56a3..82c122036 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp @@ -70,6 +70,10 @@ #include <wtf/OwnArrayPtr.h> #include <wtf/PassOwnArrayPtr.h> +#if ENABLE(SHADOW_DOM) +#include <WebCore/RuntimeEnabledFeatures.h> +#endif + using namespace WebCore; using namespace JSC; @@ -93,7 +97,7 @@ void InjectedBundle::initializeClient(WKBundleClient* client) void InjectedBundle::postMessage(const String& messageName, APIObject* messageBody) { - OwnPtr<CoreIPC::MessageEncoder> encoder = CoreIPC::MessageEncoder::create(CoreIPC::MessageKindTraits<WebContextLegacyMessage::Kind>::messageReceiverName(), "", 0); + OwnPtr<CoreIPC::MessageEncoder> encoder = CoreIPC::MessageEncoder::create(CoreIPC::MessageKindTraits<WebContextLegacyMessage::Kind>::messageReceiverName(), CoreIPC::StringReference("PostMessage"), 0); encoder->encode(messageName); encoder->encode(InjectedBundleUserMessageEncoder(messageBody)); @@ -105,7 +109,7 @@ void InjectedBundle::postSynchronousMessage(const String& messageName, APIObject InjectedBundleUserMessageDecoder messageDecoder(returnData); uint64_t syncRequestID; - OwnPtr<CoreIPC::MessageEncoder> encoder = WebProcess::shared().connection()->createSyncMessageEncoder(CoreIPC::MessageKindTraits<WebContextLegacyMessage::Kind>::messageReceiverName(), "", 0, syncRequestID); + OwnPtr<CoreIPC::MessageEncoder> encoder = WebProcess::shared().connection()->createSyncMessageEncoder(CoreIPC::MessageKindTraits<WebContextLegacyMessage::Kind>::messageReceiverName(), CoreIPC::StringReference("PostSynchronousMessage"), 0, syncRequestID); encoder->encode(messageName); encoder->encode(InjectedBundleUserMessageEncoder(messageBody)); @@ -279,8 +283,9 @@ void InjectedBundle::setPopupBlockingEnabled(WebPageGroupProxy* pageGroup, bool void InjectedBundle::switchNetworkLoaderToNewTestingSession() { -#if USE(CFURLSTORAGESESSIONS) +#if PLATFORM(MAC) || USE(CFNETWORK) // Set a private session for testing to avoid interfering with global cookies. This should be different from private browsing session. + // FIXME (NetworkProcess): Do this in network process, too. RetainPtr<CFURLStorageSessionRef> session = ResourceHandle::createPrivateBrowsingStorageSession(CFSTR("Private WebKit Session")); ResourceHandle::setDefaultStorageSession(session.get()); #endif @@ -622,6 +627,15 @@ void InjectedBundle::setSerialLoadingEnabled(bool enabled) resourceLoadScheduler()->setSerialLoadingEnabled(enabled); } +void InjectedBundle::setShadowDOMEnabled(bool enabled) +{ +#if ENABLE(SHADOW_DOM) + RuntimeEnabledFeatures::setShadowDOMEnabled(enabled); +#else + UNUSED_PARAM(enabled); +#endif +} + void InjectedBundle::dispatchPendingLoadRequests() { resourceLoadScheduler()->servePendingRequests(); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h index 754b13320..c621f2483 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h @@ -178,6 +178,7 @@ public: void setTabKeyCyclesThroughElements(WebPage*, bool enabled); void setSerialLoadingEnabled(bool); + void setShadowDOMEnabled(bool); void dispatchPendingLoadRequests(); private: diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h index 49d66966a..c3fb18d30 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h @@ -49,7 +49,7 @@ public: { } - void encode(CoreIPC::ArgumentEncoder* encoder) const + void encode(CoreIPC::ArgumentEncoder& encoder) const { APIObject::Type type = APIObject::TypeNull; if (baseEncode(encoder, type)) @@ -58,17 +58,17 @@ public: switch (type) { case APIObject::TypeBundlePage: { WebPage* page = static_cast<WebPage*>(m_root); - encoder->encode(page->pageID()); + encoder << page->pageID(); break; } case APIObject::TypeBundleFrame: { WebFrame* frame = static_cast<WebFrame*>(m_root); - encoder->encode(frame->frameID()); + encoder << frame->frameID(); break; } case APIObject::TypeBundlePageGroup: { WebPageGroupProxy* pageGroup = static_cast<WebPageGroupProxy*>(m_root); - encoder->encode(pageGroup->pageGroupID()); + encoder << pageGroup->pageGroupID(); break; } default: diff --git a/Source/WebKit2/WebProcess/Network/NetworkProcessConnection.cpp b/Source/WebKit2/WebProcess/Network/NetworkProcessConnection.cpp index dd9d6cbbc..10d672208 100644 --- a/Source/WebKit2/WebProcess/Network/NetworkProcessConnection.cpp +++ b/Source/WebKit2/WebProcess/Network/NetworkProcessConnection.cpp @@ -42,12 +42,18 @@ NetworkProcessConnection::~NetworkProcessConnection() { } -void NetworkProcessConnection::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) +void NetworkProcessConnection::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder) { + if (messageID.is<CoreIPC::MessageClassNetworkProcessConnection>()) { + didReceiveNetworkProcessConnectionMessage(connection, messageID, decoder); + return; + } + ASSERT_NOT_REACHED(); } void NetworkProcessConnection::didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&, OwnPtr<CoreIPC::MessageEncoder>&) { + ASSERT_NOT_REACHED(); } void NetworkProcessConnection::didClose(CoreIPC::Connection*) @@ -56,10 +62,14 @@ void NetworkProcessConnection::didClose(CoreIPC::Connection*) WebProcess::shared().networkProcessConnectionClosed(this); } -void NetworkProcessConnection::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID) +void NetworkProcessConnection::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference, CoreIPC::StringReference) { } +void NetworkProcessConnection::startResourceLoad(ResourceLoadIdentifier resourceLoadIdentifier) +{ + WebProcess::shared().webResourceLoadScheduler().startResourceLoad(resourceLoadIdentifier); +} } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Network/NetworkProcessConnection.h b/Source/WebKit2/WebProcess/Network/NetworkProcessConnection.h index 65e259843..6d6a98fdd 100644 --- a/Source/WebKit2/WebProcess/Network/NetworkProcessConnection.h +++ b/Source/WebKit2/WebProcess/Network/NetworkProcessConnection.h @@ -34,6 +34,8 @@ namespace WebKit { +typedef uint64_t ResourceLoadIdentifier; + class NetworkProcessConnection : public RefCounted<NetworkProcessConnection>, CoreIPC::Connection::Client { public: static PassRefPtr<NetworkProcessConnection> create(CoreIPC::Connection::Identifier connectionIdentifier) @@ -51,7 +53,11 @@ private: virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&, OwnPtr<CoreIPC::MessageEncoder>&); virtual void didClose(CoreIPC::Connection*); - virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID); + virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName) OVERRIDE; + + void didReceiveNetworkProcessConnectionMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); + + void startResourceLoad(ResourceLoadIdentifier); // The connection from the web process to the network process. RefPtr<CoreIPC::Connection> m_connection; diff --git a/Source/WebKit2/WebProcess/Network/NetworkProcessConnection.messages.in b/Source/WebKit2/WebProcess/Network/NetworkProcessConnection.messages.in new file mode 100644 index 000000000..69aeabb24 --- /dev/null +++ b/Source/WebKit2/WebProcess/Network/NetworkProcessConnection.messages.in @@ -0,0 +1,32 @@ +# Copyright (C) 2012 Apple Inc. 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. + +#if ENABLE(NETWORK_PROCESS) + +messages -> NetworkProcessConnection { + + // FIXME (NetworkProcess): This message is for the NetworkProcess to tell the WebProcess to start a load. + // Once the NetworkProcess is doing the loading itself then we should remove it. + StartResourceLoad(uint64_t resourceLoadIdentifier) +} + +#endif // ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp b/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp new file mode 100644 index 000000000..def60e45a --- /dev/null +++ b/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp @@ -0,0 +1,213 @@ +/* + * Copyright (C) 2012 Apple Inc. 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 "WebResourceLoadScheduler.h" + +#include "Logging.h" +#include "NetworkConnectionToWebProcessMessages.h" +#include "NetworkProcessConnection.h" +#include "WebCoreArgumentCoders.h" +#include "WebProcess.h" +#include <WebCore/DocumentLoader.h> +#include <WebCore/Frame.h> +#include <WebCore/FrameLoader.h> +#include <WebCore/NetscapePlugInStreamLoader.h> +#include <WebCore/ResourceLoader.h> +#include <WebCore/SubresourceLoader.h> +#include <wtf/text/CString.h> + +#if ENABLE(NETWORK_PROCESS) + +using namespace WebCore; + +namespace WebKit { + +WebResourceLoadScheduler::WebResourceLoadScheduler() + : m_suspendPendingRequestsCount(0) +{ +} + +WebResourceLoadScheduler::~WebResourceLoadScheduler() +{ +} + +PassRefPtr<SubresourceLoader> WebResourceLoadScheduler::scheduleSubresourceLoad(Frame* frame, CachedResource* resource, const ResourceRequest& request, ResourceLoadPriority priority, const ResourceLoaderOptions& options) +{ + RefPtr<SubresourceLoader> loader = SubresourceLoader::create(frame, resource, request, options); + if (loader) + scheduleLoad(loader.get(), priority); + return loader.release(); +} + +PassRefPtr<NetscapePlugInStreamLoader> WebResourceLoadScheduler::schedulePluginStreamLoad(Frame* frame, NetscapePlugInStreamLoaderClient* client, const ResourceRequest& request) +{ + RefPtr<NetscapePlugInStreamLoader> loader = NetscapePlugInStreamLoader::create(frame, client, request); + if (loader) + scheduleLoad(loader.get(), ResourceLoadPriorityLow); + return loader.release(); +} + +void WebResourceLoadScheduler::scheduleLoad(ResourceLoader* resourceLoader, ResourceLoadPriority priority) +{ + LOG(Network, "(WebProcess) WebResourceLoadScheduler::scheduleLoad, url '%s' priority %i", resourceLoader->url().string().utf8().data(), priority); + + ASSERT(resourceLoader); + ASSERT(priority != ResourceLoadPriorityUnresolved); + priority = ResourceLoadPriorityHighest; + + // If there's a web archive resource for this URL, we don't need to schedule the load since it will never touch the network. + if (resourceLoader->documentLoader()->archiveResourceForURL(resourceLoader->request().url())) { + startResourceLoader(resourceLoader); + return; + } + + ResourceLoadIdentifier identifier; + + ResourceRequest request = resourceLoader->request(); + + // We want the network process involved in scheduling data URL loads but it doesn't need to know the full (often long) URL. + if (request.url().protocolIsData()) { + DEFINE_STATIC_LOCAL(KURL, dataURL, (KURL(), "data:")); + request.setURL(dataURL); + } + + if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::ScheduleNetworkRequest(request, priority), Messages::NetworkConnectionToWebProcess::ScheduleNetworkRequest::Reply(identifier), 0)) { + // FIXME (NetworkProcess): What should we do if this fails? + ASSERT_NOT_REACHED(); + } + + resourceLoader->setIdentifier(identifier); + m_pendingResourceLoaders.set(identifier, resourceLoader); + + notifyDidScheduleResourceRequest(resourceLoader); +} + +void WebResourceLoadScheduler::addMainResourceLoad(ResourceLoader* resourceLoader) +{ + LOG(Network, "(WebProcess) WebResourceLoadScheduler::addMainResourceLoad, url '%s'", resourceLoader->url().string().utf8().data()); + + ResourceLoadIdentifier identifier; + + if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::AddLoadInProgress(resourceLoader->url()), Messages::NetworkConnectionToWebProcess::AddLoadInProgress::Reply(identifier), 0)) { + // FIXME (NetworkProcess): What should we do if this fails? + ASSERT_NOT_REACHED(); + } + + resourceLoader->setIdentifier(identifier); + + m_activeResourceLoaders.set(identifier, resourceLoader); +} + +void WebResourceLoadScheduler::remove(ResourceLoader* resourceLoader) +{ + ASSERT(resourceLoader); + LOG(Network, "(WebProcess) WebResourceLoadScheduler::remove, url '%s'", resourceLoader->url().string().utf8().data()); + + // FIXME (NetworkProcess): It's possible for a resourceLoader to be removed before it ever started, + // meaning before it even has an identifier. + // We should make this not be possible. + // The ResourceLoader code path should always for an identifier to ResourceLoaders. + + ResourceLoadIdentifier identifier = resourceLoader->identifier(); + if (!identifier) { + LOG_ERROR("WebResourceLoadScheduler removing a ResourceLoader that has no identifier."); + return; + } + + WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::RemoveLoadIdentifier(identifier), 0); + + ASSERT(m_pendingResourceLoaders.contains(identifier) || m_activeResourceLoaders.contains(identifier)); + m_pendingResourceLoaders.remove(identifier); + m_activeResourceLoaders.remove(identifier); +} + +void WebResourceLoadScheduler::crossOriginRedirectReceived(ResourceLoader* resourceLoader, const KURL& redirectURL) +{ + LOG(Network, "(WebProcess) WebResourceLoadScheduler::crossOriginRedirectReceived. From '%s' to '%s'", resourceLoader->url().string().utf8().data(), redirectURL.string().utf8().data()); + + ASSERT(resourceLoader); + ASSERT(resourceLoader->identifier()); + + if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::crossOriginRedirectReceived(resourceLoader->identifier(), redirectURL), Messages::NetworkConnectionToWebProcess::crossOriginRedirectReceived::Reply(), 0)) { + // FIXME (NetworkProcess): What should we do if this fails? + ASSERT_NOT_REACHED(); + } +} + +void WebResourceLoadScheduler::servePendingRequests(ResourceLoadPriority minimumPriority) +{ + LOG(Network, "(WebProcess) WebResourceLoadScheduler::servePendingRequests"); + + // If this WebProcess has its own request suspension count then we don't even + // have to bother messaging the NetworkProcess. + if (m_suspendPendingRequestsCount) + return; + + WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::ServePendingRequests(minimumPriority), 0); +} + +void WebResourceLoadScheduler::suspendPendingRequests() +{ + WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::SuspendPendingRequests(), Messages::NetworkConnectionToWebProcess::SuspendPendingRequests::Reply(), 0); + + ++m_suspendPendingRequestsCount; +} + +void WebResourceLoadScheduler::resumePendingRequests() +{ + WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::ResumePendingRequests(), Messages::NetworkConnectionToWebProcess::ResumePendingRequests::Reply(), 0); + + ASSERT(m_suspendPendingRequestsCount); + --m_suspendPendingRequestsCount; +} + +void WebResourceLoadScheduler::setSerialLoadingEnabled(bool enabled) +{ + WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::SetSerialLoadingEnabled(enabled), Messages::NetworkConnectionToWebProcess::SetSerialLoadingEnabled::Reply(), 0); +} + +void WebResourceLoadScheduler::startResourceLoad(ResourceLoadIdentifier identifier) +{ + RefPtr<ResourceLoader> loader = m_pendingResourceLoaders.take(identifier); + + // <rdar://problem/12596761> and http://webkit.org/b/100792 + // There is a race condition where the WebProcess might tell the NetworkProcess to remove a resource load identifier + // at the very time the NetworkProcess is telling the WebProcess to start that particular load. + // We'd like to remove that race condition but it makes sense for release builds to do an early return. + ASSERT(loader); + if (!loader) + return; + + LOG(Network, "(WebProcess) WebResourceLoadScheduler::startResourceLoad starting load for '%s'", loader->url().string().utf8().data()); + + m_activeResourceLoaders.set(identifier, loader); + + startResourceLoader(loader.get()); +} + +} // namespace WebKit + +#endif // ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.h b/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.h new file mode 100644 index 000000000..422427bc6 --- /dev/null +++ b/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.h @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2012 Apple Inc. 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 WebResourceLoadScheduler_h +#define WebResourceLoadScheduler_h + +#include <WebCore/ResourceLoadPriority.h> +#include <WebCore/ResourceLoadScheduler.h> +#include <WebCore/ResourceLoader.h> + +#if ENABLE(NETWORK_PROCESS) + +namespace WebKit { + +class NetworkProcessConnection; +typedef uint64_t ResourceLoadIdentifier; + +class WebResourceLoadScheduler : public WebCore::ResourceLoadScheduler { + WTF_MAKE_NONCOPYABLE(WebResourceLoadScheduler); WTF_MAKE_FAST_ALLOCATED; +public: + WebResourceLoadScheduler(); + virtual ~WebResourceLoadScheduler(); + + virtual PassRefPtr<WebCore::SubresourceLoader> scheduleSubresourceLoad(WebCore::Frame*, WebCore::CachedResource*, const WebCore::ResourceRequest&, WebCore::ResourceLoadPriority, const WebCore::ResourceLoaderOptions&) OVERRIDE; + virtual PassRefPtr<WebCore::NetscapePlugInStreamLoader> schedulePluginStreamLoad(WebCore::Frame*, WebCore::NetscapePlugInStreamLoaderClient*, const WebCore::ResourceRequest&) OVERRIDE; + + virtual void addMainResourceLoad(WebCore::ResourceLoader*) OVERRIDE; + virtual void remove(WebCore::ResourceLoader*) OVERRIDE; + virtual void crossOriginRedirectReceived(WebCore::ResourceLoader*, const WebCore::KURL& redirectURL) OVERRIDE; + + virtual void servePendingRequests(WebCore::ResourceLoadPriority minimumPriority = WebCore::ResourceLoadPriorityVeryLow) OVERRIDE; + + virtual void suspendPendingRequests() OVERRIDE; + virtual void resumePendingRequests() OVERRIDE; + + virtual void setSerialLoadingEnabled(bool) OVERRIDE; + +private: + void scheduleLoad(WebCore::ResourceLoader*, WebCore::ResourceLoadPriority); + + // NetworkProcessConnection gets to tell loads to actually start. + // FIXME (NetworkProcess): Once actual loading takes place in the NetworkProcess we won't need this. + friend class NetworkProcessConnection; + void startResourceLoad(ResourceLoadIdentifier); + + typedef HashMap<unsigned long, RefPtr<WebCore::ResourceLoader> > ResourceLoaderMap; + ResourceLoaderMap m_pendingResourceLoaders; + ResourceLoaderMap m_activeResourceLoaders; + + unsigned m_suspendPendingRequestsCount; + +}; + +} // namespace WebKit + +#endif // ENABLE(NETWORK_PROCESS) + +#endif // WebResourceLoadScheduler_h diff --git a/Source/WebKit2/WebProcess/NetworkInfo/WebNetworkInfoManager.cpp b/Source/WebKit2/WebProcess/NetworkInfo/WebNetworkInfoManager.cpp index 631f02234..cba67fedb 100644 --- a/Source/WebKit2/WebProcess/NetworkInfo/WebNetworkInfoManager.cpp +++ b/Source/WebKit2/WebProcess/NetworkInfo/WebNetworkInfoManager.cpp @@ -28,6 +28,7 @@ #if ENABLE(NETWORK_INFO) +#include "WebNetworkInfoManagerMessages.h" #include "WebNetworkInfoManagerProxyMessages.h" #include "WebPage.h" #include "WebProcess.h" @@ -42,6 +43,7 @@ namespace WebKit { WebNetworkInfoManager::WebNetworkInfoManager(WebProcess* process) : m_process(process) { + m_process->addMessageReceiver(Messages::WebNetworkInfoManager::messageReceiverName(), this); } WebNetworkInfoManager::~WebNetworkInfoManager() diff --git a/Source/WebKit2/WebProcess/NetworkInfo/WebNetworkInfoManager.h b/Source/WebKit2/WebProcess/NetworkInfo/WebNetworkInfoManager.h index dfe9afa95..ee3282f4f 100644 --- a/Source/WebKit2/WebProcess/NetworkInfo/WebNetworkInfoManager.h +++ b/Source/WebKit2/WebProcess/NetworkInfo/WebNetworkInfoManager.h @@ -28,24 +28,19 @@ #if ENABLE(NETWORK_INFO) -#include "MessageID.h" +#include "MessageReceiver.h" #include "WebCoreArgumentCoders.h" #include "WebNetworkInfo.h" #include <wtf/HashSet.h> #include <wtf/Noncopyable.h> #include <wtf/text/AtomicString.h> -namespace CoreIPC { -class Connection; -class MessageDecoder; -} - namespace WebKit { class WebProcess; class WebPage; -class WebNetworkInfoManager { +class WebNetworkInfoManager : private CoreIPC::MessageReceiver { WTF_MAKE_NONCOPYABLE(WebNetworkInfoManager); public: explicit WebNetworkInfoManager(WebProcess*); @@ -56,10 +51,10 @@ public: double bandwidth(WebPage*) const; bool metered(WebPage*) const; - - void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); - private: + // CoreIPC::MessageReceiver + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE; + // Implemented in generated WebNetworkInfoManagerMessageReceiver.cpp void didReceiveWebNetworkInfoManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); diff --git a/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp b/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp index fb42bcc43..35070e144 100644 --- a/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp +++ b/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp @@ -31,6 +31,7 @@ #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) #include "WebNotification.h" +#include "WebNotificationManagerMessages.h" #include "WebNotificationManagerProxyMessages.h" #include "WebPageProxyMessages.h" #include <WebCore/Document.h> @@ -57,6 +58,9 @@ static uint64_t generateNotificationID() WebNotificationManager::WebNotificationManager(WebProcess* process) : m_process(process) { +#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) + m_process->addMessageReceiver(Messages::WebNotificationManager::messageReceiverName(), this); +#endif } WebNotificationManager::~WebNotificationManager() @@ -170,7 +174,7 @@ void WebNotificationManager::cancel(Notification* notification, WebPage* page) if (!notificationID) return; - m_process->connection()->send(Messages::WebNotificationManagerProxy::Cancel(notificationID), page->pageID()); + m_process->connection()->send(Messages::WebNotificationManagerProxy::Cancel(notificationID), 0); #else UNUSED_PARAM(notification); UNUSED_PARAM(page); @@ -185,7 +189,7 @@ void WebNotificationManager::clearNotifications(WebCore::ScriptExecutionContext* return; Vector<uint64_t>& notificationIDs = it->value; - m_process->connection()->send(Messages::WebNotificationManagerProxy::ClearNotifications(notificationIDs), page->pageID()); + m_process->connection()->send(Messages::WebNotificationManagerProxy::ClearNotifications(notificationIDs), 0); size_t count = notificationIDs.size(); for (size_t i = 0; i < count; ++i) { RefPtr<Notification> notification = m_notificationIDMap.take(notificationIDs[i]); @@ -211,7 +215,7 @@ void WebNotificationManager::didDestroyNotification(Notification* notification, m_notificationIDMap.remove(notificationID); removeNotificationFromContextMap(notificationID, notification); - m_process->connection()->send(Messages::WebNotificationManagerProxy::DidDestroyNotification(notificationID), page->pageID()); + m_process->connection()->send(Messages::WebNotificationManagerProxy::DidDestroyNotification(notificationID), 0); #else UNUSED_PARAM(notification); UNUSED_PARAM(page); diff --git a/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.h b/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.h index a3f658f24..9f505aa90 100644 --- a/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.h +++ b/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.h @@ -26,7 +26,7 @@ #ifndef WebNotificationManager_h #define WebNotificationManager_h -#include "MessageID.h" +#include "MessageReceiver.h" #include <WebCore/NotificationClient.h> #include <wtf/HashMap.h> #include <wtf/Noncopyable.h> @@ -34,11 +34,6 @@ #include <wtf/Vector.h> #include <wtf/text/StringHash.h> -namespace CoreIPC { -class Connection; -class MessageDecoder; -} - namespace WebCore { class Notification; class SecurityOrigin; @@ -49,7 +44,7 @@ namespace WebKit { class WebPage; class WebProcess; -class WebNotificationManager { +class WebNotificationManager : private CoreIPC::MessageReceiver { WTF_MAKE_NONCOPYABLE(WebNotificationManager); public: explicit WebNotificationManager(WebProcess*); @@ -63,7 +58,6 @@ public: // This callback comes from WebCore, not messaged from the UI process. void didDestroyNotification(WebCore::Notification*, WebPage*); - void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); void didUpdateNotificationDecision(const String& originString, bool allowed); // Looks in local cache for permission. If not found, returns DefaultDenied. @@ -73,6 +67,9 @@ public: uint64_t notificationIDForTesting(WebCore::Notification*); private: + // CoreIPC::MessageReceiver + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE; + // Implemented in generated WebNotificationManagerMessageReceiver.cpp void didReceiveWebNotificationManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp index 27b10e726..5da43a7e4 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp @@ -52,12 +52,13 @@ namespace WebKit { class PluginDestructionProtector { public: explicit PluginDestructionProtector(NetscapePlugin* plugin) - : m_protector(static_cast<Plugin*>(plugin)->controller()) { + if (plugin) + m_protector = adoptPtr(new PluginController::PluginDestructionProtector(static_cast<Plugin*>(plugin)->controller())); } private: - PluginController::PluginDestructionProtector m_protector; + OwnPtr<PluginController::PluginDestructionProtector> m_protector; }; static bool startsWithBlankLine(const char* bytes, unsigned length) @@ -272,8 +273,8 @@ static String makeURLString(const char* url) String urlString(url); // Strip return characters. - urlString.replace('\r', ""); - urlString.replace('\n', ""); + urlString.replaceWithLiteral('\r', ""); + urlString.replaceWithLiteral('\n', ""); return urlString; } diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp index 374eb4414..3b9c6125b 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp @@ -112,12 +112,10 @@ NetscapePlugin::~NetscapePlugin() PassRefPtr<NetscapePlugin> NetscapePlugin::fromNPP(NPP npp) { - if (npp) - return static_cast<NetscapePlugin*>(npp->ndata); + if (!npp) + return 0; - // FIXME: Return the current NetscapePlugin here. - ASSERT_NOT_REACHED(); - return 0; + return static_cast<NetscapePlugin*>(npp->ndata); } void NetscapePlugin::invalidate(const NPRect* invalidRect) diff --git a/Source/WebKit2/WebProcess/Plugins/PDF/PDFLayerControllerDetails.h b/Source/WebKit2/WebProcess/Plugins/PDF/PDFLayerControllerDetails.h new file mode 100644 index 000000000..6e7b52af2 --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/PDF/PDFLayerControllerDetails.h @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2012 Apple Inc. 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. + */ + +#import <PDFKit/PDFKit.h> + +@protocol PDFLayerControllerDelegate <NSObject> + +- (void)updateScrollPosition:(CGPoint)newPosition; +- (void)writeItemsToPasteboard:(NSArray *)items withTypes:(NSArray *)types; +- (void)showDefinitionForAttributedString:(NSAttributedString *)string atPoint:(CGPoint)point; +- (void)performWebSearch:(NSString *)string; +- (void)openWithPreview; +- (void)saveToPDF; + +- (void)pdfLayerController:(PDFLayerController *)pdfLayerController didChangeActiveAnnotation:(PDFAnnotation *)annotation; + +@end + +@interface PDFLayerController : NSObject +@end + +@interface PDFLayerController (Details) + +@property(retain) CALayer *parentLayer; +@property(retain) PDFDocument *document; +@property(retain) id<PDFLayerControllerDelegate> delegate; + +- (void)setFrameSize:(CGSize)size; + +- (void)setDisplayMode:(int)mode; +- (void)setDisplaysPageBreaks:(BOOL)pageBreaks; + +- (CGFloat)tileScaleFactor; +- (void)setTileScaleFactor:(CGFloat)scaleFactor; + +- (CGSize)contentSize; +- (CGSize)contentSizeRespectingZoom; + +- (void)snapshotInContext:(CGContextRef)context; + +- (void)magnifyWithMagnification:(CGFloat)magnification atPoint:(CGPoint)point immediately:(BOOL)immediately; + +- (CGPoint)scrollPosition; +- (void)setScrollPosition:(CGPoint)newPosition; +- (void)scrollWithDelta:(CGSize)delta; + +- (void)mouseDown:(NSEvent *)event; +- (void)mouseMoved:(NSEvent *)event; +- (void)mouseUp:(NSEvent *)event; +- (void)mouseDragged:(NSEvent *)event; +- (void)mouseEntered:(NSEvent *)event; +- (void)mouseExited:(NSEvent *)event; + +- (NSArray *)findString:(NSString *)string caseSensitive:(BOOL)isCaseSensitive highlightMatches:(BOOL)shouldHighlightMatches; + +- (id)currentSelection; +- (void)copySelection; +- (void)selectAll; + +- (bool)keyDown:(NSEvent *)event; + +- (void)setHUDEnabled:(BOOL)enabled; +- (BOOL)hudEnabled; + +- (CGRect)boundsForAnnotation:(PDFAnnotation *)annotation; + +@end diff --git a/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h b/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h index cd58d8721..d3641b66b 100644 --- a/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h +++ b/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h @@ -38,15 +38,18 @@ typedef const struct OpaqueJSContext* JSContextRef; typedef struct OpaqueJSValue* JSObjectRef; typedef const struct OpaqueJSValue* JSValueRef; +OBJC_CLASS PDFAnnotation; OBJC_CLASS PDFLayerController; OBJC_CLASS WKPDFLayerControllerDelegate; namespace WebCore { +class Element; struct PluginInfo; } namespace WebKit { +class PDFPluginAnnotation; class PluginView; class WebFrame; @@ -56,6 +59,7 @@ public: ~PDFPlugin(); void paintControlForLayerInContext(CALayer *, CGContextRef); + void setActiveAnnotation(PDFAnnotation *); using ScrollableArea::notifyScrollPositionChanged; @@ -77,13 +81,15 @@ private: virtual bool handleKeyboardEvent(const WebKeyboardEvent&) OVERRIDE; virtual bool handleEditingCommand(const String& commandName, const String& argument) OVERRIDE; virtual bool isEditingCommandEnabled(const String&) OVERRIDE; - virtual bool handlesPageScaleFactor() OVERRIDE { return true; } + virtual bool handlesPageScaleFactor() OVERRIDE; // ScrollableArea functions. virtual void setScrollOffset(const WebCore::IntPoint&) OVERRIDE; virtual void invalidateScrollbarRect(WebCore::Scrollbar*, const WebCore::IntRect&) OVERRIDE; virtual void invalidateScrollCornerRect(const WebCore::IntRect&) OVERRIDE; + bool supportsForms(); + RetainPtr<CALayer> m_containerLayer; RetainPtr<CALayer> m_contentLayer; RetainPtr<CALayer> m_horizontalScrollbarLayer; @@ -91,6 +97,9 @@ private: RetainPtr<CALayer> m_scrollCornerLayer; RetainPtr<PDFLayerController> m_pdfLayerController; + RefPtr<PDFPluginAnnotation> m_activeAnnotation; + RefPtr<WebCore::Element> m_annotationContainer; + WebCore::AffineTransform m_rootViewToPluginTransform; WebCore::IntPoint m_lastMousePoint; diff --git a/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm b/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm index c5a3469cd..b09c80b6c 100644 --- a/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm +++ b/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm @@ -29,6 +29,8 @@ #import "PDFPlugin.h" #import "PDFKitImports.h" +#import "PDFLayerControllerDetails.h" +#import "PDFPluginAnnotation.h" #import "PluginView.h" #import "ShareableBitmap.h" #import "WebEvent.h" @@ -36,12 +38,15 @@ #import <PDFKit/PDFKit.h> #import <QuartzCore/QuartzCore.h> #import <WebCore/ArchiveResource.h> +#import <WebCore/CSSPrimitiveValue.h> +#import <WebCore/CSSPropertyNames.h> #import <WebCore/Chrome.h> #import <WebCore/DocumentLoader.h> #import <WebCore/FocusController.h> #import <WebCore/Frame.h> #import <WebCore/FrameView.h> #import <WebCore/GraphicsContext.h> +#import <WebCore/HTMLElement.h> #import <WebCore/HTTPHeaderMap.h> #import <WebCore/LocalizedStrings.h> #import <WebCore/Page.h> @@ -51,73 +56,35 @@ #import <WebCore/ScrollAnimator.h> #import <WebCore/ScrollbarTheme.h> -@protocol PDFLayerControllerDelegate <NSObject> - -- (void)updateScrollPosition:(CGPoint)newPosition; -- (void)writeItemsToPasteboard:(NSArray *)items withTypes:(NSArray *)types; -- (void)showDefinitionForAttributedString:(NSAttributedString *)string atPoint:(CGPoint)point; -- (void)performWebSearch:(NSString *)string; -- (void)openWithPreview; -- (void)saveToPDF; - -@end - -@interface PDFLayerController : NSObject -@end - -@interface PDFLayerController (Details) - -@property (retain) CALayer *parentLayer; -@property (retain) PDFDocument *document; -@property (retain) id<PDFLayerControllerDelegate> delegate; - -- (void)setFrameSize:(CGSize)size; - -- (void)setDisplayMode:(int)mode; -- (void)setDisplaysPageBreaks:(BOOL)pageBreaks; - -- (CGFloat)tileScaleFactor; -- (void)setTileScaleFactor:(CGFloat)scaleFactor; - -- (CGSize)contentSize; -- (CGSize)contentSizeRespectingZoom; - -- (void)snapshotInContext:(CGContextRef)context; - -- (void)magnifyWithMagnification:(CGFloat)magnification atPoint:(CGPoint)point immediately:(BOOL)immediately; - -- (CGPoint)scrollPosition; -- (void)setScrollPosition:(CGPoint)newPosition; -- (void)scrollWithDelta:(CGSize)delta; - -- (void)mouseDown:(NSEvent *)event; -- (void)mouseMoved:(NSEvent *)event; -- (void)mouseUp:(NSEvent *)event; -- (void)mouseDragged:(NSEvent *)event; -- (void)mouseEntered:(NSEvent *)event; -- (void)mouseExited:(NSEvent *)event; - -- (NSArray *)findString:(NSString *)string caseSensitive:(BOOL)isCaseSensitive highlightMatches:(BOOL)shouldHighlightMatches; - -- (id)currentSelection; -- (void)copySelection; -- (void)selectAll; - -- (bool)keyDown:(NSEvent *)event; - -- (void)setHUDEnabled:(BOOL)enabled; -- (BOOL)hudEnabled; - -@end - using namespace WebCore; +// Set overflow: hidden on the annotation container so <input> elements scrolled out of view don't show +// scrollbars on the body. We can't add annotations directly to the body, because overflow: hidden on the body +// will break rubber-banding. +static const char* annotationStyle = +"#annotationContainer {" +" overflow: hidden; " +" position: absolute; " +" pointer-events: none; " +" top: 0; " +" left: 0; " +" right: 0; " +" bottom: 0; " +"} " +".annotation { " +" position: absolute; " +" pointer-events: auto; " +"} " +"textarea.annotation { " +" resize: none; " +"}"; + @interface WKPDFPluginScrollbarLayer : CALayer { WebKit::PDFPlugin* _pdfPlugin; } -@property (assign) WebKit::PDFPlugin* pdfPlugin; +@property(assign) WebKit::PDFPlugin* pdfPlugin; @end @@ -152,7 +119,7 @@ using namespace WebCore; WebKit::PDFPlugin* _pdfPlugin; } -@property (assign) WebKit::PDFPlugin* pdfPlugin; +@property(assign) WebKit::PDFPlugin* pdfPlugin; @end @@ -208,10 +175,17 @@ using namespace WebCore; // FIXME: Implement. } +- (void)pdfLayerController:(PDFLayerController *)pdfLayerController didChangeActiveAnnotation:(PDFAnnotation *)annotation +{ + _pdfPlugin->setActiveAnnotation(annotation); +} + @end namespace WebKit { +using namespace HTMLNames; + PassRefPtr<PDFPlugin> PDFPlugin::create(WebFrame* frame) { return adoptRef(new PDFPlugin(frame)); @@ -227,7 +201,19 @@ PDFPlugin::PDFPlugin(WebFrame* frame) { m_pdfLayerController.get().delegate = m_pdfLayerControllerDelegate.get(); m_pdfLayerController.get().parentLayer = m_contentLayer.get(); - + + if (supportsForms()) { + Document* document = webFrame()->coreFrame()->document(); + m_annotationContainer = document->createElement(divTag, false); + m_annotationContainer->setAttribute(idAttr, "annotationContainer"); + + RefPtr<Element> m_annotationStyle = document->createElement(styleTag, false); + m_annotationStyle->setTextContent(annotationStyle, ASSERT_NO_EXCEPTION); + + m_annotationContainer->appendChild(m_annotationStyle.get()); + document->body()->appendChild(m_annotationContainer.get()); + } + [m_containerLayer.get() addSublayer:m_contentLayer.get()]; [m_containerLayer.get() addSublayer:m_scrollCornerLayer.get()]; } @@ -298,7 +284,10 @@ void PDFPlugin::pdfDocumentDidLoad() [m_pdfLayerController.get() setFrameSize:size()]; m_pdfLayerController.get().document = document.get(); - pluginView()->setPageScaleFactor([m_pdfLayerController.get() tileScaleFactor], IntPoint()); + if (handlesPageScaleFactor()) + pluginView()->setPageScaleFactor([m_pdfLayerController.get() tileScaleFactor], IntPoint()); + + notifyScrollPositionChanged(IntPoint([m_pdfLayerController.get() scrollPosition])); calculateSizes(); updateScrollbars(); @@ -325,6 +314,9 @@ void PDFPlugin::destroy() frameView->removeScrollableArea(this); } + m_activeAnnotation = 0; + m_annotationContainer = 0; + destroyScrollbar(HorizontalScrollbar); destroyScrollbar(VerticalScrollbar); @@ -400,16 +392,24 @@ void PDFPlugin::geometryDidChange(const IntSize& pluginSize, const IntRect&, con [CATransaction begin]; [CATransaction setDisableActions:YES]; CATransform3D transform = CATransform3DMakeScale(1, -1, 1); + transform = CATransform3DTranslate(transform, 0, -pluginSize.height(), 0); - CGFloat magnification = pluginView()->pageScaleFactor() - [m_pdfLayerController.get() tileScaleFactor]; - - // FIXME: Instead of m_lastMousePoint, we should use the zoom origin from PluginView::setPageScaleFactor. - [m_pdfLayerController.get() magnifyWithMagnification:magnification atPoint:m_lastMousePoint immediately:YES]; - [m_contentLayer.get() setSublayerTransform:CATransform3DTranslate(transform, 0, -pluginSize.height(), 0)]; - [CATransaction commit]; + if (handlesPageScaleFactor()) { + CGFloat magnification = pluginView()->pageScaleFactor() - [m_pdfLayerController.get() tileScaleFactor]; + + // FIXME: Instead of m_lastMousePoint, we should use the zoom origin from PluginView::setPageScaleFactor. + if (magnification) + [m_pdfLayerController.get() magnifyWithMagnification:magnification atPoint:m_lastMousePoint immediately:YES]; + } calculateSizes(); updateScrollbars(); + + if (m_activeAnnotation) + m_activeAnnotation->updateGeometry(); + + [m_contentLayer.get() setSublayerTransform:transform]; + [CATransaction commit]; } static NSUInteger modifierFlagsFromWebEvent(const WebEvent& event) @@ -561,7 +561,14 @@ bool PDFPlugin::isEditingCommandEnabled(const String& commandName) void PDFPlugin::setScrollOffset(const IntPoint& offset) { SimplePDFPlugin::setScrollOffset(offset); + + [CATransaction begin]; [m_pdfLayerController.get() setScrollPosition:offset]; + + if (m_activeAnnotation) + m_activeAnnotation->updateGeometry(); + + [CATransaction commit]; } void PDFPlugin::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect) @@ -577,6 +584,32 @@ void PDFPlugin::invalidateScrollCornerRect(const IntRect& rect) [m_scrollCornerLayer.get() setNeedsDisplay]; } +bool PDFPlugin::handlesPageScaleFactor() +{ + return webFrame()->isMainFrame(); +} + +void PDFPlugin::setActiveAnnotation(PDFAnnotation *annotation) +{ + if (!supportsForms()) + return; + + if (m_activeAnnotation) + m_activeAnnotation->commit(); + + if (annotation) { + m_activeAnnotation = PDFPluginAnnotation::create(annotation, m_pdfLayerController.get(), this); + m_activeAnnotation->attach(m_annotationContainer.get()); + } else + m_activeAnnotation = 0; +} + +bool PDFPlugin::supportsForms() +{ + // FIXME: Should we support forms for inline PDFs? Since we touch the document, this might be difficult. + return webFrame()->isMainFrame(); +} + } // namespace WebKit #endif // ENABLE(PDFKIT_PLUGIN) diff --git a/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginAnnotation.h b/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginAnnotation.h new file mode 100644 index 000000000..d6e3ee661 --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginAnnotation.h @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2012 Apple Inc. 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 PDFPluginAnnotation_h +#define PDFPluginAnnotation_h + +#if ENABLE(PDFKIT_PLUGIN) + +#include <WebCore/EventListener.h> +#include <wtf/RefCounted.h> +#include <wtf/RetainPtr.h> + +namespace WebCore { +class Document; +class Element; +} + +OBJC_CLASS PDFAnnotation; +OBJC_CLASS PDFLayerController; + +namespace WebKit { + +class PDFPlugin; + +class PDFPluginAnnotation : public RefCounted<PDFPluginAnnotation> { +public: + static PassRefPtr<PDFPluginAnnotation> create(PDFAnnotation *, PDFLayerController *, PDFPlugin*); + virtual ~PDFPluginAnnotation(); + + WebCore::Element* element() const { return m_element.get(); } + PDFAnnotation *annotation() const { return m_annotation.get(); } + PDFPlugin* plugin() const { return m_plugin; } + + virtual void updateGeometry(); + virtual void commit() = 0; + + void attach(WebCore::Element*); + +protected: + PDFPluginAnnotation(PDFAnnotation *annotation, PDFLayerController *pdfLayerController, PDFPlugin* plugin) + : m_annotation(annotation) + , m_eventListener(PDFPluginAnnotationEventListener::create(this)) + , m_pdfLayerController(pdfLayerController) + , m_plugin(plugin) + { + } + + WebCore::Element* parent() const { return m_parent; } + PDFLayerController *pdfLayerController() const { return m_pdfLayerController; } + +private: + virtual PassRefPtr<WebCore::Element> createAnnotationElement() = 0; + + class PDFPluginAnnotationEventListener : public WebCore::EventListener { + public: + static PassRefPtr<PDFPluginAnnotationEventListener> create(PDFPluginAnnotation* annotation) + { + return adoptRef(new PDFPluginAnnotationEventListener(annotation)); + } + + virtual bool operator==(const EventListener& listener) OVERRIDE { return this == &listener; } + + private: + + PDFPluginAnnotationEventListener(PDFPluginAnnotation* annotation) + : WebCore::EventListener(WebCore::EventListener::CPPEventListenerType) + , m_annotation(annotation) + { + } + + virtual void handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event*) OVERRIDE; + + PDFPluginAnnotation* m_annotation; + }; + + WebCore::Element* m_parent; + + RefPtr<WebCore::Element> m_element; + RetainPtr<PDFAnnotation> m_annotation; + + RefPtr<PDFPluginAnnotationEventListener> m_eventListener; + + PDFLayerController *m_pdfLayerController; + PDFPlugin* m_plugin; +}; + +} // namespace WebKit + +#endif // ENABLE(PDFKIT_PLUGIN) + +#endif // PDFPluginAnnotation_h diff --git a/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginAnnotation.mm b/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginAnnotation.mm new file mode 100644 index 000000000..efbc19d0b --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginAnnotation.mm @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2012 Apple Inc. 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. + */ + +#if ENABLE(PDFKIT_PLUGIN) + +#import "config.h" +#import "PDFPluginAnnotation.h" + +#import "PDFKitImports.h" +#import "PDFLayerControllerDetails.h" +#import "PDFPlugin.h" +#import "PDFPluginChoiceAnnotation.h" +#import "PDFPluginTextAnnotation.h" +#import <PDFKit/PDFKit.h> +#import <WebCore/CSSPrimitiveValue.h> +#import <WebCore/CSSPropertyNames.h> +#import <WebCore/ColorMac.h> +#import <WebCore/HTMLElement.h> +#import <WebCore/HTMLInputElement.h> +#import <WebCore/HTMLNames.h> +#import <WebCore/HTMLOptionElement.h> +#import <WebCore/HTMLSelectElement.h> +#import <WebCore/HTMLTextAreaElement.h> +#import <WebCore/Page.h> + +using namespace WebCore; + +namespace WebKit { + +using namespace HTMLNames; + +PassRefPtr<PDFPluginAnnotation> PDFPluginAnnotation::create(PDFAnnotation *annotation, PDFLayerController *pdfLayerController, PDFPlugin* plugin) +{ + if ([annotation isKindOfClass:pdfAnnotationTextWidgetClass()]) + return PDFPluginTextAnnotation::create(annotation, pdfLayerController, plugin); + if ([annotation isKindOfClass:pdfAnnotationChoiceWidgetClass()]) + return PDFPluginChoiceAnnotation::create(annotation, pdfLayerController, plugin); + + return 0; +} + +void PDFPluginAnnotation::attach(Element* parent) +{ + ASSERT(!m_parent); + + m_parent = parent; + m_element = createAnnotationElement(); + + m_element->setAttribute(classAttr, "annotation"); + m_element->addEventListener("change", m_eventListener, false); + m_element->addEventListener("blur", m_eventListener, false); + + updateGeometry(); + + m_parent->appendChild(m_element); + + // FIXME: The text cursor doesn't blink after this. Why? + m_element->focus(); +} + +PDFPluginAnnotation::~PDFPluginAnnotation() +{ + m_element->removeEventListener(eventNames().changeEvent, m_eventListener.get(), false); + m_element->removeEventListener(eventNames().blurEvent, m_eventListener.get(), false); + + m_parent->removeChild(element()); +} + +void PDFPluginAnnotation::updateGeometry() +{ + IntSize documentSize(m_pdfLayerController.contentSizeRespectingZoom); + IntPoint scrollPosition(m_pdfLayerController.scrollPosition); + NSRect annotationRect = NSRectFromCGRect([m_pdfLayerController boundsForAnnotation:m_annotation.get()]); + + StyledElement* styledElement = static_cast<StyledElement*>(element()); + styledElement->setInlineStyleProperty(CSSPropertyWidth, annotationRect.size.width, CSSPrimitiveValue::CSS_PX); + styledElement->setInlineStyleProperty(CSSPropertyHeight, annotationRect.size.height, CSSPrimitiveValue::CSS_PX); + styledElement->setInlineStyleProperty(CSSPropertyLeft, annotationRect.origin.x - scrollPosition.x(), CSSPrimitiveValue::CSS_PX); + styledElement->setInlineStyleProperty(CSSPropertyTop, documentSize.height() - annotationRect.origin.y - annotationRect.size.height - scrollPosition.y(), CSSPrimitiveValue::CSS_PX); +} + +void PDFPluginAnnotation::PDFPluginAnnotationEventListener::handleEvent(ScriptExecutionContext*, Event* event) +{ + if (event->type() == eventNames().blurEvent || event->type() == eventNames().changeEvent) + m_annotation->plugin()->setActiveAnnotation(0); +} + +} // namespace WebKit + +#endif // ENABLE(PDFKIT_PLUGIN) diff --git a/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.h b/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.h new file mode 100644 index 000000000..ea0e8308e --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2012 Apple Inc. 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 PDFPluginChoiceAnnotation_h +#define PDFPluginChoiceAnnotation_h + +#if ENABLE(PDFKIT_PLUGIN) + +#include "PDFPluginAnnotation.h" + +namespace WebCore { +class Element; +} + +OBJC_CLASS PDFAnnotationChoiceWidget; + +namespace WebKit { + +class PDFPluginChoiceAnnotation : public PDFPluginAnnotation { +public: + static PassRefPtr<PDFPluginChoiceAnnotation> create(PDFAnnotation *, PDFLayerController *, PDFPlugin*); + + virtual void updateGeometry() OVERRIDE; + virtual void commit() OVERRIDE; + +private: + PDFPluginChoiceAnnotation(PDFAnnotation *annotation, PDFLayerController *pdfLayerController, PDFPlugin* plugin) + : PDFPluginAnnotation(annotation, pdfLayerController, plugin) + { + } + + virtual PassRefPtr<WebCore::Element> createAnnotationElement() OVERRIDE; + + PDFAnnotationChoiceWidget *choiceAnnotation() { return static_cast<PDFAnnotationChoiceWidget *>(annotation()); } +}; + +} // namespace WebKit + +#endif // ENABLE(PDFKIT_PLUGIN) + +#endif // PDFPluginChoiceAnnotation_h diff --git a/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm b/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm new file mode 100644 index 000000000..fe996967e --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2012 Apple Inc. 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. + */ + +#if ENABLE(PDFKIT_PLUGIN) + +#import "config.h" +#import "PDFPluginChoiceAnnotation.h" + +#import "PDFKitImports.h" +#import "PDFLayerControllerDetails.h" +#import <PDFKit/PDFKit.h> +#import <WebCore/CSSPrimitiveValue.h> +#import <WebCore/CSSPropertyNames.h> +#import <WebCore/ColorMac.h> +#import <WebCore/HTMLElement.h> +#import <WebCore/HTMLNames.h> +#import <WebCore/HTMLOptionElement.h> +#import <WebCore/HTMLSelectElement.h> +#import <WebCore/Page.h> + +using namespace WebCore; + +namespace WebKit { + +using namespace HTMLNames; + +PassRefPtr<PDFPluginChoiceAnnotation> PDFPluginChoiceAnnotation::create(PDFAnnotation *annotation, PDFLayerController *pdfLayerController, PDFPlugin* plugin) +{ + return adoptRef(new PDFPluginChoiceAnnotation(annotation, pdfLayerController, plugin)); +} + +void PDFPluginChoiceAnnotation::updateGeometry() +{ + PDFPluginAnnotation::updateGeometry(); + + StyledElement* styledElement = static_cast<StyledElement*>(element()); + styledElement->setInlineStyleProperty(CSSPropertyFontSize, choiceAnnotation().font.pointSize * pdfLayerController().tileScaleFactor, CSSPrimitiveValue::CSS_PX); +} + +void PDFPluginChoiceAnnotation::commit() +{ + choiceAnnotation().stringValue = static_cast<HTMLSelectElement*>(element())->value(); +} + +PassRefPtr<Element> PDFPluginChoiceAnnotation::createAnnotationElement() +{ + Document* document = parent()->ownerDocument(); + PDFAnnotationChoiceWidget *choiceAnnotation = this->choiceAnnotation(); + + RefPtr<Element> element = document->createElement(selectTag, false); + + StyledElement* styledElement = static_cast<StyledElement*>(element.get()); + + // FIXME: Match font weight and style as well? + styledElement->setInlineStyleProperty(CSSPropertyColor, colorFromNSColor(choiceAnnotation.fontColor).serialized()); + styledElement->setInlineStyleProperty(CSSPropertyFontFamily, choiceAnnotation.font.familyName); + + NSArray *choices = choiceAnnotation.choices; + NSString *selectedChoice = choiceAnnotation.stringValue; + + for (NSString *choice in choices) { + RefPtr<Element> choiceOption = document->createElement(optionTag, false); + choiceOption->setAttribute(valueAttr, choice); + choiceOption->setTextContent(choice, ASSERT_NO_EXCEPTION); + + if (choice == selectedChoice) + choiceOption->setAttribute(selectedAttr, "selected"); + + styledElement->appendChild(choiceOption); + } + + return element; +} + +} // namespace WebKit + +#endif // ENABLE(PDFKIT_PLUGIN) diff --git a/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginTextAnnotation.h b/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginTextAnnotation.h new file mode 100644 index 000000000..626628ebe --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginTextAnnotation.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2012 Apple Inc. 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 PDFPluginTextAnnotation_h +#define PDFPluginTextAnnotation_h + +#if ENABLE(PDFKIT_PLUGIN) + +#include "PDFPluginAnnotation.h" + +namespace WebCore { +class Element; +} + +OBJC_CLASS PDFAnnotationTextWidget; + +namespace WebKit { + +class PDFPluginTextAnnotation : public PDFPluginAnnotation { +public: + static PassRefPtr<PDFPluginTextAnnotation> create(PDFAnnotation *, PDFLayerController *, PDFPlugin*); + + virtual void updateGeometry() OVERRIDE; + virtual void commit() OVERRIDE; + +private: + PDFPluginTextAnnotation(PDFAnnotation *annotation, PDFLayerController *pdfLayerController, PDFPlugin* plugin) + : PDFPluginAnnotation(annotation, pdfLayerController, plugin) + { + } + + virtual PassRefPtr<WebCore::Element> createAnnotationElement() OVERRIDE; + + PDFAnnotationTextWidget * textAnnotation() { return static_cast<PDFAnnotationTextWidget *>(annotation()); } +}; + +} // namespace WebKit + +#endif // ENABLE(PDFKIT_PLUGIN) + +#endif // PDFPluginTextAnnotation_h diff --git a/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm b/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm new file mode 100644 index 000000000..c94ea15f6 --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2012 Apple Inc. 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. + */ + +#if ENABLE(PDFKIT_PLUGIN) + +#import "config.h" +#import "PDFPluginTextAnnotation.h" + +#import "PDFKitImports.h" +#import "PDFLayerControllerDetails.h" +#import <PDFKit/PDFKit.h> +#import <WebCore/CSSPrimitiveValue.h> +#import <WebCore/CSSPropertyNames.h> +#import <WebCore/ColorMac.h> +#import <WebCore/HTMLElement.h> +#import <WebCore/HTMLInputElement.h> +#import <WebCore/HTMLNames.h> +#import <WebCore/HTMLTextAreaElement.h> +#import <WebCore/Page.h> + +@interface PDFAnnotationTextWidget (Details) +- (BOOL)isMultiline; +@end + +using namespace WebCore; + +namespace WebKit { + +using namespace HTMLNames; + +static const String cssAlignmentValueForNSTextAlignment(NSTextAlignment alignment) +{ + switch (alignment) { + case NSLeftTextAlignment: + return "left"; + case NSRightTextAlignment: + return "right"; + case NSCenterTextAlignment: + return "center"; + case NSJustifiedTextAlignment: + return "justify"; + case NSNaturalTextAlignment: + return "-webkit-start"; + } + + ASSERT_NOT_REACHED(); + return String(); +} + +PassRefPtr<PDFPluginTextAnnotation> PDFPluginTextAnnotation::create(PDFAnnotation *annotation, PDFLayerController *pdfLayerController, PDFPlugin* plugin) +{ + return adoptRef(new PDFPluginTextAnnotation(annotation, pdfLayerController, plugin)); +} + +PassRefPtr<Element> PDFPluginTextAnnotation::createAnnotationElement() +{ + RefPtr<Element> element; + + Document* document = parent()->ownerDocument(); + PDFAnnotationTextWidget *textAnnotation = this->textAnnotation(); + bool isMultiline = textAnnotation.isMultiline; + + if (isMultiline) + element = document->createElement(textareaTag, false); + else + element = document->createElement(inputTag, false); + + StyledElement* styledElement = static_cast<StyledElement*>(element.get()); + + // FIXME: Match font weight and style as well? + styledElement->setInlineStyleProperty(CSSPropertyColor, colorFromNSColor(textAnnotation.fontColor).serialized()); + styledElement->setInlineStyleProperty(CSSPropertyFontFamily, textAnnotation.font.familyName); + styledElement->setInlineStyleProperty(CSSPropertyTextAlign, cssAlignmentValueForNSTextAlignment(textAnnotation.alignment)); + + if (isMultiline) + static_cast<HTMLTextAreaElement*>(styledElement)->setValue(textAnnotation.stringValue); + else + static_cast<HTMLInputElement*>(styledElement)->setValue(textAnnotation.stringValue); + + return element; +} + +void PDFPluginTextAnnotation::updateGeometry() +{ + PDFPluginAnnotation::updateGeometry(); + + StyledElement* styledElement = static_cast<StyledElement*>(element()); + styledElement->setInlineStyleProperty(CSSPropertyFontSize, textAnnotation().font.pointSize * pdfLayerController().tileScaleFactor, CSSPrimitiveValue::CSS_PX); +} + +void PDFPluginTextAnnotation::commit() +{ + PDFAnnotationTextWidget *textAnnotation = this->textAnnotation(); + + if (textAnnotation.isMultiline) + textAnnotation.stringValue = static_cast<HTMLTextAreaElement*>(element())->value(); + else + textAnnotation.stringValue = static_cast<HTMLInputElement*>(element())->value(); +} + +} // namespace WebKit + +#endif // ENABLE(PDFKIT_PLUGIN) diff --git a/Source/WebKit2/WebProcess/Plugins/Plugin.cpp b/Source/WebKit2/WebProcess/Plugins/Plugin.cpp index bc884b962..12e0b3d31 100644 --- a/Source/WebKit2/WebProcess/Plugins/Plugin.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Plugin.cpp @@ -32,16 +32,16 @@ using namespace WebCore; namespace WebKit { -void Plugin::Parameters::encode(CoreIPC::ArgumentEncoder* encoder) const +void Plugin::Parameters::encode(CoreIPC::ArgumentEncoder& encoder) const { - encoder->encode(url.string()); - encoder->encode(names); - encoder->encode(values); - encoder->encode(mimeType); - encoder->encode(isFullFramePlugin); - encoder->encode(shouldUseManualLoader); + encoder << url.string(); + encoder << names; + encoder << values; + encoder << mimeType; + encoder << isFullFramePlugin; + encoder << shouldUseManualLoader; #if PLATFORM(MAC) - encoder->encodeEnum(layerHostingMode); + encoder.encodeEnum(layerHostingMode); #endif } diff --git a/Source/WebKit2/WebProcess/Plugins/Plugin.h b/Source/WebKit2/WebProcess/Plugins/Plugin.h index 98f8770c1..ded53d157 100644 --- a/Source/WebKit2/WebProcess/Plugins/Plugin.h +++ b/Source/WebKit2/WebProcess/Plugins/Plugin.h @@ -77,7 +77,7 @@ public: LayerHostingMode layerHostingMode; #endif - void encode(CoreIPC::ArgumentEncoder*) const; + void encode(CoreIPC::ArgumentEncoder&) const; static bool decode(CoreIPC::ArgumentDecoder*, Parameters&); }; diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp index fcfb249ad..648a51eb8 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp +++ b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp @@ -129,7 +129,7 @@ void PluginProcessConnection::didClose(CoreIPC::Connection*) } } -void PluginProcessConnection::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID) +void PluginProcessConnection::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference, CoreIPC::StringReference) { } diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.h b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.h index 2dc2cca59..bc6558ffd 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.h +++ b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.h @@ -67,7 +67,7 @@ private: virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE; virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&, OwnPtr<CoreIPC::MessageEncoder>&) OVERRIDE; virtual void didClose(CoreIPC::Connection*); - virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID); + virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName) OVERRIDE; // Message handlers. void didReceiveSyncPluginProcessConnectionMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&, OwnPtr<CoreIPC::MessageEncoder>&); diff --git a/Source/WebKit2/WebProcess/Plugins/PluginView.cpp b/Source/WebKit2/WebProcess/Plugins/PluginView.cpp index d0a5e1e2c..e82704105 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginView.cpp +++ b/Source/WebKit2/WebProcess/Plugins/PluginView.cpp @@ -61,6 +61,7 @@ #include <WebCore/SecurityPolicy.h> #include <WebCore/Settings.h> #include <WebCore/UserGestureIndicator.h> +#include <wtf/text/StringBuilder.h> using namespace JSC; using namespace WebCore; @@ -162,23 +163,22 @@ static String buildHTTPHeaders(const ResourceResponse& response, long long& expe if (!response.isHTTP()) return String(); - Vector<UChar> stringBuilder; - String separator(": "); + StringBuilder stringBuilder; String statusLine = String::format("HTTP %d ", response.httpStatusCode()); - stringBuilder.append(statusLine.characters(), statusLine.length()); - stringBuilder.append(response.httpStatusText().characters(), response.httpStatusText().length()); + stringBuilder.append(statusLine); + stringBuilder.append(response.httpStatusText()); stringBuilder.append('\n'); HTTPHeaderMap::const_iterator end = response.httpHeaderFields().end(); for (HTTPHeaderMap::const_iterator it = response.httpHeaderFields().begin(); it != end; ++it) { - stringBuilder.append(it->key.characters(), it->key.length()); - stringBuilder.append(separator.characters(), separator.length()); - stringBuilder.append(it->value.characters(), it->value.length()); + stringBuilder.append(it->key); + stringBuilder.appendLiteral(": "); + stringBuilder.append(it->value); stringBuilder.append('\n'); } - String headers = String::adopt(stringBuilder); + String headers = stringBuilder.toString(); // If the content is encoded (most likely compressed), then don't send its length to the plugin, // which is only interested in the decoded length, not yet known at the moment. diff --git a/Source/WebKit2/WebProcess/ResourceCache/WebResourceCacheManager.cpp b/Source/WebKit2/WebProcess/ResourceCache/WebResourceCacheManager.cpp index 6810f0abd..395649c50 100644 --- a/Source/WebKit2/WebProcess/ResourceCache/WebResourceCacheManager.cpp +++ b/Source/WebKit2/WebProcess/ResourceCache/WebResourceCacheManager.cpp @@ -118,8 +118,7 @@ void WebResourceCacheManager::clearCacheForOrigin(SecurityOriginData originData, #if USE(CFURLCACHE) if (resourceCachesToClear != InMemoryResourceCachesOnly) { RetainPtr<CFMutableArrayRef> hostArray(AdoptCF, CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks)); - RetainPtr<CFStringRef> host(AdoptCF, origin->host().createCFString()); - CFArrayAppendValue(hostArray.get(), host.get()); + CFArrayAppendValue(hostArray.get(), origin->host().createCFString().get()); clearCFURLCacheForHostNames(hostArray.get()); } diff --git a/Source/WebKit2/WebProcess/WebConnectionToUIProcess.cpp b/Source/WebKit2/WebProcess/WebConnectionToUIProcess.cpp index 538007d4f..9c142d8a8 100644 --- a/Source/WebKit2/WebProcess/WebConnectionToUIProcess.cpp +++ b/Source/WebKit2/WebProcess/WebConnectionToUIProcess.cpp @@ -51,7 +51,7 @@ WebConnectionToUIProcess::WebConnectionToUIProcess(WebProcess* process, CoreIPC: void WebConnectionToUIProcess::encodeMessageBody(CoreIPC::ArgumentEncoder& encoder, APIObject* messageBody) { - encoder.encode(InjectedBundleUserMessageEncoder(messageBody)); + encoder << InjectedBundleUserMessageEncoder(messageBody); } bool WebConnectionToUIProcess::decodeMessageBody(CoreIPC::ArgumentDecoder& decoder, RefPtr<APIObject>& messageBody) @@ -81,9 +81,9 @@ void WebConnectionToUIProcess::didClose(CoreIPC::Connection* connection) m_process->didClose(connection); } -void WebConnectionToUIProcess::didReceiveInvalidMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID) +void WebConnectionToUIProcess::didReceiveInvalidMessage(CoreIPC::Connection* connection, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName) { - m_process->didReceiveInvalidMessage(connection, messageID); + m_process->didReceiveInvalidMessage(connection, messageReceiverName, messageName); } #if PLATFORM(WIN) diff --git a/Source/WebKit2/WebProcess/WebConnectionToUIProcess.h b/Source/WebKit2/WebProcess/WebConnectionToUIProcess.h index af591115b..7f3f1fdb1 100644 --- a/Source/WebKit2/WebProcess/WebConnectionToUIProcess.h +++ b/Source/WebKit2/WebProcess/WebConnectionToUIProcess.h @@ -48,7 +48,7 @@ private: virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE; virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&, OwnPtr<CoreIPC::MessageEncoder>&) OVERRIDE; virtual void didClose(CoreIPC::Connection*); - virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID) OVERRIDE; + virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName) OVERRIDE; #if PLATFORM(WIN) virtual Vector<HWND> windowsToReceiveSentMessagesWhileWaitingForSyncReply(); #endif diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp index ac3daa908..3e7fe3294 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp @@ -473,19 +473,28 @@ void WebChromeClient::scrollRectIntoView(const IntRect&) const bool WebChromeClient::shouldUnavailablePluginMessageBeButton(RenderEmbeddedObject::PluginUnavailabilityReason pluginUnavailabilityReason) const { - if (pluginUnavailabilityReason == RenderEmbeddedObject::PluginMissing || pluginUnavailabilityReason == RenderEmbeddedObject::InsecurePluginVersion) { + switch (pluginUnavailabilityReason) { + case RenderEmbeddedObject::PluginMissing: // FIXME: <rdar://problem/8794397> We should only return true when there is a // missingPluginButtonClicked callback defined on the Page UI client. + case RenderEmbeddedObject::InsecurePluginVersion: + case RenderEmbeddedObject::PluginInactive: return true; + + + case RenderEmbeddedObject::PluginCrashed: + case RenderEmbeddedObject::PluginBlockedByContentSecurityPolicy: + return false; } + ASSERT_NOT_REACHED(); return false; } void WebChromeClient::unavailablePluginButtonClicked(Element* element, RenderEmbeddedObject::PluginUnavailabilityReason pluginUnavailabilityReason) const { ASSERT(element->hasTagName(objectTag) || element->hasTagName(embedTag) || element->hasTagName(appletTag)); - ASSERT(pluginUnavailabilityReason == RenderEmbeddedObject::PluginMissing || pluginUnavailabilityReason == RenderEmbeddedObject::InsecurePluginVersion); + ASSERT(pluginUnavailabilityReason == RenderEmbeddedObject::PluginMissing || pluginUnavailabilityReason == RenderEmbeddedObject::InsecurePluginVersion || pluginUnavailabilityReason == RenderEmbeddedObject::PluginInactive); HTMLPlugInImageElement* pluginElement = static_cast<HTMLPlugInImageElement*>(element); diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp index 1a1206a4b..dd3e50926 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp @@ -201,6 +201,7 @@ bool WebFrameLoaderClient::shouldUseCredentialStorage(DocumentLoader*, unsigned return webPage->injectedBundleResourceLoadClient().shouldUseCredentialStorage(webPage, m_frame, identifier); } +#if !PLATFORM(GTK) void WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge& challenge) { // FIXME: Authentication is a per-resource concept, but we don't do per-resource handling in the UIProcess at the API level quite yet. @@ -212,6 +213,7 @@ void WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(DocumentLoa AuthenticationManager::shared().didReceiveAuthenticationChallenge(m_frame, challenge); } +#endif void WebFrameLoaderClient::dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long /*identifier*/, const AuthenticationChallenge&) { @@ -1234,6 +1236,11 @@ void WebFrameLoaderClient::transitionToCommittedForNewPage() m_frame->coreFrame()->createView(webPage->size(), backgroundColor, /* transparent */ false, IntSize(), currentFixedVisibleContentRect, shouldUseFixedLayout); m_frame->coreFrame()->view()->setTransparent(!webPage->drawsBackground()); + +#if USE(TILED_BACKING_STORE) + m_frame->coreFrame()->view()->setDelegatesScrolling(shouldUseFixedLayout); + m_frame->coreFrame()->view()->setPaintsEntireContents(shouldUseFixedLayout); +#endif } void WebFrameLoaderClient::didSaveToPageCache() diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp index 62f900400..f12b85196 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp @@ -37,6 +37,7 @@ #include "WebProcessProxyMessages.h" #include <WebCore/Color.h> #include <WebCore/KURL.h> +#include <WebCore/LoaderStrategy.h> #include <WebCore/Page.h> #include <WebCore/PlatformPasteboard.h> #include <wtf/Atomics.h> @@ -68,17 +69,27 @@ CookiesStrategy* WebPlatformStrategies::createCookiesStrategy() return this; } +LoaderStrategy* WebPlatformStrategies::createLoaderStrategy() +{ + return this; +} + +PasteboardStrategy* WebPlatformStrategies::createPasteboardStrategy() +{ + return this; +} + PluginStrategy* WebPlatformStrategies::createPluginStrategy() { return this; } -VisitedLinkStrategy* WebPlatformStrategies::createVisitedLinkStrategy() +SharedWorkerStrategy* WebPlatformStrategies::createSharedWorkerStrategy() { return this; } -PasteboardStrategy* WebPlatformStrategies::createPasteboardStrategy() +VisitedLinkStrategy* WebPlatformStrategies::createVisitedLinkStrategy() { return this; } @@ -90,6 +101,23 @@ void WebPlatformStrategies::notifyCookiesChanged() WebCookieManager::shared().dispatchCookiesDidChange(); } +// LoaderStrategy + +#if ENABLE(NETWORK_PROCESS) +ResourceLoadScheduler* WebPlatformStrategies::resourceLoadScheduler() +{ + static ResourceLoadScheduler* scheduler; + if (!scheduler) { + if (WebProcess::shared().usesNetworkProcess()) + scheduler = &WebProcess::shared().webResourceLoadScheduler(); + else + scheduler = WebCore::resourceLoadScheduler(); + } + + return scheduler; +} +#endif + // PluginStrategy void WebPlatformStrategies::refreshPlugins() diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h index dfbcc334c..bb644b1ab 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h @@ -29,14 +29,16 @@ #if USE(PLATFORM_STRATEGIES) #include <WebCore/CookiesStrategy.h> +#include <WebCore/LoaderStrategy.h> #include <WebCore/PasteboardStrategy.h> #include <WebCore/PlatformStrategies.h> #include <WebCore/PluginStrategy.h> +#include <WebCore/SharedWorkerStrategy.h> #include <WebCore/VisitedLinkStrategy.h> namespace WebKit { -class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::CookiesStrategy, private WebCore::PluginStrategy, private WebCore::VisitedLinkStrategy, private WebCore::PasteboardStrategy { +class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::CookiesStrategy, private WebCore::LoaderStrategy, private WebCore::PasteboardStrategy, private WebCore::PluginStrategy, private WebCore::SharedWorkerStrategy, private WebCore::VisitedLinkStrategy { public: static void initialize(); @@ -45,13 +47,20 @@ private: // WebCore::PlatformStrategies virtual WebCore::CookiesStrategy* createCookiesStrategy() OVERRIDE; + virtual WebCore::LoaderStrategy* createLoaderStrategy() OVERRIDE; + virtual WebCore::PasteboardStrategy* createPasteboardStrategy() OVERRIDE; virtual WebCore::PluginStrategy* createPluginStrategy() OVERRIDE; + virtual WebCore::SharedWorkerStrategy* createSharedWorkerStrategy() OVERRIDE; virtual WebCore::VisitedLinkStrategy* createVisitedLinkStrategy() OVERRIDE; - virtual WebCore::PasteboardStrategy* createPasteboardStrategy() OVERRIDE; // WebCore::CookiesStrategy virtual void notifyCookiesChanged() OVERRIDE; + // WebCore::LoaderStrategy +#if ENABLE(NETWORK_PROCESS) + virtual WebCore::ResourceLoadScheduler* resourceLoadScheduler() OVERRIDE; +#endif + // WebCore::PluginStrategy virtual void refreshPlugins() OVERRIDE; virtual void getPluginInfo(const WebCore::Page*, Vector<WebCore::PluginInfo>&) OVERRIDE; diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebEditorClientEfl.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebEditorClientEfl.cpp index 22a5cf453..8dc90d00d 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebEditorClientEfl.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebEditorClientEfl.cpp @@ -27,12 +27,15 @@ #include "WebEditorClient.h" #include "Frame.h" +#include "NativeWebKeyboardEvent.h" #include "PlatformKeyboardEvent.h" #include "WebPage.h" #include "WebPageProxyMessages.h" #include "WebProcess.h" +#include <WebCore/FocusController.h> #include <WebCore/KeyboardEvent.h> #include <WebCore/NotImplemented.h> +#include <WebCore/Page.h> using namespace WebCore; @@ -44,9 +47,18 @@ void WebEditorClient::handleKeyboardEvent(KeyboardEvent* event) event->setDefaultHandled(); } -void WebEditorClient::handleInputMethodKeydown(KeyboardEvent*) +void WebEditorClient::handleInputMethodKeydown(KeyboardEvent* event) { - notImplemented(); + Frame* frame = m_page->corePage()->focusController()->focusedOrMainFrame(); + if (!frame || !frame->editor()->canEdit()) + return; + + // FIXME: sending sync message might make input lagging. + bool handled = false; + m_page->sendSync(Messages::WebPageProxy::HandleInputMethodKeydown(), Messages::WebPageProxy::HandleInputMethodKeydown::Reply(handled)); + + if (handled) + event->setDefaultHandled(); } } diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebFrameLoaderClientGtk.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebFrameLoaderClientGtk.cpp new file mode 100644 index 000000000..a6ff36e5f --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebFrameLoaderClientGtk.cpp @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2012, Igalia S.L. + * + * 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 IGALIA S.L. 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 "WebFrameLoaderClient.h" + +#include <WebCore/AuthenticationChallenge.h> +#include <WebCore/GtkAuthenticationDialog.h> +#include <WebCore/ResourceHandle.h> + +namespace WebKit { + +using WebCore::GtkAuthenticationDialog; +using WebCore::AuthenticationChallenge; + +void WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long, const AuthenticationChallenge& challenge) +{ + GtkAuthenticationDialog* dialog = new GtkAuthenticationDialog(0, challenge); + dialog->show(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm index aef59ca86..08db0ad3b 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm @@ -100,7 +100,6 @@ void InitWebCoreSystemInterface(void) INIT(SetCGFontRenderingMode); INIT(SetCONNECTProxyAuthorizationForStream); INIT(SetCONNECTProxyForStream); - INIT(SetCookieStoragePrivateBrowsingEnabled); INIT(SetDragImage); INIT(SetHTTPPipeliningMaximumPriority); INIT(SetHTTPPipeliningPriority); @@ -117,8 +116,10 @@ void InitWebCoreSystemInterface(void) INIT(CopyHTTPCookieStorage); INIT(GetHTTPCookieAcceptPolicy); INIT(SetHTTPCookieAcceptPolicy); + INIT(HTTPCookies); INIT(HTTPCookiesForURL); INIT(SetHTTPCookiesForURL); + INIT(DeleteAllHTTPCookies); INIT(DeleteHTTPCookie); INIT(SetMetadataURL); @@ -192,5 +193,17 @@ void InitWebCoreSystemInterface(void) INIT(NSReboundDeltaForElasticDelta); #endif + INIT(CaptionAppearanceHasUserPreferences); + INIT(CaptionAppearanceShowCaptionsWhenAvailable); + INIT(CaptionAppearanceCopyForegroundColor); + INIT(CaptionAppearanceCopyBackgroundColor); + INIT(CaptionAppearanceCopyWindowColor); + INIT(CaptionAppearanceGetForegroundOpacity); + INIT(CaptionAppearanceGetBackgroundOpacity); + INIT(CaptionAppearanceGetWindowOpacity); + INIT(CaptionAppearanceCopyFontForStyle); + INIT(CaptionAppearanceGetRelativeCharacterSize); + INIT(CaptionAppearanceGetTextEdgeStyle); + INIT(CaptionAppearanceGetSettingsChangedNotification); }); } diff --git a/Source/WebKit2/WebProcess/WebKitMain.cpp b/Source/WebKit2/WebProcess/WebKitMain.cpp index c3fa98ebe..0d2a0e193 100644 --- a/Source/WebKit2/WebProcess/WebKitMain.cpp +++ b/Source/WebKit2/WebProcess/WebKitMain.cpp @@ -60,11 +60,9 @@ static int WebKitMain(const CommandLine& commandLine) case ProcessLauncher::PluginProcess: return PluginProcessMain(commandLine); #endif - case ProcessLauncher::NetworkProcess: #if ENABLE(NETWORK_PROCESS) + case ProcessLauncher::NetworkProcess: return NetworkProcessMain(commandLine); -#else - break; #endif #if ENABLE(SHARED_WORKER_PROCESS) case ProcessLauncher::SharedWorkerProcess: diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp index 79c8eec5c..26e48d61c 100644 --- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp +++ b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp @@ -47,15 +47,6 @@ static HashMap<WebLayerID, CoordinatedGraphicsLayer*>& layerByIDMap() return globalMap; } -CoordinatedGraphicsLayer* CoordinatedGraphicsLayer::layerByID(WebKit::WebLayerID id) -{ - HashMap<WebLayerID, CoordinatedGraphicsLayer*>& table = layerByIDMap(); - HashMap<WebLayerID, CoordinatedGraphicsLayer*>::iterator it = table.find(id); - if (it == table.end()) - return 0; - return it->value; -} - static WebLayerID toWebLayerID(GraphicsLayer* layer) { return layer ? toCoordinatedGraphicsLayer(layer)->id() : 0; @@ -68,9 +59,9 @@ void CoordinatedGraphicsLayer::didChangeLayerState() client()->notifyFlushRequired(this); } -void CoordinatedGraphicsLayer::didChangeAnimatedProperties() +void CoordinatedGraphicsLayer::didChangeAnimations() { - m_shouldSyncAnimatedProperties = true; + m_shouldSyncAnimations = true; if (client()) client()->notifyFlushRequired(this); } @@ -93,9 +84,6 @@ void CoordinatedGraphicsLayer::didChangeFilters() void CoordinatedGraphicsLayer::setShouldUpdateVisibleRect() { - if (!transform().isAffine()) - return; - m_shouldUpdateVisibleRect = true; for (size_t i = 0; i < children().size(); ++i) toCoordinatedGraphicsLayer(children()[i])->setShouldUpdateVisibleRect(); @@ -117,7 +105,7 @@ CoordinatedGraphicsLayer::CoordinatedGraphicsLayer(GraphicsLayerClient* client) , m_shouldSyncLayerState(true) , m_shouldSyncChildren(true) , m_shouldSyncFilters(true) - , m_shouldSyncAnimatedProperties(true) + , m_shouldSyncAnimations(true) , m_fixedToViewport(false) , m_canvasNeedsDisplay(false) , m_CoordinatedGraphicsLayerClient(0) @@ -141,11 +129,6 @@ CoordinatedGraphicsLayer::~CoordinatedGraphicsLayer() willBeDestroyed(); } -void CoordinatedGraphicsLayer::willBeDestroyed() -{ - GraphicsLayer::willBeDestroyed(); -} - bool CoordinatedGraphicsLayer::setChildren(const Vector<GraphicsLayer*>& children) { bool ok = GraphicsLayer::setChildren(children); @@ -493,32 +476,23 @@ void CoordinatedGraphicsLayer::syncLayerState() m_layerInfo.mask = toWebLayerID(maskLayer()); m_layerInfo.masksToBounds = masksToBounds(); m_layerInfo.opacity = opacity(); - m_layerInfo.parent = toWebLayerID(parent()); m_layerInfo.pos = position(); m_layerInfo.preserves3D = preserves3D(); m_layerInfo.replica = toWebLayerID(replicaLayer()); m_layerInfo.size = size(); m_layerInfo.transform = transform(); - if (!m_animations.hasActiveAnimationsOfType(AnimatedPropertyWebkitTransform)) - m_effectiveTransform = transform(); - if (!m_animations.hasActiveAnimationsOfType(AnimatedPropertyOpacity)) - m_effectiveOpacity = opacity(); m_CoordinatedGraphicsLayerClient->syncLayerState(m_id, m_layerInfo); } -void CoordinatedGraphicsLayer::syncAnimatedProperties() +void CoordinatedGraphicsLayer::syncAnimations() { - m_animations.apply(this); - if (!m_shouldSyncAnimatedProperties) + if (!m_shouldSyncAnimations) return; - m_shouldSyncAnimatedProperties = false; - if (m_effectiveOpacity != opacity()) - m_CoordinatedGraphicsLayerClient->setLayerAnimatedOpacity(id(), m_effectiveOpacity); - if (m_effectiveTransform != transform()) - m_CoordinatedGraphicsLayerClient->setLayerAnimatedTransform(id(), m_effectiveTransform); -} + m_shouldSyncAnimations = false; + m_CoordinatedGraphicsLayerClient->setLayerAnimations(m_id, m_animations); +} void CoordinatedGraphicsLayer::syncCanvas() { @@ -550,7 +524,7 @@ void CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly() // The remote image might have been released by purgeBackingStores. ensureImageBackingStore(); syncLayerState(); - syncAnimatedProperties(); + syncAnimations(); computeTransformedVisibleRect(); syncChildren(); #if ENABLE(CSS_FILTERS) @@ -662,9 +636,9 @@ Color CoordinatedGraphicsLayer::tiledBackingStoreBackgroundColor() const return contentsOpaque() ? Color::white : Color::transparent; } -PassOwnPtr<WebCore::GraphicsContext> CoordinatedGraphicsLayer::beginContentUpdate(const WebCore::IntSize& size, ShareableSurface::Handle& handle, WebCore::IntPoint& offset) +PassOwnPtr<WebCore::GraphicsContext> CoordinatedGraphicsLayer::beginContentUpdate(const WebCore::IntSize& size, int& atlas, WebCore::IntPoint& offset) { - return m_CoordinatedGraphicsLayerClient->beginContentUpdate(size, contentsOpaque() ? 0 : ShareableBitmap::SupportsAlpha, handle, offset); + return m_CoordinatedGraphicsLayerClient->beginContentUpdate(size, contentsOpaque() ? 0 : ShareableBitmap::SupportsAlpha, atlas, offset); } void CoordinatedGraphicsLayer::createTile(int tileID, const SurfaceUpdateInfo& updateInfo, const IntRect& targetRect) @@ -749,12 +723,30 @@ void CoordinatedGraphicsLayer::adjustVisibleRect() m_mainBackingStore->coverWithTilesIfNeeded(); } +bool CoordinatedGraphicsLayer::hasPendingVisibleChanges() +{ + if (opacity() < 0.01 && !m_animations.hasActiveAnimationsOfType(AnimatedPropertyOpacity)) + return false; + + for (size_t i = 0; i < children().size(); ++i) { + if (toCoordinatedGraphicsLayer(children()[i])->hasPendingVisibleChanges()) + return true; + } + + if (!m_shouldSyncLayerState && !m_shouldSyncChildren && !m_shouldSyncFilters && !m_shouldSyncAnimations && !m_canvasNeedsDisplay) + return false; + + return selfOrAncestorHaveNonAffineTransforms() || !tiledBackingStoreVisibleRect().isEmpty(); + +} + void CoordinatedGraphicsLayer::computeTransformedVisibleRect() { if (!m_shouldUpdateVisibleRect) return; + m_shouldUpdateVisibleRect = false; - m_layerTransform.setLocalTransform(m_effectiveTransform); + m_layerTransform.setLocalTransform(transform()); m_layerTransform.setPosition(position()); m_layerTransform.setAnchorPoint(anchorPoint()); m_layerTransform.setSize(size()); @@ -779,13 +771,16 @@ void CoordinatedGraphicsLayer::initFactory() bool CoordinatedGraphicsLayer::selfOrAncestorHaveNonAffineTransforms() { + if (m_animations.hasActiveAnimationsOfType(AnimatedPropertyWebkitTransform)) + return true; + if (!m_layerTransform.combined().isAffine()) return true; return false; } -bool CoordinatedGraphicsLayer::addAnimation(const KeyframeValueList& valueList, const IntSize& boxSize, const Animation* anim, const String& keyframesName, double timeOffset) +bool CoordinatedGraphicsLayer::addAnimation(const KeyframeValueList& valueList, const IntSize& boxSize, const Animation* anim, const String& keyframesName, double delayAsNegativeTimeOffset) { ASSERT(!keyframesName.isEmpty()); @@ -798,39 +793,28 @@ bool CoordinatedGraphicsLayer::addAnimation(const KeyframeValueList& valueList, if (valueList.property() == AnimatedPropertyWebkitTransform) listsMatch = validateTransformOperations(valueList, ignoredHasBigRotation) >= 0; - m_animations.add(GraphicsLayerAnimation(keyframesName, valueList, boxSize, anim, timeOffset, listsMatch)); + m_lastAnimationStartTime = WTF::currentTime() - delayAsNegativeTimeOffset; + m_animations.add(GraphicsLayerAnimation(keyframesName, valueList, boxSize, anim, m_lastAnimationStartTime, listsMatch)); m_animationStartedTimer.startOneShot(0); - didChangeLayerState(); + didChangeAnimations(); return true; } -void CoordinatedGraphicsLayer::pauseAnimation(const String& animationName, double timeOffset) +void CoordinatedGraphicsLayer::pauseAnimation(const String& animationName, double time) { - m_animations.pause(animationName, timeOffset); + m_animations.pause(animationName, time); + didChangeAnimations(); } void CoordinatedGraphicsLayer::removeAnimation(const String& animationName) { m_animations.remove(animationName); + didChangeAnimations(); } void CoordinatedGraphicsLayer::animationStartedTimerFired(Timer<CoordinatedGraphicsLayer>*) { - client()->notifyAnimationStarted(this, /* DOM time */ WTF::currentTime()); + client()->notifyAnimationStarted(this, m_lastAnimationStartTime); } - -void CoordinatedGraphicsLayer::setAnimatedTransform(const TransformationMatrix& transform) -{ - m_effectiveTransform = transform; - didChangeAnimatedProperties(); - m_shouldUpdateVisibleRect = true; -} - -void CoordinatedGraphicsLayer::setAnimatedOpacity(float opacity) -{ - m_effectiveOpacity = opacity; - didChangeAnimatedProperties(); -} - } #endif diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h index 049991070..1188aa75f 100644 --- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h +++ b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h @@ -42,6 +42,7 @@ #if USE(COORDINATED_GRAPHICS) namespace WebCore { class CoordinatedGraphicsLayer; +class GraphicsLayerAnimations; } namespace WebKit { @@ -66,117 +67,130 @@ public: virtual void syncCanvas(WebLayerID, const WebCore::IntSize& canvasSize, const WebCore::GraphicsSurfaceToken&, uint32_t frontBuffer) = 0; #endif - virtual void setLayerAnimatedOpacity(WebLayerID, float) = 0; - virtual void setLayerAnimatedTransform(WebLayerID, const WebCore::TransformationMatrix&) = 0; + virtual void setLayerAnimations(WebLayerID, const WebCore::GraphicsLayerAnimations&) = 0; virtual void attachLayer(WebCore::CoordinatedGraphicsLayer*) = 0; virtual void detachLayer(WebCore::CoordinatedGraphicsLayer*) = 0; virtual void syncFixedLayers() = 0; - virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, ShareableBitmap::Flags, ShareableSurface::Handle&, WebCore::IntPoint&) = 0; + virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, ShareableBitmap::Flags, int& atlasID, WebCore::IntPoint&) = 0; }; } namespace WebCore { -class CoordinatedGraphicsLayer : public WebCore::GraphicsLayer - , public TiledBackingStoreClient - , public WebKit::CoordinatedTileClient - , public GraphicsLayerAnimation::Client { +class CoordinatedGraphicsLayer : public GraphicsLayer + , public TiledBackingStoreClient + , public WebKit::CoordinatedTileClient { public: CoordinatedGraphicsLayer(GraphicsLayerClient*); virtual ~CoordinatedGraphicsLayer(); // Reimplementations from GraphicsLayer.h. - bool setChildren(const Vector<GraphicsLayer*>&); - void addChild(GraphicsLayer*); - void addChildAtIndex(GraphicsLayer*, int); - void addChildAbove(GraphicsLayer*, GraphicsLayer*); - void addChildBelow(GraphicsLayer*, GraphicsLayer*); - bool replaceChild(GraphicsLayer*, GraphicsLayer*); - void removeFromParent(); - void setPosition(const FloatPoint&); - void setAnchorPoint(const FloatPoint3D&); - void setSize(const FloatSize&); - void setTransform(const TransformationMatrix&); - void setChildrenTransform(const TransformationMatrix&); - void setPreserves3D(bool); - void setMasksToBounds(bool); - void setDrawsContent(bool); - void setContentsVisible(bool); - void setContentsOpaque(bool); - void setBackfaceVisibility(bool); - void setOpacity(float); - void setContentsRect(const IntRect&); - void setContentsToImage(Image*); - void setContentsToCanvas(PlatformLayer*); - void setMaskLayer(GraphicsLayer*); - void setReplicatedByLayer(GraphicsLayer*); - void setNeedsDisplay(); - void setNeedsDisplayInRect(const FloatRect&); - void setContentsNeedsDisplay(); - void setContentsScale(float); - void setVisibleContentRectTrajectoryVector(const FloatPoint&); - virtual void flushCompositingState(const FloatRect&); - virtual void flushCompositingStateForThisLayerOnly(); + virtual bool setChildren(const Vector<GraphicsLayer*>&) OVERRIDE; + virtual void addChild(GraphicsLayer*) OVERRIDE; + virtual void addChildAtIndex(GraphicsLayer*, int) OVERRIDE; + virtual void addChildAbove(GraphicsLayer*, GraphicsLayer*) OVERRIDE; + virtual void addChildBelow(GraphicsLayer*, GraphicsLayer*) OVERRIDE; + virtual bool replaceChild(GraphicsLayer*, GraphicsLayer*) OVERRIDE; + virtual void removeFromParent() OVERRIDE; + virtual void setPosition(const FloatPoint&) OVERRIDE; + virtual void setAnchorPoint(const FloatPoint3D&) OVERRIDE; + virtual void setSize(const FloatSize&) OVERRIDE; + virtual void setTransform(const TransformationMatrix&) OVERRIDE; + virtual void setChildrenTransform(const TransformationMatrix&) OVERRIDE; + virtual void setPreserves3D(bool) OVERRIDE; + virtual void setMasksToBounds(bool) OVERRIDE; + virtual void setDrawsContent(bool) OVERRIDE; + virtual void setContentsVisible(bool) OVERRIDE; + virtual void setContentsOpaque(bool) OVERRIDE; + virtual void setBackfaceVisibility(bool) OVERRIDE; + virtual void setOpacity(float) OVERRIDE; + virtual void setContentsRect(const IntRect&) OVERRIDE; + virtual void setContentsToImage(Image*) OVERRIDE; + virtual void setContentsToCanvas(PlatformLayer*) OVERRIDE; + virtual void setMaskLayer(GraphicsLayer*) OVERRIDE; + virtual void setReplicatedByLayer(GraphicsLayer*) OVERRIDE; + virtual void setNeedsDisplay() OVERRIDE; + virtual void setNeedsDisplayInRect(const FloatRect&) OVERRIDE; + virtual void setContentsNeedsDisplay() OVERRIDE; + virtual void flushCompositingState(const FloatRect&) OVERRIDE; + virtual void flushCompositingStateForThisLayerOnly() OVERRIDE; #if ENABLE(CSS_FILTERS) - bool setFilters(const FilterOperations&); + virtual bool setFilters(const FilterOperations&) OVERRIDE; #endif + virtual bool addAnimation(const KeyframeValueList&, const IntSize&, const Animation*, const String&, double) OVERRIDE; + virtual void pauseAnimation(const String&, double) OVERRIDE; + virtual void removeAnimation(const String&) OVERRIDE; + + void setContentsScale(float); + void setVisibleContentRectTrajectoryVector(const FloatPoint&); void setRootLayer(bool); WebKit::WebLayerID id() const; - static CoordinatedGraphicsLayer* layerByID(WebKit::WebLayerID); - void didSynchronize(); - Image* image() { return m_image.get(); } - bool fixedToViewport() const { return m_fixedToViewport; } void setFixedToViewport(bool isFixed) { m_fixedToViewport = isFixed; } - GraphicsLayer* maskTarget() const { return m_maskTarget; } - void setMaskTarget(GraphicsLayer* layer) { m_maskTarget = layer; } IntRect coverRect() const { return m_mainBackingStore ? m_mainBackingStore->mapToContents(m_mainBackingStore->coverRect()) : IntRect(); } static void initFactory(); // TiledBackingStoreClient - virtual void tiledBackingStorePaintBegin(); - virtual void tiledBackingStorePaint(GraphicsContext*, const IntRect&); - virtual void tiledBackingStorePaintEnd(const Vector<IntRect>& paintedArea); - virtual bool tiledBackingStoreUpdatesAllowed() const; - virtual IntRect tiledBackingStoreContentsRect(); - virtual IntRect tiledBackingStoreVisibleRect(); - virtual Color tiledBackingStoreBackgroundColor() const; + virtual void tiledBackingStorePaintBegin() OVERRIDE; + virtual void tiledBackingStorePaint(GraphicsContext*, const IntRect&) OVERRIDE; + virtual void tiledBackingStorePaintEnd(const Vector<IntRect>& paintedArea) OVERRIDE; + virtual bool tiledBackingStoreUpdatesAllowed() const OVERRIDE; + virtual IntRect tiledBackingStoreContentsRect() OVERRIDE; + virtual IntRect tiledBackingStoreVisibleRect() OVERRIDE; + virtual Color tiledBackingStoreBackgroundColor() const OVERRIDE; // CoordinatedTileClient - virtual void createTile(int tileID, const WebKit::SurfaceUpdateInfo&, const WebCore::IntRect&); - virtual void updateTile(int tileID, const WebKit::SurfaceUpdateInfo&, const WebCore::IntRect&); - virtual void removeTile(int tileID); - virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, WebKit::ShareableSurface::Handle&, WebCore::IntPoint&); + virtual void createTile(int tileID, const WebKit::SurfaceUpdateInfo&, const IntRect&) OVERRIDE; + virtual void updateTile(int tileID, const WebKit::SurfaceUpdateInfo&, const IntRect&) OVERRIDE; + virtual void removeTile(int tileID) OVERRIDE; + virtual PassOwnPtr<GraphicsContext> beginContentUpdate(const IntSize&, int& atlasID, IntPoint&) OVERRIDE; void setCoordinatedGraphicsLayerClient(WebKit::CoordinatedGraphicsLayerClient*); - void syncChildren(); + + void adjustVisibleRect(); + void purgeBackingStores(); + bool hasPendingVisibleChanges(); + +private: + bool fixedToViewport() const { return m_fixedToViewport; } + void setMaskTarget(GraphicsLayer* layer) { m_maskTarget = layer; } + + void notifyChange(); + void didChangeLayerState(); + void didChangeAnimations(); + void didChangeGeometry(); + void didChangeChildren(); +#if ENABLE(CSS_FILTERS) + void didChangeFilters(); +#endif + void syncLayerState(); + void syncAnimations(); + void syncChildren(); #if ENABLE(CSS_FILTERS) void syncFilters(); #endif void syncCanvas(); void ensureImageBackingStore(); - - void adjustVisibleRect(); - bool isReadyForTileBufferSwap() const; + void computeTransformedVisibleRect(); void updateContentBuffers(); - void purgeBackingStores(); - // GraphicsLayerAnimation::Client - virtual void setAnimatedTransform(const TransformationMatrix&); - virtual void setAnimatedOpacity(float); + void createBackingStore(); - virtual bool addAnimation(const KeyframeValueList&, const IntSize&, const Animation*, const String&, double); - virtual void pauseAnimation(const String&, double); - virtual void removeAnimation(const String&); + bool selfOrAncestorHaveNonAffineTransforms(); + bool shouldUseTiledBackingStore(); + void adjustContentsScale(); + + void setShouldUpdateVisibleRect(); + float effectiveContentsScale(); + + void animationStartedTimerFired(Timer<CoordinatedGraphicsLayer>*); -private: - virtual void willBeDestroyed(); WebKit::WebLayerID m_id; WebKit::WebLayerInfo m_layerInfo; RefPtr<Image> m_image; @@ -188,42 +202,21 @@ private: bool m_shouldSyncLayerState: 1; bool m_shouldSyncChildren: 1; bool m_shouldSyncFilters: 1; - bool m_shouldSyncAnimatedProperties: 1; + bool m_shouldSyncAnimations: 1; bool m_fixedToViewport : 1; bool m_canvasNeedsDisplay : 1; - void notifyChange(); - void didChangeAnimatedProperties(); - void didChangeGeometry(); - void didChangeLayerState(); - void didChangeChildren(); -#if ENABLE(CSS_FILTERS) - void didChangeFilters(); -#endif - float m_effectiveOpacity; TransformationMatrix m_effectiveTransform; - void createBackingStore(); - - bool selfOrAncestorHaveNonAffineTransforms(); - bool shouldUseTiledBackingStore(); - void adjustContentsScale(); - void computeTransformedVisibleRect(); - void syncLayerParameters(); - void syncAnimatedProperties(); - void setShouldUpdateVisibleRect(); - float effectiveContentsScale(); - - void animationStartedTimerFired(WebCore::Timer<CoordinatedGraphicsLayer>*); - WebKit::CoordinatedGraphicsLayerClient* m_CoordinatedGraphicsLayerClient; - OwnPtr<WebCore::TiledBackingStore> m_mainBackingStore; - OwnPtr<WebCore::TiledBackingStore> m_previousBackingStore; + OwnPtr<TiledBackingStore> m_mainBackingStore; + OwnPtr<TiledBackingStore> m_previousBackingStore; float m_contentsScale; PlatformLayer* m_canvasPlatformLayer; Timer<CoordinatedGraphicsLayer> m_animationStartedTimer; GraphicsLayerAnimations m_animations; + double m_lastAnimationStartTime; }; CoordinatedGraphicsLayer* toCoordinatedGraphicsLayer(GraphicsLayer*); diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedTile.cpp b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedTile.cpp index 668ca5d9e..548d49d32 100644 --- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedTile.cpp +++ b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedTile.cpp @@ -73,7 +73,7 @@ Vector<IntRect> CoordinatedTile::updateBackBuffer() return Vector<IntRect>(); SurfaceUpdateInfo updateInfo; - OwnPtr<GraphicsContext> graphicsContext = m_client->beginContentUpdate(m_dirtyRect.size(), updateInfo.surfaceHandle, updateInfo.surfaceOffset); + OwnPtr<GraphicsContext> graphicsContext = m_client->beginContentUpdate(m_dirtyRect.size(), updateInfo.atlasID, updateInfo.surfaceOffset); if (!graphicsContext) return Vector<IntRect>(); graphicsContext->translate(-m_dirtyRect.x(), -m_dirtyRect.y()); diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedTile.h b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedTile.h index 84d1134f0..32ff4e7c7 100644 --- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedTile.h +++ b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedTile.h @@ -28,7 +28,6 @@ #if USE(TILED_BACKING_STORE) -#include "ShareableSurface.h" #include "Tile.h" #include "TiledBackingStore.h" #include "WebCore/IntRect.h" @@ -79,7 +78,7 @@ public: virtual void createTile(int tileID, const SurfaceUpdateInfo&, const WebCore::IntRect&) = 0; virtual void updateTile(int tileID, const SurfaceUpdateInfo&, const WebCore::IntRect&) = 0; virtual void removeTile(int tileID) = 0; - virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, ShareableSurface::Handle&, WebCore::IntPoint&) = 0; + virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, int& atlasID, WebCore::IntPoint&) = 0; }; class CoordinatedTileBackend : public WebCore::TiledBackingStoreBackend { diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp index aaa1c38d5..5d9b3ef38 100644 --- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp +++ b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp @@ -82,6 +82,7 @@ LayerTreeCoordinator::LayerTreeCoordinator(WebPage* webPage) , m_releaseInactiveAtlasesTimer(this, &LayerTreeCoordinator::releaseInactiveAtlasesTimerFired) , m_layerFlushSchedulingEnabled(true) , m_forceRepaintAsyncCallbackID(0) + , m_animationsLocked(false) { // Create a root layer. m_rootLayer = GraphicsLayer::create(this, this); @@ -266,6 +267,8 @@ bool LayerTreeCoordinator::flushPendingLayerChanges() m_rootLayer->flushCompositingStateForThisLayerOnly(); + purgeReleasedImages(); + if (m_shouldSyncRootLayer) { m_webPage->send(Messages::LayerTreeCoordinatorProxy::SetRootCompositingLayer(toCoordinatedGraphicsLayer(m_rootLayer.get())->id())); m_shouldSyncRootLayer = false; @@ -279,7 +282,8 @@ bool LayerTreeCoordinator::flushPendingLayerChanges() m_webPage->send(Messages::LayerTreeCoordinatorProxy::DidRenderFrame(contentsSize, coveredRect)); m_waitingForUIProcess = true; m_shouldSyncFrame = false; - } + } else + unlockAnimations(); if (m_forceRepaintAsyncCallbackID) { m_webPage->send(Messages::WebPageProxy::VoidCallback(m_forceRepaintAsyncCallbackID)); @@ -387,13 +391,37 @@ void LayerTreeCoordinator::syncFixedLayers() updateOffsetFromViewportForLayer(rootRenderLayer->firstChild()); } +void LayerTreeCoordinator::lockAnimations() +{ + m_animationsLocked = true; + m_webPage->send(Messages::LayerTreeCoordinatorProxy::SetAnimationsLocked(true)); +} + +void LayerTreeCoordinator::unlockAnimations() +{ + if (!m_animationsLocked) + return; + + m_animationsLocked = false; + m_webPage->send(Messages::LayerTreeCoordinatorProxy::SetAnimationsLocked(false)); +} + void LayerTreeCoordinator::performScheduledLayerFlush() { if (m_isSuspended || m_waitingForUIProcess) return; + // We lock the animations while performing layout, to avoid flickers caused by animations continuing in the UI process while + // the web process layout wants to cancel them. + lockAnimations(); syncDisplayState(); + // We can unlock the animations before flushing if there are no visible changes, for example if there are content updates + // in a layer with opacity 0. + bool canUnlockBeforeFlush = !m_isValid || !toCoordinatedGraphicsLayer(m_rootLayer.get())->hasPendingVisibleChanges(); + if (canUnlockBeforeFlush) + unlockAnimations(); + if (!m_isValid) return; @@ -419,6 +447,13 @@ void LayerTreeCoordinator::didPerformScheduledLayerFlush() } } +void LayerTreeCoordinator::purgeReleasedImages() +{ + for (size_t i = 0; i < m_releasedDirectlyCompositedImages.size(); ++i) + m_webPage->send(Messages::LayerTreeCoordinatorProxy::DestroyDirectlyCompositedImage(m_releasedDirectlyCompositedImages[i])); + m_releasedDirectlyCompositedImages.clear(); +} + void LayerTreeCoordinator::layerFlushTimerFired(Timer<LayerTreeCoordinator>*) { performScheduledLayerFlush(); @@ -477,15 +512,20 @@ int64_t LayerTreeCoordinator::adoptImageBackingStore(Image* image) return key; } - RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(image->size(), (image->currentFrameHasAlpha() ? ShareableBitmap::SupportsAlpha : 0)); - { - OwnPtr<WebCore::GraphicsContext> graphicsContext = bitmap->createGraphicsContext(); - graphicsContext->drawImage(image, ColorSpaceDeviceRGB, IntPoint::zero()); - } + // Check if we were going to release this image during the next flush. + size_t releasedIndex = m_releasedDirectlyCompositedImages.find(key); + if (releasedIndex == notFound) { + RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(image->size(), (image->currentFrameHasAlpha() ? ShareableBitmap::SupportsAlpha : 0)); + { + OwnPtr<WebCore::GraphicsContext> graphicsContext = bitmap->createGraphicsContext(); + graphicsContext->drawImage(image, ColorSpaceDeviceRGB, IntPoint::zero()); + } + ShareableBitmap::Handle handle; + bitmap->createHandle(handle); + m_webPage->send(Messages::LayerTreeCoordinatorProxy::CreateDirectlyCompositedImage(key, handle)); + } else + m_releasedDirectlyCompositedImages.remove(releasedIndex); - ShareableBitmap::Handle handle; - bitmap->createHandle(handle); - m_webPage->send(Messages::LayerTreeCoordinatorProxy::CreateDirectlyCompositedImage(key, handle)); m_directlyCompositedImageRefCounts.add(key, 1); return key; } @@ -503,13 +543,15 @@ void LayerTreeCoordinator::releaseImageBackingStore(int64_t key) if (it->value) return; - m_directlyCompositedImageRefCounts.remove(it); #if USE(CAIRO) // Complement the referencing in adoptImageBackingStore(). cairo_surface_t* cairoSurface = reinterpret_cast<cairo_surface_t*>(key); cairo_surface_destroy(cairoSurface); #endif - m_webPage->send(Messages::LayerTreeCoordinatorProxy::DestroyDirectlyCompositedImage(key)); + + m_directlyCompositedImageRefCounts.remove(it); + m_releasedDirectlyCompositedImages.append(key); + scheduleLayerFlush(); } @@ -536,19 +578,11 @@ void LayerTreeCoordinator::paintContents(const WebCore::GraphicsLayer* graphicsL } } -bool LayerTreeCoordinator::showDebugBorders(const WebCore::GraphicsLayer*) const -{ - return m_webPage->corePage()->settings()->showDebugBorders(); -} - -bool LayerTreeCoordinator::showRepaintCounter(const WebCore::GraphicsLayer*) const -{ - return m_webPage->corePage()->settings()->showRepaintCounter(); -} - PassOwnPtr<GraphicsLayer> LayerTreeCoordinator::createGraphicsLayer(GraphicsLayerClient* client) { - return adoptPtr(new CoordinatedGraphicsLayer(client)); + CoordinatedGraphicsLayer* newLayer = new CoordinatedGraphicsLayer(client); + newLayer->setCoordinatedGraphicsLayerClient(this); + return adoptPtr(newLayer); } bool LayerTreeHost::supportsAcceleratedCompositing() @@ -574,22 +608,26 @@ void LayerTreeCoordinator::removeTile(WebLayerID layerID, int tileID) m_webPage->send(Messages::LayerTreeCoordinatorProxy::RemoveTileForLayer(layerID, tileID)); } -WebCore::IntRect LayerTreeCoordinator::visibleContentsRect() const +void LayerTreeCoordinator::createUpdateAtlas(int atlasID, const ShareableSurface::Handle& handle) { - return m_visibleContentsRect; + m_webPage->send(Messages::LayerTreeCoordinatorProxy::CreateUpdateAtlas(atlasID, handle)); } +void LayerTreeCoordinator::removeUpdateAtlas(int atlasID) +{ + m_webPage->send(Messages::LayerTreeCoordinatorProxy::RemoveUpdateAtlas(atlasID)); +} -void LayerTreeCoordinator::setLayerAnimatedOpacity(WebLayerID id, float opacity) +WebCore::IntRect LayerTreeCoordinator::visibleContentsRect() const { - m_shouldSyncFrame = true; - m_webPage->send(Messages::LayerTreeCoordinatorProxy::SetLayerAnimatedOpacity(id, opacity)); + return m_visibleContentsRect; } -void LayerTreeCoordinator::setLayerAnimatedTransform(WebLayerID id, const TransformationMatrix& transform) + +void LayerTreeCoordinator::setLayerAnimations(WebLayerID layerID, const GraphicsLayerAnimations& animations) { m_shouldSyncFrame = true; - m_webPage->send(Messages::LayerTreeCoordinatorProxy::SetLayerAnimatedTransform(id, transform)); + m_webPage->send(Messages::LayerTreeCoordinatorProxy::SetLayerAnimations(layerID, animations.getActiveAnimations())); } void LayerTreeCoordinator::setVisibleContentsRect(const IntRect& rect, float scale, const FloatPoint& trajectoryVector) @@ -625,10 +663,17 @@ GraphicsLayerFactory* LayerTreeCoordinator::graphicsLayerFactory() return this; } +#if ENABLE(REQUEST_ANIMATION_FRAME) void LayerTreeCoordinator::scheduleAnimation() { + m_webPage->send(Messages::LayerTreeCoordinatorProxy::RequestAnimationFrame()); +} + +void LayerTreeCoordinator::animationFrameReady() +{ scheduleLayerFlush(); } +#endif void LayerTreeCoordinator::renderNextFrame() { @@ -649,27 +694,30 @@ void LayerTreeCoordinator::purgeBackingStores() for (HashSet<WebCore::CoordinatedGraphicsLayer*>::iterator it = m_registeredLayers.begin(); it != end; ++it) (*it)->purgeBackingStores(); + purgeReleasedImages(); + ASSERT(!m_directlyCompositedImageRefCounts.size()); + ASSERT(!m_releasedDirectlyCompositedImages.size()); m_updateAtlases.clear(); } -PassOwnPtr<WebCore::GraphicsContext> LayerTreeCoordinator::beginContentUpdate(const WebCore::IntSize& size, ShareableBitmap::Flags flags, ShareableSurface::Handle& handle, WebCore::IntPoint& offset) +PassOwnPtr<WebCore::GraphicsContext> LayerTreeCoordinator::beginContentUpdate(const WebCore::IntSize& size, ShareableBitmap::Flags flags, int& atlasID, WebCore::IntPoint& offset) { OwnPtr<WebCore::GraphicsContext> graphicsContext; for (unsigned i = 0; i < m_updateAtlases.size(); ++i) { UpdateAtlas* atlas = m_updateAtlases[i].get(); if (atlas->flags() == flags) { // This will return null if there is no available buffer space. - graphicsContext = atlas->beginPaintingOnAvailableBuffer(handle, size, offset); + graphicsContext = atlas->beginPaintingOnAvailableBuffer(atlasID, size, offset); if (graphicsContext) return graphicsContext.release(); } } static const int ScratchBufferDimension = 1024; // Should be a power of two. - m_updateAtlases.append(adoptPtr(new UpdateAtlas(ScratchBufferDimension, flags))); + m_updateAtlases.append(adoptPtr(new UpdateAtlas(this, ScratchBufferDimension, flags))); scheduleReleaseInactiveAtlases(); - return m_updateAtlases.last()->beginPaintingOnAvailableBuffer(handle, size, offset); + return m_updateAtlases.last()->beginPaintingOnAvailableBuffer(atlasID, size, offset); } const double ReleaseInactiveAtlasesTimerInterval = 0.5; diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h index 776a8d97e..cacb68eaa 100644 --- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h +++ b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h @@ -38,14 +38,13 @@ class UpdateInfo; class WebPage; class LayerTreeCoordinator : public LayerTreeHost, WebCore::GraphicsLayerClient - , public CoordinatedGraphicsLayerClient - , public WebCore::GraphicsLayerFactory { + , public CoordinatedGraphicsLayerClient + , public UpdateAtlasClient + , public WebCore::GraphicsLayerFactory { public: static PassRefPtr<LayerTreeCoordinator> create(WebPage*); virtual ~LayerTreeCoordinator(); - static bool supportsAcceleratedCompositing(); - virtual const LayerTreeContext& layerTreeContext() { return m_layerTreeContext; } virtual void setLayerFlushSchedulingEnabled(bool); virtual void scheduleLayerFlush(); @@ -84,8 +83,7 @@ public: virtual void syncLayerState(WebLayerID, const WebLayerInfo&); virtual void syncLayerChildren(WebLayerID, const Vector<WebLayerID>&); - virtual void setLayerAnimatedOpacity(WebLayerID, float); - virtual void setLayerAnimatedTransform(WebLayerID, const WebCore::TransformationMatrix&); + virtual void setLayerAnimations(WebLayerID, const WebCore::GraphicsLayerAnimations&); #if ENABLE(CSS_FILTERS) virtual void syncLayerFilters(WebLayerID, const WebCore::FilterOperations&); #endif @@ -96,8 +94,15 @@ public: virtual void detachLayer(WebCore::CoordinatedGraphicsLayer*); virtual void syncFixedLayers(); - virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, ShareableBitmap::Flags, ShareableSurface::Handle&, WebCore::IntPoint&); + virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, ShareableBitmap::Flags, int& atlasID, WebCore::IntPoint&); + + // UpdateAtlasClient + virtual void createUpdateAtlas(int atlasID, const ShareableSurface::Handle&); + virtual void removeUpdateAtlas(int atlasID); + +#if ENABLE(REQUEST_ANIMATION_FRAME) virtual void scheduleAnimation() OVERRIDE; +#endif protected: explicit LayerTreeCoordinator(WebPage*); @@ -107,8 +112,6 @@ private: virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time); virtual void notifyFlushRequired(const WebCore::GraphicsLayer*); virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect); - virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const; - virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const; // GraphicsLayerFactory virtual PassOwnPtr<WebCore::GraphicsLayer> createGraphicsLayer(WebCore::GraphicsLayerClient*) OVERRIDE; @@ -121,10 +124,17 @@ private: void performScheduledLayerFlush(); void didPerformScheduledLayerFlush(); void syncDisplayState(); + void lockAnimations(); + void unlockAnimations(); + void purgeReleasedImages(); void layerFlushTimerFired(WebCore::Timer<LayerTreeCoordinator>*); void scheduleReleaseInactiveAtlases(); +#if ENABLE(REQUEST_ANIMATION_FRAME) + void animationFrameReady(); +#endif + void releaseInactiveAtlasesTimerFired(WebCore::Timer<LayerTreeCoordinator>*); OwnPtr<WebCore::GraphicsLayer> m_rootLayer; @@ -138,6 +148,7 @@ private: HashSet<WebCore::CoordinatedGraphicsLayer*> m_registeredLayers; Vector<WebLayerID> m_detachedLayers; HashMap<int64_t, int> m_directlyCompositedImageRefCounts; + Vector<int64_t> m_releasedDirectlyCompositedImages; Vector<OwnPtr<UpdateAtlas> > m_updateAtlases; bool m_notifyAfterScheduledLayerFlush; @@ -156,6 +167,7 @@ private: WebCore::Timer<LayerTreeCoordinator> m_releaseInactiveAtlasesTimer; bool m_layerFlushSchedulingEnabled; uint64_t m_forceRepaintAsyncCallbackID; + bool m_animationsLocked; }; } diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.messages.in b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.messages.in index 7b9c2acdf..6ac372562 100644 --- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.messages.in +++ b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.messages.in @@ -23,5 +23,8 @@ messages -> LayerTreeCoordinator { SetVisibleContentsRect(WebCore::IntRect visibleContentsRect, float scale, WebCore::FloatPoint trajectoryVectory) RenderNextFrame() PurgeBackingStores() +#if ENABLE(REQUEST_ANIMATION_FRAME) + AnimationFrameReady() +#endif } #endif diff --git a/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp b/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp index 63417720c..4179c982c 100644 --- a/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp +++ b/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp @@ -45,7 +45,7 @@ DecoderAdapter::DecoderAdapter(const uint8_t* buffer, size_t bufferSize) bool DecoderAdapter::decodeBytes(Vector<uint8_t>& bytes) { CoreIPC::DataReference dataReference; - if (!m_decoder->decodeVariableLengthByteArray(dataReference)) + if (!m_decoder->decode(dataReference)) return false; bytes = dataReference.vector(); diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp b/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp index 11e893faf..ed6cface2 100644 --- a/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp +++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp @@ -33,6 +33,10 @@ #include "TiledCoreAnimationDrawingArea.h" #endif +#if PLATFORM(MAC) +#include "RemoteLayerTreeDrawingArea.h" +#endif + #include "WebPageCreationParameters.h" namespace WebKit { @@ -46,6 +50,10 @@ PassOwnPtr<DrawingArea> DrawingArea::create(WebPage* webPage, const WebPageCreat case DrawingAreaTypeTiledCoreAnimation: return TiledCoreAnimationDrawingArea::create(webPage, parameters); #endif +#if PLATFORM(MAC) + case DrawingAreaTypeRemoteLayerTree: + return RemoteLayerTreeDrawingArea::create(webPage, parameters); +#endif } return nullptr; diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp index 71916909d..5e70c9448 100644 --- a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp +++ b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp @@ -307,6 +307,7 @@ void DrawingAreaImpl::layerHostDidFlushLayers() #endif } +#if USE(ACCELERATED_COMPOSITING) GraphicsLayerFactory* DrawingAreaImpl::graphicsLayerFactory() { if (m_layerTreeHost) @@ -361,6 +362,7 @@ void DrawingAreaImpl::scheduleCompositingLayerFlush() return; m_layerTreeHost->scheduleLayerFlush(); } +#endif void DrawingAreaImpl::updateBackingStoreState(uint64_t stateID, bool respondImmediately, float deviceScaleFactor, const WebCore::IntSize& size, const WebCore::IntSize& scrollOffset) { diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h index ba93954f9..6d49719f7 100644 --- a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h +++ b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h @@ -68,9 +68,11 @@ private: virtual void setPaintingEnabled(bool); virtual void updatePreferences(const WebPreferencesStore&) OVERRIDE; +#if USE(ACCELERATED_COMPOSITING) virtual WebCore::GraphicsLayerFactory* graphicsLayerFactory() OVERRIDE; virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) OVERRIDE; virtual void scheduleCompositingLayerFlush() OVERRIDE; +#endif #if PLATFORM(WIN) virtual void scheduleChildWindowGeometryUpdate(const WindowGeometry&); diff --git a/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp b/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp index b7269caa1..ed6dc210e 100644 --- a/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp +++ b/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp @@ -47,7 +47,7 @@ CoreIPC::DataReference EncoderAdapter::dataReference() const void EncoderAdapter::encodeBytes(const uint8_t* bytes, size_t size) { - m_encoder->encodeVariableLengthByteArray(CoreIPC::DataReference(bytes, size)); + m_encoder->encode(CoreIPC::DataReference(bytes, size)); } void EncoderAdapter::encodeBool(bool value) diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h index 68d158236..7a1ca6cf6 100644 --- a/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h +++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h @@ -109,7 +109,7 @@ public: virtual WebCore::GraphicsDeviceAdapter* graphicsDeviceAdapter() const { return 0; } #endif -#if USE(COORDINATED_GRAPHICS) +#if USE(COORDINATED_GRAPHICS) && ENABLE(REQUEST_ANIMATION_FRAME) virtual void scheduleAnimation() = 0; #endif diff --git a/Source/WebKit2/WebProcess/WebPage/UpdateAtlas.cpp b/Source/WebKit2/WebProcess/WebPage/UpdateAtlas.cpp index 27500635d..9a5418f1e 100644 --- a/Source/WebKit2/WebProcess/WebPage/UpdateAtlas.cpp +++ b/Source/WebKit2/WebProcess/WebPage/UpdateAtlas.cpp @@ -30,12 +30,28 @@ using namespace WebCore; namespace WebKit { -UpdateAtlas::UpdateAtlas(int dimension, ShareableBitmap::Flags flags) - : m_flags(flags) +UpdateAtlas::UpdateAtlas(UpdateAtlasClient* client, int dimension, ShareableBitmap::Flags flags) + : m_client(client) + , m_flags(flags) , m_inactivityInSeconds(0) + , m_isVaild(true) { + static int nextID = 0; + m_ID = ++nextID; IntSize size = nextPowerOfTwo(IntSize(dimension, dimension)); m_surface = ShareableSurface::create(size, flags, ShareableSurface::SupportsGraphicsSurface); + + if (!m_surface->createHandle(m_handle)) { + m_isVaild = false; + return; + } + m_client->createUpdateAtlas(m_ID, m_handle); +} + +UpdateAtlas::~UpdateAtlas() +{ + if (m_isVaild) + m_client->removeUpdateAtlas(m_ID); } void UpdateAtlas::buildLayoutIfNeeded() @@ -51,7 +67,7 @@ void UpdateAtlas::didSwapBuffers() m_areaAllocator.clear(); } -PassOwnPtr<GraphicsContext> UpdateAtlas::beginPaintingOnAvailableBuffer(ShareableSurface::Handle& handle, const WebCore::IntSize& size, IntPoint& offset) +PassOwnPtr<GraphicsContext> UpdateAtlas::beginPaintingOnAvailableBuffer(int& atlasID, const WebCore::IntSize& size, IntPoint& offset) { m_inactivityInSeconds = 0; buildLayoutIfNeeded(); @@ -61,8 +77,10 @@ PassOwnPtr<GraphicsContext> UpdateAtlas::beginPaintingOnAvailableBuffer(Shareabl if (rect.isEmpty()) return PassOwnPtr<GraphicsContext>(); - if (!m_surface->createHandle(handle)) - return PassOwnPtr<WebCore::GraphicsContext>(); + if (!m_isVaild) + return PassOwnPtr<GraphicsContext>(); + + atlasID = m_ID; // FIXME: Use tri-state buffers, to allow faster updates. offset = rect.location(); diff --git a/Source/WebKit2/WebProcess/WebPage/UpdateAtlas.h b/Source/WebKit2/WebProcess/WebPage/UpdateAtlas.h index 00e850b83..7cefe9c97 100644 --- a/Source/WebKit2/WebProcess/WebPage/UpdateAtlas.h +++ b/Source/WebKit2/WebProcess/WebPage/UpdateAtlas.h @@ -32,15 +32,22 @@ class IntPoint; namespace WebKit { +class UpdateAtlasClient { +public: + virtual void createUpdateAtlas(int atlasID, const ShareableSurface::Handle&) = 0; + virtual void removeUpdateAtlas(int atlasID) = 0; +}; + class UpdateAtlas { WTF_MAKE_NONCOPYABLE(UpdateAtlas); public: - UpdateAtlas(int dimension, ShareableBitmap::Flags); + UpdateAtlas(UpdateAtlasClient*, int dimension, ShareableBitmap::Flags); + ~UpdateAtlas(); inline WebCore::IntSize size() const { return m_surface->size(); } // Returns a null pointer of there is no available buffer. - PassOwnPtr<WebCore::GraphicsContext> beginPaintingOnAvailableBuffer(ShareableSurface::Handle&, const WebCore::IntSize&, WebCore::IntPoint& offset); + PassOwnPtr<WebCore::GraphicsContext> beginPaintingOnAvailableBuffer(int& atlasID, const WebCore::IntSize&, WebCore::IntPoint& offset); void didSwapBuffers(); ShareableBitmap::Flags flags() const { return m_flags; } @@ -60,10 +67,14 @@ private: void buildLayoutIfNeeded(); private: + UpdateAtlasClient* m_client; OwnPtr<GeneralAreaAllocator> m_areaAllocator; ShareableBitmap::Flags m_flags; RefPtr<ShareableSurface> m_surface; + ShareableSurface::Handle m_handle; double m_inactivityInSeconds; + int m_ID; + bool m_isVaild; }; } diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp index 3d8583d8d..2312e84c3 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp @@ -31,6 +31,7 @@ #include "DataReference.h" #include "DecoderAdapter.h" #include "DrawingArea.h" +#include "DrawingAreaMessages.h" #include "InjectedBundle.h" #include "InjectedBundleBackForwardList.h" #include "InjectedBundleUserMessageCoders.h" @@ -60,15 +61,18 @@ #include "WebEventConversion.h" #include "WebFrame.h" #include "WebFullScreenManager.h" +#include "WebFullScreenManagerMessages.h" #include "WebGeolocationClient.h" #include "WebGeometry.h" #include "WebImage.h" #include "WebInspector.h" #include "WebInspectorClient.h" +#include "WebInspectorMessages.h" #include "WebNotificationClient.h" #include "WebOpenPanelResultListener.h" #include "WebPageCreationParameters.h" #include "WebPageGroupProxy.h" +#include "WebPageMessages.h" #include "WebPageProxyMessages.h" #include "WebPopupMenu.h" #include "WebPreferencesStore.h" @@ -176,6 +180,10 @@ #include <wtf/RefCountedLeakCounter.h> #endif +#if USE(COORDINATED_GRAPHICS) +#include "LayerTreeCoordinatorMessages.h" +#endif + using namespace JSC; using namespace WebCore; using namespace std; @@ -355,6 +363,20 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters) setMediaVolume(parameters.mediaVolume); + WebProcess::shared().addMessageReceiver(Messages::WebPage::messageReceiverName(), m_pageID, this); + + // FIXME: This should be done in the object constructors, and the objects themselves should be message receivers. + WebProcess::shared().addMessageReceiver(Messages::DrawingArea::messageReceiverName(), m_pageID, this); +#if USE(COORDINATED_GRAPHICS) + WebProcess::shared().addMessageReceiver(Messages::LayerTreeCoordinator::messageReceiverName(), m_pageID, this); +#endif +#if ENABLE(INSPECTOR) + WebProcess::shared().addMessageReceiver(Messages::WebInspector::messageReceiverName(), m_pageID, this); +#endif +#if ENABLE(FULLSCREEN_API) + WebProcess::shared().addMessageReceiver(Messages::WebFullScreenManager::messageReceiverName(), m_pageID, this); +#endif + #ifndef NDEBUG webPageCounter.increment(); #endif @@ -372,6 +394,20 @@ WebPage::~WebPage() for (HashSet<PluginView*>::const_iterator it = m_pluginViews.begin(), end = m_pluginViews.end(); it != end; ++it) (*it)->webPageDestroyed(); + WebProcess::shared().removeMessageReceiver(Messages::WebPage::messageReceiverName(), m_pageID); + + // FIXME: This should be done in the object destructors, and the objects themselves should be message receivers. + WebProcess::shared().removeMessageReceiver(Messages::DrawingArea::messageReceiverName(), m_pageID); +#if USE(COORDINATED_GRAPHICS) + WebProcess::shared().removeMessageReceiver(Messages::LayerTreeCoordinator::messageReceiverName(), m_pageID); +#endif +#if ENABLE(INSPECTOR) + WebProcess::shared().removeMessageReceiver(Messages::WebInspector::messageReceiverName(), m_pageID); +#endif +#if ENABLE(FULLSCREEN_API) + WebProcess::shared().removeMessageReceiver(Messages::WebFullScreenManager::messageReceiverName(), m_pageID); +#endif + #ifndef NDEBUG webPageCounter.decrement(); #endif @@ -455,20 +491,28 @@ void WebPage::initializeInjectedBundleDiagnosticLoggingClient(WKBundlePageDiagno PassRefPtr<Plugin> WebPage::createPlugin(WebFrame* frame, HTMLPlugInElement* pluginElement, const Plugin::Parameters& parameters) { String pluginPath; - bool blocked; - + uint32_t pluginLoadPolicy; if (!WebProcess::shared().connection()->sendSync( Messages::WebProcessProxy::GetPluginPath(parameters.mimeType, parameters.url.string()), - Messages::WebProcessProxy::GetPluginPath::Reply(pluginPath, blocked), 0)) { + Messages::WebProcessProxy::GetPluginPath::Reply(pluginPath, pluginLoadPolicy), 0)) { return 0; } - if (blocked) { + switch (static_cast<PluginModuleLoadPolicy>(pluginLoadPolicy)) { + case PluginModuleLoadNormally: + break; + + case PluginModuleBlocked: if (pluginElement->renderer()->isEmbeddedObject()) toRenderEmbeddedObject(pluginElement->renderer())->setPluginUnavailabilityReason(RenderEmbeddedObject::InsecurePluginVersion); send(Messages::WebPageProxy::DidBlockInsecurePluginVersion(parameters.mimeType, parameters.url.string())); return 0; + + case PluginModuleInactive: + if (pluginElement->renderer()->isEmbeddedObject()) + toRenderEmbeddedObject(pluginElement->renderer())->setPluginUnavailabilityReason(RenderEmbeddedObject::PluginInactive); + return 0; } if (pluginPath.isNull()) { @@ -630,6 +674,20 @@ PassRefPtr<ImmutableArray> WebPage::trackedRepaintRects() return ImmutableArray::adopt(vector); } +static PluginView* focusedPluginViewForFrame(Frame* frame) +{ + if (!frame->document()->isPluginDocument()) + return 0; + + PluginDocument* pluginDocument = static_cast<PluginDocument*>(frame->document()); + + if (pluginDocument->focusedNode() != pluginDocument->pluginNode()) + return 0; + + PluginView* pluginView = static_cast<PluginView*>(pluginDocument->pluginWidget()); + return pluginView; +} + static PluginView* pluginViewForFrame(Frame* frame) { if (!frame->document()->isPluginDocument()) @@ -646,7 +704,7 @@ void WebPage::executeEditingCommand(const String& commandName, const String& arg if (!frame) return; - if (PluginView* pluginView = pluginViewForFrame(frame)) { + if (PluginView* pluginView = focusedPluginViewForFrame(frame)) { pluginView->handleEditingCommand(commandName, argument); return; } @@ -660,7 +718,7 @@ bool WebPage::isEditingCommandEnabled(const String& commandName) if (!frame) return false; - if (PluginView* pluginView = pluginViewForFrame(frame)) + if (PluginView* pluginView = focusedPluginViewForFrame(frame)) return pluginView->isEditingCommandEnabled(commandName); Editor::Command command = frame->editor()->command(commandName); @@ -926,32 +984,6 @@ void WebPage::setFixedVisibleContentRect(const IntRect& rect) m_page->mainFrame()->view()->setFixedVisibleContentRect(rect); } -void WebPage::setResizesToContentsUsingLayoutSize(const IntSize& targetLayoutSize) -{ - ASSERT(m_useFixedLayout); - ASSERT(!targetLayoutSize.isEmpty()); - - FrameView* view = m_page->mainFrame()->view(); - - view->setDelegatesScrolling(true); - view->setUseFixedLayout(true); - view->setPaintsEntireContents(true); - - if (view->fixedLayoutSize() == targetLayoutSize) - return; - - m_page->settings()->setAcceleratedCompositingForFixedPositionEnabled(true); - m_page->settings()->setFixedElementsLayoutRelativeToFrame(true); - m_page->settings()->setFixedPositionCreatesStackingContext(true); -#if ENABLE(SMOOTH_SCROLLING) - // Ensure we don't do animated scrolling in the WebProcess when scrolling is delegated. - m_page->settings()->setEnableScrollAnimator(false); -#endif - - // Always reset even when empty. This also takes care of the relayout. - setFixedLayoutSize(targetLayoutSize); -} - void WebPage::resizeToContentsIfNeeded() { ASSERT(m_useFixedLayout); @@ -990,7 +1022,8 @@ void WebPage::sendViewportAttributesChanged() ViewportAttributes attr = computeViewportAttributes(m_page->viewportArguments(), minimumLayoutFallbackWidth, deviceWidth, deviceHeight, m_page->deviceScaleFactor(), m_viewportSize); - setResizesToContentsUsingLayoutSize(IntSize(static_cast<int>(attr.layoutSize.width()), static_cast<int>(attr.layoutSize.height()))); + // This also takes care of the relayout. + setFixedLayoutSize(IntSize(static_cast<int>(attr.layoutSize.width()), static_cast<int>(attr.layoutSize.height()))); send(Messages::WebPageProxy::DidChangeViewportProperties(attr)); } @@ -1152,12 +1185,31 @@ float WebPage::deviceScaleFactor() const void WebPage::setUseFixedLayout(bool fixed) { + // Do not overwrite current settings if initially setting it to false. + if (m_useFixedLayout == fixed) + return; m_useFixedLayout = fixed; + m_page->settings()->setFixedElementsLayoutRelativeToFrame(fixed); +#if USE(COORDINATED_GRAPHICS) + m_page->settings()->setAcceleratedCompositingForFixedPositionEnabled(fixed); + m_page->settings()->setFixedPositionCreatesStackingContext(fixed); +#endif + +#if USE(TILED_BACKING_STORE) && ENABLE(SMOOTH_SCROLLING) + // Delegated scrolling will be enabled when the FrameView is created if fixed layout is enabled. + // Ensure we don't do animated scrolling in the WebProcess in that case. + m_page->settings()->setEnableScrollAnimator(!fixed); +#endif + FrameView* view = mainFrameView(); if (!view) return; +#if USE(TILED_BACKING_STORE) + view->setDelegatesScrolling(fixed); + view->setPaintsEntireContents(fixed); +#endif view->setUseFixedLayout(fixed); if (!fixed) setFixedLayoutSize(IntSize()); @@ -1166,7 +1218,7 @@ void WebPage::setUseFixedLayout(bool fixed) void WebPage::setFixedLayoutSize(const IntSize& size) { FrameView* view = mainFrameView(); - if (!view) + if (!view || view->fixedLayoutSize() == size) return; view->setFixedLayoutSize(size); @@ -1573,7 +1625,7 @@ void WebPage::validateCommand(const String& commandName, uint64_t callbackID) int32_t state = 0; Frame* frame = m_page->focusController()->focusedOrMainFrame(); if (frame) { - if (PluginView* pluginView = pluginViewForFrame(frame)) + if (PluginView* pluginView = focusedPluginViewForFrame(frame)) isEnabled = pluginView->isEditingCommandEnabled(commandName); else { Editor::Command command = frame->editor()->command(commandName); @@ -1854,7 +1906,7 @@ void WebPage::didStartPageTransition() void WebPage::didCompletePageTransition() { -#if PLATFORM(QT) +#if USE(TILED_BACKING_STORE) if (m_mainFrame->coreFrame()->view()->delegatesScrolling()) // Wait until the UI process sent us the visible rect it wants rendered. send(Messages::WebPageProxy::PageTransitionViewportReady()); @@ -3449,12 +3501,12 @@ static bool canPluginHandleResponse(const ResourceResponse& response) { #if ENABLE(NETSCAPE_PLUGIN_API) String pluginPath; - bool blocked; + uint32_t pluginLoadPolicy; - if (!WebProcess::shared().connection()->sendSync(Messages::WebProcessProxy::GetPluginPath(response.mimeType(), response.url().string()), Messages::WebProcessProxy::GetPluginPath::Reply(pluginPath, blocked), 0)) + if (!WebProcess::shared().connection()->sendSync(Messages::WebProcessProxy::GetPluginPath(response.mimeType(), response.url().string()), Messages::WebProcessProxy::GetPluginPath::Reply(pluginPath, pluginLoadPolicy), 0)) return false; - - return !blocked && !pluginPath.isEmpty(); + + return pluginLoadPolicy != PluginModuleBlocked && !pluginPath.isEmpty(); #else return false; #endif diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h index 74be313e7..eafc8716c 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.h +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h @@ -43,6 +43,7 @@ #include "InjectedBundlePagePolicyClient.h" #include "InjectedBundlePageResourceLoadClient.h" #include "InjectedBundlePageUIClient.h" +#include "MessageReceiver.h" #include "MessageSender.h" #include "TapHighlightController.h" #include "Plugin.h" @@ -162,7 +163,7 @@ class WebGestureEvent; class WebTouchEvent; #endif -class WebPage : public APIObject, public CoreIPC::MessageSender<WebPage> { +class WebPage : public APIObject, public CoreIPC::MessageReceiver, public CoreIPC::MessageSender<WebPage> { public: static const Type APIType = TypeBundlePage; @@ -238,9 +239,8 @@ public: WebOpenPanelResultListener* activeOpenPanelResultListener() const { return m_activeOpenPanelResultListener.get(); } void setActiveOpenPanelResultListener(PassRefPtr<WebOpenPanelResultListener>); - // -- Called from WebProcess. - void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); - void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&, OwnPtr<CoreIPC::MessageEncoder>&); + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE; + void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&, OwnPtr<CoreIPC::MessageEncoder>&) OVERRIDE; // -- InjectedBundle methods #if ENABLE(CONTEXT_MENUS) @@ -378,7 +378,6 @@ public: #if USE(TILED_BACKING_STORE) void pageDidRequestScroll(const WebCore::IntPoint&); void setFixedVisibleContentRect(const WebCore::IntRect&); - void setResizesToContentsUsingLayoutSize(const WebCore::IntSize&); void resizeToContentsIfNeeded(); void sendViewportAttributesChanged(); void setViewportSize(const WebCore::IntSize&); @@ -465,7 +464,10 @@ public: void gestureWillBegin(const WebCore::IntPoint&, bool& canBeginPanning); void gestureDidScroll(const WebCore::IntSize&); void gestureDidEnd(); - +#elif PLATFORM(EFL) + void confirmComposition(const String& compositionString); + void setComposition(const WTF::String& compositionString, const WTF::Vector<WebCore::CompositionUnderline>& underlines, uint64_t cursorPosition); + void cancelComposition(); #elif PLATFORM(GTK) void updateAccessibilityTree(); #if USE(TEXTURE_MAPPER_GL) diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in index e891890ac..0933aa1aa 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in @@ -292,6 +292,11 @@ messages -> WebPage { GestureDidScroll(WebCore::IntSize size) GestureDidEnd() #endif +#if PLATFORM(EFL) + ConfirmComposition(WTF::String compositionString) + SetComposition(WTF::String compositionString, WTF::Vector<WebCore::CompositionUnderline> underlines, uint64_t cursorPosition) + CancelComposition() +#endif #if PLATFORM(QT) FindZoomableAreaForPoint(WebCore::IntPoint point, WebCore::IntSize area) #endif diff --git a/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.cpp b/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.cpp index 0872f4355..dba55c212 100644 --- a/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.cpp +++ b/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.cpp @@ -203,16 +203,6 @@ void LayerTreeHostCA::paintContents(const GraphicsLayer* graphicsLayer, Graphics } } -bool LayerTreeHostCA::showDebugBorders(const GraphicsLayer*) const -{ - return m_webPage->corePage()->settings()->showDebugBorders(); -} - -bool LayerTreeHostCA::showRepaintCounter(const GraphicsLayer*) const -{ - return m_webPage->corePage()->settings()->showRepaintCounter(); -} - float LayerTreeHostCA::deviceScaleFactor() const { return m_webPage->corePage()->deviceScaleFactor(); diff --git a/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.h b/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.h index 9cb8ca6a5..21b13da1c 100644 --- a/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.h +++ b/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.h @@ -76,8 +76,6 @@ private: virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time); virtual void notifyFlushRequired(const WebCore::GraphicsLayer*); virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect); - virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const; - virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const; virtual float deviceScaleFactor() const; virtual void didCommitChangesForLayer(const WebCore::GraphicsLayer*) const { } diff --git a/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp b/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp index 0057e86ac..520ce8576 100644 --- a/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp +++ b/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp @@ -28,6 +28,7 @@ #include "config.h" #include "WebPage.h" +#include "EditorState.h" #include "NotImplemented.h" #include "WebEvent.h" #include "WindowsKeyboardCodes.h" @@ -152,4 +153,56 @@ void WebPage::setThemePath(const String& themePath) theme->setThemePath(themePath); } +static Frame* targetFrameForEditing(WebPage* page) +{ + Frame* frame = page->corePage()->focusController()->focusedOrMainFrame(); + if (!frame) + return 0; + + Editor* editor = frame->editor(); + if (!editor->canEdit()) + return 0; + + if (editor->hasComposition()) { + // We should verify the parent node of this IME composition node are + // editable because JavaScript may delete a parent node of the composition + // node. In this case, WebKit crashes while deleting texts from the parent + // node, which doesn't exist any longer. + if (PassRefPtr<Range> range = editor->compositionRange()) { + Node* node = range->startContainer(); + if (!node || !node->isContentEditable()) + return 0; + } + } + + return frame; +} + +void WebPage::confirmComposition(const String& compositionString) +{ + Frame* targetFrame = targetFrameForEditing(this); + if (!targetFrame) + return; + + targetFrame->editor()->confirmComposition(compositionString); +} + +void WebPage::setComposition(const String& compositionString, const Vector<WebCore::CompositionUnderline>& underlines, uint64_t cursorPosition) +{ + Frame* targetFrame = targetFrameForEditing(this); + if (!targetFrame) + return; + + targetFrame->editor()->setComposition(compositionString, underlines, cursorPosition, 0); +} + +void WebPage::cancelComposition() +{ + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + if (!frame) + return; + + frame->editor()->cancelComposition(); +} + } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp b/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp index af2ae89bf..07fe12855 100644 --- a/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp +++ b/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp @@ -258,16 +258,6 @@ void LayerTreeHostGtk::paintContents(const GraphicsLayer* graphicsLayer, Graphic } } -bool LayerTreeHostGtk::showDebugBorders(const GraphicsLayer*) const -{ - return m_webPage->corePage()->settings()->showDebugBorders(); -} - -bool LayerTreeHostGtk::showRepaintCounter(const GraphicsLayer*) const -{ - return m_webPage->corePage()->settings()->showRepaintCounter(); -} - gboolean LayerTreeHostGtk::layerFlushTimerFiredCallback(LayerTreeHostGtk* layerTreeHost) { layerTreeHost->layerFlushTimerFired(); diff --git a/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h b/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h index 61b9fa671..840ada813 100644 --- a/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h +++ b/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h @@ -77,8 +77,6 @@ private: virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time); virtual void notifyFlushRequired(const WebCore::GraphicsLayer*); virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect); - virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const; - virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const; virtual void didCommitChangesForLayer(const WebCore::GraphicsLayer*) const { } void createPageOverlayLayer(); diff --git a/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h b/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h new file mode 100644 index 000000000..c6163c1d6 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2012 Apple Inc. 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 RemoteLayerTreeDrawingArea_h +#define RemoteLayerTreeDrawingArea_h + +#include "DrawingArea.h" +#include <wtf/PassOwnPtr.h> + +namespace WebKit { + +class RemoteLayerTreeDrawingArea : public DrawingArea { +public: + static PassOwnPtr<RemoteLayerTreeDrawingArea> create(WebPage*, const WebPageCreationParameters&); + virtual ~RemoteLayerTreeDrawingArea(); + +private: + RemoteLayerTreeDrawingArea(WebPage*, const WebPageCreationParameters&); + + // DrawingArea + virtual void setNeedsDisplay(const WebCore::IntRect&) OVERRIDE; + virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) OVERRIDE; + + virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) OVERRIDE; + virtual void scheduleCompositingLayerFlush() OVERRIDE; +}; + +} // namespace WebKit + +#endif // RemoteLayerTreeDrawingArea_h diff --git a/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm b/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm new file mode 100644 index 000000000..318b3815a --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2012 Apple Inc. 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 "RemoteLayerTreeDrawingArea.h" + +using namespace WebCore; + +namespace WebKit { + +PassOwnPtr<RemoteLayerTreeDrawingArea> RemoteLayerTreeDrawingArea::create(WebPage* webPage, const WebPageCreationParameters& parameters) +{ + return adoptPtr(new RemoteLayerTreeDrawingArea(webPage, parameters)); +} + +RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea(WebPage* webPage, const WebPageCreationParameters&) + : DrawingArea(DrawingAreaTypeRemoteLayerTree, webPage) +{ +} + +RemoteLayerTreeDrawingArea::~RemoteLayerTreeDrawingArea() +{ +} + +void RemoteLayerTreeDrawingArea::setNeedsDisplay(const IntRect&) +{ +} + +void RemoteLayerTreeDrawingArea::scroll(const IntRect& scrollRect, const IntSize& scrollOffset) +{ +} + +void RemoteLayerTreeDrawingArea::setRootCompositingLayer(GraphicsLayer*) +{ +} + +void RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlush() +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h index f5048a985..7d5b3be96 100644 --- a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h +++ b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h @@ -72,8 +72,6 @@ private: virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time) OVERRIDE; virtual void notifyFlushRequired(const WebCore::GraphicsLayer*) OVERRIDE; virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect) OVERRIDE; - virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const OVERRIDE; - virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const OVERRIDE; virtual float deviceScaleFactor() const OVERRIDE; // WebCore::LayerFlushSchedulerClient diff --git a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm index fcd72cac9..cf5d23e01 100644 --- a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm +++ b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm @@ -273,16 +273,6 @@ void TiledCoreAnimationDrawingArea::paintContents(const GraphicsLayer* graphicsL m_webPage->drawPageOverlay(graphicsContext, clipRect); } -bool TiledCoreAnimationDrawingArea::showDebugBorders(const GraphicsLayer*) const -{ - return m_webPage->corePage()->settings()->showDebugBorders(); -} - -bool TiledCoreAnimationDrawingArea::showRepaintCounter(const GraphicsLayer*) const -{ - return m_webPage->corePage()->settings()->showRepaintCounter(); -} - float TiledCoreAnimationDrawingArea::deviceScaleFactor() const { return m_webPage->corePage()->deviceScaleFactor(); diff --git a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm index 2acf85b0e..b524daf0c 100644 --- a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm +++ b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm @@ -679,11 +679,9 @@ bool WebPage::platformHasLocalDataForURL(const WebCore::KURL& url) NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:url]; [request setValue:(NSString*)userAgent() forHTTPHeaderField:@"User-Agent"]; NSCachedURLResponse *cachedResponse; -#if USE(CFURLSTORAGESESSIONS) if (CFURLStorageSessionRef storageSession = ResourceHandle::currentStorageSession()) cachedResponse = WKCachedResponseForRequest(storageSession, request); else -#endif cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request]; [request release]; @@ -695,10 +693,8 @@ static NSCachedURLResponse *cachedResponseForURL(WebPage* webPage, const KURL& u RetainPtr<NSMutableURLRequest> request(AdoptNS, [[NSMutableURLRequest alloc] initWithURL:url]); [request.get() setValue:(NSString *)webPage->userAgent() forHTTPHeaderField:@"User-Agent"]; -#if USE(CFURLSTORAGESESSIONS) if (CFURLStorageSessionRef storageSession = ResourceHandle::currentStorageSession()) return WKCachedResponseForRequest(storageSession, request.get()); -#endif return [[NSURLCache sharedURLCache] cachedResponseForRequest:request.get()]; } diff --git a/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp b/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp index 6294f00d8..212fe6d4d 100644 --- a/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp +++ b/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp @@ -266,19 +266,14 @@ static RetainPtr<CFCachedURLResponseRef> cachedResponseForURL(WebPage* webPage, { RetainPtr<CFURLRef> cfURL(AdoptCF, url.createCFURL()); RetainPtr<CFMutableURLRequestRef> request(AdoptCF, CFURLRequestCreateMutable(0, cfURL.get(), kCFURLRequestCachePolicyReloadIgnoringCache, 60, 0)); -#if USE(CFURLSTORAGESESSIONS) wkSetRequestStorageSession(ResourceHandle::currentStorageSession(), request.get()); -#endif - RetainPtr<CFStringRef> userAgent(AdoptCF, webPage->userAgent().createCFString()); - CFURLRequestSetHTTPHeaderFieldValue(request.get(), CFSTR("User-Agent"), userAgent.get()); + CFURLRequestSetHTTPHeaderFieldValue(request.get(), CFSTR("User-Agent"), webPage->userAgent().createCFString().get()); RetainPtr<CFURLCacheRef> cache; -#if USE(CFURLSTORAGESESSIONS) if (CFURLStorageSessionRef currentStorageSession = ResourceHandle::currentStorageSession()) cache.adoptCF(wkCopyURLCache(currentStorageSession)); else -#endif cache.adoptCF(CFURLCacheCopySharedURLCache()); RetainPtr<CFCachedURLResponseRef> response(AdoptCF, CFURLCacheCopyResponseForRequest(cache.get(), request.get())); diff --git a/Source/WebKit2/WebProcess/WebProcess.cpp b/Source/WebKit2/WebProcess/WebProcess.cpp index 33be75989..60fe731b9 100644 --- a/Source/WebKit2/WebProcess/WebProcess.cpp +++ b/Source/WebKit2/WebProcess/WebProcess.cpp @@ -199,6 +199,16 @@ void WebProcess::addMessageReceiver(CoreIPC::StringReference messageReceiverName m_messageReceiverMap.addMessageReceiver(messageReceiverName, messageReceiver); } +void WebProcess::addMessageReceiver(CoreIPC::StringReference messageReceiverName, uint64_t destinationID, CoreIPC::MessageReceiver* messageReceiver) +{ + m_messageReceiverMap.addMessageReceiver(messageReceiverName, destinationID, messageReceiver); +} + +void WebProcess::removeMessageReceiver(CoreIPC::StringReference messageReceiverName, uint64_t destinationID) +{ + m_messageReceiverMap.removeMessageReceiver(messageReceiverName, destinationID); +} + void WebProcess::initializeWebProcess(const WebProcessCreationParameters& parameters, CoreIPC::MessageDecoder& decoder) { ASSERT(m_pageMap.isEmpty()); @@ -264,7 +274,8 @@ void WebProcess::initializeWebProcess(const WebProcessCreationParameters& parame if (parameters.shouldUseFontSmoothing) setShouldUseFontSmoothing(true); -#if USE(CFURLSTORAGESESSIONS) +#if PLATFORM(MAC) || USE(CFNETWORK) + // FIXME (NetworkProcess): Send this identifier to network process. WebCore::ResourceHandle::setPrivateBrowsingStorageSessionIdentifierBase(parameters.uiProcessBundleIdentifier); #endif @@ -297,8 +308,7 @@ void WebProcess::ensureNetworkProcessConnection() #else ASSERT_NOT_REACHED(); #endif - - RefPtr<NetworkProcessConnection> m_networkProcessConnection = NetworkProcessConnection::create(connectionIdentifier); + m_networkProcessConnection = NetworkProcessConnection::create(connectionIdentifier); } #endif // ENABLE(NETWORK_PROCESS) @@ -651,18 +661,8 @@ void WebProcess::terminate() void WebProcess::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder, OwnPtr<CoreIPC::MessageEncoder>& replyEncoder) { - if (m_messageReceiverMap.dispatchSyncMessage(connection, messageID, decoder, replyEncoder)) - return; - - uint64_t pageID = decoder.destinationID(); - if (!pageID) - return; - - WebPage* page = webPage(pageID); - if (!page) + m_messageReceiverMap.dispatchSyncMessage(connection, messageID, decoder, replyEncoder); return; - - page->didReceiveSyncMessage(connection, messageID, decoder, replyEncoder); } void WebProcess::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder) @@ -692,25 +692,6 @@ void WebProcess::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Mes } #endif -#if ENABLE(BATTERY_STATUS) - if (messageID.is<CoreIPC::MessageClassWebBatteryManager>()) { - m_batteryManager.didReceiveMessage(connection, messageID, decoder); - return; - } -#endif - -#if ENABLE(NETWORK_INFO) - if (messageID.is<CoreIPC::MessageClassWebNetworkInfoManager>()) { - m_networkInfoManager.didReceiveMessage(connection, messageID, decoder); - return; - } -#endif - - if (messageID.is<CoreIPC::MessageClassWebIconDatabaseProxy>()) { - m_iconDatabaseProxy.didReceiveMessage(connection, messageID, decoder); - return; - } - if (messageID.is<CoreIPC::MessageClassWebKeyValueStorageManager>()) { WebKeyValueStorageManager::shared().didReceiveMessage(connection, messageID, decoder); return; @@ -720,25 +701,11 @@ void WebProcess::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Mes WebMediaCacheManager::shared().didReceiveMessage(connection, messageID, decoder); return; } - -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) - if (messageID.is<CoreIPC::MessageClassWebNotificationManager>()) { - m_notificationManager.didReceiveMessage(connection, messageID, decoder); - return; - } -#endif if (messageID.is<CoreIPC::MessageClassWebResourceCacheManager>()) { WebResourceCacheManager::shared().didReceiveMessage(connection, messageID, decoder); return; } - -#if USE(SOUP) - if (messageID.is<CoreIPC::MessageClassWebSoupRequestManager>()) { - m_soupRequestManager.didReceiveMessage(connection, messageID, decoder); - return; - } -#endif if (messageID.is<CoreIPC::MessageClassWebPageGroupProxy>()) { uint64_t pageGroupID = decoder.destinationID(); @@ -751,16 +718,6 @@ void WebProcess::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Mes pageGroupProxy->didReceiveMessage(connection, messageID, decoder); } - - uint64_t pageID = decoder.destinationID(); - if (!pageID) - return; - - WebPage* page = webPage(pageID); - if (!page) - return; - - page->didReceiveMessage(connection, messageID, decoder); } void WebProcess::didClose(CoreIPC::Connection*) @@ -786,7 +743,7 @@ void WebProcess::didClose(CoreIPC::Connection*) m_runLoop->stop(); } -void WebProcess::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID) +void WebProcess::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference, CoreIPC::StringReference) { // We received an invalid message, but since this is from the UI process (which we trust), // we'll let it slide. @@ -1075,8 +1032,18 @@ void WebProcess::postInjectedBundleMessage(const CoreIPC::DataReference& message } #if ENABLE(NETWORK_PROCESS) +NetworkProcessConnection* WebProcess::networkConnection() +{ + // FIXME (NetworkProcess): How do we handle not having the connection when the WebProcess needs it? + // If the NetworkProcess crashed, for example. Do we respawn it? + ASSERT(m_networkProcessConnection); + return m_networkProcessConnection.get(); +} + void WebProcess::networkProcessConnectionClosed(NetworkProcessConnection* connection) { + // FIXME (NetworkProcess): How do we handle not having the connection when the WebProcess needs it? + // If the NetworkProcess crashed, for example. Do we respawn it? ASSERT(m_networkProcessConnection); ASSERT(m_networkProcessConnection == connection); @@ -1085,6 +1052,8 @@ void WebProcess::networkProcessConnectionClosed(NetworkProcessConnection* connec void WebProcess::networkProcessCrashed(CoreIPC::Connection*) { + // FIXME (NetworkProcess): How do we handle not having the connection when the WebProcess needs it? + // If the NetworkProcess crashed, for example. Do we respawn it? ASSERT(m_networkProcessConnection); networkProcessConnectionClosed(m_networkProcessConnection.get()); diff --git a/Source/WebKit2/WebProcess/WebProcess.h b/Source/WebKit2/WebProcess/WebProcess.h index 88b5f5799..0b3c0fb99 100644 --- a/Source/WebKit2/WebProcess/WebProcess.h +++ b/Source/WebKit2/WebProcess/WebProcess.h @@ -72,6 +72,10 @@ QT_END_NAMESPACE #include "WebNotificationManager.h" #endif +#if ENABLE(NETWORK_PROCESS) +#include "WebResourceLoadScheduler.h" +#endif + #if ENABLE(PLUGIN_PROCESS) #include "PluginProcessConnectionManager.h" #endif @@ -115,6 +119,9 @@ public: WebCore::RunLoop* runLoop() const { return m_runLoop; } void addMessageReceiver(CoreIPC::StringReference messageReceiverName, CoreIPC::MessageReceiver*); + void addMessageReceiver(CoreIPC::StringReference messageReceiverName, uint64_t destinationID, CoreIPC::MessageReceiver*); + + void removeMessageReceiver(CoreIPC::StringReference messageReceiverName, uint64_t destinationID); WebConnectionToUIProcess* webConnectionToUIProcess() const { return m_connection.get(); } @@ -196,7 +203,10 @@ public: #endif #if ENABLE(NETWORK_PROCESS) + NetworkProcessConnection* networkConnection(); void networkProcessConnectionClosed(NetworkProcessConnection*); + bool usesNetworkProcess() const { return m_usesNetworkProcess; } + WebResourceLoadScheduler& webResourceLoadScheduler() { return m_webResourceLoadScheduler; } #endif private: @@ -278,7 +288,7 @@ private: virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&, OwnPtr<CoreIPC::MessageEncoder>&); virtual void didClose(CoreIPC::Connection*); - virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID); + virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName) OVERRIDE; #if PLATFORM(WIN) virtual Vector<HWND> windowsToReceiveSentMessagesWhileWaitingForSyncReply(); #endif @@ -354,6 +364,7 @@ private: void ensureNetworkProcessConnection(); RefPtr<NetworkProcessConnection> m_networkProcessConnection; bool m_usesNetworkProcess; + WebResourceLoadScheduler m_webResourceLoadScheduler; #endif #if ENABLE(PLUGIN_PROCESS) diff --git a/Source/WebKit2/WebProcess/WebProcess.messages.in b/Source/WebKit2/WebProcess/WebProcess.messages.in index 2cc1e6280..2c1b43052 100644 --- a/Source/WebKit2/WebProcess/WebProcess.messages.in +++ b/Source/WebKit2/WebProcess/WebProcess.messages.in @@ -97,4 +97,8 @@ messages -> WebProcess { SecItemResponse(uint64_t requestID, WebKit::SecItemResponseData response) DispatchOnConnectionQueue SecKeychainItemResponse(uint64_t requestID, WebKit::SecKeychainItemResponseData response) DispatchOnConnectionQueue #endif + +#if PLATFORM(MAC) + SetApplicationIsOccluded(bool flag); +#endif } diff --git a/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp b/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp index 589aa70fe..e4a807bca 100644 --- a/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp +++ b/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp @@ -41,6 +41,17 @@ #include <wtf/MainThread.h> #include <wtf/text/CString.h> +#ifdef HAVE_ECORE_X +#include <Ecore_X.h> +#include <X11/Xlib.h> +#include <X11/extensions/Xext.h> + +static int dummyExtensionErrorHandler(Display*, _Xconst char*, _Xconst char*) +{ + return 0; +} +#endif + #if USE(COORDINATED_GRAPHICS) #include "CoordinatedGraphicsLayer.h" #endif @@ -64,6 +75,19 @@ WK_EXPORT int WebProcessMainEfl(int argc, char* argv[]) return 1; } +#ifdef HAVE_ECORE_X + XSetExtensionErrorHandler(dummyExtensionErrorHandler); + + if (!ecore_x_init(0)) { + // Could not init ecore_x. + // PlatformScreenEfl and systemBeep() functions + // depend on ecore_x functionality. + ecore_shutdown(); + eina_shutdown(); + return 1; + } +#endif + #if ENABLE(GLIB_SUPPORT) g_type_init(); @@ -105,6 +129,10 @@ WK_EXPORT int WebProcessMainEfl(int argc, char* argv[]) soup_cache_dump(soupCache); g_object_unref(soupCache); + ecore_x_shutdown(); + ecore_shutdown(); + eina_shutdown(); + return 0; } diff --git a/Source/WebKit2/WebProcess/gtk/WebAuthDialog.cpp b/Source/WebKit2/WebProcess/gtk/WebAuthDialog.cpp deleted file mode 100644 index f3c3eab9c..000000000 --- a/Source/WebKit2/WebProcess/gtk/WebAuthDialog.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2011 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 "WebAuthDialog.h" - -#include <WebCore/GtkAuthenticationDialog.h> - -typedef struct { - GObject parent; -} WebAuthDialog; - -typedef struct { - GObjectClass parent; -} WebAuthDialogClass; - -static void webAuthDialogSessionFeatureInit(SoupSessionFeatureInterface*, gpointer); - -G_DEFINE_TYPE_WITH_CODE(WebAuthDialog, web_auth_dialog, G_TYPE_OBJECT, - G_IMPLEMENT_INTERFACE(SOUP_TYPE_SESSION_FEATURE, - webAuthDialogSessionFeatureInit)) - -static void web_auth_dialog_class_init(WebAuthDialogClass*) -{ -} - -static void web_auth_dialog_init(WebAuthDialog*) -{ -} - -static void sessionAuthenticate(SoupSession* session, SoupMessage* message, SoupAuth* auth, gboolean, gpointer) -{ - WebCore::GtkAuthenticationDialog* authDialog = new WebCore::GtkAuthenticationDialog(0, session, message, auth); - authDialog->show(); -} - -static void attach(SoupSessionFeature*, SoupSession* session) -{ - g_signal_connect(session, "authenticate", G_CALLBACK(sessionAuthenticate), 0); -} - -static void detach(SoupSessionFeature*, SoupSession* session) -{ - g_signal_handlers_disconnect_by_func(session, reinterpret_cast<gpointer>(sessionAuthenticate), 0); -} - -static void webAuthDialogSessionFeatureInit(SoupSessionFeatureInterface* feature, gpointer) -{ - feature->attach = attach; - feature->detach = detach; -} diff --git a/Source/WebKit2/WebProcess/gtk/WebAuthDialog.h b/Source/WebKit2/WebProcess/gtk/WebAuthDialog.h deleted file mode 100644 index 9eafea10c..000000000 --- a/Source/WebKit2/WebProcess/gtk/WebAuthDialog.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2011 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 WebAuthDialog_h -#define WebAuthDialog_h - -#include <glib-object.h> - -#define WEB_TYPE_AUTH_DIALOG (web_auth_dialog_get_type()) - -GType web_auth_dialog_get_type(); - -#endif // WebAuthDialog_h diff --git a/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp b/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp index 7dacc226e..f17ac6cee 100644 --- a/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp +++ b/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp @@ -29,9 +29,7 @@ #define LIBSOUP_USE_UNSTABLE_REQUEST_API -#include "WebAuthDialog.h" #include "WKBase.h" -#include <WebCore/GtkAuthenticationDialog.h> #include <WebCore/ResourceHandle.h> #include <WebCore/RunLoop.h> #include <WebKit2/WebProcess.h> @@ -66,12 +64,10 @@ WK_EXPORT int WebProcessMainGtk(int argc, char* argv[]) int socket = atoi(argv[1]); WebProcess::shared().initialize(socket, RunLoop::main()); - SoupSession* session = WebCore::ResourceHandle::defaultSession(); - soup_session_add_feature_by_type(session, WEB_TYPE_AUTH_DIALOG); - // Despite using system CAs to validate certificates we're // accepting invalid certificates by default. New API will be // added later to let client accept/discard invalid certificates. + SoupSession* session = WebCore::ResourceHandle::defaultSession(); g_object_set(session, SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, TRUE, SOUP_SESSION_SSL_STRICT, FALSE, NULL); diff --git a/Source/WebKit2/WebProcess/mac/WebProcessMac.mm b/Source/WebKit2/WebProcess/mac/WebProcessMac.mm index 10766d2cc..001deb4c8 100644 --- a/Source/WebKit2/WebProcess/mac/WebProcessMac.mm +++ b/Source/WebKit2/WebProcess/mac/WebProcessMac.mm @@ -53,6 +53,7 @@ #endif #if ENABLE(WEB_PROCESS_SANDBOX) +#import <pwd.h> #import <stdlib.h> #import <sysexits.h> @@ -168,15 +169,9 @@ static void appendReadonlySandboxDirectory(Vector<const char*>& vector, const ch appendSandboxParameterPathInternal(vector, name, [path length] ? [(NSString *)path fileSystemRepresentation] : ""); } -static void appendReadwriteSandboxDirectory(Vector<const char*>& vector, const char* name, NSString *path) +static void appendReadwriteSandboxDirectory(Vector<const char*>& vector, const char* name, const char* path) { - NSError *error = nil; - - // This is very unlikely to fail, but in case it actually happens, we'd like some sort of output in the console. - if (![[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:&error]) - NSLog(@"could not create \"%@\", error %@", path, error); - - appendSandboxParameterPathInternal(vector, name, [(NSString *)path fileSystemRepresentation]); + appendSandboxParameterPathInternal(vector, name, path); } #endif @@ -215,8 +210,17 @@ void WebProcess::initializeSandbox(const String& clientIdentifier) appendReadwriteConfDirectory(sandboxParameters, "DARWIN_USER_TEMP_DIR", _CS_DARWIN_USER_TEMP_DIR); appendReadwriteConfDirectory(sandboxParameters, "DARWIN_USER_CACHE_DIR", _CS_DARWIN_USER_CACHE_DIR); + char buffer[4096]; + int bufferSize = sizeof(buffer); + struct passwd pwd; + struct passwd* result = 0; + if (getpwuid_r(getuid(), &pwd, buffer, bufferSize, &result) || !result) { + WTFLogAlways("WebProcess: Couldn't find home directory\n"); + exit(EX_NOPERM); + } + // These are read-write paths. - appendReadwriteSandboxDirectory(sandboxParameters, "HOME_DIR", NSHomeDirectory()); + appendReadwriteSandboxDirectory(sandboxParameters, "HOME_DIR", pwd.pw_dir); sandboxParameters.append(static_cast<const char*>(0)); @@ -224,7 +228,7 @@ void WebProcess::initializeSandbox(const String& clientIdentifier) char* errorBuf; if (sandbox_init_with_parameters(profilePath, SANDBOX_NAMED_EXTERNAL, sandboxParameters.data(), &errorBuf)) { - WTFLogAlways("WebProcess: couldn't initialize sandbox profile [%s] error '%s'\n", profilePath, errorBuf); + WTFLogAlways("WebProcess: Couldn't initialize sandbox profile [%s] error '%s'\n", profilePath, errorBuf); for (size_t i = 0; sandboxParameters[i]; i += 2) WTFLogAlways("%s=%s\n", sandboxParameters[i], sandboxParameters[i + 1]); exit(EX_NOPERM); @@ -236,7 +240,7 @@ void WebProcess::initializeSandbox(const String& clientIdentifier) // This will override LSFileQuarantineEnabled from Info.plist unless sandbox quarantine is globally disabled. OSStatus error = WKEnableSandboxStyleFileQuarantine(); if (error) { - WTFLogAlways("WebProcess: couldn't enable sandbox style file quarantine: %ld\n", (long)error); + WTFLogAlways("WebProcess: Couldn't enable sandbox style file quarantine: %ld\n", (long)error); exit(EX_NOPERM); } #endif diff --git a/Source/WebKit2/WebProcess/soup/WebSoupRequestManager.cpp b/Source/WebKit2/WebProcess/soup/WebSoupRequestManager.cpp index b9b3587f4..c7d10c6b3 100644 --- a/Source/WebKit2/WebProcess/soup/WebSoupRequestManager.cpp +++ b/Source/WebKit2/WebProcess/soup/WebSoupRequestManager.cpp @@ -27,6 +27,7 @@ #include "WebKitSoupRequestInputStream.h" #include "WebPageProxyMessages.h" #include "WebProcess.h" +#include "WebSoupRequestManagerMessages.h" #include "WebSoupRequestManagerProxyMessages.h" #include <WebCore/ResourceHandle.h> #include <WebCore/ResourceRequest.h> @@ -80,6 +81,7 @@ WebSoupRequestManager::WebSoupRequestManager(WebProcess* process) : m_process(process) , m_schemes(adoptGRef(g_ptr_array_new_with_free_func(g_free))) { + m_process->addMessageReceiver(Messages::WebSoupRequestManager::messageReceiverName(), this); } WebSoupRequestManager::~WebSoupRequestManager() diff --git a/Source/WebKit2/WebProcess/soup/WebSoupRequestManager.h b/Source/WebKit2/WebProcess/soup/WebSoupRequestManager.h index cae652ecf..8178411a6 100644 --- a/Source/WebKit2/WebProcess/soup/WebSoupRequestManager.h +++ b/Source/WebKit2/WebProcess/soup/WebSoupRequestManager.h @@ -20,6 +20,8 @@ #ifndef WebSoupRequestManager_h #define WebSoupRequestManager_h +#include "DataReference.h" +#include "MessageReceiver.h" #include <wtf/HashMap.h> #include <wtf/Noncopyable.h> #include <wtf/OwnPtr.h> @@ -29,19 +31,12 @@ typedef struct _GInputStream GInputStream; typedef struct _GSimpleAsyncResult GSimpleAsyncResult; -namespace CoreIPC { -class Connection; -class DataReference; -class MessageDecoder; -class MessageID; -} - namespace WebKit { class WebProcess; struct WebSoupRequestAsyncData; -class WebSoupRequestManager { +class WebSoupRequestManager : private CoreIPC::MessageReceiver { WTF_MAKE_NONCOPYABLE(WebSoupRequestManager); public: explicit WebSoupRequestManager(WebProcess*); @@ -50,9 +45,11 @@ public: void send(GSimpleAsyncResult*, GCancellable*); GInputStream* finish(GSimpleAsyncResult*); - void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); - private: + // CoreIPC::MessageReceiver + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE; + + // Implemented in generated WebSoupRequestManagerMessageReceiver.cpp void didReceiveWebSoupRequestManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); void registerURIScheme(const String& scheme); diff --git a/Source/WebKit2/WebProcess/win/WebProcessWin.cpp b/Source/WebKit2/WebProcess/win/WebProcessWin.cpp index 25dbc36c4..40066a276 100644 --- a/Source/WebKit2/WebProcess/win/WebProcessWin.cpp +++ b/Source/WebKit2/WebProcess/win/WebProcessWin.cpp @@ -71,15 +71,13 @@ void WebProcess::platformSetCacheModel(CacheModel cacheModel) { #if USE(CFNETWORK) RetainPtr<CFStringRef> cfurlCacheDirectory; -#if USE(CFURLSTORAGESESSIONS) if (CFURLStorageSessionRef defaultStorageSession = ResourceHandle::defaultStorageSession()) cfurlCacheDirectory.adoptCF(wkCopyFoundationCacheDirectory(defaultStorageSession)); else -#endif cfurlCacheDirectory.adoptCF(wkCopyFoundationCacheDirectory(0)); if (!cfurlCacheDirectory) - cfurlCacheDirectory.adoptCF(WebCore::localUserSpecificStorageDirectory().createCFString()); + cfurlCacheDirectory = WebCore::localUserSpecificStorageDirectory().createCFString(); // As a fudge factor, use 1000 instead of 1024, in case the reported byte // count doesn't align exactly to a megabyte boundary. @@ -103,11 +101,9 @@ void WebProcess::platformSetCacheModel(CacheModel cacheModel) pageCache()->setCapacity(pageCacheCapacity); RetainPtr<CFURLCacheRef> cfurlCache; -#if USE(CFURLSTORAGESESSIONS) if (CFURLStorageSessionRef defaultStorageSession = ResourceHandle::defaultStorageSession()) cfurlCache.adoptCF(wkCopyURLCache(defaultStorageSession)); else -#endif // USE(CFURLSTORAGESESSIONS) cfurlCache.adoptCF(CFURLCacheCopySharedURLCache()); CFURLCacheSetMemoryCapacity(cfurlCache.get(), urlCacheMemoryCapacity); @@ -122,11 +118,9 @@ void WebProcess::platformClearResourceCaches(ResourceCachesToClear cachesToClear return; RetainPtr<CFURLCacheRef> cache; -#if USE(CFURLSTORAGESESSIONS) if (CFURLStorageSessionRef defaultStorageSession = ResourceHandle::defaultStorageSession()) cache.adoptCF(wkCopyURLCache(defaultStorageSession)); else -#endif // USE(CFURLSTORAGESESSIONS) cache.adoptCF(CFURLCacheCopySharedURLCache()); CFURLCacheRemoveAllCachedResponses(cache.get()); @@ -148,13 +142,12 @@ void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters if (defaultStorageSession) return; - RetainPtr<CFStringRef> cachePath(AdoptCF, parameters.diskCacheDirectory.createCFString()); - if (!cachePath) + if (!parameters.diskCacheDirectory) return; CFIndex cacheDiskCapacity = parameters.cfURLCacheDiskCapacity; CFIndex cacheMemoryCapacity = parameters.cfURLCacheMemoryCapacity; - RetainPtr<CFURLCacheRef> uiProcessCache(AdoptCF, CFURLCacheCreate(kCFAllocatorDefault, cacheMemoryCapacity, cacheDiskCapacity, cachePath.get())); + RetainPtr<CFURLCacheRef> uiProcessCache(AdoptCF, CFURLCacheCreate(kCFAllocatorDefault, cacheMemoryCapacity, cacheDiskCapacity, parameters.diskCacheDirectory.createCFString().get())); CFURLCacheSetSharedURLCache(uiProcessCache.get()); #endif // USE(CFNETWORK) } diff --git a/Source/WebKit2/mac/WebKit2.order b/Source/WebKit2/mac/WebKit2.order index 21ca2ff6c..0c2c53582 100644 --- a/Source/WebKit2/mac/WebKit2.order +++ b/Source/WebKit2/mac/WebKit2.order @@ -3384,3 +3384,5 @@ _WKAdvanceDefaultButtonPulseAnimation _WKAppKitDrawDecoyWindow_isKeyWindow __ZN6WebKit7WebPage36suspendActiveDOMObjectsAndAnimationsEv __ZN6WebKit7WebPage35resumeActiveDOMObjectsAndAnimationsEv +__ZNK7WebCore5Frame25trackedRepaintRectsAsTextEv +__ZN7WebCore9FrameView17setTracksRepaintsEb diff --git a/Source/WebKit2/win/WebKit2.def b/Source/WebKit2/win/WebKit2.def index 5fe9caf05..19389a9c5 100644 --- a/Source/WebKit2/win/WebKit2.def +++ b/Source/WebKit2/win/WebKit2.def @@ -216,6 +216,7 @@ EXPORTS ?scriptExecutionContext@JSDOMGlobalObject@WebCore@@QBEPAVScriptExecutionContext@2@XZ ?scriptNameToCode@WebCore@@YA?AW4UScriptCode@@ABVString@WTF@@@Z ?scrollElementToRect@FrameView@WebCore@@QAEXPAVElement@2@ABVIntRect@2@@Z + ?scrollingStateTreeAsText@Page@WebCore@@QAE?AVString@WTF@@XZ ?setCanStartMedia@Page@WebCore@@QAEX_N@Z ?setCursiveFontFamily@Settings@WebCore@@QAEXABVAtomicString@WTF@@W4UScriptCode@@@Z ?setDeviceScaleFactor@Page@WebCore@@QAEXM@Z @@ -241,6 +242,8 @@ EXPORTS ?setStorageBlockingPolicy@Settings@WebCore@@QAEXW4StorageBlockingPolicy@SecurityOrigin@2@@Z ?setSuggestedValue@HTMLInputElement@WebCore@@QAEXABVString@WTF@@@Z ?setEditingValue@HTMLInputElement@WebCore@@QAEXABVString@WTF@@@Z + ?setResolutionOverride@Settings@WebCore@@QAEXABVIntSize@2@@Z + ?setMediaTypeOverride@Settings@WebCore@@QAEXABVString@WTF@@@Z ?settings@Document@WebCore@@QBEPAVSettings@2@XZ ?settings@Frame@WebCore@@QBEPAVSettings@2@XZ ?setFixedElementsLayoutRelativeToFrame@Settings@WebCore@@QAEX_N@Z @@ -311,4 +314,6 @@ EXPORTS ?toJS@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVDOMWindow@1@@Z ?windowObjectCleared@InspectorFrontendClientLocal@WebCore@@UAEXXZ ?layerTreeAsText@Frame@WebCore@@QBE?AVString@WTF@@I@Z + ?trackedRepaintRectsAsText@Frame@WebCore@@QBE?AVString@WTF@@XZ + ?setTracksRepaints@FrameView@WebCore@@QAEX_N@Z diff --git a/Source/WebKit2/win/WebKit2CFLite.def b/Source/WebKit2/win/WebKit2CFLite.def index 5a9d4bc77..a3152e218 100644 --- a/Source/WebKit2/win/WebKit2CFLite.def +++ b/Source/WebKit2/win/WebKit2CFLite.def @@ -209,6 +209,7 @@ EXPORTS ?scriptExecutionContext@JSDOMGlobalObject@WebCore@@QBEPAVScriptExecutionContext@2@XZ ?scriptNameToCode@WebCore@@YA?AW4UScriptCode@@ABVString@WTF@@@Z ?scrollElementToRect@FrameView@WebCore@@QAEXPAVElement@2@ABVIntRect@2@@Z + ?scrollingStateTreeAsText@Page@WebCore@@QAE?AVString@WTF@@XZ ?setCanStartMedia@Page@WebCore@@QAEX_N@Z ?setCursiveFontFamily@Settings@WebCore@@QAEXABVAtomicString@WTF@@W4UScriptCode@@@Z ?setDeviceScaleFactor@Page@WebCore@@QAEXM@Z @@ -299,3 +300,5 @@ EXPORTS ?setProperty@Settings@InspectorFrontendClientLocal@WebCore@@UAEXABVString@WTF@@0@Z ?toJS@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVDOMWindow@1@@Z ?windowObjectCleared@InspectorFrontendClientLocal@WebCore@@UAEXXZ + ?trackedRepaintRectsAsText@Frame@WebCore@@QBE?AVString@WTF@@XZ + ?setTracksRepaints@FrameView@WebCore@@QAEX_N@Z |