diff options
Diffstat (limited to 'Source/WebKit2/UIProcess')
241 files changed, 1648 insertions, 5270 deletions
diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.cpp b/Source/WebKit2/UIProcess/API/C/WKContext.cpp index a41a762d1..28a70821b 100644 --- a/Source/WebKit2/UIProcess/API/C/WKContext.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKContext.cpp @@ -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 @@ -300,12 +300,6 @@ void WKContextSetJavaScriptGarbageCollectorTimerEnabled(WKContextRef contextRef, { toImpl(contextRef)->setJavaScriptGarbageCollectorTimerEnabled(enable); } - -void WKContextSetUsesNetworkProcess(WKContextRef contextRef, bool usesNetworkProcess) -{ - toImpl(contextRef)->setUsesNetworkProcess(usesNetworkProcess); -} - // Deprecated functions. void _WKContextSetAdditionalPluginsDirectory(WKContextRef context, WKStringRef pluginsDirectory) { diff --git a/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h b/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h index 8aa9c0b0c..49aec7f53 100644 --- a/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h +++ b/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010, 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 @@ -70,10 +70,6 @@ WK_EXPORT void WKContextSetHTTPPipeliningEnabled(WKContextRef context, bool enab WK_EXPORT void WKContextWarmInitialProcess(WKContextRef context); -// FIXME: This function is temporary and useful during the development of the NetworkProcess feature. -// At some point it should be removed. -WK_EXPORT void WKContextSetUsesNetworkProcess(WKContextRef context, bool usesNetworkProcess); - #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp b/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp index 5d94f3e86..99195c79c 100644 --- a/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp @@ -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 @@ -38,11 +38,6 @@ WKTypeID WKGeolocationPositionGetTypeID() WKGeolocationPositionRef WKGeolocationPositionCreate(double timestamp, double latitude, double longitude, double accuracy) { - return WKGeolocationPositionCreate_b(timestamp, latitude, longitude, accuracy, false, 0., false, 0., false, 0., false, 0.); -} - -WKGeolocationPositionRef WKGeolocationPositionCreate_b(double timestamp, double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed) -{ - RefPtr<WebGeolocationPosition> position = WebGeolocationPosition::create(timestamp, latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed); + RefPtr<WebGeolocationPosition> position = WebGeolocationPosition::create(timestamp, latitude, longitude, accuracy); return toAPI(position.release().leakRef()); } diff --git a/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.h b/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.h index 4727e9763..85183fd60 100644 --- a/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.h +++ b/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.h @@ -35,7 +35,6 @@ extern "C" { WK_EXPORT WKTypeID WKGeolocationPositionGetTypeID(); WK_EXPORT WKGeolocationPositionRef WKGeolocationPositionCreate(double timestamp, double latitude, double longitude, double accuracy); -WK_EXPORT WKGeolocationPositionRef WKGeolocationPositionCreate_b(double timestamp, double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed); #ifdef __cplusplus } diff --git a/Source/WebKit2/UIProcess/API/C/WKIconDatabase.h b/Source/WebKit2/UIProcess/API/C/WKIconDatabase.h index eec4ab3af..45ceec765 100644 --- a/Source/WebKit2/UIProcess/API/C/WKIconDatabase.h +++ b/Source/WebKit2/UIProcess/API/C/WKIconDatabase.h @@ -35,22 +35,16 @@ extern "C" { // IconDatabase Client. typedef void (*WKIconDatabaseDidChangeIconForPageURLCallback)(WKIconDatabaseRef iconDatabase, WKURLRef pageURL, const void* clientInfo); typedef void (*WKIconDatabaseDidRemoveAllIconsCallback)(WKIconDatabaseRef iconDatabase, const void* clientInfo); -typedef void (*WKIconDatabaseIconDataReadyForPageURLCallback)(WKIconDatabaseRef iconDatabase, WKURLRef pageURL, const void* clientInfo); struct WKIconDatabaseClient { int version; const void * clientInfo; - - // Version 0 WKIconDatabaseDidChangeIconForPageURLCallback didChangeIconForPageURL; WKIconDatabaseDidRemoveAllIconsCallback didRemoveAllIcons; - - // Version 1 - WKIconDatabaseIconDataReadyForPageURLCallback iconDataReadyForPageURL; }; typedef struct WKIconDatabaseClient WKIconDatabaseClient; -enum { kWKIconDatabaseClientCurrentVersion = 1 }; +enum { kWKIconDatabaseClientCurrentVersion = 0 }; WK_EXPORT WKTypeID WKIconDatabaseGetTypeID(); diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.cpp b/Source/WebKit2/UIProcess/API/C/WKPage.cpp index 52e1cebf8..94fda474a 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPage.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKPage.cpp @@ -365,16 +365,6 @@ bool WKPageIsPinnedToRightSide(WKPageRef pageRef) return toImpl(pageRef)->isPinnedToRightSide(); } -bool WKPageIsPinnedToTopSide(WKPageRef pageRef) -{ - return toImpl(pageRef)->isPinnedToTopSide(); -} - -bool WKPageIsPinnedToBottomSide(WKPageRef pageRef) -{ - return toImpl(pageRef)->isPinnedToBottomSide(); -} - void WKPageSetPaginationMode(WKPageRef pageRef, WKPaginationMode paginationMode) { Pagination::Mode mode; @@ -748,7 +738,3 @@ void WKPagePostMessageToInjectedBundle(WKPageRef pageRef, WKStringRef messageNam toImpl(pageRef)->postMessageToInjectedBundle(toImpl(messageNameRef)->string(), toImpl(messageBodyRef)); } -WKArrayRef WKPageCopyRelatedPages(WKPageRef pageRef) -{ - return toAPI(toImpl(pageRef)->relatedPages().leakRef()); -} diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.h b/Source/WebKit2/UIProcess/API/C/WKPage.h index 9dfd52e3c..62db9174c 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPage.h +++ b/Source/WebKit2/UIProcess/API/C/WKPage.h @@ -439,8 +439,6 @@ WK_EXPORT bool WKPageAreScrollbarAnimationsSuppressed(WKPageRef page); WK_EXPORT bool WKPageIsPinnedToLeftSide(WKPageRef page); WK_EXPORT bool WKPageIsPinnedToRightSide(WKPageRef page); -WK_EXPORT bool WKPageIsPinnedToTopSide(WKPageRef page); -WK_EXPORT bool WKPageIsPinnedToBottomSide(WKPageRef page); WK_EXPORT bool WKPageCanDelete(WKPageRef page); WK_EXPORT bool WKPageHasSelectedRange(WKPageRef page); diff --git a/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp b/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp index 5559d0180..8a4d86a05 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp @@ -57,13 +57,3 @@ WKPreferencesRef WKPageGroupGetPreferences(WKPageGroupRef pageGroupRef) { return toAPI(toImpl(pageGroupRef)->preferences()); } - -void WKPageGroupAddUserStyleSheet(WKPageGroupRef pageGroupRef, WKStringRef sourceRef, WKURLRef baseURL, WKArrayRef whitelist, WKArrayRef blacklist, WKUserContentInjectedFrames injectedFrames) -{ - toImpl(pageGroupRef)->addUserStyleSheet(toWTFString(sourceRef), toWTFString(baseURL), toImpl(whitelist), toImpl(blacklist), toUserContentInjectedFrames(injectedFrames), WebCore::UserStyleUserLevel); -} - -void WKPageGroupRemoveAllUserStyleSheets(WKPageGroupRef pageGroupRef) -{ - toImpl(pageGroupRef)->removeAllUserStyleSheets(); -} diff --git a/Source/WebKit2/UIProcess/API/C/WKPageGroup.h b/Source/WebKit2/UIProcess/API/C/WKPageGroup.h index 1280241c8..705df083e 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPageGroup.h +++ b/Source/WebKit2/UIProcess/API/C/WKPageGroup.h @@ -40,9 +40,6 @@ WK_EXPORT WKStringRef WKPageGroupCopyIdentifier(WKPageGroupRef pageGroup); WK_EXPORT void WKPageGroupSetPreferences(WKPageGroupRef pageGroup, WKPreferencesRef preferences); WK_EXPORT WKPreferencesRef WKPageGroupGetPreferences(WKPageGroupRef pageGroup); - -WK_EXPORT void WKPageGroupAddUserStyleSheet(WKPageGroupRef pageGroup, WKStringRef source, WKURLRef baseURL, WKArrayRef whitelist, WKArrayRef blacklist, WKUserContentInjectedFrames); -WK_EXPORT void WKPageGroupRemoveAllUserStyleSheets(WKPageGroupRef pageGroup); #ifdef __cplusplus } diff --git a/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h b/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h index 3a9de69af..4a13ae7a2 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h +++ b/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h @@ -94,8 +94,6 @@ WK_EXPORT void WKPageSetShouldSendEventsSynchronously(WKPageRef page, bool sync) WK_EXPORT void WKPageSetMediaVolume(WKPageRef page, float volume); -WK_EXPORT WKArrayRef WKPageCopyRelatedPages(WKPageRef page); - #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp index 532d82caf..657b1b730 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010, 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 @@ -298,16 +298,6 @@ bool WKPreferencesGetScreenFontSubstitutionEnabled(WKPreferencesRef preferencesR return toImpl(preferencesRef)->screenFontSubstitutionEnabled(); } -void WKPreferencesSetCookieEnabled(WKPreferencesRef preferencesRef, bool enabled) -{ - toImpl(preferencesRef)->setCookieEnabled(enabled); -} - -bool WKPreferencesGetCookieEnabled(WKPreferencesRef preferencesRef) -{ - return toImpl(preferencesRef)->cookieEnabled(); -} - void WKPreferencesSetEditableLinkBehavior(WKPreferencesRef preferencesRef, WKEditableLinkBehavior wkBehavior) { toImpl(preferencesRef)->setEditableLinkBehavior(toEditableLinkBehavior(wkBehavior)); @@ -923,23 +913,3 @@ bool WKPreferencesGetScrollingPerformanceLoggingEnabled(WKPreferencesRef prefere { return toImpl(preferencesRef)->scrollingPerformanceLoggingEnabled(); } - -void WKPreferencesSetPlugInSnapshottingEnabled(WKPreferencesRef preferencesRef, bool enabled) -{ - toImpl(preferencesRef)->setPlugInSnapshottingEnabled(enabled); -} - -bool WKPreferencesGetPlugInSnapshottingEnabled(WKPreferencesRef preferencesRef) -{ - return toImpl(preferencesRef)->plugInSnapshottingEnabled(); -} - -void WKPreferencesSetPDFPluginEnabled(WKPreferencesRef preferencesRef, bool enabled) -{ - toImpl(preferencesRef)->setPDFPluginEnabled(enabled); -} - -bool WKPreferencesGetPDFPluginEnabled(WKPreferencesRef preferencesRef) -{ - return toImpl(preferencesRef)->pdfPluginEnabled(); -} diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.h b/Source/WebKit2/UIProcess/API/C/WKPreferences.h index d91b82d83..c0fde67fd 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPreferences.h +++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010, 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 @@ -216,10 +216,6 @@ WK_EXPORT bool WKPreferencesGetShouldRespectImageOrientation(WKPreferencesRef pr WK_EXPORT void WKPreferencesSetStorageBlockingPolicy(WKPreferencesRef preferencesRef, WKStorageBlockingPolicy policy); WK_EXPORT WKStorageBlockingPolicy WKPreferencesGetStorageBlockingPolicy(WKPreferencesRef preferencesRef); -// Defaults to false -WK_EXPORT void WKPreferencesSetPlugInSnapshottingEnabled(WKPreferencesRef preferencesRef, bool enabled); -WK_EXPORT bool WKPreferencesGetPlugInSnapshottingEnabled(WKPreferencesRef preferencesRef); - #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h index af5f73b34..11311704d 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h +++ b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h @@ -219,14 +219,6 @@ WK_EXPORT bool WKPreferencesGetScrollingPerformanceLoggingEnabled(WKPreferencesR WK_EXPORT void WKPreferencesSetScreenFontSubstitutionEnabled(WKPreferencesRef preferences, bool enabled); WK_EXPORT bool WKPreferencesGetScreenFontSubstitutionEnabled(WKPreferencesRef preferences); -// Defaults to true -WK_EXPORT void WKPreferencesSetCookieEnabled(WKPreferencesRef preferences, bool enabled); -WK_EXPORT bool WKPreferencesGetCookieEnabled(WKPreferencesRef preferences); - -// Defaults to false -WK_EXPORT void WKPreferencesSetPDFPluginEnabled(WKPreferencesRef preferences, bool enabled); -WK_EXPORT bool WKPreferencesGetPDFPluginEnabled(WKPreferencesRef preferences); - WK_EXPORT void WKPreferencesResetTestRunnerOverrides(WKPreferencesRef preferencesRef); #ifdef __cplusplus diff --git a/Source/WebKit2/UIProcess/API/C/soup/WKSoupRequestManager.h b/Source/WebKit2/UIProcess/API/C/soup/WKSoupRequestManager.h index 4dba13908..1c9c001f2 100644 --- a/Source/WebKit2/UIProcess/API/C/soup/WKSoupRequestManager.h +++ b/Source/WebKit2/UIProcess/API/C/soup/WKSoupRequestManager.h @@ -33,7 +33,7 @@ extern "C" { #endif -typedef void (*WKSoupRequestManagerDidReceiveURIRequestCallback)(WKSoupRequestManagerRef soupRequestManagerRef, WKURLRef urlRef, WKPageRef pageRef, uint64_t requestID, const void* clientInfo); +typedef void (*WKSoupRequestManagerDidReceiveURIRequestCallback)(WKSoupRequestManagerRef soupRequestManagerRef, WKURLRef urlRef, uint64_t requestID, const void* clientInfo); typedef void (*WKSoupRequestManagerDidFailToLoadURIRequestCallback)(WKSoupRequestManagerRef soupRequestManagerRef, uint64_t requestID, const void* clientInfo); struct WKSoupRequestManagerClient { diff --git a/Source/WebKit2/UIProcess/API/efl/BatteryProvider.cpp b/Source/WebKit2/UIProcess/API/efl/BatteryProvider.cpp index 810711597..83cc37119 100644 --- a/Source/WebKit2/UIProcess/API/efl/BatteryProvider.cpp +++ b/Source/WebKit2/UIProcess/API/efl/BatteryProvider.cpp @@ -31,7 +31,6 @@ #include "WKAPICast.h" #include "WKBatteryManager.h" #include "WKBatteryStatus.h" -#include "WKContext.h" using namespace WebCore; using namespace WebKit; @@ -54,25 +53,17 @@ static void stopUpdatingCallback(WKBatteryManagerRef, const void* clientInfo) BatteryProvider::~BatteryProvider() { m_provider.stopUpdating(); - - WKBatteryManagerRef wkBatteryManager = WKContextGetBatteryManager(m_wkContext.get()); - ASSERT(wkBatteryManager); - - WKBatteryManagerSetProvider(wkBatteryManager, 0); } -PassRefPtr<BatteryProvider> BatteryProvider::create(WKContextRef wkContext) +PassRefPtr<BatteryProvider> BatteryProvider::create(WKBatteryManagerRef wkBatteryManager) { - return adoptRef(new BatteryProvider(wkContext)); + return adoptRef(new BatteryProvider(wkBatteryManager)); } -BatteryProvider::BatteryProvider(WKContextRef wkContext) - : m_wkContext(wkContext) +BatteryProvider::BatteryProvider(WKBatteryManagerRef wkBatteryManager) + : m_wkBatteryManager(wkBatteryManager) , m_provider(this) { - ASSERT(m_wkContext); - - WKBatteryManagerRef wkBatteryManager = WKContextGetBatteryManager(m_wkContext.get()); ASSERT(wkBatteryManager); WKBatteryProvider wkBatteryProvider = { @@ -81,7 +72,7 @@ BatteryProvider::BatteryProvider(WKContextRef wkContext) startUpdatingCallback, stopUpdatingCallback }; - WKBatteryManagerSetProvider(wkBatteryManager, &wkBatteryProvider); + WKBatteryManagerSetProvider(m_wkBatteryManager.get(), &wkBatteryProvider); } void BatteryProvider::startUpdating() @@ -96,11 +87,8 @@ void BatteryProvider::stopUpdating() void BatteryProvider::didChangeBatteryStatus(const AtomicString& eventType, PassRefPtr<BatteryStatus> status) { - WKBatteryManagerRef wkBatteryManager = WKContextGetBatteryManager(m_wkContext.get()); - ASSERT(wkBatteryManager); - WKRetainPtr<WKBatteryStatusRef> wkBatteryStatus(AdoptWK, WKBatteryStatusCreate(status->charging(), status->chargingTime(), status->dischargingTime(), status->level())); - WKBatteryManagerProviderDidChangeBatteryStatus(wkBatteryManager, toAPI(eventType.impl()), wkBatteryStatus.get()); + WKBatteryManagerProviderDidChangeBatteryStatus(m_wkBatteryManager.get(), toAPI(eventType.impl()), wkBatteryStatus.get()); } #endif // ENABLE(BATTERY_STATUS) diff --git a/Source/WebKit2/UIProcess/API/efl/BatteryProvider.h b/Source/WebKit2/UIProcess/API/efl/BatteryProvider.h index c54414e68..e9e4cf5f0 100644 --- a/Source/WebKit2/UIProcess/API/efl/BatteryProvider.h +++ b/Source/WebKit2/UIProcess/API/efl/BatteryProvider.h @@ -38,18 +38,18 @@ class BatteryProvider : public RefCounted<BatteryProvider>, public WebCore::BatteryProviderEflClient { public: virtual ~BatteryProvider(); - static PassRefPtr<BatteryProvider> create(WKContextRef); + static PassRefPtr<BatteryProvider> create(WKBatteryManagerRef); void startUpdating(); void stopUpdating(); private: - BatteryProvider(WKContextRef); + BatteryProvider(WKBatteryManagerRef); // BatteryProviderEflClient interface. virtual void didChangeBatteryStatus(const AtomicString& eventType, PassRefPtr<WebCore::BatteryStatus>); - WKRetainPtr<WKContextRef> m_wkContext; + WKRetainPtr<WKBatteryManagerRef> m_wkBatteryManager; WebCore::BatteryProviderEfl m_provider; }; diff --git a/Source/WebKit2/UIProcess/API/efl/EWebKit2.h b/Source/WebKit2/UIProcess/API/efl/EWebKit2.h index 00dd811a4..13efab13a 100644 --- a/Source/WebKit2/UIProcess/API/efl/EWebKit2.h +++ b/Source/WebKit2/UIProcess/API/efl/EWebKit2.h @@ -33,20 +33,19 @@ #include "ewk_context.h" #include "ewk_cookie_manager.h" #include "ewk_download_job.h" -#include "ewk_error.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_popup_menu_item.h" -#include "ewk_resource.h" #include "ewk_settings.h" #include "ewk_touch.h" #include "ewk_url_request.h" #include "ewk_url_response.h" #include "ewk_url_scheme_request.h" #include "ewk_view.h" +#include "ewk_web_error.h" +#include "ewk_web_resource.h" #endif // EWebKit2_h diff --git a/Source/WebKit2/UIProcess/API/efl/EflViewportHandler.cpp b/Source/WebKit2/UIProcess/API/efl/EflViewportHandler.cpp index 05be4cadf..eb3d007fe 100644 --- a/Source/WebKit2/UIProcess/API/efl/EflViewportHandler.cpp +++ b/Source/WebKit2/UIProcess/API/efl/EflViewportHandler.cpp @@ -53,11 +53,6 @@ DrawingAreaProxy* EflViewportHandler::drawingArea() const return ewk_view_page_get(m_viewWidget)->drawingArea(); } -void EflViewportHandler::setRendererActive(bool active) -{ - drawingArea()->layerTreeCoordinatorProxy()->layerTreeRenderer()->setActive(active); -} - void EflViewportHandler::display(const IntRect& rect) { WebCore::TransformationMatrix matrix; diff --git a/Source/WebKit2/UIProcess/API/efl/EflViewportHandler.h b/Source/WebKit2/UIProcess/API/efl/EflViewportHandler.h index f4d0e66de..a23f4e147 100644 --- a/Source/WebKit2/UIProcess/API/efl/EflViewportHandler.h +++ b/Source/WebKit2/UIProcess/API/efl/EflViewportHandler.h @@ -48,7 +48,7 @@ public: void updateViewportSize(const WebCore::IntSize& viewportSize); void setVisibleContentsRect(const WebCore::IntPoint&, float, const WebCore::FloatPoint&); void didChangeContentsSize(const WebCore::IntSize& size); - void setRendererActive(bool); + private: explicit EflViewportHandler(Evas_Object*); diff --git a/Source/WebKit2/UIProcess/API/efl/NetworkInfoProvider.cpp b/Source/WebKit2/UIProcess/API/efl/NetworkInfoProvider.cpp index 1431c83a7..54a6921da 100644 --- a/Source/WebKit2/UIProcess/API/efl/NetworkInfoProvider.cpp +++ b/Source/WebKit2/UIProcess/API/efl/NetworkInfoProvider.cpp @@ -28,7 +28,6 @@ #if ENABLE(NETWORK_INFO) -#include "WKContext.h" #include "WKNetworkInfoManager.h" #include <NotImplemented.h> @@ -57,18 +56,15 @@ static bool isMeteredCallback(WKNetworkInfoManagerRef, const void* clientInfo) return toNetworkInfoProvider(clientInfo)->metered(); } -PassRefPtr<NetworkInfoProvider> NetworkInfoProvider::create(WKContextRef wkContext) +PassRefPtr<NetworkInfoProvider> NetworkInfoProvider::create(WKNetworkInfoManagerRef wkManager) { - return adoptRef(new NetworkInfoProvider(wkContext)); + return adoptRef(new NetworkInfoProvider(wkManager)); } -NetworkInfoProvider::NetworkInfoProvider(WKContextRef wkContext) - : m_wkContext(wkContext) +NetworkInfoProvider::NetworkInfoProvider(WKNetworkInfoManagerRef wkManager) + : m_wkNetworkInfoManager(wkManager) { - ASSERT(wkContext); - - WKNetworkInfoManagerRef wkNetworkInfoManager = WKContextGetNetworkInfoManager(m_wkContext.get()); - ASSERT(wkNetworkInfoManager); + ASSERT(wkManager); WKNetworkInfoProvider wkNetworkInfoProvider = { kWKNetworkInfoProviderCurrentVersion, @@ -78,15 +74,11 @@ NetworkInfoProvider::NetworkInfoProvider(WKContextRef wkContext) getBandwidthCallback, isMeteredCallback }; - WKNetworkInfoManagerSetProvider(wkNetworkInfoManager, &wkNetworkInfoProvider); + WKNetworkInfoManagerSetProvider(m_wkNetworkInfoManager.get(), &wkNetworkInfoProvider); } NetworkInfoProvider::~NetworkInfoProvider() { - WKNetworkInfoManagerRef wkNetworkInfoManager = WKContextGetNetworkInfoManager(m_wkContext.get()); - ASSERT(wkNetworkInfoManager); - - WKNetworkInfoManagerSetProvider(wkNetworkInfoManager, 0); } double NetworkInfoProvider::bandwidth() const diff --git a/Source/WebKit2/UIProcess/API/efl/NetworkInfoProvider.h b/Source/WebKit2/UIProcess/API/efl/NetworkInfoProvider.h index 0a5d60e4f..b9f86e6e5 100644 --- a/Source/WebKit2/UIProcess/API/efl/NetworkInfoProvider.h +++ b/Source/WebKit2/UIProcess/API/efl/NetworkInfoProvider.h @@ -37,7 +37,7 @@ class NetworkInfoProvider : public RefCounted<NetworkInfoProvider>, public WebCore::NetworkInfoClient { public: virtual ~NetworkInfoProvider(); - static PassRefPtr<NetworkInfoProvider> create(WKContextRef); + static PassRefPtr<NetworkInfoProvider> create(WKNetworkInfoManagerRef); // NetworkInfoClient interface. virtual double bandwidth() const; @@ -47,9 +47,9 @@ public: virtual void stopUpdating(); private: - NetworkInfoProvider(WKContextRef); + NetworkInfoProvider(WKNetworkInfoManagerRef); - WKRetainPtr<WKContextRef> m_wkContext; + WKRetainPtr<WKNetworkInfoManagerRef> m_wkNetworkInfoManager; WebCore::NetworkInfoProviderEfl m_provider; }; diff --git a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp index 3bf194f57..ef2ce603f 100644 --- a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp +++ b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp @@ -94,7 +94,8 @@ bool PageClientImpl::isViewFocused() bool PageClientImpl::isViewVisible() { - return evas_object_visible_get(m_viewWidget); + notImplemented(); + return true; } bool PageClientImpl::isViewInWindow() diff --git a/Source/WebKit2/UIProcess/API/efl/VibrationProvider.cpp b/Source/WebKit2/UIProcess/API/efl/VibrationProvider.cpp index 13d4de6d6..29fb6a4fc 100644 --- a/Source/WebKit2/UIProcess/API/efl/VibrationProvider.cpp +++ b/Source/WebKit2/UIProcess/API/efl/VibrationProvider.cpp @@ -29,7 +29,6 @@ #if ENABLE(VIBRATION) #include "WKAPICast.h" -#include "WKContext.h" #include "WKVibration.h" #include <Evas.h> @@ -66,18 +65,15 @@ static void cancelVibrationCallback(WKVibrationRef, const void* clientInfo) toVibrationProvider(clientInfo)->cancelVibration(); } -PassRefPtr<VibrationProvider> VibrationProvider::create(WKContextRef wkContext) +PassRefPtr<VibrationProvider> VibrationProvider::create(WKVibrationRef wkVibrationRef) { - return adoptRef(new VibrationProvider(wkContext)); + return adoptRef(new VibrationProvider(wkVibrationRef)); } -VibrationProvider::VibrationProvider(WKContextRef wkContext) - : m_wkContext(wkContext) +VibrationProvider::VibrationProvider(WKVibrationRef wkVibrationRef) + : m_wkVibrationRef(wkVibrationRef) { - ASSERT(m_wkContext.get()); - - WKVibrationRef wkVibration = WKContextGetVibration(m_wkContext.get()); - ASSERT(wkVibration); + ASSERT(wkVibrationRef); WKVibrationProvider wkVibrationProvider = { kWKVibrationProviderCurrentVersion, @@ -85,15 +81,11 @@ VibrationProvider::VibrationProvider(WKContextRef wkContext) vibrateCallback, cancelVibrationCallback }; - WKVibrationSetProvider(wkVibration, &wkVibrationProvider); + WKVibrationSetProvider(m_wkVibrationRef.get(), &wkVibrationProvider); } VibrationProvider::~VibrationProvider() { - WKVibrationRef wkVibration = WKContextGetVibration(m_wkContext.get()); - ASSERT(wkVibration); - - WKVibrationSetProvider(wkVibration, 0); } void VibrationProvider::vibrate(uint64_t vibrationTime) diff --git a/Source/WebKit2/UIProcess/API/efl/VibrationProvider.h b/Source/WebKit2/UIProcess/API/efl/VibrationProvider.h index 6b2db4eec..c2643b638 100644 --- a/Source/WebKit2/UIProcess/API/efl/VibrationProvider.h +++ b/Source/WebKit2/UIProcess/API/efl/VibrationProvider.h @@ -37,7 +37,7 @@ typedef struct _Ewk_Vibration_Client Ewk_Vibration_Client; class VibrationProvider : public RefCounted<VibrationProvider> { public: - static PassRefPtr<VibrationProvider> create(WKContextRef); + static PassRefPtr<VibrationProvider> create(WKVibrationRef); virtual ~VibrationProvider(); void vibrate(uint64_t vibrationTime); @@ -45,9 +45,9 @@ public: void setVibrationClientCallbacks(Ewk_Vibration_Client_Vibrate_Cb, Ewk_Vibration_Client_Vibration_Cancel_Cb, void*); private: - explicit VibrationProvider(WKContextRef); + explicit VibrationProvider(WKVibrationRef); - WKRetainPtr<WKContextRef> m_wkContext; + WKRetainPtr<WKVibrationRef> m_wkVibrationRef; OwnPtr<Ewk_Vibration_Client> m_vibrationClient; }; 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 94d0300c1..be866fa0a 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.cpp @@ -54,7 +54,7 @@ struct _Ewk_Back_Forward_List { ItemsMap::iterator it = wrapperCache.begin(); ItemsMap::iterator end = wrapperCache.end(); for (; it != end; ++it) - ewk_back_forward_list_item_unref(it->value); + ewk_back_forward_list_item_unref(it->second); } }; 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 704545a0b..5679773a0 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 @@ -39,9 +39,9 @@ using namespace WebKit; struct _Ewk_Back_Forward_List_Item { unsigned int __ref; /**< the reference count of the object */ WKRetainPtr<WKBackForwardListItemRef> wkItem; - mutable WKEinaSharedString url; + mutable WKEinaSharedString uri; mutable WKEinaSharedString title; - mutable WKEinaSharedString originalURL; + mutable WKEinaSharedString originalUri; _Ewk_Back_Forward_List_Item(WKBackForwardListItemRef itemRef) : __ref(1) @@ -83,13 +83,13 @@ void ewk_back_forward_list_item_unref(Ewk_Back_Forward_List_Item* item) delete item; } -const char* ewk_back_forward_list_item_url_get(const Ewk_Back_Forward_List_Item* item) +const char* ewk_back_forward_list_item_uri_get(const Ewk_Back_Forward_List_Item* item) { EWK_BACK_FORWARD_LIST_ITEM_WK_GET_OR_RETURN(item, wkItem, 0); - item->url = WKEinaSharedString(AdoptWK, WKBackForwardListItemCopyURL(wkItem)); + item->uri = WKEinaSharedString(AdoptWK, WKBackForwardListItemCopyURL(wkItem)); - return item->url; + return item->uri; } const char* ewk_back_forward_list_item_title_get(const Ewk_Back_Forward_List_Item* item) @@ -101,13 +101,13 @@ const char* ewk_back_forward_list_item_title_get(const Ewk_Back_Forward_List_Ite return item->title; } -const char* ewk_back_forward_list_item_original_url_get(const Ewk_Back_Forward_List_Item* item) +const char* ewk_back_forward_list_item_original_uri_get(const Ewk_Back_Forward_List_Item* item) { EWK_BACK_FORWARD_LIST_ITEM_WK_GET_OR_RETURN(item, wkItem, 0); - item->originalURL = WKEinaSharedString(AdoptWK, WKBackForwardListItemCopyOriginalURL(wkItem)); + item->originalUri = WKEinaSharedString(AdoptWK, WKBackForwardListItemCopyOriginalURL(wkItem)); - return item->originalURL; + return item->originalUri; } Ewk_Back_Forward_List_Item* ewk_back_forward_list_item_new(WKBackForwardListItemRef backForwardListItemData) 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 3c544f3ef..a1227dfc0 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 @@ -59,21 +59,21 @@ EAPI Ewk_Back_Forward_List_Item *ewk_back_forward_list_item_ref(Ewk_Back_Forward EAPI void ewk_back_forward_list_item_unref(Ewk_Back_Forward_List_Item *item); /** - * Returns URL of the item. + * Returns URI of the item. * - * The returned URL may differ from the original URL (For example if the page was redirected). + * The returned URI may differ from the original URI (For example if the page was redirected). * - * @see ewk_back_forward_list_item_original_url_get() + * @see ewk_back_forward_list_item_original_uri_get() * * @param item the back-forward list item instance * - * @return the URL of the @a item or @c NULL in case of error. This pointer is + * @return the URI of the @a item or @c NULL in case of error. 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_back_forward_list_item_url_get(const Ewk_Back_Forward_List_Item *item); +EAPI const char *ewk_back_forward_list_item_uri_get(const Ewk_Back_Forward_List_Item *item); /** * Returns title of the item. @@ -89,19 +89,19 @@ EAPI const char *ewk_back_forward_list_item_url_get(const Ewk_Back_Forward_List_ EAPI const char *ewk_back_forward_list_item_title_get(const Ewk_Back_Forward_List_Item *item); /** - * Returns original URL of the item. + * Returns original URI of the item. * - * @see ewk_back_forward_list_item_url_get() + * @see ewk_back_forward_list_item_uri_get() * * @param item the back-forward list item instance * - * @return the original URL of the @a item or @c NULL in case of error. This pointer is + * @return the original URI of the @a item or @c NULL in case of error. 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_back_forward_list_item_original_url_get(const Ewk_Back_Forward_List_Item *item); +EAPI const char *ewk_back_forward_list_item_original_uri_get(const Ewk_Back_Forward_List_Item *item); #ifdef __cplusplus } diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp index 02eddb42d..b34ff77df 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp @@ -22,7 +22,6 @@ #include "ewk_context.h" #include "BatteryProvider.h" -#include "NetworkInfoProvider.h" #include "VibrationProvider.h" #include "WKAPICast.h" #include "WKContextSoup.h" @@ -31,7 +30,6 @@ #include "WKString.h" #include "WebContext.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" @@ -69,9 +67,6 @@ struct _Ewk_Context { #if ENABLE(BATTERY_STATUS) RefPtr<BatteryProvider> batteryProvider; #endif -#if ENABLE(NETWORK_INFO) - RefPtr<NetworkInfoProvider> networkInfoProvider; -#endif #if ENABLE(VIBRATION) RefPtr<VibrationProvider> vibrationProvider; #endif @@ -80,25 +75,20 @@ struct _Ewk_Context { WKRetainPtr<WKSoupRequestManagerRef> requestManager; URLSchemeHandlerMap urlSchemeHandlers; - Ewk_Context_History_Client historyClient; - _Ewk_Context(WKRetainPtr<WKContextRef> contextRef) : __ref(1) , context(contextRef) , cookieManager(0) , requestManager(WKContextGetSoupRequestManager(contextRef.get())) - , historyClient() { #if ENABLE(BATTERY_STATUS) - batteryProvider = BatteryProvider::create(context.get()); -#endif - -#if ENABLE(NETWORK_INFO) - networkInfoProvider = NetworkInfoProvider::create(context.get()); + WKBatteryManagerRef wkBatteryManager = WKContextGetBatteryManager(contextRef.get()); + batteryProvider = BatteryProvider::create(wkBatteryManager); #endif #if ENABLE(VIBRATION) - vibrationProvider = VibrationProvider::create(context.get()); + WKVibrationRef wkVibrationRef = WKContextGetVibration(contextRef.get()); + vibrationProvider = VibrationProvider::create(wkVibrationRef); #endif #if ENABLE(MEMORY_SAMPLER) @@ -113,7 +103,6 @@ struct _Ewk_Context { #endif ewk_context_request_manager_client_attach(this); ewk_context_download_client_attach(this); - ewk_context_history_client_attach(this); } ~_Ewk_Context() @@ -124,7 +113,7 @@ struct _Ewk_Context { HashMap<uint64_t, Ewk_Download_Job*>::iterator it = downloadJobs.begin(); HashMap<uint64_t, Ewk_Download_Job*>::iterator end = downloadJobs.end(); for ( ; it != end; ++it) - ewk_download_job_unref(it->value); + ewk_download_job_unref(it->second); } }; @@ -266,7 +255,7 @@ Ewk_Context* ewk_context_new_with_injected_bundle_path(const char* path) return new Ewk_Context(adoptWK(WKContextCreateWithInjectedBundlePath(pathRef.get()))); } -Eina_Bool ewk_context_url_scheme_register(Ewk_Context* ewkContext, const char* scheme, Ewk_Url_Scheme_Request_Cb callback, void* userData) +Eina_Bool ewk_context_uri_scheme_register(Ewk_Context* ewkContext, const char* scheme, Ewk_Url_Scheme_Request_Cb callback, void* userData) { EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false); EINA_SAFETY_ON_NULL_RETURN_VAL(scheme, false); @@ -287,31 +276,3 @@ void ewk_context_vibration_client_callbacks_set(Ewk_Context* ewkContext, Ewk_Vib ewkContext->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); - - ewkContext->historyClient.navigate_func = navigate; - ewkContext->historyClient.client_redirect_func = clientRedirect; - ewkContext->historyClient.server_redirect_func = serverRedirect; - ewkContext->historyClient.title_update_func = titleUpdate; - ewkContext->historyClient.populate_visited_links_func = populateVisitedLinks; - ewkContext->historyClient.user_data = data; -} - -const Ewk_Context_History_Client* ewk_context_history_client_get(const Ewk_Context* ewkContext) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, 0); - - return &ewkContext->historyClient; -} - -void ewk_context_visited_link_add(Ewk_Context* ewkContext, const char* visitedURL) -{ - EINA_SAFETY_ON_NULL_RETURN(ewkContext); - EINA_SAFETY_ON_NULL_RETURN(visitedURL); - - WKRetainPtr<WKStringRef> wkVisitedURL(AdoptWK, WKStringCreateWithUTF8CString(visitedURL)); - WKContextAddVisitedLink(ewkContext->context.get(), wkVisitedURL.get()); -} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context.h b/Source/WebKit2/UIProcess/API/efl/ewk_context.h index 3f46d460e..e6e9e0c7b 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_context.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_context.h @@ -38,7 +38,6 @@ #define ewk_context_h #include "ewk_cookie_manager.h" -#include "ewk_navigation_data.h" #include "ewk_url_scheme_request.h" #include <Evas.h> @@ -51,7 +50,7 @@ typedef struct _Ewk_Context Ewk_Context; /** * @typedef Ewk_Url_Scheme_Request_Cb Ewk_Url_Scheme_Request_Cb - * @brief Callback type for use with ewk_context_url_scheme_register(). + * @brief Callback type for use with ewk_context_uri_scheme_register(). */ typedef void (*Ewk_Url_Scheme_Request_Cb) (Ewk_Url_Scheme_Request *request, void *user_data); @@ -70,38 +69,6 @@ typedef void (*Ewk_Vibration_Client_Vibrate_Cb)(uint64_t vibration_time, void *u typedef void (*Ewk_Vibration_Client_Vibration_Cancel_Cb)(void *user_data); /** - * @typedef Ewk_History_Navigation_Cb Ewk_History_Navigation_Cb - * @brief Type definition for a function that will be called back when @a view did navigation (loaded new URL). - */ -typedef void (*Ewk_History_Navigation_Cb)(const Evas_Object *view, Ewk_Navigation_Data *navigation_data, void *user_data); - -/** - * @typedef Ewk_History_Client_Redirection_Cb Ewk_History_Client_Redirection_Cb - * @brief Type definition for a function that will be called back when @a view performed a client redirect. - */ -typedef void (*Ewk_History_Client_Redirection_Cb)(const Evas_Object *view, const char *source_url, const char *destination_url, void *user_data); - -/** - * @typedef Ewk_History_Server_Redirection_Cb Ewk_History_Server_Redirection_Cb - * @brief Type definition for a function that will be called back when @a view performed a server redirect. - */ -typedef void (*Ewk_History_Server_Redirection_Cb)(const Evas_Object *view, const char *source_url, const char *destination_url, void *user_data); - -/** - * @typedef Ewk_History_Title_Update_Cb Ewk_History_Title_Update_Cb - * @brief Type definition for a function that will be called back when history title is updated. - */ -typedef void (*Ewk_History_Title_Update_Cb)(const Evas_Object *view, const char *title, const char *url, void *user_data); - -/** - * @typedef Ewk_Context_History_Client_Visited_Links_Populate_Cb Ewk_Context_History_Client_Visited_Links_Populate_Cb - * @brief Type definition for a function that will be called back when client is asked to provide visited links from a client-managed storage. - * - * @see ewk_context_visited_link_add - */ -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 @@ -180,7 +147,7 @@ EAPI Ewk_Cookie_Manager *ewk_context_cookie_manager_get(const Ewk_Context *conte * @param user_data data to pass to callback function * * @code - * static void about_url_scheme_request_cb(Ewk_Url_Scheme_Request *request, void *user_data) + * static void about_uri_scheme_request_cb(Ewk_Url_Scheme_Request *request, void *user_data) * { * const char *path; * char *contents_data = NULL; @@ -205,7 +172,7 @@ EAPI Ewk_Cookie_Manager *ewk_context_cookie_manager_get(const Ewk_Context *conte * } * @endcode */ -EAPI Eina_Bool ewk_context_url_scheme_register(Ewk_Context *context, const char *scheme, Ewk_Url_Scheme_Request_Cb callback, void *user_data); +EAPI Eina_Bool ewk_context_uri_scheme_register(Ewk_Context *context, const char *scheme, Ewk_Url_Scheme_Request_Cb callback, void *user_data); /** * Sets vibration client callbacks to handle the tactile feedback in the form of @@ -223,41 +190,6 @@ EAPI Eina_Bool ewk_context_url_scheme_register(Ewk_Context *context, const char */ EAPI void ewk_context_vibration_client_callbacks_set(Ewk_Context *context, Ewk_Vibration_Client_Vibrate_Cb vibrate, Ewk_Vibration_Client_Vibration_Cancel_Cb cancel, void *data); -/** - * Sets history callbacks for the given @a context. - * - * To stop listening for history events, you may call this function with @c - * NULL for the callbacks. - * - * @param context context object to set history callbacks - * @param navigate_func The function to call when @c ewk_view did navigation (may be @c NULL). - * @param client_redirect_func The function to call when @c ewk_view performed a client redirect (may be @c NULL). - * @param server_redirect_func The function to call when @c ewk_view performed a server redirect (may be @c NULL). - * @param title_update_func The function to call when history title is updated (may be @c NULL). - * @param populate_visited_links_func The function is called when client is asked to provide visited links from a - * client-managed storage (may be @c NULL). - * @param data User data (may be @c NULL). - */ -EAPI void ewk_context_history_callbacks_set(Ewk_Context *context, - 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, - void *data); - -/** - * Registers the given @a visited_url as visited link in @a context visited link cache. - * - * This function shall be invoked as a response to @c populateVisitedLinks callback of the history cient. - * - * @param context context object to add visited link data - * @param visited_url visited url - * - * @see Ewk_Context_History_Client - */ -EAPI void ewk_context_visited_link_add(Ewk_Context *context, const char *visited_url); - #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_download_client.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_context_download_client.cpp index 2bbb7ef0f..9d924bff2 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_context_download_client.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_context_download_client.cpp @@ -33,10 +33,11 @@ #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 "ewk_web_error.h" +#include "ewk_web_error_private.h" #include <string.h> #include <wtf/text/CString.h> @@ -58,7 +59,7 @@ static WKStringRef decideDestinationWithSuggestedFilename(WKContextRef, WKDownlo // and the suggested file name. ewk_view_download_job_requested(ewk_download_job_view_get(download), download); - // DownloadSoup expects the destination to be a URL. + // DownloadSoup expects the destination to be a URI. String destination = String("file://") + String::fromUTF8(ewk_download_job_destination_get(download)); return WKStringCreateWithUTF8CString(destination.utf8().data()); @@ -94,10 +95,10 @@ static void didFail(WKContextRef, WKDownloadRef wkDownload, WKErrorRef error, co Ewk_Download_Job* download = ewk_context_download_job_get(toEwkContext(clientInfo), downloadId); ASSERT(download); - Ewk_Error* ewkError = ewk_error_new(error); + Ewk_Web_Error* ewkError = ewk_web_error_new(error); ewk_download_job_state_set(download, EWK_DOWNLOAD_JOB_STATE_FAILED); ewk_view_download_job_failed(ewk_download_job_view_get(download), download, ewkError); - ewk_error_free(ewkError); + ewk_web_error_free(ewkError); ewk_context_download_job_remove(toEwkContext(clientInfo), downloadId); } 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 fd1b83aae..000000000 --- a/Source/WebKit2/UIProcess/API/efl/ewk_context_history_client.cpp +++ /dev/null @@ -1,130 +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* getEwkHistoryDelegate(const void* clientInfo) -{ - ASSERT(clientInfo); - return ewk_context_history_client_get(static_cast<const Ewk_Context*>(clientInfo)); -} - -static void didNavigateWithNavigationData(WKContextRef, WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef, const void* clientInfo) -{ - const Ewk_Context_History_Client* historyDelegate = getEwkHistoryDelegate(clientInfo); - ASSERT(historyDelegate); - - if (!historyDelegate->navigate_func) - return; - - RefPtr<Ewk_Navigation_Data> navigationDataEwk = adoptRef(ewk_navigation_data_new(navigationData)); - historyDelegate->navigate_func(ewk_view_from_page_get(toImpl(page)), navigationDataEwk.get(), historyDelegate->user_data); -} - -static void didPerformClientRedirect(WKContextRef, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef, const void* clientInfo) -{ - const Ewk_Context_History_Client* historyDelegate = getEwkHistoryDelegate(clientInfo); - ASSERT(historyDelegate); - - if (!historyDelegate->client_redirect_func) - return; - - WKEinaSharedString sourceURLString(sourceURL); - WKEinaSharedString destinationURLString(destinationURL); - - historyDelegate->client_redirect_func(ewk_view_from_page_get(toImpl(page)), sourceURLString, destinationURLString, historyDelegate->user_data); -} - -static void didPerformServerRedirect(WKContextRef, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef, const void* clientInfo) -{ - const Ewk_Context_History_Client* historyDelegate = getEwkHistoryDelegate(clientInfo); - ASSERT(historyDelegate); - - if (!historyDelegate->server_redirect_func) - return; - - WKEinaSharedString sourceURLString(sourceURL); - WKEinaSharedString destinationURLString(destinationURL); - - historyDelegate->server_redirect_func(ewk_view_from_page_get(toImpl(page)), sourceURLString, destinationURLString, historyDelegate->user_data); -} - -static void didUpdateHistoryTitle(WKContextRef, WKPageRef page, WKStringRef title, WKURLRef URL, WKFrameRef, const void* clientInfo) -{ - const Ewk_Context_History_Client* historyDelegate = getEwkHistoryDelegate(clientInfo); - ASSERT(historyDelegate); - - if (!historyDelegate->title_update_func) - return; - - WKEinaSharedString titleString(title); - WKEinaSharedString stringURL(URL); - - historyDelegate->title_update_func(ewk_view_from_page_get(toImpl(page)), titleString, stringURL, historyDelegate->user_data); -} - -static void populateVisitedLinks(WKContextRef, const void* clientInfo) -{ - const Ewk_Context_History_Client* historyDelegate = getEwkHistoryDelegate(clientInfo); - ASSERT(historyDelegate); - - if (!historyDelegate->populate_visited_links_func) - return; - - historyDelegate->populate_visited_links_func(historyDelegate->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(ewk_context_WKContext_get(ewkContext), &wkHistoryClient); -} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_history_client_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_context_history_client_private.h deleted file mode 100644 index d9518ced9..000000000 --- a/Source/WebKit2/UIProcess/API/efl/ewk_context_history_client_private.h +++ /dev/null @@ -1,44 +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. - */ - -#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; -}; - -typedef struct _Ewk_Context_History_Client Ewk_Context_History_Client; - -void ewk_context_history_client_attach(Ewk_Context*); - -#endif // ewk_context_history_client_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h index f2c322a61..d1b695e0c 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h @@ -25,7 +25,6 @@ typedef struct _Ewk_Context Ewk_Context; typedef struct _Ewk_Download_Job Ewk_Download_Job; typedef struct _Ewk_Url_Scheme_Request Ewk_Url_Scheme_Request; -typedef struct _Ewk_Context_History_Client Ewk_Context_History_Client; WKContextRef ewk_context_WKContext_get(const Ewk_Context*); Ewk_Context* ewk_context_new_from_WKContext(WKContextRef); @@ -36,6 +35,4 @@ void ewk_context_download_job_add(Ewk_Context*, Ewk_Download_Job*); Ewk_Download_Job* ewk_context_download_job_get(const Ewk_Context*, uint64_t downloadId); void ewk_context_download_job_remove(Ewk_Context*, uint64_t downloadId); -const Ewk_Context_History_Client* ewk_context_history_client_get(const Ewk_Context*); - #endif // ewk_context_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_request_manager_client.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_context_request_manager_client.cpp index 5a7707229..b22bd36ff 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_context_request_manager_client.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_context_request_manager_client.cpp @@ -37,7 +37,7 @@ static inline Ewk_Context* toEwkContext(const void* clientInfo) return static_cast<Ewk_Context*>(const_cast<void*>(clientInfo)); } -static void didReceiveURIRequest(WKSoupRequestManagerRef soupRequestManagerRef, WKURLRef urlRef, WKPageRef, uint64_t requestID, const void* clientInfo) +static void didReceiveURIRequest(WKSoupRequestManagerRef soupRequestManagerRef, WKURLRef urlRef, uint64_t requestID, const void* clientInfo) { Ewk_Url_Scheme_Request* schemeRequest = ewk_url_scheme_request_new(soupRequestManagerRef, urlRef, requestID); ewk_context_url_scheme_request_received(toEwkContext(clientInfo), schemeRequest); diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.cpp index a52047336..45dd75e63 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.cpp @@ -33,8 +33,8 @@ #include "WKRetainPtr.h" #include "WKString.h" #include "WebCookieManagerProxy.h" -#include "ewk_error_private.h" #include "ewk_private.h" +#include "ewk_web_error_private.h" #include <wtf/text/CString.h> #include <wtf/text/WTFString.h> @@ -142,12 +142,12 @@ struct Get_Policy_Async_Data { static void getAcceptPolicyCallback(WKHTTPCookieAcceptPolicy policy, WKErrorRef wkError, void* data) { Get_Policy_Async_Data* callbackData = static_cast<Get_Policy_Async_Data*>(data); - Ewk_Error* ewkError = wkError ? ewk_error_new(wkError) : 0; + Ewk_Web_Error* ewkError = wkError ? ewk_web_error_new(wkError) : 0; callbackData->callback(static_cast<Ewk_Cookie_Accept_Policy>(policy), ewkError, callbackData->userData); if (ewkError) - ewk_error_free(ewkError); + ewk_web_error_free(ewkError); delete callbackData; } @@ -172,7 +172,7 @@ static void getHostnamesWithCookiesCallback(WKArrayRef wkHostnames, WKErrorRef w { Eina_List* hostnames = 0; Get_Hostnames_Async_Data* callbackData = static_cast<Get_Hostnames_Async_Data*>(context); - Ewk_Error* ewkError = wkError ? ewk_error_new(wkError) : 0; + Ewk_Web_Error* ewkError = wkError ? ewk_web_error_new(wkError) : 0; const size_t hostnameCount = WKArrayGetSize(wkHostnames); for (size_t i = 0; i < hostnameCount; ++i) { @@ -189,7 +189,7 @@ static void getHostnamesWithCookiesCallback(WKArrayRef wkHostnames, WKErrorRef w EINA_LIST_FREE(hostnames, item) eina_stringshare_del(static_cast<Eina_Stringshare*>(item)); if (ewkError) - ewk_error_free(ewkError); + ewk_web_error_free(ewkError); delete callbackData; } diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.h b/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.h index c31b90018..e37780864 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.h @@ -31,7 +31,7 @@ #ifndef ewk_cookie_manager_h #define ewk_cookie_manager_h -#include "ewk_error.h" +#include "ewk_web_error.h" #include <Eina.h> #ifdef __cplusplus @@ -77,7 +77,7 @@ typedef enum _Ewk_Cookie_Persistent_Storage Ewk_Cookie_Persistent_Storage; * @typedef Ewk_Cookie_Manager_Async_Policy_Get_Cb Ewk_Cookie_Manager_Async_Policy_Get_Cb * @brief Callback type for use with ewk_cookie_manager_async_accept_policy_get */ -typedef void (*Ewk_Cookie_Manager_Async_Policy_Get_Cb)(Ewk_Cookie_Accept_Policy policy, Ewk_Error *error, void *event_info); +typedef void (*Ewk_Cookie_Manager_Async_Policy_Get_Cb)(Ewk_Cookie_Accept_Policy policy, Ewk_Web_Error *error, void *event_info); /** * @typedef Ewk_Cookie_Manager_Async_Hostnames_Get_Cb Ewk_Cookie_Manager_Async_Hostnames_Get_Cb @@ -87,7 +87,7 @@ typedef void (*Ewk_Cookie_Manager_Async_Policy_Get_Cb)(Ewk_Cookie_Accept_Policy * save yourself some cpu cycles and use eina_stringshare_ref() instead of eina_stringshare_add() * or strdup(). */ -typedef void (*Ewk_Cookie_Manager_Async_Hostnames_Get_Cb)(Eina_List *hostnames, Ewk_Error *error, void *event_info); +typedef void (*Ewk_Cookie_Manager_Async_Hostnames_Get_Cb)(Eina_List* hostnames, Ewk_Web_Error *error, void *event_info); /** * @typedef Ewk_Cookie_Manager_Changes_Watch_Cb Ewk_Cookie_Manager_Changes_Watch_Cb diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_download_job.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_download_job.cpp index 15a95b05f..61297920b 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_download_job.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_download_job.cpp @@ -46,7 +46,7 @@ struct _Ewk_Download_Job { DownloadProxy* downloadProxy; Evas_Object* view; Ewk_Download_Job_State state; - RefPtr<Ewk_Url_Request> request; + Ewk_Url_Request* request; Ewk_Url_Response* response; double startTime; double endTime; @@ -59,6 +59,7 @@ struct _Ewk_Download_Job { , downloadProxy(download) , view(ewkView) , state(EWK_DOWNLOAD_JOB_STATE_NOT_STARTED) + , request(0) , response(0) , startTime(-1) , endTime(-1) @@ -68,6 +69,8 @@ struct _Ewk_Download_Job { ~_Ewk_Download_Job() { ASSERT(!__ref); + if (request) + ewk_url_request_unref(request); if (response) ewk_url_response_unref(response); } @@ -130,10 +133,10 @@ Ewk_Url_Request* ewk_download_job_request_get(const Ewk_Download_Job* download) if (!download->request) { EINA_SAFETY_ON_NULL_RETURN_VAL(download->downloadProxy, 0); WKRetainPtr<WKURLRequestRef> wkURLRequest(AdoptWK, toAPI(WebURLRequest::create(download->downloadProxy->request()).leakRef())); - const_cast<Ewk_Download_Job*>(download)->request = adoptRef(ewk_url_request_new(wkURLRequest.get())); + const_cast<Ewk_Download_Job*>(download)->request = ewk_url_request_new(wkURLRequest.get()); } - return download->request.get(); + return download->request; } Ewk_Url_Response* ewk_download_job_response_get(const Ewk_Download_Job* download) diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_download_job.h b/Source/WebKit2/UIProcess/API/efl/ewk_download_job.h index 388276c9c..fdcc10e98 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_download_job.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_download_job.h @@ -112,7 +112,7 @@ EAPI Ewk_Url_Request *ewk_download_job_request_get(const Ewk_Download_Job *downl EAPI Ewk_Url_Response *ewk_download_job_response_get(const Ewk_Download_Job *download); /** - * Query the URL to which the downloaded file will be written. + * Query the URI to which the downloaded file will be written. * * @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 81b544bfe..d043494c3 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_download_job_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_download_job_private.h @@ -31,7 +31,7 @@ typedef struct _Ewk_Download_Job Ewk_Download_Job; typedef struct _Ewk_Url_Response Ewk_Url_Response; -typedef struct _Ewk_Error Ewk_Error; +typedef struct _Ewk_Web_Error Ewk_Web_Error; namespace WebKit { class DownloadProxy; diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_main.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_main.cpp index 17e2b1eea..fcc9faf1a 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_main.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_main.cpp @@ -31,10 +31,6 @@ #include <glib-object.h> #include <glib.h> -#ifdef HAVE_ECORE_X -#include <Ecore_X.h> -#endif - static int _ewkInitCount = 0; /** @@ -72,13 +68,6 @@ int ewk_init(void) goto error_ecore_evas; } -#ifdef HAVE_ECORE_X - if (!ecore_x_init(0)) { - CRITICAL("could not init ecore_x."); - goto error_ecore_x; - } -#endif - g_type_init(); if (!ecore_main_loop_glib_integrate()) { @@ -88,10 +77,6 @@ int ewk_init(void) return ++_ewkInitCount; -#ifdef HAVE_ECORE_X -error_ecore_x: - ecore_evas_shutdown(); -#endif error_ecore_evas: ecore_shutdown(); error_ecore: @@ -110,9 +95,6 @@ int ewk_shutdown(void) if (--_ewkInitCount) return _ewkInitCount; -#ifdef HAVE_ECORE_X - ecore_x_shutdown(); -#endif 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 deleted file mode 100644 index 27a51f083..000000000 --- a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data.cpp +++ /dev/null @@ -1,76 +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_navigation_data.h" - -#include "ewk_navigation_data_private.h" - -using namespace WebKit; - -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); - - return data->title; -} - -Ewk_Url_Request* ewk_navigation_data_original_request_get(const Ewk_Navigation_Data* data) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(data, 0); - - return data->request.get(); -} - -const char* ewk_navigation_data_url_get(const Ewk_Navigation_Data* data) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(data, 0); - - return data->url; -} - -Ewk_Navigation_Data* ewk_navigation_data_new(WKNavigationDataRef dataRef) -{ - ASSERT(dataRef); - EINA_SAFETY_ON_NULL_RETURN_VAL(dataRef, 0); - - return new Ewk_Navigation_Data(dataRef); -} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data.h b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data.h deleted file mode 100644 index 1a1e60732..000000000 --- a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data.h +++ /dev/null @@ -1,105 +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. - */ - -/** - * @file ewk_navigation_data.h - * @brief Describes the Ewk navigation data API. - */ - -#ifndef ewk_navigation_data_h -#define ewk_navigation_data_h - -#include "ewk_url_request.h" -#include <Eina.h> - -#ifdef __cplusplus -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. - * - * @param data the navigation data object to decrease the reference count - */ -EAPI void ewk_navigation_data_unref(Ewk_Navigation_Data *data); - -/** - * Returns title for this navigation data. - * - * The title of the navigated page. - * - * @param data navigation data object to query - * - * @return the title or @c NULL in case of error. 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_navigation_data_title_get(const Ewk_Navigation_Data *data); - -/** - * Returns the original request for this navigation data. - * - * @param data navigation data object to query - * - * @return The URL request pointer or @c NULL in case of error. - */ -EAPI Ewk_Url_Request *ewk_navigation_data_original_request_get(const Ewk_Navigation_Data *data); - -/** - * Returns URL for this navigation data. - * - * The URL of the navigated page. - * - * @param data navigation data object to query - * - * @return the URL of the @a data or @c NULL in case of error. 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_navigation_data_url_get(const Ewk_Navigation_Data *data); - -#ifdef __cplusplus -} -#endif - -#endif // ewk_navigation_data_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data_private.h deleted file mode 100644 index 6e42dc629..000000000 --- a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data_private.h +++ /dev/null @@ -1,58 +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. - */ - -#ifndef ewk_navigation_data_private_h -#define ewk_navigation_data_private_h - -#include "WKAPICast.h" -#include "WKEinaSharedString.h" -#include "WKNavigationData.h" -#include "WKRetainPtr.h" -#include "ewk_private.h" -#include "ewk_url_request_private.h" - -/** - * \struct _Ewk_Navigation_Data - * @brief Contains the navigation data details. - */ -struct _Ewk_Navigation_Data : public RefCounted<_Ewk_Navigation_Data> { - WKEinaSharedString title; - WKEinaSharedString url; - RefPtr<Ewk_Url_Request> request; - - _Ewk_Navigation_Data(WKNavigationDataRef dataRef) - : title(AdoptWK, WKNavigationDataCopyTitle(dataRef)) - , url(AdoptWK, WKNavigationDataCopyURL(dataRef)) - { - WKRetainPtr<WKURLRequestRef> requestWK(AdoptWK, WKNavigationDataCopyOriginalRequest(dataRef)); - request = adoptRef(ewk_url_request_new(requestWK.get())); - } -}; - -typedef struct _Ewk_Navigation_Data Ewk_Navigation_Data; - -Ewk_Navigation_Data* ewk_navigation_data_new(WKNavigationDataRef dataRef); - -#endif // ewk_navigation_data_private_h 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 6ebbebb5c..d46805faa 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp @@ -47,10 +47,10 @@ struct _Ewk_Navigation_Policy_Decision { Ewk_Navigation_Type navigationType; Event_Mouse_Button mouseButton; Event_Modifier_Keys modifiers; - RefPtr<Ewk_Url_Request> request; + Ewk_Url_Request* request; WKEinaSharedString frameName; - _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, Ewk_Url_Request* _request, const char* _frameName) : __ref(1) , listener(_listener) , actedUponByClient(false) @@ -68,6 +68,8 @@ struct _Ewk_Navigation_Policy_Decision { // This is the default choice for all policy decisions in WebPageProxy.cpp. if (!actedUponByClient) WKFramePolicyListenerUse(listener.get()); + + ewk_url_request_unref(request); } }; @@ -122,7 +124,7 @@ Ewk_Url_Request* ewk_navigation_policy_request_get(const Ewk_Navigation_Policy_D { EINA_SAFETY_ON_NULL_RETURN_VAL(decision, 0); - return decision->request.get(); + return decision->request; } void ewk_navigation_policy_decision_accept(Ewk_Navigation_Policy_Decision* decision) @@ -175,6 +177,6 @@ Ewk_Navigation_Policy_Decision* ewk_navigation_policy_decision_new(WKFrameNaviga static_cast<Ewk_Navigation_Type>(navigationType), static_cast<Event_Mouse_Button>(mouseButton), static_cast<Event_Modifier_Keys>(modifiers), - adoptRef(ewk_url_request_new(request)), + ewk_url_request_new(request), frameName); } diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp index a9f6b0932..a1f51b8bc 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp @@ -28,7 +28,6 @@ #include "ewk_settings_private.h" #include <WebKit2/WKPreferences.h> -#include <WebKit2/WKPreferencesPrivate.h> using namespace WebKit; @@ -100,51 +99,3 @@ Eina_Bool ewk_settings_developer_extras_enabled_get(const Ewk_Settings* settings return WKPreferencesGetDeveloperExtrasEnabled(settings->preferences.get()); } - -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); - - return true; -} - -Eina_Bool ewk_settings_file_access_from_file_urls_allowed_get(const Ewk_Settings* settings) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false); - - return WKPreferencesGetFileAccessFromFileURLsAllowed(settings->preferences.get()); -} - -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); - - return true; -} - -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()); -} - -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); - - return true; -} - -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()); -} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_settings.h b/Source/WebKit2/UIProcess/API/efl/ewk_settings.h index 8b17d1cbc..1d8b213d0 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_settings.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_settings.h @@ -71,18 +71,16 @@ EAPI Eina_Bool ewk_settings_fullscreen_enabled_get(const Ewk_Settings *settings) /** * Enables/disables the javascript executing. * - * By default, JavaScript execution is enabled. - * * @param settings settings object to set javascript executing * @param enable @c EINA_TRUE to enable javascript executing - * @c EINA_FALSE to disable + * @c EINA_FALSE to disable * * @return @c EINA_TRUE on success or @c EINA_FALSE on failure */ EAPI Eina_Bool ewk_settings_javascript_enabled_set(Ewk_Settings *settings, Eina_Bool enable); /** - * Returns whether JavaScript execution is enabled. + * Returns the javascript can be executable or not. * * @param settings settings object to query if the javascript can be executed * @@ -94,22 +92,20 @@ EAPI Eina_Bool ewk_settings_javascript_enabled_get(const Ewk_Settings *settings) /** * Enables/disables auto loading of the images. * - * By default, auto loading of the images is enabled. - * * @param settings settings object to set auto loading of the images - * @param automatic @c EINA_TRUE to enable auto loading of the images - * @c EINA_FALSE to disable + * @param automatic @c EINA_TRUE to enable auto loading of the images, + * @c EINA_FALSE to disable * * @return @c EINA_TRUE on success or @c EINA_FALSE on failure */ EAPI Eina_Bool ewk_settings_loads_images_automatically_set(Ewk_Settings *settings, Eina_Bool automatic); /** - * Returns whether the images can be loaded automatically or not. + * Returns the images can be loaded automatically or not. * * @param settings settings object to get auto loading of the images * - * @return @c EINA_TRUE if the images are loaded automatically + * @return @c EINA_TRUE if the images are loaded automatically, * @c EINA_FALSE if not or on failure */ EAPI Eina_Bool ewk_settings_loads_images_automatically_get(const Ewk_Settings *settings); @@ -120,8 +116,7 @@ EAPI Eina_Bool ewk_settings_loads_images_automatically_get(const Ewk_Settings *s * By default, the developer extensions are disabled. * * @param settings settings object to set developer extensions - * @param enable @c EINA_TRUE to enable developer extensions - * @c EINA_FALSE to disable + * @param enable @c EINA_TRUE to enable developer extensions, @c EINA_FALSE to disable * * @return @c EINA_TRUE on success or @EINA_FALSE on failure */ @@ -139,86 +134,6 @@ EAPI Eina_Bool ewk_settings_developer_extras_enabled_set(Ewk_Settings *settings, */ EAPI Eina_Bool ewk_settings_developer_extras_enabled_get(const Ewk_Settings *settings); -/** - * Allow / Disallow file access from file:// URLs. - * - * By default, file access from file:// URLs is not allowed. - * - * @param settings settings object to set file access permission - * @param enable @c EINA_TRUE to enable file access permission - * @c EINA_FALSE to disable - * - * @return @c EINA_TRUE on success or @EINA_FALSE on failure - */ -EAPI Eina_Bool ewk_settings_file_access_from_file_urls_allowed_set(Ewk_Settings *settings, Eina_Bool enable); - -/** - * Queries if file access from file:// URLs is allowed. - * - * By default, file access from file:// URLs is not allowed. - * - * @param settings settings object to query file access permission - * - * @return @c EINA_TRUE if file access from file:// URLs is allowed - * @c EINA_FALSE if not or on failure - */ -EAPI Eina_Bool ewk_settings_file_access_from_file_urls_allowed_get(const Ewk_Settings *settings); - -/** - * Enables/disables frame flattening. - * - * By default, the frame flattening is disabled. - * - * @param settings settings object to set the frame flattening - * @param enable @c EINA_TRUE to enable the frame flattening - * @c EINA_FALSE to disable - * - * @return @c EINA_TRUE on success or @c EINA_FALSE on failure - * - * @see ewk_settings_enable_frame_flattening_get() - */ -EAPI Eina_Bool ewk_settings_frame_flattening_enabled_set(Ewk_Settings *settings, Eina_Bool enable); - -/** - * Returns whether the frame flattening is enabled. - * - * The frame flattening is a feature which expands sub frames until all the frames become - * one scrollable page. - * - * @param settings settings object to get the frame flattening. - * - * @return @c EINA_TRUE if the frame flattening is enabled - * @c EINA_FALSE if not or on failure - */ -EAPI Eina_Bool ewk_settings_frame_flattening_enabled_get(const Ewk_Settings *settings); - -/** - * Enables/disables DNS prefetching. - * - * By default, DNS prefetching is disabled. - * - * @param settings settings object to set DNS prefetching - * @param enable @c EINA_TRUE to enable DNS prefetching or - * @c EINA_FALSE to disable - * - * @return @c EINA_TRUE on success or @c EINA_FALSE on failure - * - * @see ewk_settings_DNS_prefetching_enabled_get() - */ -EAPI Eina_Bool ewk_settings_dns_prefetching_enabled_set(Ewk_Settings *settings, Eina_Bool enable); - -/** - * Returns whether DNS prefetching is enabled or not. - * - * DNS prefetching is an attempt to resolve domain names before a user tries to follow a link. - * - * @param settings settings object to get DNS prefetching - * - * @return @c EINA_TRUE if DNS prefetching is enabled - * @c EINA_FALSE if not or on failure - */ -EAPI Eina_Bool ewk_settings_dns_prefetching_enabled_get(const Ewk_Settings *settings); - #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp index b1c94ad61..9e7c80c40 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp @@ -26,14 +26,44 @@ #include "config.h" #include "ewk_url_request.h" +#include "WKAPICast.h" +#include "WKEinaSharedString.h" +#include "WKURL.h" +#include "WKURLRequest.h" +#include "WebURLRequest.h" #include "ewk_url_request_private.h" +#include <wtf/text/CString.h> using namespace WebKit; +/** + * \struct _Ewk_Url_Request + * @brief Contains the URL request data. + */ +struct _Ewk_Url_Request { + unsigned int __ref; /**< the reference count of the object */ + + WKEinaSharedString url; + WKEinaSharedString first_party; + WKEinaSharedString http_method; + + _Ewk_Url_Request(WKURLRequestRef requestRef) + : __ref(1) + , url(AdoptWK, WKURLRequestCopyURL(requestRef)) + , first_party(AdoptWK, WKURLRequestCopyFirstPartyForCookies(requestRef)) + , http_method(AdoptWK, WKURLRequestCopyHTTPMethod(requestRef)) + { } + + ~_Ewk_Url_Request() + { + ASSERT(!__ref); + } +}; + Ewk_Url_Request* ewk_url_request_ref(Ewk_Url_Request* request) { EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0); - request->ref(); + ++request->__ref; return request; } @@ -42,7 +72,10 @@ void ewk_url_request_unref(Ewk_Url_Request* request) { EINA_SAFETY_ON_NULL_RETURN(request); - request->deref(); + if (--request->__ref) + return; + + delete request; } const char* ewk_url_request_url_get(const Ewk_Url_Request* request) @@ -56,14 +89,14 @@ const char* ewk_request_cookies_first_party_get(const Ewk_Url_Request* request) { EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0); - return request->firstParty; + return request->first_party; } const char* ewk_url_request_http_method_get(const Ewk_Url_Request* request) { EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0); - return request->httpMethod; + return request->http_method; } /** 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 acbc984e2..548b6e91e 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_url_request_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_request_private.h @@ -26,29 +26,6 @@ #ifndef ewk_url_request_private_h #define ewk_url_request_private_h -#include "WKEinaSharedString.h" -#include "WKURL.h" -#include "WKURLRequest.h" -#include "WebURLRequest.h" - -/** - * \struct _Ewk_Url_Request - * @brief Contains the URL request data. - */ -struct _Ewk_Url_Request : public RefCounted<_Ewk_Url_Request> { - WKEinaSharedString url; - WKEinaSharedString firstParty; - WKEinaSharedString httpMethod; - - _Ewk_Url_Request(WKURLRequestRef requestRef) - : url(AdoptWK, WKURLRequestCopyURL(requestRef)) - , firstParty(AdoptWK, WKURLRequestCopyFirstPartyForCookies(requestRef)) - , httpMethod(AdoptWK, WKURLRequestCopyHTTPMethod(requestRef)) - { } -}; - -typedef struct _Ewk_Url_Request Ewk_Url_Request; - Ewk_Url_Request* ewk_url_request_new(WKURLRequestRef); #endif // ewk_url_request_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp index 07a942264..10a68c404 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp @@ -44,7 +44,6 @@ #include "ewk_popup_menu_item.h" #include "ewk_popup_menu_item_private.h" #include "ewk_private.h" -#include "ewk_resource.h" #include "ewk_settings_private.h" #include "ewk_view_find_client_private.h" #include "ewk_view_form_client_private.h" @@ -53,6 +52,7 @@ #include "ewk_view_private.h" #include "ewk_view_resource_load_client_private.h" #include "ewk_view_ui_client_private.h" +#include "ewk_web_resource.h" #include <Ecore_Evas.h> #include <Edje.h> #include <WebCore/Cursor.h> @@ -64,10 +64,6 @@ #include "WebFullScreenManagerProxy.h" #endif -#if ENABLE(INSPECTOR) -#include "WebInspectorProxy.h" -#endif - #if USE(ACCELERATED_COMPOSITING) #include <Evas_GL.h> #endif @@ -83,33 +79,9 @@ static const char EWK_VIEW_TYPE_STR[] = "EWK2_View"; static const int defaultCursorSize = 16; -typedef HashMap<uint64_t, Ewk_Resource*> LoadingResourcesMap; +typedef HashMap<uint64_t, Ewk_Web_Resource*> LoadingResourcesMap; static void _ewk_view_priv_loading_resources_clear(LoadingResourcesMap& loadingResourcesMap); -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) @@ -117,7 +89,7 @@ struct _Ewk_View_Private_Data { #endif RefPtr<WebPageProxy> pageProxy; - WKEinaSharedString url; + WKEinaSharedString uri; WKEinaSharedString title; WKEinaSharedString theme; WKEinaSharedString customEncoding; @@ -129,9 +101,6 @@ struct _Ewk_View_Private_Data { bool areMouseEventsEnabled; WKColorPickerResultListenerRef colorPickerResultListener; Ewk_Context* context; -#if ENABLE(TOUCH_EVENTS) - bool areTouchEventsEnabled; -#endif WebPopupMenuProxyEfl* popupMenuProxy; Eina_List* popupMenuItems; @@ -152,9 +121,6 @@ struct _Ewk_View_Private_Data { , areMouseEventsEnabled(false) , colorPickerResultListener(0) , context(0) -#if ENABLE(TOUCH_EVENTS) - , areTouchEventsEnabled(false) -#endif , popupMenuProxy(0) , popupMenuItems(0) #ifdef HAVE_ECORE_X @@ -390,65 +356,6 @@ static void _ewk_view_on_key_up(void* data, Evas*, Evas_Object*, void* eventInfo smartData->api->key_up(smartData, upEvent); } -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); -} - -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); - - // 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); -} - -#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) @@ -472,7 +379,7 @@ static void _ewk_view_priv_loading_resources_clear(LoadingResourcesMap& loadingR LoadingResourcesMap::iterator it = loadingResourcesMap.begin(); LoadingResourcesMap::iterator end = loadingResourcesMap.end(); for ( ; it != end; ++it) - ewk_resource_unref(it->value); + ewk_web_resource_unref(it->second); loadingResourcesMap.clear(); } @@ -527,14 +434,11 @@ static void _ewk_view_smart_add(Evas_Object* ewkView) CONNECT(EVAS_CALLBACK_MOUSE_WHEEL, _ewk_view_on_mouse_wheel); CONNECT(EVAS_CALLBACK_KEY_DOWN, _ewk_view_on_key_down); CONNECT(EVAS_CALLBACK_KEY_UP, _ewk_view_on_key_up); - CONNECT(EVAS_CALLBACK_SHOW, _ewk_view_on_show); - CONNECT(EVAS_CALLBACK_HIDE, _ewk_view_on_hide); #undef CONNECT } 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); @@ -626,7 +530,6 @@ bool ewk_view_accelerated_compositing_mode_enter(const Evas_Object* ewkView) return false; } - priv->viewportHandler->setRendererActive(true); return true; } @@ -805,9 +708,6 @@ static void _ewk_view_initialize(Evas_Object* ewkView, Ewk_Context* context, WKP priv->pageProxy = toImpl(ewk_context_WKContext_get(context))->createWebPage(priv->pageClient.get(), toImpl(pageGroupRef)); else priv->pageProxy = toImpl(ewk_context_WKContext_get(context))->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); @@ -912,11 +812,11 @@ Ewk_Context* ewk_view_context_get(const Evas_Object* ewkView) /** * @internal - * The url of view was changed by the frame loader. + * The uri of view was changed by the frame loader. * - * Emits signal: "url,changed" with pointer to new url string. + * Emits signal: "uri,changed" with pointer to new uri string. */ -void ewk_view_url_update(Evas_Object* ewkView) +void ewk_view_uri_update(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); @@ -925,32 +825,32 @@ void ewk_view_url_update(Evas_Object* ewkView) if (activeURL.isEmpty()) return; - if (priv->url == activeURL.utf8().data()) + if (priv->uri == 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)); + priv->uri = activeURL.utf8().data(); + const char* callbackArgument = static_cast<const char*>(priv->uri); + evas_object_smart_callback_call(ewkView, "uri,changed", const_cast<char*>(callbackArgument)); } -Eina_Bool ewk_view_url_set(Evas_Object* ewkView, const char* url) +Eina_Bool ewk_view_uri_set(Evas_Object* ewkView, const char* uri) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - EINA_SAFETY_ON_NULL_RETURN_VAL(url, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(uri, false); - priv->pageProxy->loadURL(url); - ewk_view_url_update(ewkView); + priv->pageProxy->loadURL(uri); + ewk_view_uri_update(ewkView); return true; } -const char* ewk_view_url_get(const Evas_Object* ewkView) +const char* ewk_view_uri_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->url; + return priv->uri; } Eina_Bool ewk_view_reload(Evas_Object* ewkView) @@ -959,7 +859,7 @@ Eina_Bool ewk_view_reload(Evas_Object* ewkView) EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); priv->pageProxy->reload(/*reloadFromOrigin*/ false); - ewk_view_url_update(ewkView); + ewk_view_uri_update(ewkView); return true; } @@ -970,7 +870,7 @@ Eina_Bool ewk_view_reload_bypass_cache(Evas_Object* ewkView) EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); priv->pageProxy->reload(/*reloadFromOrigin*/ true); - ewk_view_url_update(ewkView); + ewk_view_uri_update(ewkView); return true; } @@ -999,15 +899,15 @@ Ewk_Settings* ewk_view_settings_get(const Evas_Object* ewkView) * * Emits signal: "resource,request,new" with pointer to resource request. */ -void ewk_view_resource_load_initiated(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Resource* resource, Ewk_Url_Request* request) +void ewk_view_resource_load_initiated(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Web_Resource* resource, Ewk_Url_Request* request) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - Ewk_Resource_Request resourceRequest = {resource, request, 0}; + Ewk_Web_Resource_Request resourceRequest = {resource, request, 0}; // Keep the resource internally to reuse it later. - priv->loadingResourcesMap.add(resourceIdentifier, ewk_resource_ref(resource)); + priv->loadingResourcesMap.add(resourceIdentifier, ewk_web_resource_ref(resource)); evas_object_smart_callback_call(ewkView, "resource,request,new", &resourceRequest); } @@ -1026,8 +926,8 @@ void ewk_view_resource_load_response(Evas_Object* ewkView, uint64_t resourceIden if (!priv->loadingResourcesMap.contains(resourceIdentifier)) return; - Ewk_Resource* resource = priv->loadingResourcesMap.get(resourceIdentifier); - Ewk_Resource_Load_Response resourceLoadResponse = {resource, response}; + Ewk_Web_Resource* resource = priv->loadingResourcesMap.get(resourceIdentifier); + Ewk_Web_Resource_Load_Response resourceLoadResponse = {resource, response}; evas_object_smart_callback_call(ewkView, "resource,request,response", &resourceLoadResponse); } @@ -1037,7 +937,7 @@ void ewk_view_resource_load_response(Evas_Object* ewkView, uint64_t resourceIden * * Emits signal: "resource,request,finished" with pointer to the resource load error. */ -void ewk_view_resource_load_failed(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Error* error) +void ewk_view_resource_load_failed(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Web_Error* error) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); @@ -1045,8 +945,8 @@ void ewk_view_resource_load_failed(Evas_Object* ewkView, uint64_t resourceIdenti if (!priv->loadingResourcesMap.contains(resourceIdentifier)) return; - Ewk_Resource* resource = priv->loadingResourcesMap.get(resourceIdentifier); - Ewk_Resource_Load_Error resourceLoadError = {resource, error}; + Ewk_Web_Resource* resource = priv->loadingResourcesMap.get(resourceIdentifier); + Ewk_Web_Resource_Load_Error resourceLoadError = {resource, error}; evas_object_smart_callback_call(ewkView, "resource,request,failed", &resourceLoadError); } @@ -1064,10 +964,10 @@ void ewk_view_resource_load_finished(Evas_Object* ewkView, uint64_t resourceIden if (!priv->loadingResourcesMap.contains(resourceIdentifier)) return; - Ewk_Resource* resource = priv->loadingResourcesMap.take(resourceIdentifier); + Ewk_Web_Resource* resource = priv->loadingResourcesMap.take(resourceIdentifier); evas_object_smart_callback_call(ewkView, "resource,request,finished", resource); - ewk_resource_unref(resource); + ewk_web_resource_unref(resource); } /** @@ -1084,8 +984,8 @@ void ewk_view_resource_request_sent(Evas_Object* ewkView, uint64_t resourceIdent if (!priv->loadingResourcesMap.contains(resourceIdentifier)) return; - Ewk_Resource* resource = priv->loadingResourcesMap.get(resourceIdentifier); - Ewk_Resource_Request resourceRequest = {resource, request, redirectResponse}; + Ewk_Web_Resource* resource = priv->loadingResourcesMap.get(resourceIdentifier); + Ewk_Web_Resource_Request resourceRequest = {resource, request, redirectResponse}; evas_object_smart_callback_call(ewkView, "resource,request,sent", &resourceRequest); } @@ -1307,22 +1207,6 @@ void ewk_view_full_screen_exit(Evas_Object* ewkView) } #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 @@ -1352,7 +1236,7 @@ void ewk_view_download_job_requested(Evas_Object* ewkView, Ewk_Download_Job* dow * * 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) +void ewk_view_download_job_failed(Evas_Object* ewkView, Ewk_Download_Job* download, Ewk_Web_Error* error) { Ewk_Download_Job_Error downloadError = { download, error }; evas_object_smart_callback_call(ewkView, "download,failed", &downloadError); @@ -1463,11 +1347,11 @@ void ewk_view_form_submission_request_new(Evas_Object* ewkView, Ewk_Form_Submiss * @internal * Reports load failed with error information. * - * Emits signal: "load,error" with pointer to Ewk_Error. + * Emits signal: "load,error" with pointer to Ewk_Web_Error. */ -void ewk_view_load_error(Evas_Object* ewkView, const Ewk_Error* error) +void ewk_view_load_error(Evas_Object* ewkView, const Ewk_Web_Error* error) { - evas_object_smart_callback_call(ewkView, "load,error", const_cast<Ewk_Error*>(error)); + evas_object_smart_callback_call(ewkView, "load,error", const_cast<Ewk_Web_Error*>(error)); } /** @@ -1478,7 +1362,7 @@ void ewk_view_load_error(Evas_Object* ewkView, const Ewk_Error* error) */ void ewk_view_load_finished(Evas_Object* ewkView) { - ewk_view_url_update(ewkView); + ewk_view_uri_update(ewkView); evas_object_smart_callback_call(ewkView, "load,finished", 0); } @@ -1486,11 +1370,11 @@ void ewk_view_load_finished(Evas_Object* ewkView) * @internal * Reports view provisional load failed with error information. * - * Emits signal: "load,provisional,failed" with pointer to Ewk_Error. + * Emits signal: "load,provisional,failed" with pointer to Ewk_Web_Error. */ -void ewk_view_load_provisional_failed(Evas_Object* ewkView, const Ewk_Error* error) +void ewk_view_load_provisional_failed(Evas_Object* ewkView, const Ewk_Web_Error* error) { - evas_object_smart_callback_call(ewkView, "load,provisional,failed", const_cast<Ewk_Error*>(error)); + evas_object_smart_callback_call(ewkView, "load,provisional,failed", const_cast<Ewk_Web_Error*>(error)); } /** @@ -1501,7 +1385,7 @@ void ewk_view_load_provisional_failed(Evas_Object* ewkView, const Ewk_Error* err */ void ewk_view_load_provisional_redirect(Evas_Object* ewkView) { - ewk_view_url_update(ewkView); + ewk_view_uri_update(ewkView); evas_object_smart_callback_call(ewkView, "load,provisional,redirect", 0); } @@ -1520,23 +1404,12 @@ void ewk_view_load_provisional_started(Evas_Object* ewkView) // the loadingResources HashMap to start clean. _ewk_view_priv_loading_resources_clear(priv->loadingResourcesMap); - ewk_view_url_update(ewkView); + ewk_view_uri_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 * Reports that a navigation policy decision should be taken. * * Emits signal: "policy,decision,navigation". @@ -1567,7 +1440,7 @@ Eina_Bool ewk_view_html_string_load(Evas_Object* ewkView, const char* html, cons priv->pageProxy->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); + ewk_view_uri_update(ewkView); return true; } @@ -1585,13 +1458,6 @@ void ewk_view_intent_service_register(Evas_Object* ewkView, const Ewk_Intent_Ser } #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); - - return pageViewMap().get(page); -} - WebPageProxy* ewk_view_page_get(const Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); @@ -1651,13 +1517,14 @@ COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_SHOW_OVERLAY, kWKFindOptionsShowOv COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_SHOW_FIND_INDICATOR, kWKFindOptionsShowFindIndicator); COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_SHOW_HIGHLIGHT, kWKFindOptionsShowHighlight); -Eina_Bool ewk_view_text_find(Evas_Object* ewkView, const char* text, Ewk_Find_Options options, unsigned maxMatchCount) +Eina_Bool ewk_view_text_find(Evas_Object* ewkView, const char* text, Ewk_Find_Options options, unsigned int maxMatchCount) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); EINA_SAFETY_ON_NULL_RETURN_VAL(text, false); - priv->pageProxy->findString(String::fromUTF8(text), static_cast<WebKit::FindOptions>(options), maxMatchCount); + WKRetainPtr<WKStringRef> findText(AdoptWK, WKStringCreateWithUTF8CString(text)); + WKPageFindString(toAPI(priv->pageProxy.get()), findText.get(), static_cast<WKFindOptions>(options), maxMatchCount); return true; } @@ -1667,18 +1534,7 @@ 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); - priv->pageProxy->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); - EINA_SAFETY_ON_NULL_RETURN_VAL(text, false); - - priv->pageProxy->countStringMatches(String::fromUTF8(text), static_cast<WebKit::FindOptions>(options), maxMatchCount); + WKPageHideFindUI(toAPI(priv->pageProxy.get())); return true; } @@ -1922,85 +1778,3 @@ Eina_Bool ewk_view_feed_touch_event(Evas_Object* ewkView, Ewk_Touch_Event_Type t return false; #endif } - -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; - - 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); - } - - return true; -#else - return false; -#endif -} - -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); - - return priv->areTouchEventsEnabled; -#else - return false; -#endif -} - -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); - - WebInspectorProxy* inspector = priv->pageProxy->inspector(); - if (inspector) - inspector->show(); - - return true; -#else - return false; -#endif -} - -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); - - WebInspectorProxy* inspector = priv->pageProxy->inspector(); - if (inspector) - inspector->close(); - - return true; -#else - return false; -#endif -} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.h b/Source/WebKit2/UIProcess/API/efl/ewk_view.h index e9cbe4e1f..13f138c87 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.h @@ -26,7 +26,6 @@ * * The following signals (see evas_object_smart_callback_add()) are emitted: * - * - "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. * - "download,cancelled", Ewk_Download_Job*: reports that a download was effectively cancelled. @@ -45,10 +44,10 @@ * ewk_form_submission_request_submit() will be called automatically. * - "intent,request,new", Ewk_Intent*: reports new Web intent request. * - "intent,service,register", Ewk_Intent_Service*: reports new Web intent service registration. - * - "load,error", const Ewk_Error*: reports main frame load failed. + * - "load,error", const Ewk_Web_Error*: reports main frame load failed. * - "load,finished", void: reports load finished. * - "load,progress", double*: load progress has changed (value from 0.0 to 1.0). - * - "load,provisional,failed", const Ewk_Error*: view provisional load failed. + * - "load,provisional,failed", const Ewk_Web_Error*: view provisional load failed. * - "load,provisional,redirect", void: view received redirect for provisional load. * - "load,provisional,started", void: view started provisional load. * - "policy,decision,navigation", Ewk_Navigation_Policy_Decision*: a navigation policy decision should be taken. @@ -57,14 +56,14 @@ * - "policy,decision,new,window", Ewk_Navigation_Policy_Decision*: a new window policy decision should be taken. * To make a policy decision asynchronously, simply increment the reference count of the * #Ewk_Navigation_Policy_Decision object using ewk_navigation_policy_decision_ref(). - * - "resource,request,failed", const Ewk_Resource_Load_Error*: a resource failed loading. - * - "resource,request,finished", const Ewk_Resource*: a resource finished loading. - * - "resource,request,new", const Ewk_Resource_Request*: a resource request was initiated. - * - "resource,request,response", Ewk_Resource_Load_Response*: a response to a resource request was received. - * - "resource,request,sent", const Ewk_Resource_Request*: a resource request was sent. + * - "resource,request,failed", const Ewk_Web_Resource_Load_Error*: a resource failed loading. + * - "resource,request,finished", const Ewk_Web_Resource*: a resource finished loading. + * - "resource,request,new", const Ewk_Web_Resource_Request*: a resource request was initiated. + * - "resource,request,response", Ewk_Web_Resource_Load_Response*: a response to a resource request was received. + * - "resource,request,sent", const Ewk_Web_Resource_Request*: a resource request was sent. * - "text,found", unsigned int*: the requested text was found and it gives the number of matches. * - "title,changed", const char*: title of the main frame was changed. - * - "url,changed", const char*: url of the main frame was changed. + * - "uri,changed", const char*: uri of the main frame was changed. * - "webprocess,crashed", Eina_Bool*: expects a @c EINA_TRUE if web process crash is handled; @c EINA_FALSE, otherwise. */ @@ -74,13 +73,13 @@ #include "ewk_back_forward_list.h" #include "ewk_context.h" #include "ewk_download_job.h" -#include "ewk_error.h" #include "ewk_intent.h" -#include "ewk_resource.h" #include "ewk_settings.h" #include "ewk_touch.h" #include "ewk_url_request.h" #include "ewk_url_response.h" +#include "ewk_web_error.h" +#include "ewk_web_resource.h" #include <Evas.h> #ifdef __cplusplus @@ -128,17 +127,13 @@ struct _Ewk_View_Smart_Class { // - 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_dismiss)(Ewk_View_Smart_Data *sd); - - // storage: - // - Web database. - unsigned long long (*exceeded_database_quota)(Ewk_View_Smart_Data *sd, const char *databaseName, const char *displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage); }; /** * The version you have to put into the version field * in the @a Ewk_View_Smart_Class structure. */ -#define EWK_VIEW_SMART_CLASS_VERSION 6UL +#define EWK_VIEW_SMART_CLASS_VERSION 5UL /** * Initializer for whole Ewk_View_Smart_Class structure. @@ -150,7 +145,7 @@ struct _Ewk_View_Smart_Class { * @see EWK_VIEW_SMART_CLASS_INIT_VERSION * @see EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION */ -#define EWK_VIEW_SMART_CLASS_INIT(smart_class_init) {smart_class_init, EWK_VIEW_SMART_CLASS_VERSION, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +#define EWK_VIEW_SMART_CLASS_INIT(smart_class_init) {smart_class_init, EWK_VIEW_SMART_CLASS_VERSION, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} /** * Initializer to zero a whole Ewk_View_Smart_Class structure. @@ -202,40 +197,40 @@ struct _Ewk_View_Smart_Data { } changed; }; -/// Creates a type name for _Ewk_Resource_Request. -typedef struct _Ewk_Resource_Request Ewk_Resource_Request; +/// Creates a type name for _Ewk_Web_Resource_Request. +typedef struct _Ewk_Web_Resource_Request Ewk_Web_Resource_Request; /** * @brief Structure containing details about a resource request. */ -struct _Ewk_Resource_Request { - Ewk_Resource *resource; /**< resource being requested */ +struct _Ewk_Web_Resource_Request { + Ewk_Web_Resource *resource; /**< resource being requested */ Ewk_Url_Request *request; /**< URL request for the resource */ Ewk_Url_Response *redirect_response; /**< Possible redirect response for the resource or @c NULL */ }; -/// Creates a type name for _Ewk_Resource_Load_Response. -typedef struct _Ewk_Resource_Load_Response Ewk_Resource_Load_Response; +/// Creates a type name for _Ewk_Web_Resource_Load_Response. +typedef struct _Ewk_Web_Resource_Load_Response Ewk_Web_Resource_Load_Response; /** * @brief Structure containing details about a response to a resource request. */ -struct _Ewk_Resource_Load_Response { - Ewk_Resource *resource; /**< resource requested */ - Ewk_Url_Response *response; /**< resource load response */ +struct _Ewk_Web_Resource_Load_Response { + Ewk_Web_Resource *resource; /**< resource requested */ + Ewk_Url_Response *response; /**< resource load response */ }; -/// Creates a type name for _Ewk_Resource_Load_Error. -typedef struct _Ewk_Resource_Load_Error Ewk_Resource_Load_Error; +/// Creates a type name for _Ewk_Web_Resource_Load_Error. +typedef struct _Ewk_Web_Resource_Load_Error Ewk_Web_Resource_Load_Error; /** * @brief Structure containing details about a resource load error. * * Details given about a resource load failure. */ -struct _Ewk_Resource_Load_Error { - Ewk_Resource *resource; /**< resource that failed loading */ - Ewk_Error *error; /**< load error */ +struct _Ewk_Web_Resource_Load_Error { + Ewk_Web_Resource *resource; /**< resource that failed loading */ + Ewk_Web_Error *error; /**< load error */ }; /// Creates a type name for _Ewk_Download_Job_Error. @@ -246,7 +241,7 @@ typedef struct _Ewk_Download_Job_Error Ewk_Download_Job_Error; */ struct _Ewk_Download_Job_Error { Ewk_Download_Job *download_job; /**< download that failed */ - Ewk_Error *error; /**< download error */ + Ewk_Web_Error *error; /**< download error */ }; /** @@ -334,27 +329,27 @@ EAPI Evas_Object *ewk_view_add_with_context(Evas *e, Ewk_Context *context); EAPI Ewk_Context *ewk_view_context_get(const Evas_Object *o); /** - * Asks the object to load the given URL. + * Asks the object to load the given URI. * - * @param o view object to load @a URL - * @param url uniform resource identifier to load + * @param o view object to load @a URI + * @param uri uniform resource identifier to load * * @return @c EINA_TRUE is returned if @a o is valid, irrespective of load, * or @c EINA_FALSE on failure */ -EAPI Eina_Bool ewk_view_url_set(Evas_Object *o, const char *url); +EAPI Eina_Bool ewk_view_uri_set(Evas_Object *o, const char *uri); /** - * Returns the current URL string of view object. + * Returns the current URI string of view object. * * It returns an internal string and should not * be modified. The string is guaranteed to be stringshared. * - * @param o view object to get current URL + * @param o view object to get current URI * - * @return current URL on success or @c NULL on failure + * @return current URI on success or @c NULL on failure */ -EAPI const char *ewk_view_url_get(const Evas_Object *o); +EAPI const char *ewk_view_uri_get(const Evas_Object *o); /** * Asks the main frame to reload the current document. @@ -618,50 +613,27 @@ EAPI const char *ewk_view_setting_encoding_custom_get(const Evas_Object *o); EAPI Eina_Bool ewk_view_setting_encoding_custom_set(Evas_Object *o, const char *encoding); /** - * Searches and hightlights the given string in the document. - * - * @param o view object to find text - * @param text text to find - * @param options options to find - * @param max_match_count maximum match count to find, unlimited if 0 - * - * @return @c EINA_TRUE on success, @c EINA_FALSE on errors - */ -EAPI Eina_Bool ewk_view_text_find(Evas_Object *o, const char *text, Ewk_Find_Options options, unsigned max_match_count); +* Searches the given string in the document. +* +* @param o view object to find text +* @param text text to find +* @param options options to find +* @param max count to find, unlimited if 0 +* +* @return @c EINA_TRUE on success, @c EINA_FALSE on errors +*/ +EAPI Eina_Bool ewk_view_text_find(Evas_Object *o, const char *text, Ewk_Find_Options options, unsigned int max_match_count); /** - * Clears the highlight of searched text. - * - * @param o view object to find text - * - * @return @c EINA_TRUE on success, @c EINA_FALSE on errors - */ +* Clears the highlight of searched text. +* +* @param o view object to find text +* +* @return @c EINA_TRUE on success, @c EINA_FALSE on errors +*/ EAPI Eina_Bool ewk_view_text_find_highlight_clear(Evas_Object *o); /** - * Counts the given string in the document. - * - * This does not highlight the matched string and just count the matched string. - * - * As the search is carried out through the whole document, - * only the following EWK_FIND_OPTIONS are valid. - * - EWK_FIND_OPTIONS_NONE - * - EWK_FIND_OPTIONS_CASE_INSENSITIVE - * - EWK_FIND_OPTIONS_AT_WORD_START - * - EWK_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START - * - * The "text,found" callback will be called with the number of matched string. - * - * @param o view object to find text - * @param text text to find - * @param options options to find - * @param max_match_count maximum match count to find, unlimited if 0 - * - * @return @c EINA_TRUE on success, @c EINA_FALSE on errors - */ -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. @@ -736,48 +708,6 @@ EAPI Eina_Bool ewk_view_color_picker_color_set(Evas_Object *o, int r, int g, int */ EAPI Eina_Bool ewk_view_feed_touch_event(Evas_Object *o, Ewk_Touch_Event_Type type, const Eina_List *points, const Evas_Modifier *modifiers); -/** - * Sets whether the ewk_view supports the touch events or not. - * - * The ewk_view will support the touch events if @c EINA_TRUE or not support the - * touch events otherwise. The default value is @c EINA_FALSE. - * - * @param o view object to enable/disable the touch events - * @param enabled a state to set - * - * @return @c EINA_TRUE on success or @c EINA_FALSE on failure - */ -EAPI Eina_Bool ewk_view_touch_events_enabled_set(Evas_Object *o, Eina_Bool enabled); - -/** - * Queries if the ewk_view supports the touch events. - * - * @param o view object to query if the touch events are enabled - * - * @return @c EINA_TRUE if the touch events are enabled or @c EINA_FALSE otherwise - */ -EAPI Eina_Bool ewk_view_touch_events_enabled_get(const Evas_Object *o); - -/** - * Show the inspector to debug a web page. - * - * @param o The view to show the inspector. - * - * @return @c EINA_TRUE on success or @c EINA_FALSE on failure - * - * @see ewk_settings_developer_extras_enabled_set() - */ -EAPI Eina_Bool ewk_view_inspector_show(Evas_Object *o); - -/** - * Close the inspector - * - * @param o The view to close the inspector. - * - * @return @c EINA_TRUE on success or @c EINA_FALSE on failure - */ -EAPI Eina_Bool ewk_view_inspector_close(Evas_Object *o); - #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_find_client.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view_find_client.cpp index 1edc3cbfd..637e7aec2 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_find_client.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_find_client.cpp @@ -34,19 +34,9 @@ static inline Evas_Object* toEwkView(const void* clientInfo) return static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); } -static void didFindString(WKPageRef, WKStringRef, unsigned matchCount, const void* clientInfo) +static void didFindString(WKPageRef, WKStringRef /*string*/, unsigned matchCount, const void* clientInfo) { - ewk_view_text_found(toEwkView(clientInfo), matchCount); -} - -static void didFailToFindString(WKPageRef, WKStringRef, const void* clientInfo) -{ - ewk_view_text_found(toEwkView(clientInfo), 0); -} - -static void didCountStringMatches(WKPageRef, WKStringRef, unsigned matchCount, const void* clientInfo) -{ - ewk_view_text_found(toEwkView(clientInfo), matchCount); + ewk_view_text_found(toEwkView(clientInfo), static_cast<unsigned int>(matchCount)); } void ewk_view_find_client_attach(WKPageRef pageRef, Evas_Object* ewkView) @@ -56,7 +46,5 @@ void ewk_view_find_client_attach(WKPageRef pageRef, Evas_Object* ewkView) findClient.version = kWKPageFindClientCurrentVersion; findClient.clientInfo = ewkView; findClient.didFindString = didFindString; - findClient.didFailToFindString = didFailToFindString; - findClient.didCountStringMatches = didCountStringMatches; WKPageSetPageFindClient(pageRef, &findClient); } diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client.cpp index a3afdb4ba..997ca35a8 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client.cpp @@ -28,13 +28,14 @@ #include "WKFrame.h" #include "ewk_back_forward_list_private.h" -#include "ewk_error_private.h" #include "ewk_intent.h" #include "ewk_intent_private.h" #include "ewk_intent_service.h" #include "ewk_intent_service_private.h" #include "ewk_view_loader_client_private.h" #include "ewk_view_private.h" +#include "ewk_web_error.h" +#include "ewk_web_error_private.h" #include <wtf/text/CString.h> using namespace WebKit; @@ -89,10 +90,10 @@ static void didFailLoadWithErrorForFrame(WKPageRef, WKFrameRef frame, WKErrorRef return; Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); - Ewk_Error* ewkError = ewk_error_new(error); + Ewk_Web_Error* ewkError = ewk_web_error_new(error); ewk_view_load_error(ewkView, ewkError); ewk_view_load_finished(ewkView); - ewk_error_free(ewkError); + ewk_web_error_free(ewkError); } static void didStartProvisionalLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef /*userData*/, const void* clientInfo) @@ -119,9 +120,9 @@ static void didFailProvisionalLoadWithErrorForFrame(WKPageRef, WKFrameRef frame, return; Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); - Ewk_Error* ewkError = ewk_error_new(error); + Ewk_Web_Error* ewkError = ewk_web_error_new(error); ewk_view_load_provisional_failed(ewkView, ewkError); - ewk_error_free(ewkError); + ewk_web_error_free(ewkError); } static void didChangeBackForwardList(WKPageRef, WKBackForwardListItemRef addedItem, WKArrayRef removedItems, const void* clientInfo) @@ -130,7 +131,6 @@ static void didChangeBackForwardList(WKPageRef, WKBackForwardListItemRef addedIt ASSERT(ewkView); ewk_back_forward_list_changed(ewk_view_back_forward_list_get(ewkView), addedItem, removedItems); - ewk_view_back_forward_list_changed(ewkView); } static void didSameDocumentNavigationForFrame(WKPageRef, WKFrameRef frame, WKSameDocumentNavigationType, WKTypeRef, const void* clientInfo) @@ -139,7 +139,7 @@ static void didSameDocumentNavigationForFrame(WKPageRef, WKFrameRef frame, WKSam return; Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); - ewk_view_url_update(ewkView); + ewk_view_uri_update(ewkView); } void ewk_view_loader_client_attach(WKPageRef pageRef, Evas_Object* ewkView) diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h index 8ec91c13c..4cba22d36 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h @@ -43,8 +43,8 @@ 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_Web_Error Ewk_Web_Error; +typedef struct _Ewk_Web_Resource Ewk_Web_Resource; typedef struct _Ewk_Navigation_Policy_Decision Ewk_Navigation_Policy_Decision; #if ENABLE(WEB_INTENTS) typedef struct _Ewk_Intent Ewk_Intent; @@ -56,7 +56,7 @@ typedef struct _Ewk_Intent_Service Ewk_Intent_Service; 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_failed(Evas_Object* ewkView, Ewk_Download_Job*, Ewk_Web_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*); @@ -65,10 +65,10 @@ 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_error(Evas_Object* ewkView, const Ewk_Web_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_failed(Evas_Object* ewkView, const Ewk_Web_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); @@ -76,15 +76,14 @@ void ewk_view_new_window_policy_decision(Evas_Object* ewkView, Ewk_Navigation_Po 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_resource_load_failed(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Error* error); +void ewk_view_resource_load_failed(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Web_Error* error); void ewk_view_resource_load_finished(Evas_Object* ewkView, uint64_t resourceIdentifier); -void ewk_view_resource_load_initiated(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Resource* resource, Ewk_Url_Request* request); +void ewk_view_resource_load_initiated(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Web_Resource* resource, Ewk_Url_Request* request); void ewk_view_resource_load_response(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Url_Response* response); void ewk_view_resource_request_sent(Evas_Object* ewkView, uint64_t resourceIdentifier, 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_uri_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); Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef, WKPageGroupRef); @@ -95,7 +94,6 @@ void ewk_view_intent_request_new(Evas_Object* ewkView, const Ewk_Intent* ewkInte 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); @@ -116,8 +114,4 @@ void ewk_view_color_picker_request(Evas_Object* ewkView, int r, int g, int b, in 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_resource_load_client.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client.cpp index 469e18278..113e178b9 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client.cpp @@ -32,15 +32,16 @@ #include "WKURL.h" #include "WKURLRequest.h" #include "WKURLResponse.h" -#include "ewk_error_private.h" -#include "ewk_resource.h" -#include "ewk_resource_private.h" #include "ewk_url_request.h" #include "ewk_url_request_private.h" #include "ewk_url_response.h" #include "ewk_url_response_private.h" #include "ewk_view_private.h" #include "ewk_view_resource_load_client_private.h" +#include "ewk_web_error.h" +#include "ewk_web_error_private.h" +#include "ewk_web_resource.h" +#include "ewk_web_resource_private.h" #include <wtf/text/CString.h> using namespace WebCore; @@ -56,17 +57,19 @@ static void didInitiateLoadForResource(WKPageRef, WKFrameRef wkFrame, uint64_t r bool isMainResource = (WKFrameIsMainFrame(wkFrame) && pageIsProvisionallyLoading); WKRetainPtr<WKURLRef> wkUrl(AdoptWK, WKURLRequestCopyURL(wkRequest)); - Ewk_Resource* resource = ewk_resource_new(toImpl(wkUrl.get())->string().utf8().data(), isMainResource); - RefPtr<Ewk_Url_Request> request = adoptRef(ewk_url_request_new(wkRequest)); - ewk_view_resource_load_initiated(toEwkView(clientInfo), resourceIdentifier, resource, request.get()); - ewk_resource_unref(resource); + Ewk_Web_Resource* resource = ewk_web_resource_new(toImpl(wkUrl.get())->string().utf8().data(), isMainResource); + Ewk_Url_Request* request = ewk_url_request_new(wkRequest); + ewk_view_resource_load_initiated(toEwkView(clientInfo), resourceIdentifier, resource, request); + ewk_web_resource_unref(resource); + ewk_url_request_unref(request); } static void didSendRequestForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, WKURLRequestRef wkRequest, WKURLResponseRef wkRedirectResponse, const void* clientInfo) { - RefPtr<Ewk_Url_Request> request = adoptRef(ewk_url_request_new(wkRequest)); + Ewk_Url_Request* request = ewk_url_request_new(wkRequest); Ewk_Url_Response* redirectResponse = wkRedirectResponse ? ewk_url_response_new(toImpl(wkRedirectResponse)->resourceResponse()) : 0; - ewk_view_resource_request_sent(toEwkView(clientInfo), resourceIdentifier, request.get(), redirectResponse); + ewk_view_resource_request_sent(toEwkView(clientInfo), resourceIdentifier, request, redirectResponse); + ewk_url_request_unref(request); if (redirectResponse) ewk_url_response_unref(redirectResponse); } @@ -85,10 +88,10 @@ static void didFinishLoadForResource(WKPageRef, WKFrameRef, uint64_t resourceIde static void didFailLoadForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, WKErrorRef wkError, const void* clientInfo) { - Ewk_Error* ewkError = ewk_error_new(wkError); + Ewk_Web_Error* ewkError = ewk_web_error_new(wkError); ewk_view_resource_load_failed(toEwkView(clientInfo), resourceIdentifier, ewkError); ewk_view_resource_load_finished(toEwkView(clientInfo), resourceIdentifier); - ewk_error_free(ewkError); + ewk_web_error_free(ewkError); } void ewk_view_resource_load_client_attach(WKPageRef pageRef, Evas_Object* ewkView) diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_ui_client.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view_ui_client.cpp index 0f7bd9277..6bbf8956c 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_ui_client.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_ui_client.cpp @@ -28,7 +28,6 @@ #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) { @@ -74,45 +73,6 @@ static void hideColorPicker(WKPageRef, const void* 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; @@ -124,14 +84,6 @@ void ewk_view_ui_client_attach(WKPageRef pageRef, Evas_Object* ewkView) 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; diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_error.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp index a7d576d0a..70380bdd2 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_error.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp @@ -24,13 +24,13 @@ */ #include "config.h" -#include "ewk_error.h" +#include "ewk_web_error.h" #include "ErrorsEfl.h" #include "WKEinaSharedString.h" #include "WKString.h" #include "WKURL.h" -#include "ewk_error_private.h" +#include "ewk_web_error_private.h" #include <WKAPICast.h> #include <WKError.h> #include <WKRetainPtr.h> @@ -39,24 +39,24 @@ using namespace WebCore; using namespace WebKit; -struct _Ewk_Error { +struct _Ewk_Web_Error { WKRetainPtr<WKErrorRef> wkError; WKEinaSharedString url; WKEinaSharedString description; - _Ewk_Error(WKErrorRef errorRef) + _Ewk_Web_Error(WKErrorRef errorRef) : wkError(errorRef) , url(AdoptWK, WKErrorCopyFailingURL(errorRef)) , description(AdoptWK, WKErrorCopyLocalizedDescription(errorRef)) { } - ~_Ewk_Error() + ~_Ewk_Web_Error() { } }; -#define EWK_ERROR_WK_GET_OR_RETURN(error, wkError_, ...) \ +#define EWK_WEB_ERROR_WK_GET_OR_RETURN(error, wkError_, ...) \ if (!(error)) { \ EINA_LOG_CRIT("error is NULL."); \ return __VA_ARGS__; \ @@ -67,68 +67,64 @@ struct _Ewk_Error { } \ WKErrorRef wkError_ = (error)->wkError.get() -/** - * @internal - * Frees the given object. - */ -void ewk_error_free(Ewk_Error* error) +void ewk_web_error_free(Ewk_Web_Error* error) { EINA_SAFETY_ON_NULL_RETURN(error); delete error; } -Ewk_Error_Type ewk_error_type_get(const Ewk_Error* error) +Ewk_Web_Error_Type ewk_web_error_type_get(const Ewk_Web_Error* error) { - EWK_ERROR_WK_GET_OR_RETURN(error, wkError, EWK_ERROR_TYPE_NONE); + EWK_WEB_ERROR_WK_GET_OR_RETURN(error, wkError, EWK_WEB_ERROR_TYPE_NONE); WKRetainPtr<WKStringRef> wkDomain(AdoptWK, WKErrorCopyDomain(wkError)); WTF::String errorDomain = toWTFString(wkDomain.get()); if (errorDomain == errorDomainNetwork) - return EWK_ERROR_TYPE_NETWORK; + return EWK_WEB_ERROR_TYPE_NETWORK; if (errorDomain == errorDomainPolicy) - return EWK_ERROR_TYPE_POLICY; + return EWK_WEB_ERROR_TYPE_POLICY; if (errorDomain == errorDomainPlugin) - return EWK_ERROR_TYPE_PLUGIN; + return EWK_WEB_ERROR_TYPE_PLUGIN; if (errorDomain == errorDomainDownload) - return EWK_ERROR_TYPE_DOWNLOAD; + return EWK_WEB_ERROR_TYPE_DOWNLOAD; if (errorDomain == errorDomainPrint) - return EWK_ERROR_TYPE_PRINT; - return EWK_ERROR_TYPE_INTERNAL; + return EWK_WEB_ERROR_TYPE_PRINT; + return EWK_WEB_ERROR_TYPE_INTERNAL; } -const char* ewk_error_url_get(const Ewk_Error* error) +const char* ewk_web_error_url_get(const Ewk_Web_Error* error) { EINA_SAFETY_ON_NULL_RETURN_VAL(error, 0); return error->url; } -int ewk_error_code_get(const Ewk_Error* error) +int ewk_web_error_code_get(const Ewk_Web_Error* error) { - EWK_ERROR_WK_GET_OR_RETURN(error, wkError, 0); + EWK_WEB_ERROR_WK_GET_OR_RETURN(error, wkError, 0); return WKErrorGetErrorCode(wkError); } -const char* ewk_error_description_get(const Ewk_Error* error) +const char* ewk_web_error_description_get(const Ewk_Web_Error* error) { EINA_SAFETY_ON_NULL_RETURN_VAL(error, 0); return error->description; } -Eina_Bool ewk_error_cancellation_get(const Ewk_Error* error) +Eina_Bool ewk_web_error_cancellation_get(const Ewk_Web_Error* error) { - EWK_ERROR_WK_GET_OR_RETURN(error, wkError, false); + EWK_WEB_ERROR_WK_GET_OR_RETURN(error, wkError, false); return toImpl(wkError)->platformError().isCancellation(); } -Ewk_Error* ewk_error_new(WKErrorRef error) +Ewk_Web_Error* ewk_web_error_new(WKErrorRef error) { EINA_SAFETY_ON_NULL_RETURN_VAL(error, 0); - return new Ewk_Error(error); + return new Ewk_Web_Error(error); } diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_error.h b/Source/WebKit2/UIProcess/API/efl/ewk_web_error.h index 01214d121..4ba0c7acd 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_error.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_web_error.h @@ -24,12 +24,12 @@ */ /** - * @file ewk_error.h + * @file ewk_web_error.h * @brief Describes the Web Error API. */ -#ifndef ewk_error_h -#define ewk_error_h +#ifndef ewk_web_error_h +#define ewk_web_error_h #include <Eina.h> @@ -37,19 +37,26 @@ extern "C" { #endif -/** Creates a type name for @a Ewk_Error. */ -typedef struct _Ewk_Error Ewk_Error; +/** Creates a type name for @a Ewk_Web_Error. */ +typedef struct _Ewk_Web_Error Ewk_Web_Error; -/// Creates a type name for Ewk_Error_Type. +/// Creates a type name for Ewk_Web_Error_Type. typedef enum { - EWK_ERROR_TYPE_NONE, - EWK_ERROR_TYPE_INTERNAL, - EWK_ERROR_TYPE_NETWORK, - EWK_ERROR_TYPE_POLICY, - EWK_ERROR_TYPE_PLUGIN, - EWK_ERROR_TYPE_DOWNLOAD, - EWK_ERROR_TYPE_PRINT -} Ewk_Error_Type; + EWK_WEB_ERROR_TYPE_NONE, + EWK_WEB_ERROR_TYPE_INTERNAL, + EWK_WEB_ERROR_TYPE_NETWORK, + EWK_WEB_ERROR_TYPE_POLICY, + EWK_WEB_ERROR_TYPE_PLUGIN, + EWK_WEB_ERROR_TYPE_DOWNLOAD, + EWK_WEB_ERROR_TYPE_PRINT +} Ewk_Web_Error_Type; + +/** + * Frees the given object. + * + * @param error the error object to free + */ +EAPI void ewk_web_error_free(Ewk_Web_Error *error); /** * Query type for this error. @@ -62,7 +69,7 @@ typedef enum { * eina_stringshare_ref() instead of eina_stringshare_add() or * strdup(). */ -EAPI Ewk_Error_Type ewk_error_type_get(const Ewk_Error *error); +EAPI Ewk_Web_Error_Type ewk_web_error_type_get(const Ewk_Web_Error *error); /** * Query failing URL for this error. @@ -77,7 +84,7 @@ EAPI Ewk_Error_Type ewk_error_type_get(const Ewk_Error *error); * eina_stringshare_ref() instead of eina_stringshare_add() or * strdup(). */ -EAPI const char *ewk_error_url_get(const Ewk_Error *error); +EAPI const char *ewk_web_error_url_get(const Ewk_Web_Error *error); /** * Query HTTP error code. @@ -86,7 +93,7 @@ EAPI const char *ewk_error_url_get(const Ewk_Error *error); * * @return the HTTP error code. */ -EAPI int ewk_error_code_get(const Ewk_Error *error); +EAPI int ewk_web_error_code_get(const Ewk_Web_Error *error); /** * Query description for this error. @@ -99,7 +106,7 @@ EAPI int ewk_error_code_get(const Ewk_Error *error); * eina_stringshare_ref() instead of eina_stringshare_add() or * strdup(). */ -EAPI const char *ewk_error_description_get(const Ewk_Error *error); +EAPI const char *ewk_web_error_description_get(const Ewk_Web_Error *error); /** * Query if error should be treated as a cancellation. @@ -108,10 +115,10 @@ EAPI const char *ewk_error_description_get(const Ewk_Error *error); * * @return @c EINA_TRUE if this error should be treated as a cancellation, @c EINA_FALSE otherwise */ -EAPI Eina_Bool ewk_error_cancellation_get(const Ewk_Error *error); +EAPI Eina_Bool ewk_web_error_cancellation_get(const Ewk_Web_Error *error); #ifdef __cplusplus } #endif -#endif // ewk_error_h +#endif // ewk_web_error_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_error_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_web_error_private.h index 2f01988c2..c9a31e50a 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_error_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_web_error_private.h @@ -23,14 +23,13 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ewk_error_private_h -#define ewk_error_private_h +#ifndef ewk_web_error_private_h +#define ewk_web_error_private_h #include <WKError.h> -typedef struct _Ewk_Error Ewk_Error; +typedef struct _Ewk_Web_Error Ewk_Web_Error; -Ewk_Error* ewk_error_new(WKErrorRef error); -void ewk_error_free(Ewk_Error* error); +Ewk_Web_Error* ewk_web_error_new(WKErrorRef error); -#endif // ewk_error_private_h +#endif // ewk_web_error_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_resource.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp index aaa7e98e7..89879eead 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_resource.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp @@ -24,30 +24,30 @@ */ #include "config.h" -#include "ewk_resource.h" +#include "ewk_web_resource.h" #include "WKEinaSharedString.h" -#include "ewk_resource_private.h" +#include "ewk_web_resource_private.h" #include <wtf/text/CString.h> -struct _Ewk_Resource { - unsigned __ref; /**< the reference count of the object */ +struct _Ewk_Web_Resource { + unsigned int __ref; /**< the reference count of the object */ WKEinaSharedString url; bool isMainResource; - _Ewk_Resource(const char* url, bool isMainResource) + _Ewk_Web_Resource(const char* url, bool isMainResource) : __ref(1) , url(url) , isMainResource(isMainResource) { } - ~_Ewk_Resource() + ~_Ewk_Web_Resource() { ASSERT(!__ref); } }; -Ewk_Resource* ewk_resource_ref(Ewk_Resource* resource) +Ewk_Web_Resource* ewk_web_resource_ref(Ewk_Web_Resource* resource) { EINA_SAFETY_ON_NULL_RETURN_VAL(resource, 0); @@ -56,7 +56,7 @@ Ewk_Resource* ewk_resource_ref(Ewk_Resource* resource) return resource; } -void ewk_resource_unref(Ewk_Resource* resource) +void ewk_web_resource_unref(Ewk_Web_Resource* resource) { EINA_SAFETY_ON_NULL_RETURN(resource); @@ -66,7 +66,7 @@ void ewk_resource_unref(Ewk_Resource* resource) delete resource; } -const char* ewk_resource_url_get(const Ewk_Resource* resource) +const char* ewk_web_resource_url_get(const Ewk_Web_Resource* resource) { EINA_SAFETY_ON_NULL_RETURN_VAL(resource, 0); @@ -75,16 +75,16 @@ const char* ewk_resource_url_get(const Ewk_Resource* resource) /** * @internal - * Constructs a Ewk_Resource. + * Constructs a Ewk_Web_Resource. */ -Ewk_Resource* ewk_resource_new(const char* url, bool isMainResource) +Ewk_Web_Resource* ewk_web_resource_new(const char* url, bool isMainResource) { EINA_SAFETY_ON_NULL_RETURN_VAL(url, 0); - return new Ewk_Resource(url, isMainResource); + return new Ewk_Web_Resource(url, isMainResource); } -Eina_Bool ewk_resource_main_resource_get(const Ewk_Resource* resource) +Eina_Bool ewk_web_resource_main_resource_get(const Ewk_Web_Resource* resource) { EINA_SAFETY_ON_NULL_RETURN_VAL(resource, false); diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_resource.h b/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.h index a2f4786b8..dc2cf087d 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_resource.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.h @@ -24,12 +24,12 @@ */ /** - * @file ewk_resource.h + * @file ewk_web_resource.h * @brief Describes the Web Resource API. */ -#ifndef ewk_resource_h -#define ewk_resource_h +#ifndef ewk_web_resource_h +#define ewk_web_resource_h #include <Eina.h> @@ -37,8 +37,8 @@ extern "C" { #endif -/** Creates a type name for @a Ewk_Resource. */ -typedef struct _Ewk_Resource Ewk_Resource; +/** Creates a type name for @a Ewk_Web_Resource. */ +typedef struct _Ewk_Web_Resource Ewk_Web_Resource; /** * Increases the reference count of the given object. @@ -47,7 +47,7 @@ typedef struct _Ewk_Resource Ewk_Resource; * * @return a pointer to the object on success, @c NULL otherwise. */ -EAPI Ewk_Resource *ewk_resource_ref(Ewk_Resource *resource); +EAPI Ewk_Web_Resource *ewk_web_resource_ref(Ewk_Web_Resource *resource); /** * Decreases the reference count of the given object, possibly freeing it. @@ -56,7 +56,7 @@ EAPI Ewk_Resource *ewk_resource_ref(Ewk_Resource *resource); * * @param resource the resource object to decrease the reference count */ -EAPI void ewk_resource_unref(Ewk_Resource *resource); +EAPI void ewk_web_resource_unref(Ewk_Web_Resource *resource); /** * Query URL for this resource. @@ -69,7 +69,7 @@ EAPI void ewk_resource_unref(Ewk_Resource *resource); * eina_stringshare_ref() instead of eina_stringshare_add() or * strdup(). */ -EAPI const char *ewk_resource_url_get(const Ewk_Resource *resource); +EAPI const char *ewk_web_resource_url_get(const Ewk_Web_Resource *resource); /** * Query if this is the main resource. @@ -78,10 +78,10 @@ EAPI const char *ewk_resource_url_get(const Ewk_Resource *resource); * * @return @c EINA_TRUE if this is the main resource, @c EINA_FALSE otherwise */ -EAPI Eina_Bool ewk_resource_main_resource_get(const Ewk_Resource *resource); +EAPI Eina_Bool ewk_web_resource_main_resource_get(const Ewk_Web_Resource *resource); #ifdef __cplusplus } #endif -#endif // ewk_resource_h +#endif // ewk_web_resource_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_resource_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_web_resource_private.h index 4fd4cfd62..5b44fe19f 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_resource_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_web_resource_private.h @@ -23,11 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ewk_resource_private_h -#define ewk_resource_private_h +#ifndef ewk_web_resource_private_h +#define ewk_web_resource_private_h -typedef struct _Ewk_Resource Ewk_Resource; +typedef struct _Ewk_Web_Resource Ewk_Web_Resource; -Ewk_Resource* ewk_resource_new(const char* url, bool isMainResource); +Ewk_Web_Resource* ewk_web_resource_new(const char* uri, bool isMainResource); -#endif // ewk_resource_private_h +#endif // ewk_web_resource_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp index e02f011ca..1691f0d7c 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp @@ -50,7 +50,10 @@ void EWK2UnitTestBase::SetUp() unsigned int width = environment->defaultWidth(); unsigned int height = environment->defaultHeight(); - m_ecoreEvas = ecore_evas_new(0, 0, 0, width, height, 0); + if (environment->useX11Window()) + m_ecoreEvas = ecore_evas_new(0, 0, 0, width, height, 0); + else + m_ecoreEvas = ecore_evas_buffer_new(width, height); ecore_evas_show(m_ecoreEvas); Evas* evas = ecore_evas_get(m_ecoreEvas); @@ -71,17 +74,17 @@ void EWK2UnitTestBase::TearDown() ewk_shutdown(); } -bool EWK2UnitTestBase::loadUrlSync(const char* url, double timeoutSeconds) +void EWK2UnitTestBase::loadUrlSync(const char* url) { - ewk_view_url_set(m_webView, url); - return waitUntilLoadFinished(timeoutSeconds); + ewk_view_uri_set(m_webView, url); + waitUntilLoadFinished(); } class CallbackDataTimer { public: - explicit CallbackDataTimer(double timeoutSeconds) + CallbackDataTimer(double timeoutSeconds, Ecore_Task_Cb callback) : m_done(false) - , m_timer(timeoutSeconds >= 0 ? ecore_timer_add(timeoutSeconds, reinterpret_cast<Ecore_Task_Cb>(timeOutCallback), this) : 0) + , m_timer(timeoutSeconds >= 0 ? ecore_timer_add(timeoutSeconds, callback, this) : 0) , m_didTimeOut(false) { } @@ -105,19 +108,6 @@ public: bool didTimeOut() const { return m_didTimeOut; } -protected: - bool m_done; - Ecore_Timer* m_timer; - bool m_didTimeOut; - -private: - static bool timeOutCallback(void* userData) - { - CallbackDataTimer* data = static_cast<CallbackDataTimer*>(userData); - data->setTimedOut(); - return ECORE_CALLBACK_CANCEL; - } - void setTimedOut() { m_done = true; @@ -125,13 +115,17 @@ private: m_didTimeOut = true; } +protected: + bool m_done; + Ecore_Timer* m_timer; + bool m_didTimeOut; }; template <class T> class CallbackDataExpectedValue : public CallbackDataTimer { public: - CallbackDataExpectedValue(const T& expectedValue, double timeoutSeconds) - : CallbackDataTimer(timeoutSeconds) + CallbackDataExpectedValue(const T& expectedValue, double timeoutSeconds, Ecore_Task_Cb callback) + : CallbackDataTimer(timeoutSeconds, callback) , m_expectedValue(expectedValue) { } @@ -151,9 +145,17 @@ static void onLoadFinished(void* userData, Evas_Object* webView, void* eventInfo data->setDone(); } +static bool timeOutWhileWaitingUntilLoadFinished(void* userData) +{ + CallbackDataTimer* data = static_cast<CallbackDataTimer*>(userData); + data->setTimedOut(); + + return ECORE_CALLBACK_CANCEL; +} + bool EWK2UnitTestBase::waitUntilLoadFinished(double timeoutSeconds) { - CallbackDataTimer data(timeoutSeconds); + CallbackDataTimer data(timeoutSeconds, reinterpret_cast<Ecore_Task_Cb>(timeOutWhileWaitingUntilLoadFinished)); evas_object_smart_callback_add(m_webView, "load,finished", onLoadFinished, &data); @@ -175,9 +177,17 @@ static void onTitleChanged(void* userData, Evas_Object* webView, void*) data->setDone(); } +static bool timeOutWhileWaitingUntilTitleChangedTo(void* userData) +{ + CallbackDataExpectedValue<CString>* data = static_cast<CallbackDataExpectedValue<CString>*>(userData); + data->setTimedOut(); + + return ECORE_CALLBACK_CANCEL; +} + bool EWK2UnitTestBase::waitUntilTitleChangedTo(const char* expectedTitle, double timeoutSeconds) { - CallbackDataExpectedValue<CString> data(expectedTitle, timeoutSeconds); + CallbackDataExpectedValue<CString> data(expectedTitle, timeoutSeconds, reinterpret_cast<Ecore_Task_Cb>(timeOutWhileWaitingUntilTitleChangedTo)); evas_object_smart_callback_add(m_webView, "title,changed", onTitleChanged, &data); @@ -189,26 +199,34 @@ bool EWK2UnitTestBase::waitUntilTitleChangedTo(const char* expectedTitle, double return !data.didTimeOut(); } -static void onURLChanged(void* userData, Evas_Object* webView, void*) +static void onURIChanged(void* userData, Evas_Object* webView, void*) { CallbackDataExpectedValue<CString>* data = static_cast<CallbackDataExpectedValue<CString>*>(userData); - if (strcmp(ewk_view_url_get(webView), data->expectedValue().data())) + if (strcmp(ewk_view_uri_get(webView), data->expectedValue().data())) return; data->setDone(); } -bool EWK2UnitTestBase::waitUntilURLChangedTo(const char* expectedURL, double timeoutSeconds) +static bool timeOutWhileWaitingUntilURIChangedTo(void* userData) +{ + CallbackDataExpectedValue<CString>* data = static_cast<CallbackDataExpectedValue<CString>*>(userData); + data->setTimedOut(); + + return ECORE_CALLBACK_CANCEL; +} + +bool EWK2UnitTestBase::waitUntilURIChangedTo(const char* expectedURI, double timeoutSeconds) { - CallbackDataExpectedValue<CString> data(expectedURL, timeoutSeconds); + CallbackDataExpectedValue<CString> data(expectedURI, timeoutSeconds, reinterpret_cast<Ecore_Task_Cb>(timeOutWhileWaitingUntilURIChangedTo)); - evas_object_smart_callback_add(m_webView, "url,changed", onURLChanged, &data); + evas_object_smart_callback_add(m_webView, "uri,changed", onURIChanged, &data); while (!data.isDone()) ecore_main_loop_iterate(); - evas_object_smart_callback_del(m_webView, "url,changed", onURLChanged); + evas_object_smart_callback_del(m_webView, "uri,changed", onURIChanged); return !data.didTimeOut(); } @@ -221,38 +239,4 @@ void EWK2UnitTestBase::mouseClick(int x, int y) evas_event_feed_mouse_up(evas, /* Left */ 1, EVAS_BUTTON_NONE, 0, 0); } -void EWK2UnitTestBase::mouseDown(int x, int y) -{ - Evas* evas = evas_object_evas_get(m_webView); - evas_event_feed_mouse_move(evas, x, y, 0, 0); - evas_event_feed_mouse_down(evas, /* Left */ 1, EVAS_BUTTON_NONE, 0, 0); -} - -void EWK2UnitTestBase::mouseUp(int x, int y) -{ - Evas* evas = evas_object_evas_get(m_webView); - evas_event_feed_mouse_move(evas, x, y, 0, 0); - evas_event_feed_mouse_up(evas, /* Left */ 1, EVAS_BUTTON_NONE, 0, 0); -} - -void EWK2UnitTestBase::mouseMove(int x, int y) -{ - evas_event_feed_mouse_move(evas_object_evas_get(m_webView), x, y, 0, 0); -} - -void EWK2UnitTestBase::multiDown(int id, int x, int y) -{ - evas_event_feed_multi_down(evas_object_evas_get(m_webView), id, x, y, 0, 0, 0, 0, 0, 0, 0, EVAS_BUTTON_NONE, 0, 0); -} - -void EWK2UnitTestBase::multiUp(int id, int x, int y) -{ - evas_event_feed_multi_up(evas_object_evas_get(m_webView), id, x, y, 0, 0, 0, 0, 0, 0, 0, EVAS_BUTTON_NONE, 0, 0); -} - -void EWK2UnitTestBase::multiMove(int id, int x, int y) -{ - evas_event_feed_multi_move(evas_object_evas_get(m_webView), id, x, y, 0, 0, 0, 0, 0, 0, 0, 0, 0); -} - } // namespace EWK2UnitTest diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h index 2ebb95093..e1146b198 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h @@ -40,20 +40,14 @@ protected: virtual void SetUp(); virtual void TearDown(); - static const double defaultTimeoutSeconds = 10.0; + void loadUrlSync(const char* url); - bool loadUrlSync(const char* url, double timeoutSeconds = defaultTimeoutSeconds); + static const double defaultTimeoutSeconds = 10.0; bool waitUntilLoadFinished(double timeoutSeconds = defaultTimeoutSeconds); bool waitUntilTitleChangedTo(const char* expectedTitle, double timeoutSeconds = defaultTimeoutSeconds); - bool waitUntilURLChangedTo(const char* expectedURL, double timeoutSeconds = defaultTimeoutSeconds); + bool waitUntilURIChangedTo(const char* expectedURI, double timeoutSeconds = defaultTimeoutSeconds); void mouseClick(int x, int y); - void mouseDown(int x, int y); - void mouseUp(int x, int y); - void mouseMove(int x, int y); - void multiDown(int id, int x, int y); - void multiUp(int id, int x, int y); - void multiMove(int id, int x, int y); private: Evas_Object* m_webView; diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp index f9e0f7b73..0b7977f54 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp @@ -26,9 +26,10 @@ namespace EWK2UnitTest { -EWK2UnitTestEnvironment::EWK2UnitTestEnvironment() +EWK2UnitTestEnvironment::EWK2UnitTestEnvironment(bool useX11Window) : m_defaultWidth(800) , m_defaultHeight(600) + , m_useX11Window(useX11Window) { } diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h index 8b401b56a..4255b01b4 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h @@ -27,8 +27,9 @@ namespace EWK2UnitTest { class EWK2UnitTestEnvironment : public ::testing::Environment { public: - EWK2UnitTestEnvironment(); + EWK2UnitTestEnvironment(bool useX11Window); + bool useX11Window() const { return m_useX11Window; } const char* defaultTestPageUrl() const; const char* defaultTheme() const; const char* injectedBundleSample() const; @@ -41,6 +42,8 @@ public: private: unsigned int m_defaultWidth; unsigned int m_defaultHeight; + + bool m_useX11Window; }; } // namespace EWK2UnitTest diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestMain.cpp b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestMain.cpp index 778d261e8..06e9c069a 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestMain.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestMain.cpp @@ -26,11 +26,27 @@ using namespace EWK2UnitTest; EWK2UnitTestEnvironment* environment = 0; +static bool parseArguments(int argc, char** argv) +{ + int useX11Window = 0; + + static const option options[] = { + {"useX11Window", no_argument, &useX11Window, 1}, + {0, 0, 0, 0} + }; + + while (getopt_long(argc, argv, "", options, 0) != -1) { } + + return useX11Window; +} + int main(int argc, char** argv) { + bool useX11Window = parseArguments(argc, argv); + ::testing::InitGoogleTest(&argc, argv); - environment = new EWK2UnitTestEnvironment(); + environment = new EWK2UnitTestEnvironment(useX11Window); testing::AddGlobalTestEnvironment(environment); return RUN_ALL_TESTS(); diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestServer.cpp b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestServer.cpp index 4ef4cf76f..52e6af46e 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestServer.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestServer.cpp @@ -27,14 +27,14 @@ EWK2UnitTestServer::EWK2UnitTestServer() soup_address_resolve_sync(address, 0); m_soupServer = soup_server_new(SOUP_SERVER_INTERFACE, address, static_cast<char*>(0)); - m_baseURL = soup_uri_new("http://127.0.0.1/"); - soup_uri_set_port(m_baseURL, soup_server_get_port(m_soupServer)); + m_baseURI = soup_uri_new("http://127.0.0.1/"); + soup_uri_set_port(m_baseURI, soup_server_get_port(m_soupServer)); g_object_unref(address); } EWK2UnitTestServer::~EWK2UnitTestServer() { - soup_uri_free(m_baseURL); + soup_uri_free(m_baseURI); g_object_unref(m_soupServer); } @@ -44,13 +44,13 @@ void EWK2UnitTestServer::run(SoupServerCallback serverCallback) soup_server_add_handler(m_soupServer, 0, serverCallback, 0, 0); } -CString EWK2UnitTestServer::getURLForPath(const char* path) const +CString EWK2UnitTestServer::getURIForPath(const char* path) const { - SoupURI* soupURL = soup_uri_new_with_base(m_baseURL, path); - char* url = soup_uri_to_string(soupURL, false); - CString urlString = url; - free(url); - soup_uri_free(soupURL); + SoupURI* soupURI = soup_uri_new_with_base(m_baseURI, path); + char* uri = soup_uri_to_string(soupURI, false); + CString uriString = uri; + free(uri); + soup_uri_free(soupURI); - return urlString; + return uriString; } diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestServer.h b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestServer.h index b967ce409..3eb146f06 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestServer.h +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestServer.h @@ -29,12 +29,14 @@ public: EWK2UnitTestServer(); virtual ~EWK2UnitTestServer(); - CString getURLForPath(const char* path) const; + SoupURI* baseURI() const { return m_baseURI; } + + CString getURIForPath(const char* path) const; void run(SoupServerCallback); private: SoupServer* m_soupServer; - SoupURI* m_baseURL; + SoupURI* m_baseURI; }; #endif // EWK2UnitTestServer_h diff --git a/Source/WebKit2/UIProcess/API/efl/tests/resources/frame_flattening_test.html b/Source/WebKit2/UIProcess/API/efl/tests/resources/frame_flattening_test.html deleted file mode 100644 index 6367992bb..000000000 --- a/Source/WebKit2/UIProcess/API/efl/tests/resources/frame_flattening_test.html +++ /dev/null @@ -1,4 +0,0 @@ -<!doctype html> -<body onload="document.title=document.getElementById('test').offsetWidth;"> -<iframe id="test" src="./frame_flattening_test_subframe.html" width="200" frameborder="0"></iframe> -</body> diff --git a/Source/WebKit2/UIProcess/API/efl/tests/resources/frame_flattening_test_subframe.html b/Source/WebKit2/UIProcess/API/efl/tests/resources/frame_flattening_test_subframe.html deleted file mode 100644 index 56ef7c9bd..000000000 --- a/Source/WebKit2/UIProcess/API/efl/tests/resources/frame_flattening_test_subframe.html +++ /dev/null @@ -1,11 +0,0 @@ -<!doctype html> -<head> -<style> -body { -width:600px; -margin:0px; -padding:0px; -} -</style> -</head> -<body></body> diff --git a/Source/WebKit2/UIProcess/API/efl/tests/resources/local_file_access.html b/Source/WebKit2/UIProcess/API/efl/tests/resources/local_file_access.html deleted file mode 100644 index a71fbf976..000000000 --- a/Source/WebKit2/UIProcess/API/efl/tests/resources/local_file_access.html +++ /dev/null @@ -1,31 +0,0 @@ -<html> -<head> -<script> -function checkFrameLoaded() -{ - var myframe = document.getElementById('myframe'); - var testWindow = myframe.contentWindow; - var state = null; - try { - var state = testWindow.document.readyState; - if (state == "complete") { - document.title = "Frame loaded"; - return; - } - } catch(e) {} - document.title = "Frame NOT loaded"; -} - -function loadFrame() -{ - var myframe = document.getElementById('myframe'); - myframe.src = "default_test_page.html"; - - setTimeout("checkFrameLoaded()", 300); -} -</script> -</head> -<body onload="loadFrame()"> -<iframe id="myframe"></iframe> -</body> -</html> diff --git a/Source/WebKit2/UIProcess/API/efl/tests/resources/redirect_url_to_default.html b/Source/WebKit2/UIProcess/API/efl/tests/resources/redirect_uri_to_default.html index 846fd1113..846fd1113 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/resources/redirect_url_to_default.html +++ b/Source/WebKit2/UIProcess/API/efl/tests/resources/redirect_uri_to_default.html diff --git a/Source/WebKit2/UIProcess/API/efl/tests/resources/window_move_resize.html b/Source/WebKit2/UIProcess/API/efl/tests/resources/window_move_resize.html deleted file mode 100644 index 693ac2ef2..000000000 --- a/Source/WebKit2/UIProcess/API/efl/tests/resources/window_move_resize.html +++ /dev/null @@ -1,15 +0,0 @@ -<html> -<head> -<title>Window move and resize test</title> -<script> -function test() -{ - window.resizeTo(200, 100); - window.moveTo(150, 200); - document.title = "Moved and resized"; -} -</script> -</head> -<body onload="test()"> -</body> -</html> 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..9542b76f0 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 @@ -61,19 +61,19 @@ static void serverCallbackNavigation(SoupServer* server, SoupMessage* message, c soup_message_body_complete(message->response_body); } -static inline void checkItem(Ewk_Back_Forward_List_Item* item, const char* title, const char* url, const char* originalURL) +static inline void checkItem(Ewk_Back_Forward_List_Item* item, const char* title, const char* uri, const char* originalURI) { ASSERT_TRUE(item); - EXPECT_STREQ(url, ewk_back_forward_list_item_url_get(item)); + EXPECT_STREQ(uri, ewk_back_forward_list_item_uri_get(item)); EXPECT_STREQ(title, ewk_back_forward_list_item_title_get(item)); - EXPECT_STREQ(originalURL, ewk_back_forward_list_item_original_url_get(item)); + EXPECT_STREQ(originalURI, ewk_back_forward_list_item_original_uri_get(item)); } static inline WKEinaSharedString urlFromTitle(EWK2UnitTestServer* httpServer, const char* title) { Eina_Strbuf* path = eina_strbuf_new(); eina_strbuf_append_printf(path, "/%s", title); - WKEinaSharedString res = httpServer->getURLForPath(eina_strbuf_string_get(path)).data(); + WKEinaSharedString res = httpServer->getURIForPath(eina_strbuf_string_get(path)).data(); eina_strbuf_free(path); return res; @@ -89,7 +89,7 @@ static inline void freeEinaList(Eina_List* list) TEST_F(EWK2UnitTestBase, ewk_back_forward_list_current_item_get) { const char* url = environment->defaultTestPageUrl(); - ASSERT_TRUE(loadUrlSync(url)); + loadUrlSync(url); Ewk_Back_Forward_List* backForwardList = ewk_view_back_forward_list_get(webView()); ASSERT_TRUE(backForwardList); @@ -106,11 +106,11 @@ TEST_F(EWK2UnitTestBase, ewk_back_forward_list_previous_item_get) httpServer->run(serverCallbackNavigation); WKEinaSharedString url1 = urlFromTitle(httpServer.get(), title1); - ASSERT_TRUE(loadUrlSync(url1)); - ASSERT_STREQ(title1, ewk_view_title_get(webView())); + loadUrlSync(url1); + ASSERT_STREQ(ewk_view_title_get(webView()), title1); - ASSERT_TRUE(loadUrlSync(urlFromTitle(httpServer.get(), title2))); - ASSERT_STREQ(title2, ewk_view_title_get(webView())); + loadUrlSync(urlFromTitle(httpServer.get(), title2)); + ASSERT_STREQ(ewk_view_title_get(webView()), title2); Ewk_Back_Forward_List* backForwardList = ewk_view_back_forward_list_get(webView()); ASSERT_TRUE(backForwardList); @@ -127,12 +127,12 @@ TEST_F(EWK2UnitTestBase, ewk_back_forward_list_next_item_get) OwnPtr<EWK2UnitTestServer> httpServer = adoptPtr(new EWK2UnitTestServer); httpServer->run(serverCallbackNavigation); - ASSERT_TRUE(loadUrlSync(urlFromTitle(httpServer.get(), title1))); - ASSERT_STREQ(title1, ewk_view_title_get(webView())); + loadUrlSync(urlFromTitle(httpServer.get(), title1)); + ASSERT_STREQ(ewk_view_title_get(webView()), title1); WKEinaSharedString url2 = urlFromTitle(httpServer.get(), title2); - ASSERT_TRUE(loadUrlSync(url2)); - ASSERT_STREQ(title2, ewk_view_title_get(webView())); + loadUrlSync(url2); + ASSERT_STREQ(ewk_view_title_get(webView()), title2); // Go back to Page1. ewk_view_back(webView()); @@ -154,11 +154,11 @@ TEST_F(EWK2UnitTestBase, ewk_back_forward_list_item_at_index_get) httpServer->run(serverCallbackNavigation); WKEinaSharedString url1 = urlFromTitle(httpServer.get(), title1); - ASSERT_TRUE(loadUrlSync(url1)); - ASSERT_STREQ(title1, ewk_view_title_get(webView())); + loadUrlSync(url1); + ASSERT_STREQ(ewk_view_title_get(webView()), title1); - ASSERT_TRUE(loadUrlSync(urlFromTitle(httpServer.get(), title2))); - ASSERT_STREQ(title2, ewk_view_title_get(webView())); + loadUrlSync(urlFromTitle(httpServer.get(), title2)); + ASSERT_STREQ(ewk_view_title_get(webView()), title2); Ewk_Back_Forward_List* backForwardList = ewk_view_back_forward_list_get(webView()); ASSERT_TRUE(backForwardList); @@ -178,16 +178,16 @@ TEST_F(EWK2UnitTestBase, ewk_back_forward_list_count) OwnPtr<EWK2UnitTestServer> httpServer = adoptPtr(new EWK2UnitTestServer); httpServer->run(serverCallbackNavigation); - ASSERT_TRUE(loadUrlSync(urlFromTitle(httpServer.get(), title1))); - ASSERT_STREQ(title1, ewk_view_title_get(webView())); + loadUrlSync(urlFromTitle(httpServer.get(), title1)); + ASSERT_STREQ(ewk_view_title_get(webView()), title1); - ASSERT_TRUE(loadUrlSync(urlFromTitle(httpServer.get(), title2))); - ASSERT_STREQ(title2, ewk_view_title_get(webView())); + loadUrlSync(urlFromTitle(httpServer.get(), title2)); + ASSERT_STREQ(ewk_view_title_get(webView()), title2); Ewk_Back_Forward_List* backForwardList = ewk_view_back_forward_list_get(webView()); ASSERT_TRUE(backForwardList); - EXPECT_EQ(2, ewk_back_forward_list_count(backForwardList)); + EXPECT_EQ(ewk_back_forward_list_count(backForwardList), 2); } TEST_F(EWK2UnitTestBase, ewk_back_forward_list_n_back_items_copy) @@ -196,22 +196,22 @@ TEST_F(EWK2UnitTestBase, ewk_back_forward_list_n_back_items_copy) httpServer->run(serverCallbackNavigation); WKEinaSharedString url1 = urlFromTitle(httpServer.get(), title1); - ASSERT_TRUE(loadUrlSync(url1)); - ASSERT_STREQ(title1, ewk_view_title_get(webView())); + loadUrlSync(url1); + ASSERT_STREQ(ewk_view_title_get(webView()), title1); WKEinaSharedString url2 = urlFromTitle(httpServer.get(), title2); - ASSERT_TRUE(loadUrlSync(url2)); - ASSERT_STREQ(title2, ewk_view_title_get(webView())); + loadUrlSync(url2); + ASSERT_STREQ(ewk_view_title_get(webView()), title2); - ASSERT_TRUE(loadUrlSync(urlFromTitle(httpServer.get(), title3))); - ASSERT_STREQ(title3, ewk_view_title_get(webView())); + loadUrlSync(urlFromTitle(httpServer.get(), title3)); + ASSERT_STREQ(ewk_view_title_get(webView()), title3); Ewk_Back_Forward_List* backForwardList = ewk_view_back_forward_list_get(webView()); ASSERT_TRUE(backForwardList); Eina_List* backList = ewk_back_forward_list_n_back_items_copy(backForwardList, 1); ASSERT_TRUE(backList); - ASSERT_EQ(1, eina_list_count(backList)); + ASSERT_EQ(eina_list_count(backList), 1); checkItem(static_cast<Ewk_Back_Forward_List_Item*>(eina_list_nth(backList, 0)), title2, url2, url2); freeEinaList(backList); @@ -221,7 +221,7 @@ TEST_F(EWK2UnitTestBase, ewk_back_forward_list_n_back_items_copy) backList = ewk_back_forward_list_n_back_items_copy(backForwardList, -1); ASSERT_TRUE(backList); - ASSERT_EQ(2, eina_list_count(backList)); + ASSERT_EQ(eina_list_count(backList), 2); checkItem(static_cast<Ewk_Back_Forward_List_Item*>(eina_list_nth(backList, 0)), title1, url1, url1); checkItem(static_cast<Ewk_Back_Forward_List_Item*>(eina_list_nth(backList, 1)), title2, url2, url2); freeEinaList(backList); @@ -232,16 +232,16 @@ TEST_F(EWK2UnitTestBase, ewk_back_forward_list_n_forward_items_copy) OwnPtr<EWK2UnitTestServer> httpServer = adoptPtr(new EWK2UnitTestServer); httpServer->run(serverCallbackNavigation); - ASSERT_TRUE(loadUrlSync(urlFromTitle(httpServer.get(), title1))); - ASSERT_STREQ(title1, ewk_view_title_get(webView())); + loadUrlSync(urlFromTitle(httpServer.get(), title1)); + ASSERT_STREQ(ewk_view_title_get(webView()), title1); WKEinaSharedString url2 = urlFromTitle(httpServer.get(), title2); - ASSERT_TRUE(loadUrlSync(url2)); - ASSERT_STREQ(title2, ewk_view_title_get(webView())); + loadUrlSync(url2); + ASSERT_STREQ(ewk_view_title_get(webView()), title2); WKEinaSharedString url3 = urlFromTitle(httpServer.get(), title3); - ASSERT_TRUE(loadUrlSync(url3)); - ASSERT_STREQ(title3, ewk_view_title_get(webView())); + loadUrlSync(url3); + ASSERT_STREQ(ewk_view_title_get(webView()), title3); // Go back to Page1. ewk_view_back(webView()); @@ -254,7 +254,7 @@ TEST_F(EWK2UnitTestBase, ewk_back_forward_list_n_forward_items_copy) Eina_List* forwardList = ewk_back_forward_list_n_forward_items_copy(backForwardList, 1); ASSERT_TRUE(forwardList); - ASSERT_EQ(1, eina_list_count(forwardList)); + ASSERT_EQ(eina_list_count(forwardList), 1); checkItem(static_cast<Ewk_Back_Forward_List_Item*>(eina_list_nth(forwardList, 0)), title2, url2, url2); freeEinaList(forwardList); @@ -264,7 +264,7 @@ TEST_F(EWK2UnitTestBase, ewk_back_forward_list_n_forward_items_copy) forwardList = ewk_back_forward_list_n_forward_items_copy(backForwardList, -1); ASSERT_TRUE(forwardList); - ASSERT_EQ(2, eina_list_count(forwardList)); + ASSERT_EQ(eina_list_count(forwardList), 2); checkItem(static_cast<Ewk_Back_Forward_List_Item*>(eina_list_nth(forwardList, 0)), title2, url2, url2); checkItem(static_cast<Ewk_Back_Forward_List_Item*>(eina_list_nth(forwardList, 1)), title3, url3, url3); freeEinaList(forwardList); 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 dff485348..82ded55da 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp @@ -56,19 +56,19 @@ TEST_F(EWK2UnitTestBase, ewk_context_cookie_manager_get) static void schemeRequestCallback(Ewk_Url_Scheme_Request* request, void* userData) { const char* scheme = ewk_url_scheme_request_scheme_get(request); - ASSERT_STREQ("fooscheme", scheme); + ASSERT_STREQ(scheme, "fooscheme"); const char* url = ewk_url_scheme_request_url_get(request); - ASSERT_STREQ("fooscheme:MyPath", url); + ASSERT_STREQ(url, "fooscheme:MyPath"); const char* path = ewk_url_scheme_request_path_get(request); - ASSERT_STREQ("MyPath", path); + ASSERT_STREQ(path, "MyPath"); ASSERT_TRUE(ewk_url_scheme_request_finish(request, htmlReply, strlen(htmlReply), "text/html")); } -TEST_F(EWK2UnitTestBase, ewk_context_url_scheme_register) +TEST_F(EWK2UnitTestBase, ewk_context_uri_scheme_register) { - ewk_context_url_scheme_register(ewk_view_context_get(webView()), "fooscheme", schemeRequestCallback, 0); - ASSERT_TRUE(loadUrlSync("fooscheme:MyPath")); - ASSERT_STREQ("Foo", ewk_view_title_get(webView())); + ewk_context_uri_scheme_register(ewk_view_context_get(webView()), "fooscheme", schemeRequestCallback, 0); + loadUrlSync("fooscheme:MyPath"); + ASSERT_STREQ(ewk_view_title_get(webView()), "Foo"); } struct VibrationCbData { @@ -128,7 +128,7 @@ TEST_F(EWK2UnitTestBase, ewk_context_vibration_client_callbacks_set) // This case the pattern will cause the device to vibrate for 200 ms, be still for 100 ms, and then vibrate for 5000 ms. loadVibrationHTMLString(webView(), "[200, 100, 5000]", true, &data); - ASSERT_EQ(2, data.vibrateCalledCount); + ASSERT_EQ(data.vibrateCalledCount, 2); ASSERT_TRUE(data.didReceiveVibrateCallback); // Cancel outstanding vibration pattern. @@ -141,13 +141,13 @@ TEST_F(EWK2UnitTestBase, ewk_context_vibration_client_callbacks_set) // Make sure we don't receive vibration event. loadVibrationHTMLString(webView(), "[5000]", false, &data); ASSERT_TRUE(waitUntilTitleChangedTo("Loaded")); - ASSERT_STREQ("Loaded", ewk_view_title_get(webView())); + ASSERT_STREQ(ewk_view_title_get(webView()), "Loaded"); ASSERT_FALSE(data.didReceiveVibrateCallback); // Make sure we don't receive cancel vibration event. loadVibrationHTMLString(webView(), "0", false, &data); ASSERT_TRUE(waitUntilTitleChangedTo("Loaded")); - ASSERT_STREQ("Loaded", ewk_view_title_get(webView())); + ASSERT_STREQ(ewk_view_title_get(webView()), "Loaded"); ASSERT_FALSE(data.didReceiveCancelVibrationCallback); } diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context_history_callbacks.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context_history_callbacks.cpp deleted file mode 100644 index f60a16c2f..000000000 --- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context_history_callbacks.cpp +++ /dev/null @@ -1,183 +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 "UnitTestUtils/EWK2UnitTestBase.h" -#include "UnitTestUtils/EWK2UnitTestEnvironment.h" -#include "UnitTestUtils/EWK2UnitTestServer.h" -#include <EWebKit2.h> -#include <Ecore.h> -#include <gtest/gtest.h> - -using namespace EWK2UnitTest; - -extern EWK2UnitTestEnvironment* environment; - -static const char defaultTitle[] = "Default Testing Web Page"; - -static const char toBeRedirectedPath[] = "/some_page_to_be_redirected"; -static const char redirectionTargetPath[] = "/redirection_target"; - -static EWK2UnitTestServer* httpServer() -{ - static EWK2UnitTestServer* server = 0; - - if (!server) - server = new EWK2UnitTestServer; - - return server; -} - -#define DECLARE_INVOKE_FLAG(functionName) \ - static bool functionName##Invoked = false; - -#define WAS_INVOKED(functionName) \ - if (functionName##Invoked) \ - return; \ - functionName##Invoked = true - -#define CHECK_WAS_INVOKED(functionName) \ - ASSERT_TRUE(functionName##Invoked) - -DECLARE_INVOKE_FLAG(navigateWithNavigationData) -DECLARE_INVOKE_FLAG(performClientRedirect) -DECLARE_INVOKE_FLAG(performServerRedirect) -DECLARE_INVOKE_FLAG(updateHistoryTitle) -DECLARE_INVOKE_FLAG(populateVisitedLinks) - -static void navigateWithNavigationData(const Evas_Object* view, Ewk_Navigation_Data* navigationData, void* userData) -{ - WAS_INVOKED(navigateWithNavigationData); - - EWK2UnitTestBase* unitTest = static_cast<EWK2UnitTestBase*>(userData); - ASSERT_TRUE(unitTest); - ASSERT_EQ(unitTest->webView(), view); - // FIXME: WebFrameLoaderClient sends empty title. - // ASSERT_STREQ(defaultTitle, ewk_navigation_data_title_get(navigationData)); - ASSERT_STREQ(environment->defaultTestPageUrl(), ewk_navigation_data_url_get(navigationData)); - - Ewk_Url_Request* request = ewk_navigation_data_original_request_get(navigationData); - ASSERT_STREQ("GET", ewk_url_request_http_method_get(request)); - ASSERT_STREQ(environment->defaultTestPageUrl(), ewk_url_request_url_get(request)); - ASSERT_EQ(0, ewk_request_cookies_first_party_get(request)); -} - -static void performClientRedirect(const Evas_Object* view, const char* sourceUrl, const char* destinationUrl, void* userData) -{ - WAS_INVOKED(performClientRedirect); - - EWK2UnitTestBase* unitTest = static_cast<EWK2UnitTestBase*>(userData); - ASSERT_TRUE(unitTest); - ASSERT_EQ(unitTest->webView(), view); - ASSERT_STREQ(environment->urlForResource("redirect_url_to_default.html").data(), sourceUrl); - ASSERT_STREQ(environment->defaultTestPageUrl(), destinationUrl); -} - -static void performServerRedirect(const Evas_Object* view, const char* sourceUrl, const char* destinationUrl, void* userData) -{ - WAS_INVOKED(performServerRedirect); - - EWK2UnitTestBase* unitTest = static_cast<EWK2UnitTestBase*>(userData); - ASSERT_TRUE(unitTest); - ASSERT_EQ(unitTest->webView(), view); - ASSERT_STREQ(httpServer()->getURLForPath(toBeRedirectedPath).data(), sourceUrl); - ASSERT_STREQ(httpServer()->getURLForPath(redirectionTargetPath).data(), destinationUrl); -} - -static void updateHistoryTitle(const Evas_Object* view, const char* title, const char* url, void* userData) -{ - WAS_INVOKED(updateHistoryTitle); - - EWK2UnitTestBase* unitTest = static_cast<EWK2UnitTestBase*>(userData); - ASSERT_TRUE(unitTest); - ASSERT_EQ(unitTest->webView(), view); - ASSERT_STREQ(defaultTitle, title); - ASSERT_STREQ(environment->defaultTestPageUrl(), url); -} - -static void populateVisitedLinks(void* userData) -{ - WAS_INVOKED(populateVisitedLinks); - - EWK2UnitTestBase* unitTest = static_cast<EWK2UnitTestBase*>(userData); - ASSERT_TRUE(unitTest); -} - -static void onLoadFinishedForRedirection(void* userData, Evas_Object*, void*) -{ - int* countLoadFinished = static_cast<int*>(userData); - --(*countLoadFinished); -} - -static void serverCallbackRedirection(SoupServer*, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer) -{ - if (message->method != SOUP_METHOD_GET) { - soup_message_set_status(message, SOUP_STATUS_NOT_IMPLEMENTED); - return; - } - - if (strcmp(path, redirectionTargetPath)) { // Redirect if 'path' is not equal to 'redirectionTargetPath'. - soup_message_set_status(message, SOUP_STATUS_TEMPORARY_REDIRECT); - soup_message_headers_append(message->response_headers, "Location", httpServer()->getURLForPath(redirectionTargetPath).data()); - return; - } - - soup_message_set_status(message, SOUP_STATUS_OK); - Eina_Strbuf* body = eina_strbuf_new(); - eina_strbuf_append_printf(body, "<html><title>Redirection Target</title></html>"); - const size_t bodyLength = eina_strbuf_length_get(body); - soup_message_body_append(message->response_body, SOUP_MEMORY_TAKE, eina_strbuf_string_steal(body), bodyLength); - eina_strbuf_free(body); - - soup_message_body_complete(message->response_body); -} - -TEST_F(EWK2UnitTestBase, ewk_context_history_callbacks_set) -{ - ewk_context_history_callbacks_set(ewk_view_context_get(webView()), navigateWithNavigationData, performClientRedirect, performServerRedirect, updateHistoryTitle, populateVisitedLinks, this); - - // Test navigation. - ASSERT_TRUE(loadUrlSync(environment->defaultTestPageUrl())); - CHECK_WAS_INVOKED(navigateWithNavigationData); - CHECK_WAS_INVOKED(updateHistoryTitle); - CHECK_WAS_INVOKED(populateVisitedLinks); - - // Test client redirect. - int countLoadFinished = 2; - evas_object_smart_callback_add(webView(), "load,finished", onLoadFinishedForRedirection, &countLoadFinished); - ewk_view_url_set(webView(), environment->urlForResource("redirect_url_to_default.html").data()); - while (countLoadFinished) - ecore_main_loop_iterate(); - evas_object_smart_callback_del(webView(), "load,finished", onLoadFinishedForRedirection); - CHECK_WAS_INVOKED(performClientRedirect); - - // Test server redirect. - httpServer()->run(serverCallbackRedirection); - - ASSERT_TRUE(loadUrlSync(httpServer()->getURLForPath(toBeRedirectedPath).data())); - CHECK_WAS_INVOKED(performServerRedirect); -} - diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp index 598b15519..4353ced79 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp @@ -65,7 +65,7 @@ static void serverCallback(SoupServer* server, SoupMessage* message, const char* soup_message_body_complete(message->response_body); } -static void getAcceptPolicyCallback(Ewk_Cookie_Accept_Policy policy, Ewk_Error* error, void* event_info) +static void getAcceptPolicyCallback(Ewk_Cookie_Accept_Policy policy, Ewk_Web_Error* error, void* event_info) { ASSERT_FALSE(error); Ewk_Cookie_Accept_Policy* ret = static_cast<Ewk_Cookie_Accept_Policy*>(event_info); @@ -81,7 +81,7 @@ static Ewk_Cookie_Accept_Policy getAcceptPolicy(Ewk_Cookie_Manager* manager) return policy; } -static void getHostnamesWithCookiesCallback(Eina_List* hostnames, Ewk_Error* error, void* event_info) +static void getHostnamesWithCookiesCallback(Eina_List* hostnames, Ewk_Web_Error* error, void* event_info) { ASSERT_FALSE(error); @@ -116,11 +116,6 @@ static int countHostnamesWithCookies(Ewk_Cookie_Manager* manager) return count; } -static int compareHostNames(const void* hostName1, const void* hostName2) -{ - return strcmp(static_cast<const char*>(hostName1), static_cast<const char*>(hostName2)); -} - TEST_F(EWK2UnitTestBase, ewk_cookie_manager_accept_policy) { OwnPtr<EWK2UnitTestServer> httpServer = adoptPtr(new EWK2UnitTestServer); @@ -130,33 +125,32 @@ TEST_F(EWK2UnitTestBase, ewk_cookie_manager_accept_policy) ASSERT_TRUE(cookieManager); // Default policy is EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY. - ASSERT_EQ(EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY, getAcceptPolicy(cookieManager)); - ASSERT_TRUE(loadUrlSync(httpServer->getURLForPath("/index.html").data())); + ASSERT_EQ(getAcceptPolicy(cookieManager), EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY); + loadUrlSync(httpServer->getURIForPath("/index.html").data()); Eina_List* hostnames = getHostnamesWithCookies(cookieManager); - ASSERT_EQ(1, eina_list_count(hostnames)); - ASSERT_STREQ(FIRST_PARTY_DOMAIN, static_cast<char*>(eina_list_nth(hostnames, 0))); + ASSERT_EQ(eina_list_count(hostnames), 1); + ASSERT_STREQ(static_cast<char*>(eina_list_nth(hostnames, 0)), FIRST_PARTY_DOMAIN); freeHostNames(hostnames); ewk_cookie_manager_cookies_clear(cookieManager); // Change policy to EWK_COOKIE_ACCEPT_POLICY_ALWAYS ewk_cookie_manager_accept_policy_set(cookieManager, EWK_COOKIE_ACCEPT_POLICY_ALWAYS); - ASSERT_EQ(EWK_COOKIE_ACCEPT_POLICY_ALWAYS, getAcceptPolicy(cookieManager)); - ASSERT_TRUE(loadUrlSync(httpServer->getURLForPath("/index.html").data())); + ASSERT_EQ(getAcceptPolicy(cookieManager), EWK_COOKIE_ACCEPT_POLICY_ALWAYS); + loadUrlSync(httpServer->getURIForPath("/index.html").data()); hostnames = getHostnamesWithCookies(cookieManager); - ASSERT_EQ(2, eina_list_count(hostnames)); - hostnames = eina_list_sort(hostnames, eina_list_count(hostnames), compareHostNames); - ASSERT_STREQ(FIRST_PARTY_DOMAIN, static_cast<char*>(eina_list_nth(hostnames, 0))); - ASSERT_STREQ(THIRD_PARTY_DOMAIN, static_cast<char*>(eina_list_nth(hostnames, 1))); + ASSERT_EQ(eina_list_count(hostnames), 2); + ASSERT_STREQ(static_cast<char*>(eina_list_nth(hostnames, 0)), FIRST_PARTY_DOMAIN); + ASSERT_STREQ(static_cast<char*>(eina_list_nth(hostnames, 1)), THIRD_PARTY_DOMAIN); freeHostNames(hostnames); ewk_cookie_manager_cookies_clear(cookieManager); // Change policy to EWK_COOKIE_ACCEPT_POLICY_NEVER ewk_cookie_manager_accept_policy_set(cookieManager, EWK_COOKIE_ACCEPT_POLICY_NEVER); - ASSERT_EQ(EWK_COOKIE_ACCEPT_POLICY_NEVER, getAcceptPolicy(cookieManager)); - ASSERT_TRUE(loadUrlSync(httpServer->getURLForPath("/index.html").data())); - ASSERT_EQ(0, countHostnamesWithCookies(cookieManager)); + ASSERT_EQ(getAcceptPolicy(cookieManager), EWK_COOKIE_ACCEPT_POLICY_NEVER); + loadUrlSync(httpServer->getURIForPath("/index.html").data()); + ASSERT_EQ(countHostnamesWithCookies(cookieManager), 0); } void onCookiesChanged(void *eventInfo) @@ -174,14 +168,14 @@ TEST_F(EWK2UnitTestBase, ewk_cookie_manager_changes_watch) ASSERT_TRUE(cookieManager); ewk_cookie_manager_accept_policy_set(cookieManager, EWK_COOKIE_ACCEPT_POLICY_ALWAYS); - ASSERT_EQ(EWK_COOKIE_ACCEPT_POLICY_ALWAYS, getAcceptPolicy(cookieManager)); + ASSERT_EQ(getAcceptPolicy(cookieManager), EWK_COOKIE_ACCEPT_POLICY_ALWAYS); // Watch for changes bool cookiesChanged = false; ewk_cookie_manager_changes_watch(cookieManager, onCookiesChanged, &cookiesChanged); // Check for cookie changes notifications - ASSERT_TRUE(loadUrlSync(httpServer->getURLForPath("/index.html").data())); + loadUrlSync(httpServer->getURIForPath("/index.html").data()); while (!cookiesChanged) ecore_main_loop_iterate(); @@ -196,8 +190,8 @@ TEST_F(EWK2UnitTestBase, ewk_cookie_manager_changes_watch) // Stop watching for notifications ewk_cookie_manager_changes_watch(cookieManager, 0, 0); cookiesChanged = false; - ASSERT_TRUE(loadUrlSync(httpServer->getURLForPath("/index.html").data())); - ASSERT_EQ(2, countHostnamesWithCookies(cookieManager)); + loadUrlSync(httpServer->getURIForPath("/index.html").data()); + ASSERT_EQ(countHostnamesWithCookies(cookieManager), 2); ASSERT_FALSE(cookiesChanged); // Watch again for notifications @@ -210,15 +204,15 @@ TEST_F(EWK2UnitTestBase, ewk_cookie_manager_changes_watch) ASSERT_TRUE(mktemp(textStorage2)); ewk_cookie_manager_persistent_storage_set(cookieManager, textStorage1, EWK_COOKIE_PERSISTENT_STORAGE_TEXT); - ASSERT_TRUE(loadUrlSync(httpServer->getURLForPath("/index.html").data())); - ASSERT_EQ(2, countHostnamesWithCookies(cookieManager)); + loadUrlSync(httpServer->getURIForPath("/index.html").data()); + ASSERT_EQ(countHostnamesWithCookies(cookieManager), 2); cookiesChanged = false; ewk_cookie_manager_persistent_storage_set(cookieManager, textStorage2, EWK_COOKIE_PERSISTENT_STORAGE_TEXT); - ASSERT_EQ(0, countHostnamesWithCookies(cookieManager)); + ASSERT_EQ(countHostnamesWithCookies(cookieManager), 0); ewk_cookie_manager_persistent_storage_set(cookieManager, textStorage1, EWK_COOKIE_PERSISTENT_STORAGE_TEXT); - ASSERT_EQ(2, countHostnamesWithCookies(cookieManager)); + ASSERT_EQ(countHostnamesWithCookies(cookieManager), 2); ASSERT_FALSE(cookiesChanged); @@ -237,31 +231,31 @@ TEST_F(EWK2UnitTestBase, ewk_cookie_manager_cookies_delete) ASSERT_TRUE(cookieManager); ewk_cookie_manager_accept_policy_set(cookieManager, EWK_COOKIE_ACCEPT_POLICY_ALWAYS); - ASSERT_EQ(EWK_COOKIE_ACCEPT_POLICY_ALWAYS, getAcceptPolicy(cookieManager)); + ASSERT_EQ(getAcceptPolicy(cookieManager), EWK_COOKIE_ACCEPT_POLICY_ALWAYS); - ASSERT_TRUE(loadUrlSync(httpServer->getURLForPath("/index.html").data())); + loadUrlSync(httpServer->getURIForPath("/index.html").data()); Eina_List* hostnames = getHostnamesWithCookies(cookieManager); - ASSERT_EQ(2, eina_list_count(hostnames)); + ASSERT_EQ(eina_list_count(hostnames), 2); freeHostNames(hostnames); // Delete first party cookie ewk_cookie_manager_hostname_cookies_clear(cookieManager, FIRST_PARTY_DOMAIN); hostnames = getHostnamesWithCookies(cookieManager); - ASSERT_EQ(1, eina_list_count(hostnames)); - ASSERT_STREQ(THIRD_PARTY_DOMAIN, static_cast<char*>(eina_list_nth(hostnames, 0))); + ASSERT_EQ(eina_list_count(hostnames), 1); + ASSERT_STREQ(static_cast<char*>(eina_list_nth(hostnames, 0)), THIRD_PARTY_DOMAIN); freeHostNames(hostnames); // Delete third party cookie ewk_cookie_manager_hostname_cookies_clear(cookieManager, THIRD_PARTY_DOMAIN); - ASSERT_EQ(0, countHostnamesWithCookies(cookieManager)); + ASSERT_EQ(countHostnamesWithCookies(cookieManager), 0); // Get all cookies again - ASSERT_TRUE(loadUrlSync(httpServer->getURLForPath("/index.html").data())); - ASSERT_EQ(2, countHostnamesWithCookies(cookieManager)); + loadUrlSync(httpServer->getURIForPath("/index.html").data()); + ASSERT_EQ(countHostnamesWithCookies(cookieManager), 2); // Clear all cookies ewk_cookie_manager_cookies_clear(cookieManager); - ASSERT_EQ(0, countHostnamesWithCookies(cookieManager)); + ASSERT_EQ(countHostnamesWithCookies(cookieManager), 0); } TEST_F(EWK2UnitTestBase, DISABLED_ewk_cookie_manager_permanent_storage) @@ -279,33 +273,33 @@ TEST_F(EWK2UnitTestBase, DISABLED_ewk_cookie_manager_permanent_storage) ASSERT_TRUE(cookieManager); ewk_cookie_manager_accept_policy_set(cookieManager, EWK_COOKIE_ACCEPT_POLICY_ALWAYS); - ASSERT_EQ(EWK_COOKIE_ACCEPT_POLICY_ALWAYS, getAcceptPolicy(cookieManager)); + ASSERT_EQ(getAcceptPolicy(cookieManager), EWK_COOKIE_ACCEPT_POLICY_ALWAYS); // Text storage using a new file. ewk_cookie_manager_persistent_storage_set(cookieManager, textStorage, EWK_COOKIE_PERSISTENT_STORAGE_TEXT); - ASSERT_EQ(0, countHostnamesWithCookies(cookieManager)); + ASSERT_EQ(countHostnamesWithCookies(cookieManager), 0); - ASSERT_TRUE(loadUrlSync(httpServer->getURLForPath("/index.html").data())); - ASSERT_EQ(2, countHostnamesWithCookies(cookieManager)); + loadUrlSync(httpServer->getURIForPath("/index.html").data()); + ASSERT_EQ(countHostnamesWithCookies(cookieManager), 2); // SQLite storage using a new file. ewk_cookie_manager_persistent_storage_set(cookieManager, sqliteStorage, EWK_COOKIE_PERSISTENT_STORAGE_SQLITE); - ASSERT_EQ(0, countHostnamesWithCookies(cookieManager)); + ASSERT_EQ(countHostnamesWithCookies(cookieManager), 0); - ASSERT_TRUE(loadUrlSync(httpServer->getURLForPath("/index.html").data())); - ASSERT_EQ(2, countHostnamesWithCookies(cookieManager)); + loadUrlSync(httpServer->getURIForPath("/index.html").data()); + ASSERT_EQ(countHostnamesWithCookies(cookieManager), 2); // Text storage using an existing file. ewk_cookie_manager_persistent_storage_set(cookieManager, textStorage, EWK_COOKIE_PERSISTENT_STORAGE_TEXT); - ASSERT_EQ(2, countHostnamesWithCookies(cookieManager)); + ASSERT_EQ(countHostnamesWithCookies(cookieManager), 2); ewk_cookie_manager_cookies_clear(cookieManager); - ASSERT_EQ(0, countHostnamesWithCookies(cookieManager)); + ASSERT_EQ(countHostnamesWithCookies(cookieManager), 0); // SQLite storage with an existing file. ewk_cookie_manager_persistent_storage_set(cookieManager, sqliteStorage, EWK_COOKIE_PERSISTENT_STORAGE_SQLITE); - ASSERT_EQ(2, countHostnamesWithCookies(cookieManager)); + ASSERT_EQ(countHostnamesWithCookies(cookieManager), 2); ewk_cookie_manager_cookies_clear(cookieManager); - ASSERT_EQ(0, countHostnamesWithCookies(cookieManager)); + ASSERT_EQ(countHostnamesWithCookies(cookieManager), 0); // Final clean up. unlink(textStorage); diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_download_job.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_download_job.cpp index 1494926e2..22c97aad8 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_download_job.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_download_job.cpp @@ -102,23 +102,23 @@ static void on_download_requested(void* userData, Evas_Object* webview, void* ev { DownloadTestData* testData = static_cast<DownloadTestData*>(userData); Ewk_Download_Job* download = static_cast<Ewk_Download_Job*>(eventInfo); - ASSERT_EQ(EWK_DOWNLOAD_JOB_STATE_NOT_STARTED, ewk_download_job_state_get(download)); - ASSERT_EQ(0, ewk_download_job_estimated_progress_get(download)); - ASSERT_EQ(0, ewk_download_job_elapsed_time_get(download)); + ASSERT_EQ(ewk_download_job_state_get(download), EWK_DOWNLOAD_JOB_STATE_NOT_STARTED); + ASSERT_EQ(ewk_download_job_estimated_progress_get(download), 0); + ASSERT_EQ(ewk_download_job_elapsed_time_get(download), 0); Ewk_Url_Request* request = ewk_download_job_request_get(download); ASSERT_TRUE(request); - EXPECT_STREQ(testData->fileUrl, ewk_url_request_url_get(request)); + EXPECT_STREQ(ewk_url_request_url_get(request), testData->fileUrl); Ewk_Url_Response* response = ewk_download_job_response_get(download); ASSERT_TRUE(response); - EXPECT_STREQ("application/pdf", ewk_url_response_mime_type_get(response)); + EXPECT_STREQ(ewk_url_response_mime_type_get(response), "application/pdf"); - EXPECT_STREQ(serverSuggestedFilename, ewk_download_job_suggested_filename_get(download)); + EXPECT_STREQ(ewk_download_job_suggested_filename_get(download), serverSuggestedFilename); ASSERT_FALSE(fileExists(testData->destinationPath)); ewk_download_job_destination_set(download, testData->destinationPath); - EXPECT_STREQ(testData->destinationPath, ewk_download_job_destination_get(download)); + EXPECT_STREQ(ewk_download_job_destination_get(download), testData->destinationPath); } static void on_download_cancelled(void* userData, Evas_Object* webview, void* eventInfo) @@ -131,7 +131,7 @@ static void on_download_cancelled(void* userData, Evas_Object* webview, void* ev static void on_download_failed(void* userData, Evas_Object* webview, void* eventInfo) { Ewk_Download_Job_Error* downloadError = static_cast<Ewk_Download_Job_Error*>(eventInfo); - fprintf(stderr, "Download error: %s\n", ewk_error_description_get(downloadError->error)); + fprintf(stderr, "Download error: %s\n", ewk_web_error_description_get(downloadError->error)); ecore_main_loop_quit(); FAIL(); } @@ -141,8 +141,8 @@ static void on_download_finished(void* userData, Evas_Object* webview, void* eve DownloadTestData* testData = static_cast<DownloadTestData*>(userData); Ewk_Download_Job* download = static_cast<Ewk_Download_Job*>(eventInfo); - ASSERT_EQ(1, ewk_download_job_estimated_progress_get(download)); - ASSERT_EQ(EWK_DOWNLOAD_JOB_STATE_FINISHED, ewk_download_job_state_get(download)); + ASSERT_EQ(ewk_download_job_estimated_progress_get(download), 1); + ASSERT_EQ(ewk_download_job_state_get(download), EWK_DOWNLOAD_JOB_STATE_FINISHED); ASSERT_GT(ewk_download_job_elapsed_time_get(download), 0); ASSERT_TRUE(fileExists(testData->destinationPath)); @@ -159,7 +159,7 @@ TEST_F(EWK2UnitTestBase, ewk_download) char destinationPath[] = "/tmp/pdf-file.XXXXXX"; ASSERT_TRUE(mktemp(destinationPath)); - CString fileUrl = httpServer->getURLForPath(testFilePath); + CString fileUrl = httpServer->getURIForPath(testFilePath); DownloadTestData userData = { fileUrl.data(), destinationPath }; ASSERT_FALSE(fileExists(destinationPath)); @@ -170,7 +170,7 @@ TEST_F(EWK2UnitTestBase, ewk_download) evas_object_smart_callback_add(webView(), "download,finished", on_download_finished, &userData); // Download test pdf - ewk_view_url_set(webView(), fileUrl.data()); + ewk_view_uri_set(webView(), fileUrl.data()); ecore_main_loop_begin(); // Clean up diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp index 4b46cd883..be8b0ffa8 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp @@ -43,18 +43,18 @@ static void onIntentServiceRegistration(void* userData, Evas_Object*, void* even Ewk_Intent_Service* service = static_cast<Ewk_Intent_Service*>(eventInfo); ASSERT_TRUE(service); - EXPECT_STREQ("action", ewk_intent_service_action_get(service)); - EXPECT_STREQ("type", ewk_intent_service_type_get(service)); - EXPECT_STREQ("Title", ewk_intent_service_title_get(service)); - EXPECT_STREQ("http://example.com/service", ewk_intent_service_href_get(service)); - EXPECT_STREQ("inline", ewk_intent_service_disposition_get(service)); + EXPECT_STREQ(ewk_intent_service_action_get(service), "action"); + EXPECT_STREQ(ewk_intent_service_type_get(service), "type"); + EXPECT_STREQ(ewk_intent_service_title_get(service), "Title"); + EXPECT_STREQ(ewk_intent_service_href_get(service), "http://example.com/service"); + EXPECT_STREQ(ewk_intent_service_disposition_get(service), "inline"); } TEST_F(EWK2UnitTestBase, ewk_intent_service_registration) { bool intentRegistered = false; evas_object_smart_callback_add(webView(), "intent,service,register", onIntentServiceRegistration, &intentRegistered); - ASSERT_TRUE(loadUrlSync(environment->urlForResource("intent-service.html").data())); + loadUrlSync(environment->urlForResource("intent-service.html").data()); evas_object_smart_callback_del(webView(), "intent,service,register", onIntentServiceRegistration); ASSERT_TRUE(intentRegistered); } @@ -76,22 +76,22 @@ static void onIntentReceived(void* userData, Evas_Object*, void* eventInfo) if (*intentReceivedCount == 1) { // First intent. - EXPECT_STREQ("action1", ewk_intent_action_get(intent)); - EXPECT_STREQ("mime/type1", ewk_intent_type_get(intent)); - EXPECT_STREQ("http://service1.com/", ewk_intent_service_get(intent)); - EXPECT_STREQ("value1", ewk_intent_extra_get(intent, "key1")); - EXPECT_STREQ("value2", ewk_intent_extra_get(intent, "key2")); + EXPECT_STREQ(ewk_intent_action_get(intent), "action1"); + EXPECT_STREQ(ewk_intent_type_get(intent), "mime/type1"); + EXPECT_STREQ(ewk_intent_service_get(intent), "http://service1.com/"); + EXPECT_STREQ(ewk_intent_extra_get(intent, "key1"), "value1"); + EXPECT_STREQ(ewk_intent_extra_get(intent, "key2"), "value2"); } else { // Second intent. - EXPECT_STREQ("action2", ewk_intent_action_get(intent)); - EXPECT_STREQ("mime/type2", ewk_intent_type_get(intent)); + EXPECT_STREQ(ewk_intent_action_get(intent), "action2"); + EXPECT_STREQ(ewk_intent_type_get(intent), "mime/type2"); Eina_List* suggestions = ewk_intent_suggestions_get(intent); ASSERT_TRUE(suggestions); - ASSERT_EQ(2, eina_list_count(suggestions)); + ASSERT_EQ(eina_list_count(suggestions), 2); // We need to sort the suggestions since Intent is using a HashSet internally. suggestions = eina_list_sort(suggestions, 2, stringSortCb); - EXPECT_STREQ("http://service1.com/", static_cast<const char*>(eina_list_nth(suggestions, 0))); - EXPECT_STREQ("http://service2.com/", static_cast<const char*>(eina_list_nth(suggestions, 1))); + EXPECT_STREQ(static_cast<const char*>(eina_list_nth(suggestions, 0)), "http://service1.com/"); + EXPECT_STREQ(static_cast<const char*>(eina_list_nth(suggestions, 1)), "http://service2.com/"); void* listData = 0; EINA_LIST_FREE(suggestions, listData) @@ -103,18 +103,18 @@ TEST_F(EWK2UnitTestBase, ewk_intent_request) { unsigned intentReceivedCount = 0; evas_object_smart_callback_add(webView(), "intent,request,new", onIntentReceived, &intentReceivedCount); - ASSERT_TRUE(loadUrlSync(environment->urlForResource("intent-request.html").data())); + loadUrlSync(environment->urlForResource("intent-request.html").data()); // A user gesture is required for the intent to start. mouseClick(5, 5); while (intentReceivedCount != 1) ecore_main_loop_iterate(); - ASSERT_EQ(1, intentReceivedCount); + ASSERT_EQ(intentReceivedCount, 1); // Generate a second intent request. mouseClick(5, 5); while (intentReceivedCount != 2) ecore_main_loop_iterate(); - ASSERT_EQ(2, intentReceivedCount); + ASSERT_EQ(intentReceivedCount, 2); evas_object_smart_callback_del(webView(), "intent,request,new", onIntentReceived); } diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_refptr_evas_object.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_refptr_evas_object.cpp index 939d20c6d..fb6e57269 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_refptr_evas_object.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_refptr_evas_object.cpp @@ -65,14 +65,14 @@ TEST_F(EWK2UnitTestBase, reffing) RefPtr<Evas_Object> object = adoptRef(evas_object_box_add(canvas())); ASSERT_TRUE(object); // Evas_Objec external ref count is not as you would expect. - ASSERT_EQ(0, evas_object_ref_get(object.get())); + ASSERT_EQ(evas_object_ref_get(object.get()), 0); { RefPtr<Evas_Object> aRef = object; ASSERT_TRUE(object); ASSERT_TRUE(aRef); - ASSERT_EQ(1, evas_object_ref_get(object.get())); - ASSERT_EQ(1, evas_object_ref_get(aRef.get())); + ASSERT_EQ(evas_object_ref_get(object.get()), 1); + ASSERT_EQ(evas_object_ref_get(aRef.get()), 1); { RefPtr<Evas_Object> bRef = object; @@ -81,51 +81,51 @@ TEST_F(EWK2UnitTestBase, reffing) ASSERT_TRUE(aRef); ASSERT_TRUE(bRef); - ASSERT_EQ(2, evas_object_ref_get(object.get())); - ASSERT_EQ(2, evas_object_ref_get(aRef.get())); + ASSERT_EQ(evas_object_ref_get(object.get()), 2); + ASSERT_EQ(evas_object_ref_get(aRef.get()), 2); RefPtr<Evas_Object> cRef = bRef; ASSERT_TRUE(cRef); - ASSERT_EQ(3, evas_object_ref_get(object.get())); - ASSERT_EQ(3, evas_object_ref_get(aRef.get())); - ASSERT_EQ(3, evas_object_ref_get(bRef.get())); - ASSERT_EQ(3, evas_object_ref_get(cRef.get())); + ASSERT_EQ(evas_object_ref_get(object.get()), 3); + ASSERT_EQ(evas_object_ref_get(aRef.get()), 3); + ASSERT_EQ(evas_object_ref_get(bRef.get()), 3); + ASSERT_EQ(evas_object_ref_get(cRef.get()), 3); bRef.clear(); - ASSERT_EQ(2, evas_object_ref_get(object.get())); - ASSERT_EQ(2, evas_object_ref_get(aRef.get())); - ASSERT_EQ(2, evas_object_ref_get(cRef.get())); + ASSERT_EQ(evas_object_ref_get(object.get()), 2); + ASSERT_EQ(evas_object_ref_get(aRef.get()), 2); + ASSERT_EQ(evas_object_ref_get(cRef.get()), 2); } - ASSERT_EQ(1, evas_object_ref_get(object.get())); - ASSERT_EQ(1, evas_object_ref_get(aRef.get())); + ASSERT_EQ(evas_object_ref_get(object.get()), 1); + ASSERT_EQ(evas_object_ref_get(aRef.get()), 1); } - ASSERT_EQ(0, evas_object_ref_get(object.get())); + ASSERT_EQ(evas_object_ref_get(object.get()), 0); } TEST_F(EWK2UnitTestBase, destruction) { RefPtr<Evas_Object> object = adoptRef(evas_object_box_add(canvas())); ASSERT_TRUE(object); - ASSERT_EQ(0, evas_object_ref_get(object.get())); + ASSERT_EQ(evas_object_ref_get(object.get()), 0); RefPtr<Evas_Object> aRef = object; ASSERT_TRUE(object); ASSERT_TRUE(aRef); - ASSERT_EQ(1, evas_object_ref_get(object.get())); - ASSERT_EQ(1, evas_object_ref_get(aRef.get())); + ASSERT_EQ(evas_object_ref_get(object.get()), 1); + ASSERT_EQ(evas_object_ref_get(aRef.get()), 1); object = nullptr; - ASSERT_EQ(0, evas_object_ref_get(object.get())); - ASSERT_EQ(0, evas_object_ref_get(aRef.get())); + ASSERT_EQ(evas_object_ref_get(object.get()), 0); + ASSERT_EQ(evas_object_ref_get(aRef.get()), 0); object = aRef; - ASSERT_EQ(1, evas_object_ref_get(object.get())); - ASSERT_EQ(1, evas_object_ref_get(aRef.get())); + ASSERT_EQ(evas_object_ref_get(object.get()), 1); + ASSERT_EQ(evas_object_ref_get(aRef.get()), 1); object = 0; - ASSERT_EQ(0, evas_object_ref_get(object.get())); - ASSERT_EQ(0, evas_object_ref_get(aRef.get())); + ASSERT_EQ(evas_object_ref_get(object.get()), 0); + ASSERT_EQ(evas_object_ref_get(aRef.get()), 0); aRef.clear(); ASSERT_FALSE(aRef); 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..9889bbae7 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_settings.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_settings.cpp @@ -26,14 +26,11 @@ #include "config.h" #include "UnitTestUtils/EWK2UnitTestBase.h" -#include "UnitTestUtils/EWK2UnitTestEnvironment.h" #include <EWebKit2.h> #include <Eina.h> using namespace EWK2UnitTest; -extern EWK2UnitTestEnvironment* environment; - TEST_F(EWK2UnitTestBase, ewk_settings_fullscreen_enabled) { Ewk_Settings* settings = ewk_view_settings_get(webView()); @@ -98,62 +95,3 @@ TEST_F(EWK2UnitTestBase, ewk_settings_developer_extras_enabled) ASSERT_TRUE(ewk_settings_developer_extras_enabled_set(settings, EINA_FALSE)); ASSERT_FALSE(ewk_settings_developer_extras_enabled_get(settings)); } - -TEST_F(EWK2UnitTestBase, ewk_settings_file_access_from_file_urls_allowed) -{ - CString testURL = environment->urlForResource("local_file_access.html"); - Ewk_Settings* settings = ewk_view_settings_get(webView()); - - ASSERT_FALSE(ewk_settings_file_access_from_file_urls_allowed_get(settings)); - - ASSERT_TRUE(ewk_settings_file_access_from_file_urls_allowed_set(settings, true)); - ASSERT_TRUE(ewk_settings_file_access_from_file_urls_allowed_get(settings)); - - // Check that file access from file:// URLs is allowed. - ewk_view_url_set(webView(), testURL.data()); - ASSERT_TRUE(waitUntilTitleChangedTo("Frame loaded")); - - ASSERT_TRUE(ewk_settings_file_access_from_file_urls_allowed_set(settings, false)); - ASSERT_FALSE(ewk_settings_file_access_from_file_urls_allowed_get(settings)); - - // Check that file access from file:// URLs is NOT allowed. - ewk_view_url_set(webView(), testURL.data()); - ASSERT_TRUE(waitUntilTitleChangedTo("Frame NOT loaded")); -} - -TEST_F(EWK2UnitTestBase, ewk_settings_frame_flattening_enabled_set) -{ - Ewk_Settings* settings = ewk_view_settings_get(webView()); - ASSERT_TRUE(settings); - - // The frame flattening is disabled by default. - ASSERT_FALSE(ewk_settings_frame_flattening_enabled_get(settings)); - ewk_view_url_set(webView(), environment->urlForResource("frame_flattening_test.html").data()); - waitUntilTitleChangedTo("200"); // width of iframe tag. - ASSERT_STREQ("200", ewk_view_title_get(webView())); - - ASSERT_TRUE(ewk_settings_frame_flattening_enabled_set(settings, true)); - ASSERT_TRUE(ewk_settings_frame_flattening_enabled_get(settings)); - ewk_view_url_set(webView(), environment->urlForResource("frame_flattening_test.html").data()); - waitUntilTitleChangedTo("600"); // width of frame_flattening_test_subframe.html - ASSERT_STREQ("600", ewk_view_title_get(webView())); - - ASSERT_TRUE(ewk_settings_frame_flattening_enabled_set(settings, false)); - ASSERT_FALSE(ewk_settings_frame_flattening_enabled_get(settings)); - ewk_view_url_set(webView(), environment->urlForResource("frame_flattening_test.html").data()); - waitUntilTitleChangedTo("200"); // width of iframe tag. - ASSERT_STREQ("200", ewk_view_title_get(webView())); -} - -TEST_F(EWK2UnitTestBase, ewk_settings_dns_prefetching_enabled) -{ - Ewk_Settings* settings = ewk_view_settings_get(webView()); - - // DNS prefeching is disabled by default. - ASSERT_FALSE(ewk_settings_dns_prefetching_enabled_get(settings)); - ASSERT_TRUE(ewk_settings_dns_prefetching_enabled_set(settings, true)); - ASSERT_TRUE(ewk_settings_dns_prefetching_enabled_get(settings)); - - ASSERT_TRUE(ewk_settings_dns_prefetching_enabled_set(settings, false)); - ASSERT_FALSE(ewk_settings_dns_prefetching_enabled_get(settings)); -} 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 0ab0c912e..73f3ac749 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp @@ -44,42 +44,42 @@ static void onLoadFinishedForRedirection(void* userData, Evas_Object*, void*) (*countLoadFinished)--; } -TEST_F(EWK2UnitTestBase, ewk_view_url_get) +TEST_F(EWK2UnitTestBase, ewk_view_uri_get) { - ASSERT_TRUE(loadUrlSync(environment->defaultTestPageUrl())); - EXPECT_STREQ(environment->defaultTestPageUrl(), ewk_view_url_get(webView())); + loadUrlSync(environment->defaultTestPageUrl()); + EXPECT_STREQ(ewk_view_uri_get(webView()), environment->defaultTestPageUrl()); int countLoadFinished = 2; evas_object_smart_callback_add(webView(), "load,finished", onLoadFinishedForRedirection, &countLoadFinished); - ewk_view_url_set(webView(), environment->urlForResource("redirect_url_to_default.html").data()); + ewk_view_uri_set(webView(), environment->urlForResource("redirect_uri_to_default.html").data()); while (countLoadFinished) ecore_main_loop_iterate(); evas_object_smart_callback_del(webView(), "load,finished", onLoadFinishedForRedirection); - EXPECT_STREQ(environment->defaultTestPageUrl(), ewk_view_url_get(webView())); + EXPECT_STREQ(ewk_view_uri_get(webView()), environment->defaultTestPageUrl()); } TEST_F(EWK2UnitTestBase, ewk_view_device_pixel_ratio) { - ASSERT_TRUE(loadUrlSync(environment->defaultTestPageUrl())); + loadUrlSync(environment->defaultTestPageUrl()); // Default pixel ratio is 1.0 - ASSERT_FLOAT_EQ(1, ewk_view_device_pixel_ratio_get(webView())); + ASSERT_FLOAT_EQ(ewk_view_device_pixel_ratio_get(webView()), 1); ASSERT_TRUE(ewk_view_device_pixel_ratio_set(webView(), 1.2)); - ASSERT_FLOAT_EQ(1.2, ewk_view_device_pixel_ratio_get(webView())); + ASSERT_FLOAT_EQ(ewk_view_device_pixel_ratio_get(webView()), 1.2); ASSERT_TRUE(ewk_view_device_pixel_ratio_set(webView(), 1)); - ASSERT_FLOAT_EQ(1, ewk_view_device_pixel_ratio_get(webView())); + ASSERT_FLOAT_EQ(ewk_view_device_pixel_ratio_get(webView()), 1); } TEST_F(EWK2UnitTestBase, ewk_view_html_string_load) { ewk_view_html_string_load(webView(), "<html><head><title>Foo</title></head><body>Bar</body></html>", 0, 0); ASSERT_TRUE(waitUntilTitleChangedTo("Foo")); - ASSERT_STREQ("Foo", ewk_view_title_get(webView())); + ASSERT_STREQ(ewk_view_title_get(webView()), "Foo"); ewk_view_html_string_load(webView(), "<html><head><title>Bar</title></head><body>Foo</body></html>", 0, 0); ASSERT_TRUE(waitUntilTitleChangedTo("Bar")); - ASSERT_STREQ("Bar", ewk_view_title_get(webView())); + ASSERT_STREQ(ewk_view_title_get(webView()), "Bar"); } static void serverCallbackNavigation(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer) @@ -106,28 +106,28 @@ TEST_F(EWK2UnitTestBase, ewk_view_navigation) httpServer->run(serverCallbackNavigation); // Visit Page1 - ASSERT_TRUE(loadUrlSync(httpServer->getURLForPath("/Page1").data())); - ASSERT_STREQ("Page1", ewk_view_title_get(webView())); + loadUrlSync(httpServer->getURIForPath("/Page1").data()); + ASSERT_STREQ(ewk_view_title_get(webView()), "Page1"); ASSERT_FALSE(ewk_view_back_possible(webView())); ASSERT_FALSE(ewk_view_forward_possible(webView())); // Visit Page2 - ASSERT_TRUE(loadUrlSync(httpServer->getURLForPath("/Page2").data())); - ASSERT_STREQ("Page2", ewk_view_title_get(webView())); + loadUrlSync(httpServer->getURIForPath("/Page2").data()); + ASSERT_STREQ(ewk_view_title_get(webView()), "Page2"); ASSERT_TRUE(ewk_view_back_possible(webView())); ASSERT_FALSE(ewk_view_forward_possible(webView())); // Go back to Page1 ewk_view_back(webView()); ASSERT_TRUE(waitUntilTitleChangedTo("Page1")); - ASSERT_STREQ("Page1", ewk_view_title_get(webView())); + ASSERT_STREQ(ewk_view_title_get(webView()), "Page1"); ASSERT_FALSE(ewk_view_back_possible(webView())); ASSERT_TRUE(ewk_view_forward_possible(webView())); // Go forward to Page2 ewk_view_forward(webView()); ASSERT_TRUE(waitUntilTitleChangedTo("Page2")); - ASSERT_STREQ("Page2", ewk_view_title_get(webView())); + ASSERT_STREQ(ewk_view_title_get(webView()), "Page2"); ASSERT_TRUE(ewk_view_back_possible(webView())); ASSERT_FALSE(ewk_view_forward_possible(webView())); } @@ -136,7 +136,7 @@ TEST_F(EWK2UnitTestBase, ewk_view_setting_encoding_custom) { ASSERT_FALSE(ewk_view_setting_encoding_custom_get(webView())); ASSERT_TRUE(ewk_view_setting_encoding_custom_set(webView(), "UTF-8")); - ASSERT_STREQ("UTF-8", ewk_view_setting_encoding_custom_get(webView())); + ASSERT_STREQ(ewk_view_setting_encoding_custom_get(webView()), "UTF-8"); // Set the default charset. ASSERT_TRUE(ewk_view_setting_encoding_custom_set(webView(), 0)); ASSERT_FALSE(ewk_view_setting_encoding_custom_get(webView())); @@ -151,19 +151,19 @@ static void onFormAboutToBeSubmitted(void* userData, Evas_Object*, void* eventIn Eina_List* fieldNames = ewk_form_submission_request_field_names_get(request); ASSERT_TRUE(fieldNames); - ASSERT_EQ(3, eina_list_count(fieldNames)); + ASSERT_EQ(eina_list_count(fieldNames), 3); void* data; EINA_LIST_FREE(fieldNames, data) eina_stringshare_del(static_cast<char*>(data)); const char* value1 = ewk_form_submission_request_field_value_get(request, "text1"); - ASSERT_STREQ("value1", value1); + ASSERT_STREQ(value1, "value1"); eina_stringshare_del(value1); const char* value2 = ewk_form_submission_request_field_value_get(request, "text2"); - ASSERT_STREQ("value2", value2); + ASSERT_STREQ(value2, "value2"); eina_stringshare_del(value2); const char* password = ewk_form_submission_request_field_value_get(request, "password"); - ASSERT_STREQ("secret", password); + ASSERT_STREQ(password, "secret"); eina_stringshare_del(password); *handled = true; @@ -195,9 +195,9 @@ TEST_F(EWK2UnitTestBase, ewk_view_form_submission_request) 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)); + EXPECT_EQ(ewk_popup_menu_item_type_get(item), EWK_POPUP_MENU_ITEM); + EXPECT_STREQ(ewk_popup_menu_item_text_get(item), title); + EXPECT_EQ(ewk_popup_menu_item_enabled_get(item), enabled); } static Eina_Bool selectItemAfterDelayed(void* data) @@ -208,25 +208,25 @@ static Eina_Bool selectItemAfterDelayed(void* data) static Eina_Bool showPopupMenu(Ewk_View_Smart_Data* smartData, Eina_Rectangle, Ewk_Text_Direction, double, Eina_List* list, int selectedIndex) { - EXPECT_EQ(2, selectedIndex); + EXPECT_EQ(selectedIndex, 2); 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_EQ(ewk_popup_menu_item_text_direction_get(item), EWK_TEXT_DIRECTION_LEFT_TO_RIGHT); + 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)); + EXPECT_EQ(ewk_popup_menu_item_enabled_get(item), false); 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_EQ(ewk_popup_menu_item_text_direction_get(item), EWK_TEXT_DIRECTION_RIGHT_TO_LEFT); + EXPECT_STREQ(ewk_popup_menu_item_tooltip_get(item), "tooltip"); + EXPECT_STREQ(ewk_popup_menu_item_accessibility_text_get(item), "aria"); EXPECT_TRUE(ewk_popup_menu_item_selected_get(item)); item = static_cast<Ewk_Popup_Menu_Item*>(eina_list_nth(list, 3)); @@ -237,8 +237,8 @@ static Eina_Bool showPopupMenu(Ewk_View_Smart_Data* smartData, Eina_Rectangle, E 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)); + EXPECT_EQ(ewk_popup_menu_item_type_get(item), EWK_POPUP_MENU_UNKNOWN); + EXPECT_STREQ(ewk_popup_menu_item_text_get(item), 0); ecore_timer_add(0, selectItemAfterDelayed, smartData->self); return true; @@ -310,6 +310,18 @@ static Eina_Bool fullScreenCallback(Ewk_View_Smart_Data* smartData) return false; } +static void checkFullScreenProperty(Evas_Object* webView, bool expectedState) +{ + if (environment->useX11Window()) { + Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(webView)); + Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(smartData->base.evas); + bool windowState = false; + while (((windowState = ecore_evas_fullscreen_get(ecoreEvas)) != expectedState)) + ecore_main_loop_iterate(); + ASSERT_TRUE(expectedState == windowState); + } +} + TEST_F(EWK2UnitTestBase, ewk_view_full_screen_enter) { const char fullscreenHTML[] = @@ -327,6 +339,7 @@ TEST_F(EWK2UnitTestBase, ewk_view_full_screen_enter) mouseClick(50, 50); ASSERT_TRUE(waitUntilTitleChangedTo("fullscreen entered")); ASSERT_TRUE(fullScreenCallbackCalled); + checkFullScreenProperty(webView(), true); } TEST_F(EWK2UnitTestBase, ewk_view_full_screen_exit) @@ -347,17 +360,18 @@ TEST_F(EWK2UnitTestBase, ewk_view_full_screen_exit) mouseClick(50, 50); ASSERT_TRUE(waitUntilTitleChangedTo("fullscreen exited")); ASSERT_TRUE(fullScreenCallbackCalled); + checkFullScreenProperty(webView(), false); } TEST_F(EWK2UnitTestBase, ewk_view_same_page_navigation) { - // Tests that same page navigation updates the page URL. + // Tests that same page navigation updates the page URI. String testUrl = environment->urlForResource("same_page_navigation.html").data(); - ASSERT_TRUE(loadUrlSync(testUrl.utf8().data())); - ASSERT_STREQ(testUrl.utf8().data(), ewk_view_url_get(webView())); + loadUrlSync(testUrl.utf8().data()); + ASSERT_STREQ(testUrl.utf8().data(), ewk_view_uri_get(webView())); mouseClick(50, 50); testUrl = testUrl + '#'; - ASSERT_TRUE(waitUntilURLChangedTo(testUrl.utf8().data())); + ASSERT_TRUE(waitUntilURIChangedTo(testUrl.utf8().data())); } TEST_F(EWK2UnitTestBase, ewk_view_title_changed) @@ -367,21 +381,21 @@ TEST_F(EWK2UnitTestBase, ewk_view_title_changed) "<body onload=\"document.title='Title after changed';\"></body>"; ewk_view_html_string_load(webView(), titleChangedHTML, 0, 0); EXPECT_TRUE(waitUntilTitleChangedTo("Title after changed")); - EXPECT_STREQ("Title after changed", ewk_view_title_get(webView())); + EXPECT_STREQ(ewk_view_title_get(webView()), "Title after changed"); titleChangedHTML = "<!doctype html><head><title>Title before changed</title></head>" "<body onload=\"document.title='';\"></body>"; ewk_view_html_string_load(webView(), titleChangedHTML, 0, 0); EXPECT_TRUE(waitUntilTitleChangedTo("")); - EXPECT_STREQ("", ewk_view_title_get(webView())); + EXPECT_STREQ(ewk_view_title_get(webView()), ""); titleChangedHTML = "<!doctype html><head><title>Title before changed</title></head>" "<body onload=\"document.title=null;\"></body>"; ewk_view_html_string_load(webView(), titleChangedHTML, 0, 0); EXPECT_TRUE(waitUntilTitleChangedTo("")); - EXPECT_STREQ("", ewk_view_title_get(webView())); + EXPECT_STREQ(ewk_view_title_get(webView()), ""); } static struct { @@ -417,35 +431,35 @@ TEST_F(EWK2UnitTestBase, ewk_view_run_javascript_alert) alertCallbackData.called = false; ewk_view_html_string_load(webView(), alertHTML, 0, 0); EXPECT_TRUE(waitUntilLoadFinished()); - EXPECT_TRUE(alertCallbackData.called); + EXPECT_EQ(alertCallbackData.called, true); alertHTML = "<!doctype html><body onload=\"alert('');\"></body>"; alertCallbackData.expectedMessage = ""; alertCallbackData.called = false; ewk_view_html_string_load(webView(), alertHTML, 0, 0); EXPECT_TRUE(waitUntilLoadFinished()); - EXPECT_TRUE(alertCallbackData.called); + EXPECT_EQ(alertCallbackData.called, true); alertHTML = "<!doctype html><body onload=\"alert(null);\"></body>"; alertCallbackData.expectedMessage = "null"; alertCallbackData.called = false; ewk_view_html_string_load(webView(), alertHTML, 0, 0); EXPECT_TRUE(waitUntilLoadFinished()); - EXPECT_TRUE(alertCallbackData.called); + EXPECT_EQ(alertCallbackData.called, true); alertHTML = "<!doctype html><body onload=\"alert();\"></body>"; alertCallbackData.expectedMessage = "undefined"; alertCallbackData.called = false; ewk_view_html_string_load(webView(), alertHTML, 0, 0); EXPECT_TRUE(waitUntilLoadFinished()); - EXPECT_TRUE(alertCallbackData.called); + EXPECT_EQ(alertCallbackData.called, true); ewkViewClass()->run_javascript_alert = 0; alertCallbackData.called = false; ewk_view_html_string_load(webView(), alertHTML, 0, 0); EXPECT_TRUE(waitUntilLoadFinished()); - EXPECT_FALSE(alertCallbackData.called); + EXPECT_EQ(alertCallbackData.called, false); } static Eina_Bool checkConfirm(Ewk_View_Smart_Data*, const char* message) @@ -465,16 +479,16 @@ TEST_F(EWK2UnitTestBase, ewk_view_run_javascript_confirm) confirmCallbackData.called = false; ewk_view_html_string_load(webView(), confirmHTML, 0, 0); EXPECT_TRUE(waitUntilTitleChangedTo("true")); - EXPECT_STREQ("true", ewk_view_title_get(webView())); - EXPECT_TRUE(confirmCallbackData.called); + EXPECT_STREQ(ewk_view_title_get(webView()), "true"); + EXPECT_EQ(confirmCallbackData.called, true); confirmCallbackData.expectedMessage = "Confirm message"; confirmCallbackData.result = false; confirmCallbackData.called = false; ewk_view_html_string_load(webView(), confirmHTML, 0, 0); EXPECT_TRUE(waitUntilTitleChangedTo("false")); - EXPECT_STREQ("false", ewk_view_title_get(webView())); - EXPECT_TRUE(confirmCallbackData.called); + EXPECT_STREQ(ewk_view_title_get(webView()), "false"); + EXPECT_EQ(confirmCallbackData.called, true); confirmHTML = "<!doctype html><body onload=\"document.title = confirm('');\"></body>"; confirmCallbackData.expectedMessage = ""; @@ -482,8 +496,8 @@ TEST_F(EWK2UnitTestBase, ewk_view_run_javascript_confirm) confirmCallbackData.called = false; ewk_view_html_string_load(webView(), confirmHTML, 0, 0); EXPECT_TRUE(waitUntilTitleChangedTo("true")); - EXPECT_STREQ("true", ewk_view_title_get(webView())); - EXPECT_TRUE(confirmCallbackData.called); + EXPECT_STREQ(ewk_view_title_get(webView()), "true"); + EXPECT_EQ(confirmCallbackData.called, true); confirmHTML = "<!doctype html><body onload=\"document.title = confirm(null);\"></body>"; confirmCallbackData.expectedMessage = "null"; @@ -491,8 +505,8 @@ TEST_F(EWK2UnitTestBase, ewk_view_run_javascript_confirm) confirmCallbackData.called = false; ewk_view_html_string_load(webView(), confirmHTML, 0, 0); EXPECT_TRUE(waitUntilTitleChangedTo("true")); - EXPECT_STREQ("true", ewk_view_title_get(webView())); - EXPECT_TRUE(confirmCallbackData.called); + EXPECT_STREQ(ewk_view_title_get(webView()), "true"); + EXPECT_EQ(confirmCallbackData.called, true); confirmHTML = "<!doctype html><body onload=\"document.title = confirm();\"></body>"; confirmCallbackData.expectedMessage = "undefined"; @@ -500,16 +514,16 @@ TEST_F(EWK2UnitTestBase, ewk_view_run_javascript_confirm) confirmCallbackData.called = false; ewk_view_html_string_load(webView(), confirmHTML, 0, 0); EXPECT_TRUE(waitUntilTitleChangedTo("true")); - EXPECT_STREQ("true", ewk_view_title_get(webView())); - EXPECT_TRUE(confirmCallbackData.called); + EXPECT_STREQ(ewk_view_title_get(webView()), "true"); + EXPECT_EQ(confirmCallbackData.called, true); ewkViewClass()->run_javascript_confirm = 0; confirmCallbackData.called = false; ewk_view_html_string_load(webView(), confirmHTML, 0, 0); EXPECT_TRUE(waitUntilTitleChangedTo("false")); - EXPECT_STREQ("false", ewk_view_title_get(webView())); - EXPECT_FALSE(confirmCallbackData.called); + EXPECT_STREQ(ewk_view_title_get(webView()), "false"); + EXPECT_EQ(confirmCallbackData.called, false); } static const char* checkPrompt(Ewk_View_Smart_Data*, const char* message, const char* defaultValue) @@ -538,8 +552,8 @@ TEST_F(EWK2UnitTestBase, ewk_view_run_javascript_prompt) promptCallbackData.called = false; ewk_view_html_string_load(webView(), promptHTML, 0, 0); EXPECT_TRUE(waitUntilTitleChangedTo(promptResult)); - EXPECT_STREQ(promptResult, ewk_view_title_get(webView())); - EXPECT_TRUE(promptCallbackData.called); + EXPECT_STREQ(ewk_view_title_get(webView()), promptResult); + EXPECT_EQ(promptCallbackData.called, true); promptHTML = "<!doctype html><body onload=\"document.title = prompt('Prompt message', '');\"></body>"; promptCallbackData.expectedMessage = promptMessage; @@ -548,8 +562,8 @@ TEST_F(EWK2UnitTestBase, ewk_view_run_javascript_prompt) promptCallbackData.called = false; ewk_view_html_string_load(webView(), promptHTML, 0, 0); EXPECT_TRUE(waitUntilTitleChangedTo(promptResult)); - EXPECT_STREQ(promptResult, ewk_view_title_get(webView())); - EXPECT_TRUE(promptCallbackData.called); + EXPECT_STREQ(ewk_view_title_get(webView()), promptResult); + EXPECT_EQ(promptCallbackData.called, true); promptHTML = "<!doctype html><body onload=\"document.title = prompt('Prompt message');\"></body>"; promptCallbackData.expectedMessage = promptMessage; @@ -558,8 +572,8 @@ TEST_F(EWK2UnitTestBase, ewk_view_run_javascript_prompt) promptCallbackData.called = false; ewk_view_html_string_load(webView(), promptHTML, 0, 0); EXPECT_TRUE(waitUntilTitleChangedTo(promptResult)); - EXPECT_STREQ(promptResult, ewk_view_title_get(webView())); - EXPECT_TRUE(promptCallbackData.called); + EXPECT_STREQ(ewk_view_title_get(webView()), promptResult); + EXPECT_EQ(promptCallbackData.called, true); promptHTML = "<!doctype html><body onload=\"document.title = prompt('');\"></body>"; promptCallbackData.expectedMessage = ""; @@ -568,8 +582,8 @@ TEST_F(EWK2UnitTestBase, ewk_view_run_javascript_prompt) promptCallbackData.called = false; ewk_view_html_string_load(webView(), promptHTML, 0, 0); EXPECT_TRUE(waitUntilTitleChangedTo(promptResult)); - EXPECT_STREQ(promptResult, ewk_view_title_get(webView())); - EXPECT_TRUE(promptCallbackData.called); + EXPECT_STREQ(ewk_view_title_get(webView()), promptResult); + EXPECT_EQ(promptCallbackData.called, true); promptHTML = "<!doctype html><body onload=\"document.title = prompt();\"></body>"; promptCallbackData.expectedMessage = "undefined"; @@ -578,8 +592,8 @@ TEST_F(EWK2UnitTestBase, ewk_view_run_javascript_prompt) promptCallbackData.called = false; ewk_view_html_string_load(webView(), promptHTML, 0, 0); EXPECT_TRUE(waitUntilTitleChangedTo(promptResult)); - EXPECT_STREQ(promptResult, ewk_view_title_get(webView())); - EXPECT_TRUE(promptCallbackData.called); + EXPECT_STREQ(ewk_view_title_get(webView()), promptResult); + EXPECT_EQ(promptCallbackData.called, true); promptHTML = "<html><head><title>Default title</title></head>" "<body onload=\"var promptResult = prompt('Prompt message');" @@ -591,8 +605,8 @@ TEST_F(EWK2UnitTestBase, ewk_view_run_javascript_prompt) promptCallbackData.called = false; ewk_view_html_string_load(webView(), promptHTML, 0, 0); EXPECT_TRUE(waitUntilTitleChangedTo("")); - EXPECT_STREQ("", ewk_view_title_get(webView())); - EXPECT_TRUE(promptCallbackData.called); + EXPECT_STREQ(ewk_view_title_get(webView()), ""); + EXPECT_EQ(promptCallbackData.called, true); promptCallbackData.expectedMessage = promptMessage; promptCallbackData.expectedDefaultValue = ""; @@ -600,16 +614,16 @@ TEST_F(EWK2UnitTestBase, ewk_view_run_javascript_prompt) promptCallbackData.called = false; ewk_view_html_string_load(webView(), promptHTML, 0, 0); EXPECT_TRUE(waitUntilTitleChangedTo("null")); - EXPECT_STREQ("null", ewk_view_title_get(webView())); - EXPECT_TRUE(promptCallbackData.called); + EXPECT_STREQ(ewk_view_title_get(webView()), "null"); + EXPECT_EQ(promptCallbackData.called, true); ewkViewClass()->run_javascript_prompt = 0; promptCallbackData.called = false; ewk_view_html_string_load(webView(), promptHTML, 0, 0); EXPECT_TRUE(waitUntilTitleChangedTo("null")); - EXPECT_STREQ("null", ewk_view_title_get(webView())); - EXPECT_FALSE(promptCallbackData.called); + EXPECT_STREQ(ewk_view_title_get(webView()), "null"); + EXPECT_EQ(promptCallbackData.called, false); } #if ENABLE(INPUT_TYPE_COLOR) @@ -651,18 +665,18 @@ static Eina_Bool showColorPicker(Ewk_View_Smart_Data* smartData, int r, int g, i 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); + EXPECT_EQ(r, initialRed); + EXPECT_EQ(g, initialGreen); + EXPECT_EQ(b, initialBlue); + EXPECT_EQ(a, initialAlpha); 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); + EXPECT_EQ(r, changedRed); + EXPECT_EQ(g, changedGreen); + EXPECT_EQ(b, changedBlue); + EXPECT_EQ(a, changedAlpha); evas_object_smart_callback_call(smartData->self, "input,type,color,request", 0); return true; @@ -730,7 +744,7 @@ TEST_F(EWK2UnitTestBase, ewk_view_color_picker_color_set) while (!handled) ecore_main_loop_iterate(); - // 8. Click button to remove input element durlng color picker is shown. + // 8. Click button to remove input element during color picker is shown. api->input_picker_color_dismiss = hideColorPickerByRemovingElement; mouseClick(80, 20); @@ -773,168 +787,3 @@ TEST_F(EWK2UnitTestBase, ewk_view_feed_touch_event) eina_list_free(points); } - -static void onTextFound(void* userData, Evas_Object*, void* eventInfo) -{ - int* result = static_cast<int*>(userData); - unsigned* matchCount = static_cast<unsigned*>(eventInfo); - - *result = *matchCount; -} - -TEST_F(EWK2UnitTestBase, ewk_view_text_find) -{ - const char textFindHTML[] = - "<!DOCTYPE html>" - "<body>" - "apple apple apple banana banana coconut" - "</body>"; - ewk_view_html_string_load(webView(), textFindHTML, 0, 0); - waitUntilLoadFinished(); - - int matchCount = -1; - evas_object_smart_callback_add(webView(), "text,found", onTextFound, &matchCount); - - ewk_view_text_find(webView(), "apple", EWK_FIND_OPTIONS_SHOW_OVERLAY, 100); - while (matchCount < 0) - ecore_main_loop_iterate(); - EXPECT_EQ(3, matchCount); - - matchCount = -1; - ewk_view_text_find(webView(), "mango", EWK_FIND_OPTIONS_SHOW_OVERLAY, 100); - while (matchCount < 0) - ecore_main_loop_iterate(); - EXPECT_EQ(0, matchCount); - - evas_object_smart_callback_del(webView(), "text,found", onTextFound); -} - -TEST_F(EWK2UnitTestBase, ewk_view_text_matches_count) -{ - const char textFindHTML[] = - "<!DOCTYPE html>" - "<body>" - "apple Apple apple apple banana bananaApple banana coconut" - "</body>"; - ewk_view_html_string_load(webView(), textFindHTML, 0, 0); - waitUntilLoadFinished(); - - int matchCount = -1; - evas_object_smart_callback_add(webView(), "text,found", onTextFound, &matchCount); - - ewk_view_text_matches_count(webView(), "apple", EWK_FIND_OPTIONS_NONE, 100); - while (matchCount < 0) - ecore_main_loop_iterate(); - EXPECT_EQ(3, matchCount); - - matchCount = -1; - ewk_view_text_matches_count(webView(), "apple", EWK_FIND_OPTIONS_CASE_INSENSITIVE, 100); - while (matchCount < 0) - ecore_main_loop_iterate(); - EXPECT_EQ(5, matchCount); - - matchCount = -1; - ewk_view_text_matches_count(webView(), "Apple", EWK_FIND_OPTIONS_AT_WORD_STARTS, 100); - while (matchCount < 0) - ecore_main_loop_iterate(); - EXPECT_EQ(1, matchCount); - - matchCount = -1; - ewk_view_text_matches_count(webView(), "Apple", EWK_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START, 100); - while (matchCount < 0) - ecore_main_loop_iterate(); - EXPECT_EQ(2, matchCount); - - matchCount = -1; - ewk_view_text_matches_count(webView(), "mango", EWK_FIND_OPTIONS_NONE, 100); - while (matchCount < 0) - ecore_main_loop_iterate(); - EXPECT_EQ(0, matchCount); - - // If we have more matches than allowed, -1 is returned as a matched count. - matchCount = -2; - ewk_view_text_matches_count(webView(), "apple", EWK_FIND_OPTIONS_NONE, 2); - while (matchCount < -1) - ecore_main_loop_iterate(); - EXPECT_EQ(-1, matchCount); - - evas_object_smart_callback_del(webView(), "text,found", onTextFound); -} - -TEST_F(EWK2UnitTestBase, ewk_view_touch_events_enabled) -{ - ASSERT_FALSE(ewk_view_touch_events_enabled_get(webView())); - - ASSERT_TRUE(ewk_view_touch_events_enabled_set(webView(), true)); - ASSERT_TRUE(ewk_view_touch_events_enabled_get(webView())); - - ASSERT_TRUE(ewk_view_touch_events_enabled_set(webView(), 2)); - ASSERT_TRUE(ewk_view_touch_events_enabled_get(webView())); - - const char* touchHTML = - "<!doctype html><body><div style=\"width:100px; height:100px;\" " - "ontouchstart=\"document.title='touchstarted' + event.touches.length;\" " - "ontouchmove=\"document.title='touchmoved' + event.touches.length;\" " - "ontouchend=\"document.title='touchended' + event.touches.length;\">" - "</div></body>"; - - ewk_view_html_string_load(webView(), touchHTML, "file:///", 0); - ASSERT_TRUE(waitUntilLoadFinished()); - - mouseDown(10, 10); - ASSERT_TRUE(waitUntilTitleChangedTo("touchstarted1")); - - multiDown(1, 30, 30); - ASSERT_TRUE(waitUntilTitleChangedTo("touchstarted2")); - - multiMove(1, 40, 40); - ASSERT_TRUE(waitUntilTitleChangedTo("touchmoved2")); - - multiUp(1, 40, 40); - ASSERT_TRUE(waitUntilTitleChangedTo("touchended1")); - - mouseMove(20, 20); - ASSERT_TRUE(waitUntilTitleChangedTo("touchmoved1")); - - mouseUp(20, 20); - ASSERT_TRUE(waitUntilTitleChangedTo("touchended0")); - - ASSERT_TRUE(ewk_view_touch_events_enabled_set(webView(), false)); - ASSERT_FALSE(ewk_view_touch_events_enabled_get(webView())); -} - -Eina_Bool windowMoveResizeTimedOut(void* data) -{ - *static_cast<bool*>(data) = true; -} - -TEST_F(EWK2UnitTestBase, window_move_resize) -{ - int x, y, width, height; - Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_object_evas_get(webView())); - ecore_evas_geometry_get(ee, 0, 0, &width, &height); - - EXPECT_EQ(800, width); - EXPECT_EQ(600, height); - - ewk_view_url_set(webView(), environment->urlForResource("window_move_resize.html").data()); - ASSERT_TRUE(waitUntilTitleChangedTo("Moved and resized")); - - // Check that the window has been moved and resized. - ecore_evas_request_geometry_get(ee, &x, &y, &width, &height); - EXPECT_EQ(150, x); - EXPECT_EQ(200, y); - EXPECT_EQ(200, width); - EXPECT_EQ(100, height); -} - -TEST_F(EWK2UnitTestBase, ewk_view_inspector) -{ -#if ENABLE(INSPECTOR) - ASSERT_TRUE(ewk_view_inspector_show(webView())); - ASSERT_TRUE(ewk_view_inspector_close(webView())); -#else - ASSERT_FALSE(ewk_view_inspector_show(webView())); - ASSERT_FALSE(ewk_view_inspector_close(webView())); -#endif -} diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadClient.cpp index 79c1c3e2a..6e72496ef 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadClient.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadClient.cpp @@ -34,13 +34,13 @@ using namespace WebKit; static void didStart(WKContextRef, WKDownloadRef wkDownload, const void* clientInfo) { - GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(toImpl(wkDownload)); + GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(wkDownload); webkitWebContextDownloadStarted(WEBKIT_WEB_CONTEXT(clientInfo), download.get()); } static void didReceiveResponse(WKContextRef, WKDownloadRef wkDownload, WKURLResponseRef wkResponse, const void* clientInfo) { - GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(toImpl(wkDownload)); + GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(wkDownload); if (webkitDownloadIsCancelled(download.get())) return; @@ -50,13 +50,13 @@ static void didReceiveResponse(WKContextRef, WKDownloadRef wkDownload, WKURLResp static void didReceiveData(WKContextRef, WKDownloadRef wkDownload, uint64_t length, const void* clientInfo) { - GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(toImpl(wkDownload)); + GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(wkDownload); webkitDownloadNotifyProgress(download.get(), length); } static WKStringRef decideDestinationWithSuggestedFilename(WKContextRef, WKDownloadRef wkDownload, WKStringRef filename, bool* allowOverwrite, const void* clientInfo) { - GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(toImpl(wkDownload)); + GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(wkDownload); CString destinationURI = webkitDownloadDecideDestinationWithSuggestedFilename(download.get(), toImpl(filename)->string().utf8()); return WKStringCreateWithUTF8CString(destinationURI.data()); @@ -64,33 +64,33 @@ static WKStringRef decideDestinationWithSuggestedFilename(WKContextRef, WKDownlo static void didCreateDestination(WKContextRef, WKDownloadRef wkDownload, WKStringRef path, const void* clientInfo) { - GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(toImpl(wkDownload)); + GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(wkDownload); webkitDownloadDestinationCreated(download.get(), toImpl(path)->string().utf8()); } static void didFail(WKContextRef, WKDownloadRef wkDownload, WKErrorRef error, const void *clientInfo) { - GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(toImpl(wkDownload)); + GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(wkDownload); if (webkitDownloadIsCancelled(download.get())) { // Cancellation takes precedence over other errors. webkitDownloadCancelled(download.get()); } else webkitDownloadFailed(download.get(), toImpl(error)->platformError()); - webkitWebContextRemoveDownload(toImpl(wkDownload)); + webkitWebContextRemoveDownload(wkDownload); } static void didCancel(WKContextRef, WKDownloadRef wkDownload, const void *clientInfo) { - GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(toImpl(wkDownload)); + GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(wkDownload); webkitDownloadCancelled(download.get()); - webkitWebContextRemoveDownload(toImpl(wkDownload)); + webkitWebContextRemoveDownload(wkDownload); } static void didFinish(WKContextRef wkContext, WKDownloadRef wkDownload, const void *clientInfo) { - GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(toImpl(wkDownload)); + GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(wkDownload); webkitDownloadFinished(download.get()); - webkitWebContextRemoveDownload(toImpl(wkDownload)); + webkitWebContextRemoveDownload(wkDownload); } void attachDownloadClientToContext(WebKitWebContext* webContext) @@ -110,6 +110,6 @@ void attachDownloadClientToContext(WebKitWebContext* webContext) didCancel, 0, // processDidCrash }; - WKContextSetDownloadClient(toAPI(webkitWebContextGetContext(webContext)), &wkDownloadClient); + WKContextSetDownloadClient(webkitWebContextGetWKContext(webContext), &wkDownloadClient); } diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFaviconDatabase.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitFaviconDatabase.cpp deleted file mode 100644 index cb016ab09..000000000 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitFaviconDatabase.cpp +++ /dev/null @@ -1,391 +0,0 @@ -/* - * Copyright (C) 2012 Igalia S.L. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2,1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" -#include "WebKitFaviconDatabase.h" - -#include "WebKitFaviconDatabasePrivate.h" -#include "WebKitPrivate.h" -#include <WebCore/FileSystem.h> -#include <WebCore/Image.h> -#include <WebCore/IntSize.h> -#include <WebCore/RefPtrCairo.h> -#include <glib/gi18n-lib.h> -#include <wtf/MainThread.h> -#include <wtf/gobject/GOwnPtr.h> -#include <wtf/gobject/GRefPtr.h> -#include <wtf/text/CString.h> - -using namespace WebKit; - -enum { - ICON_READY, - - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0, }; - -typedef Vector<GRefPtr<GSimpleAsyncResult> > PendingIconRequestVector; -typedef HashMap<String, PendingIconRequestVector*> PendingIconRequestMap; - -struct _WebKitFaviconDatabasePrivate { - RefPtr<WebIconDatabase> iconDatabase; - PendingIconRequestMap pendingIconRequests; -}; - -G_DEFINE_TYPE(WebKitFaviconDatabase, webkit_favicon_database, G_TYPE_OBJECT) - -static void webkit_favicon_database_init(WebKitFaviconDatabase* manager) -{ - WebKitFaviconDatabasePrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(manager, WEBKIT_TYPE_FAVICON_DATABASE, WebKitFaviconDatabasePrivate); - manager->priv = priv; - new (priv) WebKitFaviconDatabasePrivate(); -} - -static void webkitFaviconDatabaseDispose(GObject* object) -{ - WebKitFaviconDatabase* database = WEBKIT_FAVICON_DATABASE(object); - - WebKitFaviconDatabasePrivate* priv = database->priv; - if (priv->iconDatabase->isOpen()) - priv->iconDatabase->close(); - - G_OBJECT_CLASS(webkit_favicon_database_parent_class)->dispose(object); -} - -static void webkitFaviconDatabaseFinalize(GObject* object) -{ - WebKitFaviconDatabase* database = WEBKIT_FAVICON_DATABASE(object); - database->priv->~WebKitFaviconDatabasePrivate(); - G_OBJECT_CLASS(webkit_favicon_database_parent_class)->finalize(object); -} - -static void webkit_favicon_database_class_init(WebKitFaviconDatabaseClass* faviconDatabaseClass) -{ - GObjectClass* gObjectClass = G_OBJECT_CLASS(faviconDatabaseClass); - gObjectClass->dispose = webkitFaviconDatabaseDispose; - gObjectClass->finalize = webkitFaviconDatabaseFinalize; - - /** - * WebKitFaviconDatabase::favicon-ready: - * @database: the object on which the signal is emitted - * @page_uri: the URI of the Web page containing the icon. - * - * This signal gets emitted when the favicon of @page_uri is - * ready. This means that the favicon's data is ready to be used - * by the application, either because it has been loaded from the - * network, if it's the first time it gets retrieved, or because - * it has been already imported from the icon database. - */ - signals[ICON_READY] = - g_signal_new("favicon-ready", - G_TYPE_FROM_CLASS(faviconDatabaseClass), - G_SIGNAL_RUN_LAST, - 0, 0, 0, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, - G_TYPE_STRING); - - g_type_class_add_private(faviconDatabaseClass, sizeof(WebKitFaviconDatabasePrivate)); -} - -struct GetFaviconSurfaceAsyncData { - GRefPtr<WebKitFaviconDatabase> faviconDatabase; - String pageURL; - RefPtr<cairo_surface_t> icon; - GOwnPtr<GError> error; - GRefPtr<GCancellable> cancellable; -}; -WEBKIT_DEFINE_ASYNC_DATA_STRUCT(GetFaviconSurfaceAsyncData) - -static cairo_surface_t* getIconSurfaceSynchronously(WebKitFaviconDatabase* database, const String& pageURL, GError** error) -{ - ASSERT(isMainThread()); - - database->priv->iconDatabase->retainIconForPageURL(pageURL); - - // The exact size we pass is irrelevant to the iconDatabase code. - // We must pass something greater than 0x0 to get an icon. - WebCore::Image* iconImage = database->priv->iconDatabase->imageForPageURL(pageURL, WebCore::IntSize(1, 1)); - if (!iconImage) { - g_set_error(error, WEBKIT_FAVICON_DATABASE_ERROR, WEBKIT_FAVICON_DATABASE_ERROR_FAVICON_UNKNOWN, _("Unknown favicon for page %s"), pageURL.utf8().data()); - database->priv->iconDatabase->releaseIconForPageURL(pageURL); - return 0; - } - - WebCore::NativeImagePtr icon = iconImage->nativeImageForCurrentFrame(); - if (!icon) { - g_set_error(error, WEBKIT_FAVICON_DATABASE_ERROR, WEBKIT_FAVICON_DATABASE_ERROR_FAVICON_NOT_FOUND, _("Page %s does not have a favicon"), pageURL.utf8().data()); - database->priv->iconDatabase->releaseIconForPageURL(pageURL); - return 0; - } - - return icon->surface(); -} - -static void deletePendingIconRequests(WebKitFaviconDatabase* database, PendingIconRequestVector* requests, const String& pageURL) -{ - database->priv->pendingIconRequests.remove(pageURL); - delete requests; -} - -static void processPendingIconsForPageURL(WebKitFaviconDatabase* database, const String& pageURL) -{ - PendingIconRequestVector* pendingIconRequests = database->priv->pendingIconRequests.get(pageURL); - if (!pendingIconRequests) - return; - - GOwnPtr<GError> error; - RefPtr<cairo_surface_t> icon = getIconSurfaceSynchronously(database, pageURL, &error.outPtr()); - - for (size_t i = 0; i < pendingIconRequests->size(); ++i) { - GSimpleAsyncResult* result = pendingIconRequests->at(i).get(); - GetFaviconSurfaceAsyncData* data = static_cast<GetFaviconSurfaceAsyncData*>(g_simple_async_result_get_op_res_gpointer(result)); - if (!g_cancellable_is_cancelled(data->cancellable.get())) { - if (error) - g_propagate_error(&data->error.outPtr(), error.release()); - else - data->icon = icon; - } - - g_simple_async_result_complete(result); - } - deletePendingIconRequests(database, pendingIconRequests, pageURL); -} - -static void iconDataReadyForPageURLCallback(WKIconDatabaseRef wkIconDatabase, WKURLRef wkPageURL, const void* clientInfo) -{ - ASSERT(isMainThread()); - - WebKitFaviconDatabase* database = WEBKIT_FAVICON_DATABASE(clientInfo); - String pageURL = toImpl(wkPageURL)->string(); - - processPendingIconsForPageURL(database, pageURL); - g_signal_emit(database, signals[ICON_READY], 0, pageURL.utf8().data()); -} - -WebKitFaviconDatabase* webkitFaviconDatabaseCreate(WebIconDatabase* iconDatabase) -{ - WebKitFaviconDatabase* faviconDatabase = WEBKIT_FAVICON_DATABASE(g_object_new(WEBKIT_TYPE_FAVICON_DATABASE, NULL)); - faviconDatabase->priv->iconDatabase = iconDatabase; - - WKIconDatabaseClient wkIconDatabaseClient = { - kWKIconDatabaseClientCurrentVersion, - faviconDatabase, // clientInfo - 0, // didChangeIconForPageURLCallback - 0, // didRemoveAllIconsCallback - iconDataReadyForPageURLCallback, - }; - WKIconDatabaseSetIconDatabaseClient(toAPI(iconDatabase), &wkIconDatabaseClient); - return faviconDatabase; -} - -cairo_surface_t* webkitFaviconDatabaseGetFavicon(WebKitFaviconDatabase* database, const CString& pageURL) -{ - ASSERT(WEBKIT_IS_FAVICON_DATABASE(database)); - ASSERT(!pageURL.isNull()); - - cairo_surface_t* iconSurface = getIconSurfaceSynchronously(database, String::fromUTF8(pageURL.data()), 0); - if (!iconSurface) - return 0; - - return cairo_surface_reference(iconSurface); -} - -static PendingIconRequestVector* getOrCreatePendingIconRequests(WebKitFaviconDatabase* database, const String& pageURL) -{ - PendingIconRequestVector* icons = database->priv->pendingIconRequests.get(pageURL); - if (!icons) { - icons = new PendingIconRequestVector; - database->priv->pendingIconRequests.set(pageURL, icons); - } - - return icons; -} - -static void setErrorForAsyncResult(GSimpleAsyncResult* result, WebKitFaviconDatabaseError error, const String& pageURL = String()) -{ - ASSERT(result); - - switch (error) { - case WEBKIT_FAVICON_DATABASE_ERROR_NOT_INITIALIZED: - g_simple_async_result_set_error(result, WEBKIT_FAVICON_DATABASE_ERROR, error, _("Favicons database not initialized yet")); - break; - - case WEBKIT_FAVICON_DATABASE_ERROR_FAVICON_NOT_FOUND: - g_simple_async_result_set_error(result, WEBKIT_FAVICON_DATABASE_ERROR, error, _("Page %s does not have a favicon"), pageURL.utf8().data()); - break; - - case WEBKIT_FAVICON_DATABASE_ERROR_FAVICON_UNKNOWN: - g_simple_async_result_set_error(result, WEBKIT_FAVICON_DATABASE_ERROR, error, _("Unknown favicon for page %s"), pageURL.utf8().data()); - break; - - default: - ASSERT_NOT_REACHED(); - } -} - -GQuark webkit_favicon_database_error_quark(void) -{ - return g_quark_from_static_string("WebKitFaviconDatabaseError"); -} - -/** - * webkit_favicon_database_get_favicon: - * @database: a #WebKitFaviconDatabase - * @page_uri: URI of the page for which we want to retrieve the favicon - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: (scope async): A #GAsyncReadyCallback to call when the request is - * satisfied or %NULL if you don't care about the result. - * @user_data: (closure): The data to pass to @callback. - * - * Asynchronously obtains a #cairo_surface_t of the favicon for the - * given page URI. It returns the cached icon if it's in the database - * asynchronously waiting for the icon to be read from the database. - * - * This is an asynchronous method. When the operation is finished, callback will - * be invoked. You can then call webkit_favicon_database_get_favicon_finish() - * to get the result of the operation. - */ -void webkit_favicon_database_get_favicon(WebKitFaviconDatabase* database, const gchar* pageURI, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer userData) -{ - g_return_if_fail(WEBKIT_IS_FAVICON_DATABASE(database)); - g_return_if_fail(pageURI); - - GRefPtr<GSimpleAsyncResult> result = adoptGRef(g_simple_async_result_new(G_OBJECT(database), callback, userData, reinterpret_cast<gpointer>(webkit_favicon_database_get_favicon))); - g_simple_async_result_set_check_cancellable(result.get(), cancellable); - - GetFaviconSurfaceAsyncData* data = createGetFaviconSurfaceAsyncData(); - g_simple_async_result_set_op_res_gpointer(result.get(), data, reinterpret_cast<GDestroyNotify>(destroyGetFaviconSurfaceAsyncData)); - data->faviconDatabase = database; - data->pageURL = String::fromUTF8(pageURI); - data->cancellable = cancellable; - - WebKitFaviconDatabasePrivate* priv = database->priv; - WebIconDatabase* iconDatabaseImpl = priv->iconDatabase.get(); - if (!iconDatabaseImpl->isOpen()) { - setErrorForAsyncResult(result.get(), WEBKIT_FAVICON_DATABASE_ERROR_NOT_INITIALIZED); - g_simple_async_result_complete_in_idle(result.get()); - return; - } - - if (data->pageURL.isEmpty() || data->pageURL.startsWith("about:")) { - setErrorForAsyncResult(result.get(), WEBKIT_FAVICON_DATABASE_ERROR_FAVICON_NOT_FOUND, data->pageURL); - g_simple_async_result_complete_in_idle(result.get()); - return; - } - - // 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). - GOwnPtr<GError> error; - data->icon = getIconSurfaceSynchronously(database, data->pageURL, &error.outPtr()); - if (data->icon) { - g_simple_async_result_complete_in_idle(result.get()); - return; - } - - if (g_error_matches(error.get(), WEBKIT_FAVICON_DATABASE_ERROR, WEBKIT_FAVICON_DATABASE_ERROR_FAVICON_NOT_FOUND)) { - g_simple_async_result_take_error(result.get(), error.release()); - g_simple_async_result_complete_in_idle(result.get()); - return; - } - - // If there's not a valid icon, but there's an iconURL registered, - // or it's still not registered but the import process hasn't - // finished yet, we need to wait for iconDataReadyForPage to be - // called before making and informed decision. - String iconURLForPageURL; - iconDatabaseImpl->synchronousIconURLForPageURL(data->pageURL, iconURLForPageURL); - if (!iconURLForPageURL.isEmpty() || !iconDatabaseImpl->isUrlImportCompleted()) { - PendingIconRequestVector* icons = getOrCreatePendingIconRequests(database, data->pageURL); - ASSERT(icons); - icons->append(result); - return; - } - - setErrorForAsyncResult(result.get(), WEBKIT_FAVICON_DATABASE_ERROR_FAVICON_UNKNOWN, data->pageURL); - g_simple_async_result_complete_in_idle(result.get()); -} - -/** - * webkit_favicon_database_get_favicon_finish: - * @database: a #WebKitFaviconDatabase - * @result: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to webkit_favicon_database_get_favicon() - * @error: (allow-none): Return location for error or %NULL. - * - * Finishes an operation started with webkit_favicon_database_get_favicon(). - * - * Returns: (transfer full): a new reference to a #cairo_surface_t, or - * %NULL in case of error. - */ -cairo_surface_t* webkit_favicon_database_get_favicon_finish(WebKitFaviconDatabase* database, GAsyncResult* result, GError** error) -{ - GSimpleAsyncResult* simpleResult = G_SIMPLE_ASYNC_RESULT(result); - g_warn_if_fail(g_simple_async_result_get_source_tag(simpleResult) == webkit_favicon_database_get_favicon); - - if (g_simple_async_result_propagate_error(simpleResult, error)) - return 0; - - GetFaviconSurfaceAsyncData* data = static_cast<GetFaviconSurfaceAsyncData*>(g_simple_async_result_get_op_res_gpointer(simpleResult)); - ASSERT(data); - if (data->error) { - g_propagate_error(error, data->error.release()); - return 0; - } - - return cairo_surface_reference(data->icon.get()); -} - -/** - * webkit_favicon_database_get_favicon_uri: - * @database: a #WebKitFaviconDatabase - * @page_uri: URI of the page containing the icon - * - * Obtains the URI of the favicon for the given @page_uri. - * - * Returns: a newly allocated URI for the favicon, or %NULL if the - * database doesn't have a favicon for @page_uri. - */ -gchar* webkit_favicon_database_get_favicon_uri(WebKitFaviconDatabase* database, const gchar* pageURL) -{ - g_return_val_if_fail(WEBKIT_IS_FAVICON_DATABASE(database), 0); - g_return_val_if_fail(pageURL, 0); - ASSERT(isMainThread()); - - String iconURLForPageURL; - database->priv->iconDatabase->synchronousIconURLForPageURL(String::fromUTF8(pageURL), iconURLForPageURL); - if (iconURLForPageURL.isEmpty()) - return 0; - - return g_strdup(iconURLForPageURL.utf8().data()); -} - -/** - * webkit_favicon_database_clear: - * @database: a #WebKitFaviconDatabase - * - * Clears all icons from the database. - */ -void webkit_favicon_database_clear(WebKitFaviconDatabase* database) -{ - g_return_if_fail(WEBKIT_IS_FAVICON_DATABASE(database)); - - database->priv->iconDatabase->removeAllIcons(); -} diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFaviconDatabase.h b/Source/WebKit2/UIProcess/API/gtk/WebKitFaviconDatabase.h deleted file mode 100644 index 811a8e6bb..000000000 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitFaviconDatabase.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2012 Igalia S.L. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2,1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION) -#error "Only <webkit2/webkit2.h> can be included directly." -#endif - -#ifndef WebKitFaviconDatabase_h -#define WebKitFaviconDatabase_h - -#include <cairo.h> -#include <gio/gio.h> -#include <glib-object.h> -#include <webkit2/WebKitDefines.h> - -G_BEGIN_DECLS - -#define WEBKIT_TYPE_FAVICON_DATABASE (webkit_favicon_database_get_type()) -#define WEBKIT_FAVICON_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_FAVICON_DATABASE, WebKitFaviconDatabase)) -#define WEBKIT_IS_FAVICON_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_FAVICON_DATABASE)) -#define WEBKIT_FAVICON_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_FAVICON_DATABASE, WebKitFaviconDatabaseClass)) -#define WEBKIT_IS_FAVICON_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_FAVICON_DATABASE)) -#define WEBKIT_FAVICON_DATABASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_FAVICON_DATABASE, WebKitFaviconDatabaseClass)) -#define WEBKIT_FAVICON_DATABASE_ERROR (webkit_favicon_database_error_quark()) - -typedef struct _WebKitFaviconDatabase WebKitFaviconDatabase; -typedef struct _WebKitFaviconDatabaseClass WebKitFaviconDatabaseClass; -typedef struct _WebKitFaviconDatabasePrivate WebKitFaviconDatabasePrivate; - -struct _WebKitFaviconDatabase { - GObject parent; - - WebKitFaviconDatabasePrivate *priv; -}; - -struct _WebKitFaviconDatabaseClass { - GObjectClass parent_class; -}; - -/** - * WebKitFaviconDatabaseError: - * @WEBKIT_FAVICON_DATABASE_ERROR_NOT_INITIALIZED: The #WebKitFaviconDatabase has not been initialized yet - * @WEBKIT_FAVICON_DATABASE_ERROR_FAVICON_NOT_FOUND: There is not an icon available for the requested URL - * @WEBKIT_FAVICON_DATABASE_ERROR_FAVICON_UNKNOWN: There might be an icon for the requested URL, but its data is unknown at the moment - * - * Enum values used to denote the various errors related to the #WebKitFaviconDatabase. - **/ -typedef enum { - WEBKIT_FAVICON_DATABASE_ERROR_NOT_INITIALIZED, - WEBKIT_FAVICON_DATABASE_ERROR_FAVICON_NOT_FOUND, - WEBKIT_FAVICON_DATABASE_ERROR_FAVICON_UNKNOWN -} WebKitFaviconDatabaseError; - -WEBKIT_API GQuark -webkit_favicon_database_error_quark (void); - -WEBKIT_API GType -webkit_favicon_database_get_type (void); - -WEBKIT_API void -webkit_favicon_database_get_favicon (WebKitFaviconDatabase *database, - const gchar *page_uri, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); -WEBKIT_API cairo_surface_t * -webkit_favicon_database_get_favicon_finish (WebKitFaviconDatabase *database, - GAsyncResult *result, - GError **error); -WEBKIT_API gchar * -webkit_favicon_database_get_favicon_uri (WebKitFaviconDatabase *database, - const gchar *page_uri); -WEBKIT_API void -webkit_favicon_database_clear (WebKitFaviconDatabase *database); - -G_END_DECLS - -#endif diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFaviconDatabasePrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitFaviconDatabasePrivate.h deleted file mode 100644 index 6c50949fb..000000000 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitFaviconDatabasePrivate.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2012 Igalia S.L. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef WebKitFaviconDatabasePrivate_h -#define WebKitFaviconDatabasePrivate_h - -#include "WebIconDatabase.h" -#include "WebKitFaviconDatabase.h" -#include <wtf/text/CString.h> - -using namespace WebKit; - -WebKitFaviconDatabase* webkitFaviconDatabaseCreate(WebIconDatabase*); -cairo_surface_t* webkitFaviconDatabaseGetFavicon(WebKitFaviconDatabase*, const CString&); - -#endif // WebKitFaviconDatabasePrivate_h diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitJavascriptResult.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitJavascriptResult.cpp index 2a1b8d5a3..84ad04d03 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitJavascriptResult.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitJavascriptResult.cpp @@ -21,16 +21,15 @@ #include "WebKitJavascriptResult.h" #include "WebKitJavascriptResultPrivate.h" -#include "WebSerializedScriptValue.h" #include <wtf/gobject/GRefPtr.h> struct _WebKitJavascriptResult { - _WebKitJavascriptResult(WebKitWebView* view, WebSerializedScriptValue* serializedScriptValue) + _WebKitJavascriptResult(WebKitWebView* view, WKSerializedScriptValueRef wkSerializedScriptValue) : webView(view) , referenceCount(1) - { - value = serializedScriptValue->deserialize(webkit_web_view_get_javascript_global_context(view), 0); - } + { + value = WKSerializedScriptValueDeserialize(wkSerializedScriptValue, webkit_web_view_get_javascript_global_context(view), 0); + } GRefPtr<WebKitWebView> webView; JSValueRef value; @@ -40,10 +39,10 @@ struct _WebKitJavascriptResult { G_DEFINE_BOXED_TYPE(WebKitJavascriptResult, webkit_javascript_result, webkit_javascript_result_ref, webkit_javascript_result_unref) -WebKitJavascriptResult* webkitJavascriptResultCreate(WebKitWebView* webView, WebSerializedScriptValue* serializedScriptValue) +WebKitJavascriptResult* webkitJavascriptResultCreate(WebKitWebView* webView, WKSerializedScriptValueRef wkSerializedScriptValue) { WebKitJavascriptResult* result = g_slice_new(WebKitJavascriptResult); - new (result) WebKitJavascriptResult(webView, serializedScriptValue); + new (result) WebKitJavascriptResult(webView, wkSerializedScriptValue); return result; } diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitJavascriptResultPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitJavascriptResultPrivate.h index ac7578857..840ead058 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitJavascriptResultPrivate.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitJavascriptResultPrivate.h @@ -24,8 +24,6 @@ #include "WebKitPrivate.h" #include "WebKitWebView.h" -using namespace WebKit; - -WebKitJavascriptResult* webkitJavascriptResultCreate(WebKitWebView*, WebSerializedScriptValue*); +WebKitJavascriptResult* webkitJavascriptResultCreate(WebKitWebView*, WKSerializedScriptValueRef); #endif // WebKitJavascriptResultPrivate_h diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp index 457c40141..6c3bf920a 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp @@ -152,7 +152,6 @@ void attachLoaderClientToView(WebKitWebView* webView) 0, // pluginDidFail 0, // didReceiveIntentForFrame 0, // registerIntentServiceForFrame - 0, // didLayout }; WKPageRef wkPage = toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView))); WKPageSetPageLoaderClient(wkPage, &wkLoaderClient); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h index 9ceafecb6..8fede827f 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h @@ -34,7 +34,6 @@ #include <WebKit2/WKGeolocationManager.h> #include <WebKit2/WKGeolocationPermissionRequest.h> #include <WebKit2/WKGeolocationPosition.h> -#include <WebKit2/WKIconDatabase.h> #include <WebKit2/WKInspector.h> #include <WebKit2/WKInspectorClientGtk.h> #include <WebKit2/WKRetainPtr.h> diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitRequestManagerClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitRequestManagerClient.cpp index babafe651..8ea09f200 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitRequestManagerClient.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitRequestManagerClient.cpp @@ -26,10 +26,10 @@ using namespace WebKit; -static void didReceiveURIRequest(WKSoupRequestManagerRef soupRequestManagerRef, WKURLRef urlRef, WKPageRef initiatingPageRef, uint64_t requestID, const void* clientInfo) +static void didReceiveURIRequest(WKSoupRequestManagerRef soupRequestManagerRef, WKURLRef urlRef, uint64_t requestID, const void* clientInfo) { WebKitWebContext* webContext = WEBKIT_WEB_CONTEXT(clientInfo); - GRefPtr<WebKitURISchemeRequest> request = adoptGRef(webkitURISchemeRequestCreate(webContext, soupRequestManagerRef, urlRef, initiatingPageRef, requestID)); + GRefPtr<WebKitURISchemeRequest> request = adoptGRef(webkitURISchemeRequestCreate(webContext, soupRequestManagerRef, urlRef, requestID)); webkitWebContextReceivedURIRequest(webContext, request.get()); } @@ -46,6 +46,6 @@ void attachRequestManagerClientToContext(WebKitWebContext* webContext) didReceiveURIRequest, didFailToLoadURIRequest }; - WKSoupRequestManagerSetClient(toAPI(webkitWebContextGetRequestManager(webContext)), &wkRequestManagerClient); + WKSoupRequestManagerSetClient(webkitWebContextGetRequestManager(webContext), &wkRequestManagerClient); } diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitSecurityManager.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitSecurityManager.cpp index d170fcf3f..53b46f875 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitSecurityManager.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitSecurityManager.cpp @@ -74,7 +74,7 @@ WebKitSecurityManager* webkitSecurityManagerCreate(WebKitWebContext* webContext) static void registerSecurityPolicyForURIScheme(WebKitSecurityManager* manager, const char* scheme, SecurityPolicy policy) { String urlScheme = String::fromUTF8(scheme); - WebContext* webContext = webkitWebContextGetContext(manager->priv->webContext); + WebContext* webContext = toImpl(webkitWebContextGetWKContext(manager->priv->webContext)); // We keep the WebCore::SchemeRegistry of the UI process in sync with the // web process one, so that we can return the SecurityPolicy for diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp index 17d4c881b..c0a64162a 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp @@ -34,7 +34,6 @@ #include "WebKitPrivate.h" #include "WebKitSettingsPrivate.h" #include "WebPageProxy.h" -#include "WebPreferences.h" #include <WebCore/UserAgentGtk.h> #include <glib/gi18n-lib.h> #include <wtf/text/CString.h> @@ -118,8 +117,7 @@ enum { PROP_DRAW_COMPOSITING_INDICATORS, PROP_ENABLE_SITE_SPECIFIC_QUIRKS, PROP_ENABLE_PAGE_CACHE, - PROP_USER_AGENT, - PROP_ENABLE_SMOOTH_SCROLLING + PROP_USER_AGENT }; static void webKitSettingsSetProperty(GObject* object, guint propId, const GValue* value, GParamSpec* paramSpec) @@ -253,9 +251,6 @@ static void webKitSettingsSetProperty(GObject* object, guint propId, const GValu case PROP_USER_AGENT: webkit_settings_set_user_agent(settings, g_value_get_string(value)); break; - case PROP_ENABLE_SMOOTH_SCROLLING: - webkit_settings_set_enable_smooth_scrolling(settings, g_value_get_boolean(value)); - break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec); break; @@ -393,9 +388,6 @@ static void webKitSettingsGetProperty(GObject* object, guint propId, GValue* val case PROP_USER_AGENT: g_value_set_string(value, webkit_settings_get_user_agent(settings)); break; - case PROP_ENABLE_SMOOTH_SCROLLING: - g_value_set_boolean(value, webkit_settings_get_enable_smooth_scrolling(settings)); - break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec); break; @@ -1047,19 +1039,6 @@ static void webkit_settings_class_init(WebKitSettingsClass* klass) 0, // A null string forces the standard user agent. readWriteConstructParamFlags)); - /** - * WebKitSettings:enable-smooth-scrolling: - * - * Enable or disable smooth scrolling. - */ - g_object_class_install_property(gObjectClass, - PROP_ENABLE_SMOOTH_SCROLLING, - g_param_spec_boolean("enable-smooth-scrolling", - _("Enable smooth scrolling"), - _("Whether to enable smooth scrolling"), - FALSE, - readWriteConstructParamFlags)); - g_type_class_add_private(klass, sizeof(WebKitSettingsPrivate)); } @@ -2665,38 +2644,3 @@ void webkit_settings_set_user_agent_with_application_details(WebKitSettings* set CString newUserAgent = WebCore::standardUserAgent(String::fromUTF8(applicationName), String::fromUTF8(applicationVersion)).utf8(); webkit_settings_set_user_agent(settings, newUserAgent.data()); } - -/** - * webkit_settings_get_enable_smooth_scrolling: - * @settings: a #WebKitSettings - * - * Get the #WebKitSettings:enable-smooth-scrolling property. - * - * Returns: %TRUE if smooth scrolling is enabled or %FALSE otherwise. - */ -gboolean webkit_settings_get_enable_smooth_scrolling(WebKitSettings* settings) -{ - g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE); - - return WebKit::toImpl(settings->priv->preferences.get())->scrollAnimatorEnabled(); -} - -/** - * webkit_settings_set_enable_smooth_scrolling: - * @settings: a #WebKitSettings - * @enabled: Value to be set - * - * Set the #WebKitSettings:enable-smooth-scrolling property. - */ -void webkit_settings_set_enable_smooth_scrolling(WebKitSettings* settings, gboolean enabled) -{ - g_return_if_fail(WEBKIT_IS_SETTINGS(settings)); - - WebKitSettingsPrivate* priv = settings->priv; - bool currentValue = WebKit::toImpl(priv->preferences.get())->scrollAnimatorEnabled(); - if (currentValue == enabled) - return; - - WebKit::toImpl(priv->preferences.get())->setScrollAnimatorEnabled(enabled); - g_object_notify(G_OBJECT(settings), "enable-smooth-scrolling"); -} diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h b/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h index a9fe86a30..b35a23f06 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h @@ -373,13 +373,6 @@ webkit_settings_set_user_agent_with_application_details (WebKitSettings * const gchar *application_name, const gchar *application_version); -WEBKIT_API gboolean -webkit_settings_get_enable_smooth_scrolling (WebKitSettings *settings); - -WEBKIT_API void -webkit_settings_set_enable_smooth_scrolling (WebKitSettings *settings, - gboolean enabled); - G_END_DECLS #endif /* WebKitSettings_h */ diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequest.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequest.cpp index e69831f29..e62c1faf5 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequest.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequest.cpp @@ -22,8 +22,6 @@ #include "WebKitURISchemeRequestPrivate.h" #include "WebKitWebContextPrivate.h" -#include "WebKitWebView.h" -#include "WebPageProxy.h" #include <WebCore/GOwnPtrSoup.h> #include <libsoup/soup.h> #include <wtf/gobject/GRefPtr.h> @@ -38,7 +36,6 @@ G_DEFINE_TYPE(WebKitURISchemeRequest, webkit_uri_scheme_request, G_TYPE_OBJECT) struct _WebKitURISchemeRequestPrivate { WebKitWebContext* webContext; WKRetainPtr<WKSoupRequestManagerRef> wkRequestManager; - WKRetainPtr<WKPageRef> wkInitiatingPage; uint64_t requestID; CString uri; GOwnPtr<SoupURI> soupURI; @@ -71,13 +68,12 @@ static void webkit_uri_scheme_request_class_init(WebKitURISchemeRequestClass* re g_type_class_add_private(requestClass, sizeof(WebKitURISchemeRequestPrivate)); } -WebKitURISchemeRequest* webkitURISchemeRequestCreate(WebKitWebContext* webContext, WKSoupRequestManagerRef wkRequestManager, WKURLRef wkURL, WKPageRef wkInitiatingPage, uint64_t requestID) +WebKitURISchemeRequest* webkitURISchemeRequestCreate(WebKitWebContext* webContext, WKSoupRequestManagerRef wkRequestManager, WKURLRef wkURL, uint64_t requestID) { WebKitURISchemeRequest* request = WEBKIT_URI_SCHEME_REQUEST(g_object_new(WEBKIT_TYPE_URI_SCHEME_REQUEST, NULL)); request->priv->webContext = webContext; request->priv->wkRequestManager = wkRequestManager; request->priv->uri = toImpl(wkURL)->string().utf8(); - request->priv->wkInitiatingPage = wkInitiatingPage; request->priv->requestID = requestID; return request; } @@ -142,21 +138,6 @@ const char* webkit_uri_scheme_request_get_path(WebKitURISchemeRequest* request) return request->priv->soupURI->path; } -/** - * webkit_uri_scheme_request_get_web_view: - * @request: a #WebKitURISchemeRequest - * - * Get the #WebKitWebView that initiated the request. - * - * Returns: (transfer none): the #WebKitWebView that initiated @request. - */ -WebKitWebView* webkit_uri_scheme_request_get_web_view(WebKitURISchemeRequest* request) -{ - g_return_val_if_fail(WEBKIT_IS_URI_SCHEME_REQUEST(request), 0); - - return WEBKIT_WEB_VIEW(toImpl(request->priv->wkInitiatingPage.get())->viewWidget()); -} - static void webkitURISchemeRequestReadCallback(GInputStream* inputStream, GAsyncResult* result, WebKitURISchemeRequest* schemeRequest) { GRefPtr<WebKitURISchemeRequest> request = adoptGRef(schemeRequest); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequest.h b/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequest.h index 9ead50709..34f214489 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequest.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequest.h @@ -51,25 +51,22 @@ struct _WebKitURISchemeRequestClass { }; WEBKIT_API GType -webkit_uri_scheme_request_get_type (void); +webkit_uri_scheme_request_get_type (void); WEBKIT_API const gchar * -webkit_uri_scheme_request_get_scheme (WebKitURISchemeRequest *request); +webkit_uri_scheme_request_get_scheme (WebKitURISchemeRequest *request); WEBKIT_API const gchar * -webkit_uri_scheme_request_get_uri (WebKitURISchemeRequest *request); +webkit_uri_scheme_request_get_uri (WebKitURISchemeRequest *request); WEBKIT_API const gchar * -webkit_uri_scheme_request_get_path (WebKitURISchemeRequest *request); - -WEBKIT_API WebKitWebView * -webkit_uri_scheme_request_get_web_view (WebKitURISchemeRequest *request); +webkit_uri_scheme_request_get_path (WebKitURISchemeRequest *request); WEBKIT_API void -webkit_uri_scheme_request_finish (WebKitURISchemeRequest *request, - GInputStream *stream, - gint64 stream_length, - const gchar *mime_type); +webkit_uri_scheme_request_finish (WebKitURISchemeRequest *request, + GInputStream *stream, + gint64 stream_length, + const gchar *mime_type); G_END_DECLS diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequestPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequestPrivate.h index b7c011f66..149813def 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequestPrivate.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequestPrivate.h @@ -25,7 +25,7 @@ #include "WebKitWebContext.h" #include <WebKit2/WKSoupRequestManager.h> -WebKitURISchemeRequest* webkitURISchemeRequestCreate(WebKitWebContext*, WKSoupRequestManagerRef, WKURLRef, WKPageRef, uint64_t requestID); +WebKitURISchemeRequest* webkitURISchemeRequestCreate(WebKitWebContext*, WKSoupRequestManagerRef, WKURLRef, uint64_t requestID); uint64_t webkitURISchemeRequestGetID(WebKitURISchemeRequest*); void webkitURISchemeRequestCancel(WebKitURISchemeRequest*); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp index dab18a87d..5b2c26697 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp @@ -20,10 +20,10 @@ #include "config.h" #include "WebKitWebContext.h" +#include "WebContext.h" #include "WebKitCookieManagerPrivate.h" #include "WebKitDownloadClient.h" #include "WebKitDownloadPrivate.h" -#include "WebKitFaviconDatabasePrivate.h" #include "WebKitGeolocationProvider.h" #include "WebKitPluginPrivate.h" #include "WebKitPrivate.h" @@ -32,9 +32,7 @@ #include "WebKitTextChecker.h" #include "WebKitURISchemeRequestPrivate.h" #include "WebKitWebContextPrivate.h" -#include "WebResourceCacheManagerProxy.h" #include <WebCore/FileSystem.h> -#include <WebCore/IconDatabase.h> #include <WebCore/Language.h> #include <wtf/HashMap.h> #include <wtf/OwnPtr.h> @@ -44,6 +42,8 @@ #include <wtf/gobject/GRefPtr.h> #include <wtf/text/CString.h> +using namespace WebKit; + enum { DOWNLOAD_STARTED, @@ -93,12 +93,11 @@ typedef HashMap<String, RefPtr<WebKitURISchemeHandler> > URISchemeHandlerMap; typedef HashMap<uint64_t, GRefPtr<WebKitURISchemeRequest> > URISchemeRequestMap; struct _WebKitWebContextPrivate { - RefPtr<WebContext> context; + WKRetainPtr<WKContextRef> context; GRefPtr<WebKitCookieManager> cookieManager; - GRefPtr<WebKitFaviconDatabase> faviconDatabase; GRefPtr<WebKitSecurityManager> securityManager; - RefPtr<WebSoupRequestManagerProxy> requestManager; + WKRetainPtr<WKSoupRequestManagerRef> requestManager; URISchemeHandlerMap uriSchemeHandlers; URISchemeRequestMap uriSchemeRequests; #if ENABLE(GEOLOCATION) @@ -107,7 +106,6 @@ struct _WebKitWebContextPrivate { #if ENABLE(SPELLCHECK) OwnPtr<WebKitTextChecker> textChecker; #endif - CString faviconDatabaseDirectory; }; static guint signals[LAST_SIGNAL] = { 0, }; @@ -154,20 +152,17 @@ static void webkit_web_context_class_init(WebKitWebContextClass* webContextClass static gpointer createDefaultWebContext(gpointer) { static GRefPtr<WebKitWebContext> webContext = adoptGRef(WEBKIT_WEB_CONTEXT(g_object_new(WEBKIT_TYPE_WEB_CONTEXT, NULL))); - WebKitWebContextPrivate* priv = webContext->priv; - - priv->context = WebContext::create(String()); - priv->requestManager = webContext->priv->context->soupRequestManagerProxy(); - priv->context->setCacheModel(CacheModelPrimaryWebBrowser); - + webContext->priv->context = WKContextCreate(); + webContext->priv->requestManager = WKContextGetSoupRequestManager(webContext->priv->context.get()); + WKContextSetCacheModel(webContext->priv->context.get(), kWKCacheModelPrimaryWebBrowser); attachDownloadClientToContext(webContext.get()); attachRequestManagerClientToContext(webContext.get()); - #if ENABLE(GEOLOCATION) - priv->geolocationProvider = WebKitGeolocationProvider::create(toAPI(priv->context->geolocationManagerProxy())); + WKGeolocationManagerRef wkGeolocationManager = WKContextGetGeolocationManager(webContext->priv->context.get()); + webContext->priv->geolocationProvider = WebKitGeolocationProvider::create(wkGeolocationManager); #endif #if ENABLE(SPELLCHECK) - priv->textChecker = WebKitTextChecker::create(); + webContext->priv->textChecker = WebKitTextChecker::create(); #endif return webContext.get(); } @@ -211,26 +206,26 @@ WebKitWebContext* webkit_web_context_get_default(void) */ void webkit_web_context_set_cache_model(WebKitWebContext* context, WebKitCacheModel model) { - CacheModel cacheModel; + WKCacheModel cacheModel; g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context)); switch (model) { case WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER: - cacheModel = CacheModelDocumentViewer; + cacheModel = kWKCacheModelDocumentViewer; break; case WEBKIT_CACHE_MODEL_WEB_BROWSER: - cacheModel = CacheModelPrimaryWebBrowser; + cacheModel = kWKCacheModelPrimaryWebBrowser; break; case WEBKIT_CACHE_MODEL_DOCUMENT_BROWSER: - cacheModel = CacheModelDocumentBrowser; + cacheModel = kWKCacheModelDocumentBrowser; break; default: g_assert_not_reached(); } - - if (cacheModel != context->priv->context->cacheModel()) - context->priv->context->setCacheModel(cacheModel); + WebKitWebContextPrivate* priv = context->priv; + if (cacheModel != WKContextGetCacheModel(priv->context.get())) + WKContextSetCacheModel(priv->context.get(), cacheModel); } /** @@ -247,12 +242,13 @@ WebKitCacheModel webkit_web_context_get_cache_model(WebKitWebContext* context) { g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), WEBKIT_CACHE_MODEL_WEB_BROWSER); - switch (context->priv->context->cacheModel()) { - case CacheModelDocumentViewer: + WebKitWebContextPrivate* priv = context->priv; + switch (WKContextGetCacheModel(priv->context.get())) { + case kWKCacheModelDocumentViewer: return WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER; - case CacheModelPrimaryWebBrowser: + case kWKCacheModelPrimaryWebBrowser: return WEBKIT_CACHE_MODEL_WEB_BROWSER; - case CacheModelDocumentBrowser: + case kWKCacheModelDocumentBrowser: return WEBKIT_CACHE_MODEL_DOCUMENT_BROWSER; default: g_assert_not_reached(); @@ -272,10 +268,11 @@ void webkit_web_context_clear_cache(WebKitWebContext* context) { g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context)); - context->priv->context->resourceCacheManagerProxy()->clearCacheForAllOrigins(AllResourceCaches); + WebKitWebContextPrivate* priv = context->priv; + WKResourceCacheManagerClearCacheForAllOrigins(WKContextGetResourceCacheManager(priv->context.get()), WKResourceCachesToClearAll); } -typedef HashMap<DownloadProxy*, GRefPtr<WebKitDownload> > DownloadsMap; +typedef HashMap<WKDownloadRef, GRefPtr<WebKitDownload> > DownloadsMap; static DownloadsMap& downloadsMap() { @@ -298,9 +295,12 @@ 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(toAPI(downloadProxy)); - downloadsMap().set(downloadProxy, download); + WebKitWebContextPrivate* priv = context->priv; + WKRetainPtr<WKURLRef> wkURL(AdoptWK, WKURLCreateWithUTF8CString(uri)); + WKRetainPtr<WKURLRequestRef> wkRequest(AdoptWK, WKURLRequestCreateWithWKURL(wkURL.get())); + WKRetainPtr<WKDownloadRef> wkDownload = WKContextDownloadURLRequest(priv->context.get(), wkRequest.get()); + WebKitDownload* download = webkitDownloadCreate(wkDownload.get()); + downloadsMap().set(wkDownload.get(), download); return download; } @@ -318,107 +318,11 @@ WebKitCookieManager* webkit_web_context_get_cookie_manager(WebKitWebContext* con WebKitWebContextPrivate* priv = context->priv; if (!priv->cookieManager) - priv->cookieManager = adoptGRef(webkitCookieManagerCreate(toAPI(priv->context->cookieManagerProxy()))); + priv->cookieManager = adoptGRef(webkitCookieManagerCreate(WKContextGetCookieManager(priv->context.get()))); return priv->cookieManager.get(); } -static void ensureFaviconDatabase(WebKitWebContext* context) -{ - WebKitWebContextPrivate* priv = context->priv; - if (priv->faviconDatabase) - return; - - priv->faviconDatabase = adoptGRef(webkitFaviconDatabaseCreate(priv->context->iconDatabase())); -} - -/** - * webkit_web_context_set_favicon_database_directory: - * @context: a #WebKitWebContext - * @path: (allow-none): an absolute path to the icon database - * directory or %NULL to use the defaults - * - * Set the directory path to be used to store the favicons database - * for @context on disk. Passing %NULL as @path means using the - * default directory for the platform (see g_get_user_data_dir()). - * - * Calling this method also means enabling the favicons database for - * its use from the applications, so that's why it's expected to be - * called only once. Further calls for the same instance of - * #WebKitWebContext won't cause any effect. - */ -void webkit_web_context_set_favicon_database_directory(WebKitWebContext* context, const gchar* path) -{ - g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context)); - - WebKitWebContextPrivate* priv = context->priv; - WebIconDatabase* iconDatabase = priv->context->iconDatabase(); - if (iconDatabase->isOpen()) - return; - - ensureFaviconDatabase(context); - - // Use default if 0 is passed as parameter. - String directoryPath = WebCore::filenameToString(path); - priv->faviconDatabaseDirectory = directoryPath.isEmpty() - ? priv->context->iconDatabasePath().utf8() - : directoryPath.utf8(); - - // Build the full path to the icon database file on disk. - GOwnPtr<gchar> faviconDatabasePath(g_build_filename(priv->faviconDatabaseDirectory.data(), - WebCore::IconDatabase::defaultDatabaseFilename().utf8().data(), - NULL)); - - // Setting the path will cause the icon database to be opened. - priv->context->setIconDatabasePath(WebCore::filenameToString(faviconDatabasePath.get())); -} - -/** - * webkit_web_context_get_favicon_database_directory: - * @context: a #WebKitWebContext - * - * Get the directory path being used to store the favicons database - * for @context, or %NULL if - * webkit_web_context_set_favicon_database_directory() hasn't been - * called yet. - * - * This function will always return the same path after having called - * webkit_web_context_set_favicon_database_directory() for the first - * time. - * - * Returns: (transfer none): the path of the directory of the favicons - * database associated with @context, or %NULL. - */ -const gchar* webkit_web_context_get_favicon_database_directory(WebKitWebContext *context) -{ - g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), 0); - - WebKitWebContextPrivate* priv = context->priv; - if (priv->faviconDatabaseDirectory.isNull()) - return 0; - - return priv->faviconDatabaseDirectory.data(); -} - -/** - * webkit_web_context_get_favicon_database: - * @context: a #WebKitWebContext - * - * Get the #WebKitFaviconDatabase associated with @context. - * - * To initialize the database you need to call - * webkit_web_context_set_favicon_database_directory(). - * - * Returns: (transfer none): the #WebKitFaviconDatabase of @context. - */ -WebKitFaviconDatabase* webkit_web_context_get_favicon_database(WebKitWebContext* context) -{ - g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), 0); - - ensureFaviconDatabase(context); - return context->priv->faviconDatabase.get(); -} - /** * webkit_web_context_get_security_manager: * @context: a #WebKitWebContext @@ -450,7 +354,7 @@ void webkit_web_context_set_additional_plugins_directory(WebKitWebContext* conte g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context)); g_return_if_fail(directory); - context->priv->context->setAdditionalPluginsDirectory(WebCore::filenameToString(directory)); + toImpl(context->priv->context.get())->setAdditionalPluginsDirectory(WebCore::filenameToString(directory)); } struct GetPluginsAsyncData { @@ -461,7 +365,7 @@ WEBKIT_DEFINE_ASYNC_DATA_STRUCT(GetPluginsAsyncData) static void webkitWebContextGetPluginThread(GSimpleAsyncResult* result, GObject* object, GCancellable*) { GetPluginsAsyncData* data = static_cast<GetPluginsAsyncData*>(g_simple_async_result_get_op_res_gpointer(result)); - data->plugins = WEBKIT_WEB_CONTEXT(object)->priv->context->pluginInfoStore().plugins(); + data->plugins = toImpl(WEBKIT_WEB_CONTEXT(object)->priv->context.get())->pluginInfoStore().plugins(); } /** @@ -568,7 +472,8 @@ void webkit_web_context_register_uri_scheme(WebKitWebContext* context, const cha RefPtr<WebKitURISchemeHandler> handler = adoptRef(new WebKitURISchemeHandler(callback, userData, destroyNotify)); context->priv->uriSchemeHandlers.set(String::fromUTF8(scheme), handler.get()); - context->priv->requestManager->registerURIScheme(String::fromUTF8(scheme)); + WKRetainPtr<WKStringRef> wkScheme(AdoptWK, WKStringCreateWithUTF8CString(scheme)); + WKSoupRequestManagerRegisterURIScheme(context->priv->requestManager.get(), wkScheme.get()); } /** @@ -682,20 +587,20 @@ void webkit_web_context_set_preferred_languages(WebKitWebContext* context, const WebCore::languageDidChange(); } -WebKitDownload* webkitWebContextGetOrCreateDownload(DownloadProxy* downloadProxy) +WebKitDownload* webkitWebContextGetOrCreateDownload(WKDownloadRef wkDownload) { - GRefPtr<WebKitDownload> download = downloadsMap().get(downloadProxy); + GRefPtr<WebKitDownload> download = downloadsMap().get(wkDownload); if (download) return download.get(); - download = adoptGRef(webkitDownloadCreate(toAPI(downloadProxy))); - downloadsMap().set(downloadProxy, download.get()); + download = adoptGRef(webkitDownloadCreate(wkDownload)); + downloadsMap().set(wkDownload, download.get()); return download.get(); } -void webkitWebContextRemoveDownload(DownloadProxy* downloadProxy) +void webkitWebContextRemoveDownload(WKDownloadRef wkDownload) { - downloadsMap().remove(downloadProxy); + downloadsMap().remove(wkDownload); } void webkitWebContextDownloadStarted(WebKitWebContext* context, WebKitDownload* download) @@ -703,14 +608,14 @@ void webkitWebContextDownloadStarted(WebKitWebContext* context, WebKitDownload* g_signal_emit(context, signals[DOWNLOAD_STARTED], 0, download); } -WebContext* webkitWebContextGetContext(WebKitWebContext* context) +WKContextRef webkitWebContextGetWKContext(WebKitWebContext* context) { g_assert(WEBKIT_IS_WEB_CONTEXT(context)); return context->priv->context.get(); } -WebSoupRequestManagerProxy* webkitWebContextGetRequestManager(WebKitWebContext* context) +WKSoupRequestManagerRef webkitWebContextGetRequestManager(WebKitWebContext* context) { return context->priv->requestManager.get(); } diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h index ae79bec87..f77086f4d 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h @@ -28,7 +28,6 @@ #include <webkit2/WebKitCookieManager.h> #include <webkit2/WebKitDefines.h> #include <webkit2/WebKitDownload.h> -#include <webkit2/WebKitFaviconDatabase.h> #include <webkit2/WebKitSecurityManager.h> #include <webkit2/WebKitURISchemeRequest.h> @@ -115,15 +114,6 @@ webkit_web_context_download_uri (WebKitWebContext WEBKIT_API WebKitCookieManager * webkit_web_context_get_cookie_manager (WebKitWebContext *context); -WEBKIT_API WebKitFaviconDatabase * -webkit_web_context_get_favicon_database (WebKitWebContext *context); - -WEBKIT_API void -webkit_web_context_set_favicon_database_directory (WebKitWebContext *context, - const gchar *path); -WEBKIT_API const gchar * -webkit_web_context_get_favicon_database_directory (WebKitWebContext *context); - WEBKIT_API WebKitSecurityManager * webkit_web_context_get_security_manager (WebKitWebContext *context); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h index 67be48d5c..9e5536b3a 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h @@ -26,20 +26,15 @@ #ifndef WebKitWebContextPrivate_h #define WebKitWebContextPrivate_h -#include "DownloadProxy.h" -#include "WebContext.h" #include "WebKitPrivate.h" #include "WebKitURISchemeRequest.h" #include "WebKitWebContext.h" -#include "WebSoupRequestManagerProxy.h" -using namespace WebKit; - -WebContext* webkitWebContextGetContext(WebKitWebContext*); -WebKitDownload* webkitWebContextGetOrCreateDownload(DownloadProxy*); -void webkitWebContextRemoveDownload(DownloadProxy*); +WKContextRef webkitWebContextGetWKContext(WebKitWebContext*); +WebKitDownload* webkitWebContextGetOrCreateDownload(WKDownloadRef); +void webkitWebContextRemoveDownload(WKDownloadRef); void webkitWebContextDownloadStarted(WebKitWebContext*, WebKitDownload*); -WebSoupRequestManagerProxy* webkitWebContextGetRequestManager(WebKitWebContext*); +WKSoupRequestManagerRef webkitWebContextGetRequestManager(WebKitWebContext*); void webkitWebContextReceivedURIRequest(WebKitWebContext*, WebKitURISchemeRequest*); void webkitWebContextDidFailToLoadURIRequest(WebKitWebContext*, uint64_t requestID); void webkitWebContextDidFinishURIRequest(WebKitWebContext*, uint64_t requestID); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp index 236a4f304..301be899c 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp @@ -30,7 +30,6 @@ #include "WebKitContextMenuPrivate.h" #include "WebKitEnumTypes.h" #include "WebKitError.h" -#include "WebKitFaviconDatabasePrivate.h" #include "WebKitFormClient.h" #include "WebKitFullscreenClient.h" #include "WebKitHitTestResultPrivate.h" @@ -57,7 +56,6 @@ #include <WebCore/DragIcon.h> #include <WebCore/GOwnPtrGtk.h> #include <WebCore/GtkUtilities.h> -#include <WebCore/RefPtrCairo.h> #include <glib/gi18n-lib.h> #include <wtf/gobject/GOwnPtr.h> #include <wtf/gobject/GRefPtr.h> @@ -104,7 +102,6 @@ enum { PROP_WEB_CONTEXT, PROP_TITLE, PROP_ESTIMATED_LOAD_PROGRESS, - PROP_FAVICON, PROP_URI, PROP_ZOOM_LEVEL, PROP_IS_LOADING @@ -123,7 +120,6 @@ struct _WebKitWebViewPrivate { bool waitingForMainResource; gulong mainResourceResponseHandlerID; - gulong watchForChangesInFaviconHandlerID; WebKitLoadEvent lastDelayedEvent; GRefPtr<WebKitBackForwardList> backForwardList; @@ -143,9 +139,6 @@ struct _WebKitWebViewPrivate { ResourcesMap subresourcesMap; GRefPtr<WebKitWebInspector> inspector; - - RefPtr<cairo_surface_t> favicon; - GRefPtr<GCancellable> faviconCancellable; }; static guint signals[LAST_SIGNAL] = { 0, }; @@ -267,37 +260,6 @@ static void userAgentChanged(WebKitSettings* settings, GParamSpec*, WebKitWebVie getPage(webView)->setCustomUserAgent(String::fromUTF8(webkit_settings_get_user_agent(settings))); } -static void webkitWebViewCancelFaviconRequest(WebKitWebView* webView) -{ - if (!webView->priv->faviconCancellable) - return; - - g_cancellable_cancel(webView->priv->faviconCancellable.get()); - webView->priv->faviconCancellable = 0; -} - -static void webkitWebViewUpdateFavicon(WebKitWebView* webView, cairo_surface_t* favicon) -{ - if (webView->priv->favicon.get() == favicon) - return; - - webView->priv->favicon = favicon; - g_object_notify(G_OBJECT(webView), "favicon"); -} - -static void iconReadyCallback(WebKitFaviconDatabase* database, const char* uri, WebKitWebView* webView) -{ - // Consider only the icon matching the active URI for this webview. - if (webView->priv->activeURI != uri) - return; - - // Update the favicon only if we don't have one already. - if (!webView->priv->favicon) { - RefPtr<cairo_surface_t> favicon = adoptRef(webkitFaviconDatabaseGetFavicon(database, webView->priv->activeURI)); - webkitWebViewUpdateFavicon(webView, favicon.get()); - } -} - static void webkitWebViewSetSettings(WebKitWebView* webView, WebKitSettings* settings) { webView->priv->settings = settings; @@ -323,29 +285,6 @@ static void webkitWebViewDisconnectMainResourceResponseChangedSignalHandler(WebK priv->mainResourceResponseHandlerID = 0; } -static void webkitWebViewWatchForChangesInFavicon(WebKitWebView* webView) -{ - WebKitWebViewPrivate* priv = webView->priv; - WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(priv->context); - - // Make sure we only connect to this signal once per view. - if (priv->watchForChangesInFaviconHandlerID) - return; - - priv->watchForChangesInFaviconHandlerID = - g_signal_connect(database, "favicon-ready", G_CALLBACK(iconReadyCallback), webView); -} - -static void webkitWebViewDisconnectFaviconDatabaseSignalHandlers(WebKitWebView* webView) -{ - WebKitWebViewPrivate* priv = webView->priv; - WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(priv->context); - - if (priv->watchForChangesInFaviconHandlerID) - g_signal_handler_disconnect(database, priv->watchForChangesInFaviconHandlerID); - priv->watchForChangesInFaviconHandlerID = 0; -} - static void fileChooserDialogResponseCallback(GtkDialog* dialog, gint responseID, WebKitFileChooserRequest* request) { GRefPtr<WebKitFileChooserRequest> adoptedRequest = adoptGRef(request); @@ -398,7 +337,7 @@ static void webkitWebViewConstructed(GObject* object) WebKitWebViewPrivate* priv = webView->priv; WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(webView); - webkitWebViewBaseCreateWebPage(webViewBase, webkitWebContextGetContext(priv->context), 0); + webkitWebViewBaseCreateWebPage(webViewBase, toImpl(webkitWebContextGetWKContext(priv->context)), 0); attachLoaderClientToView(webView); attachUIClientToView(webView); @@ -446,9 +385,6 @@ static void webkitWebViewGetProperty(GObject* object, guint propId, GValue* valu case PROP_ESTIMATED_LOAD_PROGRESS: g_value_set_double(value, webkit_web_view_get_estimated_load_progress(webView)); break; - case PROP_FAVICON: - g_value_set_pointer(value, webkit_web_view_get_favicon(webView)); - break; case PROP_URI: g_value_set_string(value, webkit_web_view_get_uri(webView)); break; @@ -475,10 +411,8 @@ static void webkitWebViewFinalize(GObject* object) if (priv->modalLoop && g_main_loop_is_running(priv->modalLoop.get())) g_main_loop_quit(priv->modalLoop.get()); - webkitWebViewCancelFaviconRequest(webView); webkitWebViewDisconnectMainResourceResponseChangedSignalHandler(webView); webkitWebViewDisconnectSettingsSignalHandlers(webView); - webkitWebViewDisconnectFaviconDatabaseSignalHandlers(webView); priv->~WebKitWebViewPrivate(); G_OBJECT_CLASS(webkit_web_view_parent_class)->finalize(object); @@ -566,18 +500,6 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) 0.0, 1.0, 0.0, WEBKIT_PARAM_READABLE)); /** - * WebKitWebView:favicon: - * - * The favicon currently associated to the #WebKitWebView. - * See webkit_web_view_get_favicon() for more details. - */ - g_object_class_install_property(gObjectClass, - PROP_FAVICON, - g_param_spec_pointer("favicon", - _("Favicon"), - _("The favicon associated to the view, if any"), - WEBKIT_PARAM_READABLE)); - /** * WebKitWebView:uri: * * The current active URI of the #WebKitWebView. @@ -1236,10 +1158,9 @@ static void setCertificateToMainResource(WebKitWebView* webView) static void webkitWebViewEmitLoadChanged(WebKitWebView* webView, WebKitLoadEvent loadEvent) { - if (loadEvent == WEBKIT_LOAD_STARTED) { + if (loadEvent == WEBKIT_LOAD_STARTED) webkitWebViewSetIsLoading(webView, true); - webkitWebViewWatchForChangesInFavicon(webView); - } else if (loadEvent == WEBKIT_LOAD_FINISHED) { + else if (loadEvent == WEBKIT_LOAD_FINISHED) { webkitWebViewSetIsLoading(webView, false); webView->priv->waitingForMainResource = false; webkitWebViewDisconnectMainResourceResponseChangedSignalHandler(webView); @@ -1261,52 +1182,29 @@ static void webkitWebViewEmitDelayedLoadEvents(WebKitWebView* webView) priv->waitingForMainResource = false; } -static void getFaviconReadyCallback(GObject* object, GAsyncResult* result, gpointer userData) -{ - GOwnPtr<GError> error; - RefPtr<cairo_surface_t> favicon = adoptRef(webkit_favicon_database_get_favicon_finish(WEBKIT_FAVICON_DATABASE(object), result, &error.outPtr())); - if (!g_error_matches(error.get(), G_IO_ERROR, G_IO_ERROR_CANCELLED)) { - WebKitWebView* webView = WEBKIT_WEB_VIEW(userData); - webkitWebViewUpdateFavicon(webView, favicon.get()); - webView->priv->faviconCancellable = 0; - } -} - -static void webkitWebViewRequestFavicon(WebKitWebView* webView) -{ - WebKitWebViewPrivate* priv = webView->priv; - WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(priv->context); - priv->faviconCancellable = adoptGRef(g_cancellable_new()); - webkit_favicon_database_get_favicon(database, priv->activeURI.data(), priv->faviconCancellable.get(), getFaviconReadyCallback, webView); -} - void webkitWebViewLoadChanged(WebKitWebView* webView, WebKitLoadEvent loadEvent) { - WebKitWebViewPrivate* priv = webView->priv; if (loadEvent == WEBKIT_LOAD_STARTED) { // Finish a possible previous load waiting for main resource. webkitWebViewEmitDelayedLoadEvents(webView); - webkitWebViewCancelFaviconRequest(webView); - priv->loadingResourcesMap.clear(); - priv->mainResource = 0; - priv->waitingForMainResource = false; + webView->priv->loadingResourcesMap.clear(); + webView->priv->mainResource = 0; + webView->priv->waitingForMainResource = false; } else if (loadEvent == WEBKIT_LOAD_COMMITTED) { - webkitWebViewRequestFavicon(webView); - - priv->subresourcesMap.clear(); - if (!priv->mainResource) { + webView->priv->subresourcesMap.clear(); + if (!webView->priv->mainResource) { // When a page is loaded from the history cache, the main resource load callbacks // are called when the main frame load is finished. We want to make sure there's a // main resource available when load has been committed, so we delay the emission of // load-changed signal until main resource object has been created. - priv->waitingForMainResource = true; + webView->priv->waitingForMainResource = true; } else setCertificateToMainResource(webView); } - if (priv->waitingForMainResource) - priv->lastDelayedEvent = loadEvent; + if (webView->priv->waitingForMainResource) + webView->priv->lastDelayedEvent = loadEvent; else webkitWebViewEmitLoadChanged(webView, loadEvent); } @@ -1952,26 +1850,6 @@ const gchar* webkit_web_view_get_uri(WebKitWebView* webView) } /** - * webkit_web_view_get_favicon: - * @web_view: a #WebKitWebView - * - * Returns favicon currently associated to @web_view, if any. You can - * connect to notify::favicon signal of @web_view to be notified when - * the favicon is available. - * - * Returns: (transfer none): a pointer to a #cairo_surface_t with the - * favicon or %NULL if there's no icon associated with @web_view. - */ -cairo_surface_t* webkit_web_view_get_favicon(WebKitWebView* webView) -{ - g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); - if (webView->priv->activeURI.isNull()) - return 0; - - return webView->priv->favicon.get(); -} - -/** * webkit_web_view_get_custom_charset: * @web_view: a #WebKitWebView * @@ -2314,7 +2192,7 @@ static void webkitWebViewRunJavaScriptCallback(WKSerializedScriptValueRef wkSeri g_simple_async_result_take_error(result.get(), error); else if (wkSerializedScriptValue) { GRefPtr<WebKitWebView> webView = adoptGRef(WEBKIT_WEB_VIEW(g_async_result_get_source_object(G_ASYNC_RESULT(result.get())))); - data->scriptResult = webkitJavascriptResultCreate(webView.get(), toImpl(wkSerializedScriptValue)); + data->scriptResult = webkitJavascriptResultCreate(webView.get(), wkSerializedScriptValue); } else { g_set_error_literal(&error, WEBKIT_JAVASCRIPT_ERROR, WEBKIT_JAVASCRIPT_ERROR_SCRIPT_FAILED, _("An exception was raised in JavaScript")); g_simple_async_result_take_error(result.get(), error); @@ -2429,94 +2307,6 @@ WebKitJavascriptResult* webkit_web_view_run_javascript_finish(WebKitWebView* web return data->scriptResult ? webkit_javascript_result_ref(data->scriptResult) : 0; } -static void resourcesStreamReadCallback(GObject* object, GAsyncResult* result, gpointer userData) -{ - GOutputStream* outputStream = G_OUTPUT_STREAM(object); - GRefPtr<GSimpleAsyncResult> runJavascriptResult = adoptGRef(G_SIMPLE_ASYNC_RESULT(userData)); - - GError* error = 0; - g_output_stream_splice_finish(outputStream, result, &error); - if (error) { - g_simple_async_result_take_error(runJavascriptResult.get(), error); - g_simple_async_result_complete(runJavascriptResult.get()); - return; - } - - GRefPtr<WebKitWebView> webView = adoptGRef(WEBKIT_WEB_VIEW(g_async_result_get_source_object(G_ASYNC_RESULT(runJavascriptResult.get())))); - gpointer outputStreamData = g_memory_output_stream_get_data(G_MEMORY_OUTPUT_STREAM(outputStream)); - getPage(webView.get())->runJavaScriptInMainFrame(String::fromUTF8(reinterpret_cast<const gchar*>(outputStreamData)), - ScriptValueCallback::create(runJavascriptResult.leakRef(), webkitWebViewRunJavaScriptCallback)); -} - -/** - * webkit_web_view_run_javascript_from_gresource: - * @web_view: a #WebKitWebView - * @resource: the location of the resource to load - * @cancellable: (allow-none): a #GCancellable or %NULL to ignore - * @callback: (scope async): a #GAsyncReadyCallback to call when the script finished - * @user_data: (closure): the data to pass to callback function - * - * Asynchronously run the script from @resource in the context of the - * current page in @web_view. - * - * When the operation is finished, @callback will be called. You can - * then call webkit_web_view_run_javascript_from_gresource_finish() to get the result - * of the operation. - */ -void webkit_web_view_run_javascript_from_gresource(WebKitWebView* webView, const gchar* resource, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer userData) -{ - g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); - g_return_if_fail(resource); - - GRefPtr<GSimpleAsyncResult> result = adoptGRef(g_simple_async_result_new(G_OBJECT(webView), callback, userData, - reinterpret_cast<gpointer>(webkit_web_view_run_javascript_from_gresource))); - RunJavaScriptAsyncData* data = createRunJavaScriptAsyncData(); - data->cancellable = cancellable; - g_simple_async_result_set_op_res_gpointer(result.get(), data, reinterpret_cast<GDestroyNotify>(destroyRunJavaScriptAsyncData)); - - GError* error = 0; - GRefPtr<GInputStream> inputStream = adoptGRef(g_resources_open_stream(resource, G_RESOURCE_LOOKUP_FLAGS_NONE, &error)); - if (error) { - g_simple_async_result_take_error(result.get(), error); - g_simple_async_result_complete_in_idle(result.get()); - return; - } - - GRefPtr<GOutputStream> outputStream = adoptGRef(g_memory_output_stream_new(0, 0, fastRealloc, fastFree)); - g_output_stream_splice_async(outputStream.get(), inputStream.get(), - static_cast<GOutputStreamSpliceFlags>(G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET), - G_PRIORITY_DEFAULT, - cancellable, resourcesStreamReadCallback, result.leakRef()); -} - -/** - * webkit_web_view_run_javascript_from_gresource_finish: - * @web_view: a #WebKitWebView - * @result: a #GAsyncResult - * @error: return location for error or %NULL to ignore - * - * Finish an asynchronous operation started with webkit_web_view_run_javascript_from_gresource(). - * - * Check webkit_web_view_run_javascript_finish() for a usage example. - * - * Returns: (transfer full): a #WebKitJavascriptResult with the result of the last executed statement in @script - * or %NULL in case of error - */ -WebKitJavascriptResult* webkit_web_view_run_javascript_from_gresource_finish(WebKitWebView* webView, GAsyncResult* result, GError** error) -{ - g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); - g_return_val_if_fail(G_IS_ASYNC_RESULT(result), 0); - - GSimpleAsyncResult* simpleResult = G_SIMPLE_ASYNC_RESULT(result); - g_warn_if_fail(g_simple_async_result_get_source_tag(simpleResult) == webkit_web_view_run_javascript_from_gresource); - - if (g_simple_async_result_propagate_error(simpleResult, error)) - return 0; - - RunJavaScriptAsyncData* data = static_cast<RunJavaScriptAsyncData*>(g_simple_async_result_get_op_res_gpointer(simpleResult)); - return data->scriptResult ? webkit_javascript_result_ref(data->scriptResult) : 0; -} - /** * webkit_web_view_get_main_resource: * @web_view: a #WebKitWebView @@ -2551,7 +2341,7 @@ GList* webkit_web_view_get_subresources(WebKitWebView* webView) WebKitWebViewPrivate* priv = webView->priv; ResourcesMap::const_iterator end = priv->subresourcesMap.end(); for (ResourcesMap::const_iterator it = priv->subresourcesMap.begin(); it != end; ++it) - subresources = g_list_prepend(subresources, it->value.get()); + subresources = g_list_prepend(subresources, it->second.get()); return g_list_reverse(subresources); } diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h index ac2e2813f..8a397b752 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h @@ -191,185 +191,170 @@ struct _WebKitWebViewClass { }; WEBKIT_API GType -webkit_web_view_get_type (void); +webkit_web_view_get_type (void); WEBKIT_API GtkWidget * -webkit_web_view_new (void); +webkit_web_view_new (void); WEBKIT_API GtkWidget * -webkit_web_view_new_with_context (WebKitWebContext *context); +webkit_web_view_new_with_context (WebKitWebContext *context); WEBKIT_API WebKitWebContext * -webkit_web_view_get_context (WebKitWebView *web_view); +webkit_web_view_get_context (WebKitWebView *web_view); WEBKIT_API void -webkit_web_view_load_uri (WebKitWebView *web_view, - const gchar *uri); +webkit_web_view_load_uri (WebKitWebView *web_view, + const gchar *uri); WEBKIT_API void -webkit_web_view_load_html (WebKitWebView *web_view, - const gchar *content, - const gchar *base_uri); +webkit_web_view_load_html (WebKitWebView *web_view, + const gchar *content, + const gchar *base_uri); WEBKIT_API void -webkit_web_view_load_alternate_html (WebKitWebView *web_view, - const gchar *content, - const gchar *content_uri, - const gchar *base_uri); +webkit_web_view_load_alternate_html (WebKitWebView *web_view, + const gchar *content, + const gchar *content_uri, + const gchar *base_uri); WEBKIT_API void -webkit_web_view_load_plain_text (WebKitWebView *web_view, - const gchar *plain_text); +webkit_web_view_load_plain_text (WebKitWebView *web_view, + const gchar *plain_text); WEBKIT_API void -webkit_web_view_load_request (WebKitWebView *web_view, - WebKitURIRequest *request); +webkit_web_view_load_request (WebKitWebView *web_view, + WebKitURIRequest *request); WEBKIT_API void -webkit_web_view_stop_loading (WebKitWebView *web_view); +webkit_web_view_stop_loading (WebKitWebView *web_view); WEBKIT_API gboolean -webkit_web_view_is_loading (WebKitWebView *web_view); +webkit_web_view_is_loading (WebKitWebView *web_view); WEBKIT_API const gchar * -webkit_web_view_get_title (WebKitWebView *web_view); +webkit_web_view_get_title (WebKitWebView *web_view); WEBKIT_API void -webkit_web_view_reload (WebKitWebView *web_view); +webkit_web_view_reload (WebKitWebView *web_view); WEBKIT_API void -webkit_web_view_reload_bypass_cache (WebKitWebView *web_view); +webkit_web_view_reload_bypass_cache (WebKitWebView *web_view); WEBKIT_API gdouble -webkit_web_view_get_estimated_load_progress (WebKitWebView *web_view); +webkit_web_view_get_estimated_load_progress (WebKitWebView *web_view); WEBKIT_API void -webkit_web_view_go_back (WebKitWebView *web_view); +webkit_web_view_go_back (WebKitWebView *web_view); WEBKIT_API gboolean -webkit_web_view_can_go_back (WebKitWebView *web_view); +webkit_web_view_can_go_back (WebKitWebView *web_view); WEBKIT_API void -webkit_web_view_go_forward (WebKitWebView *web_view); +webkit_web_view_go_forward (WebKitWebView *web_view); WEBKIT_API gboolean -webkit_web_view_can_go_forward (WebKitWebView *web_view); +webkit_web_view_can_go_forward (WebKitWebView *web_view); WEBKIT_API WebKitBackForwardList * -webkit_web_view_get_back_forward_list (WebKitWebView *web_view); +webkit_web_view_get_back_forward_list (WebKitWebView *web_view); WEBKIT_API void -webkit_web_view_go_to_back_forward_list_item (WebKitWebView *web_view, - WebKitBackForwardListItem *list_item); +webkit_web_view_go_to_back_forward_list_item (WebKitWebView *web_view, + WebKitBackForwardListItem *list_item); WEBKIT_API const gchar * -webkit_web_view_get_uri (WebKitWebView *web_view); - -WEBKIT_API cairo_surface_t * -webkit_web_view_get_favicon (WebKitWebView *web_view); +webkit_web_view_get_uri (WebKitWebView *web_view); WEBKIT_API const gchar * -webkit_web_view_get_custom_charset (WebKitWebView *web_view); +webkit_web_view_get_custom_charset (WebKitWebView *web_view); WEBKIT_API void -webkit_web_view_set_custom_charset (WebKitWebView *web_view, - const gchar *charset); +webkit_web_view_set_custom_charset (WebKitWebView *web_view, + const gchar *charset); WEBKIT_API void -webkit_web_view_set_settings (WebKitWebView *web_view, - WebKitSettings *settings); +webkit_web_view_set_settings (WebKitWebView *web_view, + WebKitSettings *settings); WEBKIT_API WebKitSettings * -webkit_web_view_get_settings (WebKitWebView *web_view); +webkit_web_view_get_settings (WebKitWebView *web_view); WEBKIT_API WebKitWindowProperties * -webkit_web_view_get_window_properties (WebKitWebView *web_view); +webkit_web_view_get_window_properties (WebKitWebView *web_view); WEBKIT_API void -webkit_web_view_set_zoom_level (WebKitWebView *web_view, - gdouble zoom_level); +webkit_web_view_set_zoom_level (WebKitWebView *web_view, + gdouble zoom_level); WEBKIT_API gdouble -webkit_web_view_get_zoom_level (WebKitWebView *web_view); +webkit_web_view_get_zoom_level (WebKitWebView *web_view); WEBKIT_API void -webkit_web_view_can_execute_editing_command (WebKitWebView *web_view, - const gchar *command, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); +webkit_web_view_can_execute_editing_command (WebKitWebView *web_view, + const gchar *command, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); WEBKIT_API gboolean -webkit_web_view_can_execute_editing_command_finish (WebKitWebView *web_view, - GAsyncResult *result, - GError **error); +webkit_web_view_can_execute_editing_command_finish (WebKitWebView *web_view, + GAsyncResult *result, + GError **error); WEBKIT_API void -webkit_web_view_execute_editing_command (WebKitWebView *web_view, - const gchar *command); +webkit_web_view_execute_editing_command (WebKitWebView *web_view, + const gchar *command); WEBKIT_API WebKitFindController * -webkit_web_view_get_find_controller (WebKitWebView *web_view); +webkit_web_view_get_find_controller (WebKitWebView *web_view); WEBKIT_API JSGlobalContextRef -webkit_web_view_get_javascript_global_context (WebKitWebView *web_view); +webkit_web_view_get_javascript_global_context (WebKitWebView *web_view); WEBKIT_API void -webkit_web_view_run_javascript (WebKitWebView *web_view, - const gchar *script, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); -WEBKIT_API WebKitJavascriptResult * -webkit_web_view_run_javascript_finish (WebKitWebView *web_view, - GAsyncResult *result, - GError **error); - -WEBKIT_API void -webkit_web_view_run_javascript_from_gresource (WebKitWebView *web_view, - const gchar *resource, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); - +webkit_web_view_run_javascript (WebKitWebView *web_view, + const gchar *script, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); WEBKIT_API WebKitJavascriptResult * -webkit_web_view_run_javascript_from_gresource_finish (WebKitWebView *web_view, - GAsyncResult *result, - GError **error); +webkit_web_view_run_javascript_finish (WebKitWebView *web_view, + GAsyncResult *result, + GError **error); WEBKIT_API WebKitWebResource * -webkit_web_view_get_main_resource (WebKitWebView *web_view); +webkit_web_view_get_main_resource (WebKitWebView *web_view); WEBKIT_API GList * -webkit_web_view_get_subresources (WebKitWebView *web_view); +webkit_web_view_get_subresources (WebKitWebView *web_view); WEBKIT_API WebKitWebInspector * -webkit_web_view_get_inspector (WebKitWebView *web_view); +webkit_web_view_get_inspector (WebKitWebView *web_view); WEBKIT_API gboolean -webkit_web_view_can_show_mime_type (WebKitWebView *web_view, - const gchar *mime_type); +webkit_web_view_can_show_mime_type (WebKitWebView *web_view, + const gchar *mime_type); WEBKIT_API void -webkit_web_view_save (WebKitWebView *web_view, - WebKitSaveMode save_mode, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); +webkit_web_view_save (WebKitWebView *web_view, + WebKitSaveMode save_mode, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); WEBKIT_API GInputStream * -webkit_web_view_save_finish (WebKitWebView *web_view, - GAsyncResult *result, - GError **error); +webkit_web_view_save_finish (WebKitWebView *web_view, + GAsyncResult *result, + GError **error); WEBKIT_API void -webkit_web_view_save_to_file (WebKitWebView *web_view, - GFile *file, - WebKitSaveMode save_mode, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); +webkit_web_view_save_to_file (WebKitWebView *web_view, + GFile *file, + WebKitSaveMode save_mode, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); WEBKIT_API gboolean -webkit_web_view_save_to_file_finish (WebKitWebView *web_view, - GAsyncResult *result, - GError **error); +webkit_web_view_save_to_file_finish (WebKitWebView *web_view, + GAsyncResult *result, + GError **error); G_END_DECLS diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp index e5bac671e..b42b2ee8f 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp @@ -75,10 +75,6 @@ using namespace WebCore; typedef HashMap<GtkWidget*, IntRect> WebKitWebViewChildrenMap; -#if USE(TEXTURE_MAPPER_GL) -void redirectedWindowDamagedCallback(void* data); -#endif - struct _WebKitWebViewBasePrivate { WebKitWebViewChildrenMap children; OwnPtr<PageClientImpl> pageClient; @@ -115,6 +111,7 @@ struct _WebKitWebViewBasePrivate { #if USE(TEXTURE_MAPPER_GL) OwnPtr<RedirectedXCompositeWindow> redirectedWindow; + bool readyToRenderAcceleratedCompositingResults; #endif }; @@ -303,7 +300,7 @@ static void webkitWebViewBaseContainerForall(GtkContainer* container, gboolean i WebKitWebViewChildrenMap children = priv->children; WebKitWebViewChildrenMap::const_iterator end = children.end(); for (WebKitWebViewChildrenMap::const_iterator current = children.begin(); current != end; ++current) - (*callback)(current->key, callbackData); + (*callback)(current->first, callbackData); if (includeInternals && priv->inspectorView) (*callback)(priv->inspectorView, callbackData); @@ -354,8 +351,7 @@ static void webkit_web_view_base_init(WebKitWebViewBase* webkitWebViewBase) #if USE(TEXTURE_MAPPER_GL) priv->redirectedWindow = RedirectedXCompositeWindow::create(IntSize(1, 1)); - if (priv->redirectedWindow) - priv->redirectedWindow->setDamageNotifyCallback(redirectedWindowDamagedCallback, webkitWebViewBase); + priv->readyToRenderAcceleratedCompositingResults = false; #endif } @@ -368,9 +364,10 @@ static bool webkitWebViewRenderAcceleratedCompositingResults(WebKitWebViewBase* // To avoid flashes when initializing accelerated compositing for the first // time, we wait until we know there's a frame ready before rendering. WebKitWebViewBasePrivate* priv = webViewBase->priv; - if (!priv->redirectedWindow) + if (!priv->readyToRenderAcceleratedCompositingResults) return false; + ASSERT(priv->redirectedWindow); cairo_rectangle(cr, clipRect->x, clipRect->y, clipRect->width, clipRect->height); cairo_surface_t* surface = priv->redirectedWindow->cairoSurfaceForWidget(GTK_WIDGET(webViewBase)); cairo_set_source_surface(cr, surface, 0, 0); @@ -433,7 +430,7 @@ static void resizeWebKitWebViewBaseFromAllocation(WebKitWebViewBase* webViewBase } #if USE(TEXTURE_MAPPER_GL) - if (sizeChanged && webViewBase->priv->redirectedWindow) + if (sizeChanged) webViewBase->priv->redirectedWindow->resize(viewRect.size()); #endif @@ -804,8 +801,7 @@ void webkitWebViewBaseCreateWebPage(WebKitWebViewBase* webkitWebViewBase, WebCon #endif #if USE(TEXTURE_MAPPER_GL) - if (priv->redirectedWindow) - priv->pageProxy->setAcceleratedCompositingWindowId(priv->redirectedWindow->windowId()); + priv->pageProxy->setAcceleratedCompositingWindowId(priv->redirectedWindow->windowId()); #endif } @@ -932,9 +928,37 @@ GdkEvent* webkitWebViewBaseTakeContextMenuEvent(WebKitWebViewBase* webkitWebView } #if USE(TEXTURE_MAPPER_GL) -void redirectedWindowDamagedCallback(void* data) +static gboolean queueAnotherDrawOfAcceleratedCompositingResults(gpointer* webViewBasePointer) { - gtk_widget_queue_draw(GTK_WIDGET(data)); + // The WebViewBase may have been destroyed in the time since we queued this + // draw and the time we are actually executing. + if (!*webViewBasePointer) { + fastFree(webViewBasePointer); + return FALSE; + } + + WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(*webViewBasePointer); + gtk_widget_queue_draw(GTK_WIDGET(webViewBase)); + webViewBase->priv->readyToRenderAcceleratedCompositingResults = true; + + g_object_remove_weak_pointer(G_OBJECT(webViewBase), webViewBasePointer); + fastFree(webViewBasePointer); + + return FALSE; +} + +void webkitWebViewBaseQueueDrawOfAcceleratedCompositingResults(WebKitWebViewBase* webViewBase) +{ + gtk_widget_queue_draw(GTK_WIDGET(webViewBase)); + + // Redraw again, one frame later, as it might take some time for the new GL frame to be available. + // This prevents the display from always being one frame behind in the case GL hasn't yet finished + // rendering to the window. + // TODO: Add XDamage support to RedirectedXCompositeWindow to accomplish this. + gpointer* webViewBasePointer = static_cast<gpointer*>(fastMalloc(sizeof(gpointer))); + g_object_add_weak_pointer(G_OBJECT(webViewBase), webViewBasePointer); + *webViewBasePointer = webViewBase; + g_timeout_add(1000 / 60, reinterpret_cast<GSourceFunc>(queueAnotherDrawOfAcceleratedCompositingResults), webViewBasePointer); } #endif diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml index 8623af33e..a7f34e6d1 100644 --- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml +++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml @@ -30,7 +30,6 @@ <xi:include href="xml/WebKitPrintOperation.xml"/> <xi:include href="xml/WebKitWebResource.xml"/> <xi:include href="xml/WebKitError.xml"/> - <xi:include href="xml/WebKitFaviconDatabase.xml"/> <xi:include href="xml/WebKitFileChooserRequest.xml"/> <xi:include href="xml/WebKitFindController.xml"/> <xi:include href="xml/WebKitCookieManager.xml"/> diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt index f56267b9a..1827b6b16 100644 --- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt +++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt @@ -30,9 +30,6 @@ webkit_web_context_set_cache_model webkit_web_context_clear_cache webkit_web_context_download_uri webkit_web_context_get_cookie_manager -webkit_web_context_get_favicon_database -webkit_web_context_set_favicon_database_directory -webkit_web_context_get_favicon_database_directory webkit_web_context_get_security_manager webkit_web_context_set_additional_plugins_directory webkit_web_context_get_plugins @@ -101,7 +98,6 @@ webkit_web_view_set_custom_charset webkit_web_view_get_back_forward_list webkit_web_view_go_to_back_forward_list_item webkit_web_view_get_uri -webkit_web_view_get_favicon webkit_web_view_set_settings webkit_web_view_get_settings webkit_web_view_get_window_properties @@ -115,8 +111,6 @@ webkit_web_view_get_inspector webkit_web_view_get_javascript_global_context webkit_web_view_run_javascript webkit_web_view_run_javascript_finish -webkit_web_view_run_javascript_from_gresource -webkit_web_view_run_javascript_from_gresource_finish webkit_web_view_can_show_mime_type webkit_web_view_save webkit_web_view_save_finish @@ -297,8 +291,6 @@ webkit_settings_set_enable_page_cache webkit_settings_get_user_agent webkit_settings_set_user_agent webkit_settings_set_user_agent_with_application_details -webkit_settings_get_enable_smooth_scrolling -webkit_settings_set_enable_smooth_scrolling <SUBSECTION Standard> WebKitSettingsClass @@ -610,31 +602,6 @@ webkit_javascript_error_quark </SECTION> <SECTION> -<FILE>WebKitFaviconDatabase</FILE> -WebKitFaviconDatabase -WEBKIT_FAVICON_DATABASE_ERROR -WebKitFaviconDatabaseError -webkit_favicon_database_get_favicon -webkit_favicon_database_get_favicon_finish -webkit_favicon_database_get_favicon_uri -webkit_favicon_database_clear - -<SUBSECTION Standard> -WebKitFaviconDatabaseClass -WEBKIT_TYPE_FAVICON_DATABASE -WEBKIT_FAVICON_DATABASE -WEBKIT_IS_FAVICON_DATABASE -WEBKIT_FAVICON_DATABASE_CLASS -WEBKIT_IS_FAVICON_DATABASE_CLASS -WEBKIT_FAVICON_DATABASE_GET_CLASS - -<SUBSECTION Private> -WebKitFaviconDatabasePrivate -webkit_favicon_database_get_type -webkit_favicon_database_error_quark -</SECTION> - -<SECTION> <FILE>WebKitFileChooserRequest</FILE> WebKitFileChooserRequest webkit_file_chooser_request_get_mime_types @@ -778,7 +745,6 @@ WebKitURISchemeRequest webkit_uri_scheme_request_get_scheme webkit_uri_scheme_request_get_uri webkit_uri_scheme_request_get_path -webkit_uri_scheme_request_get_web_view webkit_uri_scheme_request_finish <SUBSECTION Standard> diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am b/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am index 06ea1af7c..3fadf40b4 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am +++ b/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am @@ -11,7 +11,6 @@ TEST_PROGS += \ Programs/WebKit2APITests/TestResources \ Programs/WebKit2APITests/TestSSL \ Programs/WebKit2APITests/TestWebKitVersion \ - Programs/WebKit2APITests/TestWebKitFaviconDatabase \ Programs/WebKit2APITests/TestWebKitFindController \ Programs/WebKit2APITests/TestWebKitPolicyClient \ Programs/WebKit2APITests/TestWebKitSettings \ @@ -30,7 +29,6 @@ endif webkit2_tests_cppflags = \ -DWEBKIT_EXEC_PATH=\"${shell pwd}/$(top_builddir)/Programs\" \ -DWEBKIT_SRC_DIR=\"${shell pwd}/${srcdir}\" \ - -DWEBKIT_DERIVED_SRC_DIR=\"${shell pwd}/${top_builddir}/DerivedSources\" \ $(javascriptcore_cppflags) \ -I$(srcdir)/Source/JavaScriptCore \ -I$(srcdir)/Source \ @@ -57,12 +55,6 @@ 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) --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 - noinst_LTLIBRARIES += Libraries/libWebKit2APITestCore.la Libraries_libWebKit2APITestCore_la_SOURCES = \ Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp \ @@ -77,9 +69,7 @@ Libraries_libWebKit2APITestCore_la_CPPFLAGS = $(webkit2_tests_cppflags) EXTRA_DIST += \ Source/WebKit2/UIProcess/API/gtk/tests/resources/test-cert.pem \ - Source/WebKit2/UIProcess/API/gtk/tests/resources/test-key.pem \ - Source/WebKit2/UIProcess/API/gtk/tests/resources/webkit2gtk-tests.gresource.xml \ - Source/WebKit2/UIProcess/API/gtk/tests/resources/link-title.js + Source/WebKit2/UIProcess/API/gtk/tests/resources/test-key.pem Programs_WebKit2APITests_TestWebKitWebContext_SOURCES = \ Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp @@ -151,12 +141,6 @@ Programs_WebKit2APITests_TestPrinting_CPPFLAGS = $(webkit2_tests_cppflags) $(GTK Programs_WebKit2APITests_TestPrinting_LDADD = $(webkit2_tests_ldadd) $(GTK_UNIX_PRINTING_LIBS) Programs_WebKit2APITests_TestPrinting_LDFLAGS = $(webkit2_tests_ldflags) -Programs_WebKit2APITests_TestWebKitFaviconDatabase_SOURCES = \ - Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitFaviconDatabase.cpp -Programs_WebKit2APITests_TestWebKitFaviconDatabase_CPPFLAGS = $(webkit2_tests_cppflags) -Programs_WebKit2APITests_TestWebKitFaviconDatabase_LDADD = $(webkit2_tests_ldadd) -Programs_WebKit2APITests_TestWebKitFaviconDatabase_LDFLAGS = $(webkit2_tests_ldflags) - Programs_WebKit2APITests_TestWebKitFindController_SOURCES = \ Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitFindController.cpp Programs_WebKit2APITests_TestWebKitFindController_CPPFLAGS = $(webkit2_tests_cppflags) diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestBackForwardList.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestBackForwardList.cpp index b479366a4..e70e391ff 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestBackForwardList.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestBackForwardList.cpp @@ -38,11 +38,6 @@ static void serverCallback(SoupServer* server, SoupMessage* msg, const char* pat return; } - if (g_str_has_suffix(path, "favicon.ico")) { - soup_message_set_status(msg, SOUP_STATUS_NOT_FOUND); - return; - } - soup_message_set_status(msg, SOUP_STATUS_OK); char* body = g_strdup_printf("<html><title>%s</title><body>%s</body></html>", path + 1, path + 1); diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestCookieManager.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestCookieManager.cpp index 94aeef6e1..2fe8998b5 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestCookieManager.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestCookieManager.cpp @@ -295,7 +295,7 @@ static void serverCallback(SoupServer* server, SoupMessage* message, const char* } else if (g_str_equal(path, "/image.png")) soup_message_headers_replace(message->response_headers, "Set-Cookie", "baz=qux; Max-Age=60"); else - soup_message_set_status(message, SOUP_STATUS_NOT_FOUND); + g_assert_not_reached(); soup_message_body_complete(message->response_body); } diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp index 8fcf33009..c3a14193d 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp @@ -312,8 +312,7 @@ static void serverCallback(SoupServer* server, SoupMessage* message, const char* soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, responseString, strlen(responseString)); soup_server_unpause_message(server, message); return; - } else - soup_message_set_status(message, SOUP_STATUS_NOT_FOUND); + } soup_message_body_complete(message->response_body); } diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestMain.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestMain.cpp index 9db47f82b..8622af19c 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestMain.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestMain.cpp @@ -25,24 +25,12 @@ void beforeAll(); void afterAll(); -static void registerGResource(void) -{ - GOwnPtr<char> resourcesPath(g_build_filename(WEBKIT_DERIVED_SRC_DIR, "WebKit2", "webkit2gtk-tests-resources.gresource", NULL)); - GResource* resource = g_resource_load(resourcesPath.get(), 0); - g_assert(resource); - - g_resources_register(resource); - g_resource_unref(resource); -} - int main(int argc, char** argv) { gtk_test_init(&argc, &argv, 0); g_setenv("WEBKIT_EXEC_PATH", WEBKIT_EXEC_PATH, FALSE); g_test_bug_base("https://bugs.webkit.org/"); - registerGResource(); - beforeAll(); int returnValue = g_test_run(); afterAll(); diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp index 20b90b0b4..7e2e5de61 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp @@ -80,11 +80,6 @@ public: { test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(resource)); test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(request)); - - // Ignore favicons. - if (g_str_has_suffix(webkit_uri_request_get_uri(request), "favicon.ico")) - return; - test->resourceLoadStarted(resource, request); g_signal_connect(resource, "sent-request", G_CALLBACK(resourceSentRequestCallback), test); g_signal_connect(resource, "notify::response", G_CALLBACK(resourceReceivedResponseCallback), test); @@ -512,31 +507,21 @@ static void testWebResourceGetData(ResourcesTest* test, gconstpointer) static void testWebViewResourcesHistoryCache(SingleResourceLoadTest* test, gconstpointer) { - CString javascriptURI = kServer->getURIForPath("/javascript.html"); - test->loadURI(javascriptURI.data()); + test->loadURI(kServer->getURIForPath("/").data()); test->waitUntilResourceLoadFinished(); - WebKitWebResource* resource = webkit_web_view_get_main_resource(test->m_webView); - g_assert(resource); - g_assert_cmpstr(webkit_web_resource_get_uri(resource), ==, javascriptURI.data()); + g_assert(webkit_web_view_get_main_resource(test->m_webView)); - CString simpleStyleCSSURI = kServer->getURIForPath("/simple-style-css.html"); - test->loadURI(simpleStyleCSSURI.data()); + test->loadURI(kServer->getURIForPath("/javascript.html").data()); test->waitUntilResourceLoadFinished(); - resource = webkit_web_view_get_main_resource(test->m_webView); - g_assert(resource); - g_assert_cmpstr(webkit_web_resource_get_uri(resource), ==, simpleStyleCSSURI.data()); + g_assert(webkit_web_view_get_main_resource(test->m_webView)); test->goBack(); test->waitUntilResourceLoadFinished(); - resource = webkit_web_view_get_main_resource(test->m_webView); - g_assert(resource); - g_assert_cmpstr(webkit_web_resource_get_uri(resource), ==, javascriptURI.data()); + g_assert(webkit_web_view_get_main_resource(test->m_webView)); test->goForward(); test->waitUntilResourceLoadFinished(); - resource = webkit_web_view_get_main_resource(test->m_webView); - g_assert(resource); - g_assert_cmpstr(webkit_web_resource_get_uri(resource), ==, simpleStyleCSSURI.data()); + g_assert(webkit_web_view_get_main_resource(test->m_webView)); } static void addCacheHTTPHeadersToResponse(SoupMessage* message) @@ -582,9 +567,6 @@ static void serverCallback(SoupServer* server, SoupMessage* message, const char* } else if (g_str_equal(path, "/invalid-css.html")) { static const char* invalidCSSHtml = "<html><head><link rel='stylesheet' href='/invalid.css' type='text/css'></head><body></html>"; soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, invalidCSSHtml, strlen(invalidCSSHtml)); - } else if (g_str_equal(path, "/simple-style-css.html")) { - static const char* simpleStyleCSSHtml = "<html><head><link rel='stylesheet' href='/simple-style.css' type='text/css'></head><body></html>"; - soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, simpleStyleCSSHtml, strlen(simpleStyleCSSHtml)); } else if (g_str_equal(path, "/style.css")) { soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, kStyleCSS, strlen(kStyleCSS)); addCacheHTTPHeadersToResponse(message); @@ -612,8 +594,6 @@ static void serverCallback(SoupServer* server, SoupMessage* message, const char* soup_message_headers_append(message->response_headers, "Location", "/simple-style.css"); } else if (g_str_equal(path, "/invalid.css")) soup_message_set_status(message, SOUP_STATUS_CANT_CONNECT); - else - soup_message_set_status(message, SOUP_STATUS_NOT_FOUND); soup_message_body_complete(message->response_body); } diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestSSL.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestSSL.cpp index 8fa013dc4..40e9fbeee 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestSSL.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestSSL.cpp @@ -82,12 +82,9 @@ static void serverCallback(SoupServer* server, SoupMessage* message, const char* return; } - if (g_str_equal(path, "/")) { - soup_message_set_status(message, SOUP_STATUS_OK); - soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, indexHTML, strlen(indexHTML)); - soup_message_body_complete(message->response_body); - } else - soup_message_set_status(message, SOUP_STATUS_NOT_FOUND); + soup_message_set_status(message, SOUP_STATUS_OK); + soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, indexHTML, strlen(indexHTML)); + soup_message_body_complete(message->response_body); } void beforeAll() diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitFaviconDatabase.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitFaviconDatabase.cpp deleted file mode 100644 index 40fb5a17a..000000000 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitFaviconDatabase.cpp +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright (C) 2012 Igalia S.L. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2,1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" - -#include "WebKitTestServer.h" -#include "WebViewTest.h" -#include <glib/gstdio.h> -#include <libsoup/soup.h> -#include <wtf/gobject/GOwnPtr.h> - -static WebKitTestServer* kServer; -static char* kTempDirectory; - -class FaviconDatabaseTest: public WebViewTest { -public: - MAKE_GLIB_TEST_FIXTURE(FaviconDatabaseTest); - - FaviconDatabaseTest() - : m_webContext(webkit_web_context_get_default()) - , m_favicon(0) - , m_error(0) - , m_iconReadySignalReceived(false) - , m_faviconNotificationReceived(false) - { - WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(m_webContext); - g_signal_connect(database, "favicon-ready", G_CALLBACK(iconReadyCallback), this); - } - - ~FaviconDatabaseTest() - { - if (m_favicon) - cairo_surface_destroy(m_favicon); - - WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(m_webContext); - g_signal_handlers_disconnect_matched(database, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this); - } - - static void iconReadyCallback(WebKitFaviconDatabase* database, const char* pageURI, FaviconDatabaseTest* test) - { - g_assert_cmpstr(webkit_web_view_get_uri(test->m_webView), ==, pageURI); - test->m_iconReadySignalReceived = true; - } - - static void faviconChangedCallback(WebKitWebView* webView, GParamSpec* pspec, gpointer data) - { - FaviconDatabaseTest* test = static_cast<FaviconDatabaseTest*>(data); - g_assert(test->m_webView == webView); - test->m_faviconNotificationReceived = true; - test->quitMainLoop(); - } - - static void getFaviconCallback(GObject* sourceObject, GAsyncResult* result, void* data) - { - FaviconDatabaseTest* test = static_cast<FaviconDatabaseTest*>(data); - WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(test->m_webContext); - test->m_favicon = webkit_favicon_database_get_favicon_finish(database, result, &test->m_error.outPtr()); - test->quitMainLoop(); - } - - void waitUntilFaviconChanged() - { - m_faviconNotificationReceived = false; - unsigned long handlerID = g_signal_connect(m_webView, "notify::favicon", G_CALLBACK(faviconChangedCallback), this); - g_main_loop_run(m_mainLoop); - g_signal_handler_disconnect(m_webView, handlerID); - } - - void getFaviconForPageURIAndWaitUntilReady(const char* pageURI) - { - m_error.clear(); - if (m_favicon) { - cairo_surface_destroy(m_favicon); - m_favicon = 0; - } - WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(m_webContext); - webkit_favicon_database_get_favicon(database, pageURI, 0, getFaviconCallback, this); - g_main_loop_run(m_mainLoop); - } - - WebKitWebContext* m_webContext; - cairo_surface_t* m_favicon; - GOwnPtr<GError> m_error; - bool m_iconReadySignalReceived; - bool m_faviconNotificationReceived; -}; - -static void -serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable* query, SoupClientContext* context, void* data) -{ - if (message->method != SOUP_METHOD_GET) { - soup_message_set_status(message, SOUP_STATUS_NOT_IMPLEMENTED); - return; - } - - char* contents; - gsize length; - if (g_str_equal(path, "/favicon.ico")) { - GOwnPtr<char> pathToFavicon(g_build_filename(Test::getWebKit1TestResoucesDir().data(), "blank.ico", NULL)); - g_file_get_contents(pathToFavicon.get(), &contents, &length, 0); - } else if (g_str_equal(path, "/nofavicon/favicon.ico")) { - soup_message_set_status(message, SOUP_STATUS_NOT_FOUND); - soup_message_body_complete(message->response_body); - return; - } else { - contents = g_strdup("<html><body>test</body></html>"); - length = strlen(contents); - } - - soup_message_set_status(message, SOUP_STATUS_OK); - soup_message_body_append(message->response_body, SOUP_MEMORY_TAKE, contents, length); - soup_message_body_complete(message->response_body); -} - -static void testNotInitialized(FaviconDatabaseTest* test, gconstpointer) -{ - // Try to retrieve a valid favicon from a not initialized database. - test->getFaviconForPageURIAndWaitUntilReady(kServer->getURIForPath("/").data()); - g_assert(!test->m_favicon); - g_assert(test->m_error); - g_assert_cmpint(test->m_error->code, ==, WEBKIT_FAVICON_DATABASE_ERROR_NOT_INITIALIZED); -} - -static void testSetDirectory(FaviconDatabaseTest* test, gconstpointer) -{ - webkit_web_context_set_favicon_database_directory(test->m_webContext, kTempDirectory); - g_assert_cmpstr(kTempDirectory, ==, webkit_web_context_get_favicon_database_directory(test->m_webContext)); -} - -static void testClearDatabase(FaviconDatabaseTest* test, gconstpointer) -{ - WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(test->m_webContext); - webkit_favicon_database_clear(database); - - GOwnPtr<char> iconURI(webkit_favicon_database_get_favicon_uri(database, kServer->getURIForPath("/").data())); - g_assert(!iconURI); -} - -static void testGetFavicon(FaviconDatabaseTest* test, gconstpointer) -{ - // We need to load the page first to ensure the icon data will be - // in the database in case there's an associated favicon. - test->loadURI(kServer->getURIForPath("/").data()); - test->waitUntilFaviconChanged(); - g_assert(test->m_iconReadySignalReceived); - - // Check the API retrieving a valid favicon. - test->m_iconReadySignalReceived = false; - test->getFaviconForPageURIAndWaitUntilReady(kServer->getURIForPath("/").data()); - g_assert(test->m_favicon); - g_assert(!test->m_error); - g_assert(!test->m_iconReadySignalReceived); - - // Check that width and height match those from blank.ico (16x16 favicon). - g_assert_cmpint(cairo_image_surface_get_width(test->m_favicon), ==, 16); - g_assert_cmpint(cairo_image_surface_get_height(test->m_favicon), ==, 16); - - // Check the API retrieving an invalid favicon. - test->loadURI(kServer->getURIForPath("/nofavicon").data()); - test->waitUntilFaviconChanged(); - g_assert(!test->m_iconReadySignalReceived); - - test->getFaviconForPageURIAndWaitUntilReady(kServer->getURIForPath("/nofavicon/").data()); - g_assert(!test->m_favicon); - g_assert(test->m_error); - g_assert(!test->m_iconReadySignalReceived); -} - -static void testGetFaviconURI(FaviconDatabaseTest* test, gconstpointer) -{ - WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(test->m_webContext); - - const char* baseURI = kServer->getURIForPath("/").data(); - GOwnPtr<char> iconURI(webkit_favicon_database_get_favicon_uri(database, baseURI)); - g_assert_cmpstr(iconURI.get(), ==, kServer->getURIForPath("/favicon.ico").data()); -} - -static void testWebViewFavicon(FaviconDatabaseTest* test, gconstpointer) -{ - cairo_surface_t* iconFromWebView = webkit_web_view_get_favicon(test->m_webView); - g_assert(!iconFromWebView); - - test->loadURI(kServer->getURIForPath("/").data()); - test->waitUntilFaviconChanged(); - g_assert(test->m_faviconNotificationReceived); - - iconFromWebView = webkit_web_view_get_favicon(test->m_webView); - g_assert(iconFromWebView); - g_assert_cmpuint(cairo_image_surface_get_width(iconFromWebView), ==, 16); - g_assert_cmpuint(cairo_image_surface_get_height(iconFromWebView), ==, 16); -} - -void beforeAll() -{ - // Start a soup server for testing. - kServer = new WebKitTestServer(); - kServer->run(serverCallback); - - kTempDirectory = g_dir_make_tmp("WebKit2Tests-XXXXXX", 0); - g_assert(kTempDirectory); - - // Add tests to the suite. - FaviconDatabaseTest::add("WebKitFaviconDatabase", "not-initialized", testNotInitialized); - FaviconDatabaseTest::add("WebKitFaviconDatabase", "set-directory", testSetDirectory); - FaviconDatabaseTest::add("WebKitFaviconDatabase", "get-favicon", testGetFavicon); - FaviconDatabaseTest::add("WebKitFaviconDatabase", "get-favicon-uri", testGetFaviconURI); - FaviconDatabaseTest::add("WebKitFaviconDatabase", "clear-database", testClearDatabase); - FaviconDatabaseTest::add("WebKitWebView", "favicon", testWebViewFavicon); -} - -static void webkitFaviconDatabaseFinalizedCallback(gpointer, GObject*) -{ - if (!g_file_test(kTempDirectory, G_FILE_TEST_IS_DIR)) - return; - - GOwnPtr<char> filename(g_build_filename(kTempDirectory, "WebpageIcons.db", NULL)); - g_unlink(filename.get()); - - g_rmdir(kTempDirectory); -} - -void afterAll() -{ - delete kServer; - - // Delete the temporary files after the IconDatabase has been - // closed, that is, once WebKitFaviconDatabase is being destroyed. - WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(webkit_web_context_get_default()); - g_object_weak_ref(G_OBJECT(database), webkitFaviconDatabaseFinalizedCallback, 0); -} diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitPolicyClient.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitPolicyClient.cpp index abbfd652a..9f6ce7819 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitPolicyClient.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitPolicyClient.cpp @@ -232,13 +232,11 @@ static void serverCallback(SoupServer* server, SoupMessage* message, const char* return; } - if (g_str_equal(path, "/")) { - static const char* responseString = "<html><body>Testing!</body></html>"; - soup_message_set_status(message, SOUP_STATUS_OK); - soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, responseString, strlen(responseString)); - soup_message_body_complete(message->response_body); - } else - soup_message_set_status(message, SOUP_STATUS_NOT_FOUND); + soup_message_set_status(message, SOUP_STATUS_OK); + + static const char* responseString = "<html><body>Testing!</body></html>"; + soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, responseString, strlen(responseString)); + soup_message_body_complete(message->response_body); } void beforeAll() diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitSettings.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitSettings.cpp index c7a0dc259..d8e355472 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitSettings.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitSettings.cpp @@ -243,11 +243,6 @@ static void testWebKitSettings(Test*, gconstpointer) webkit_settings_set_enable_page_cache(settings, FALSE); g_assert(!webkit_settings_get_enable_page_cache(settings)); - // By default, smooth scrolling is disabled. - g_assert(!webkit_settings_get_enable_smooth_scrolling(settings)); - webkit_settings_set_enable_smooth_scrolling(settings, TRUE); - g_assert(webkit_settings_get_enable_smooth_scrolling(settings)); - g_object_unref(G_OBJECT(settings)); } @@ -320,13 +315,10 @@ static void serverCallback(SoupServer* server, SoupMessage* message, const char* return; } - if (g_str_equal(path, "/")) { - const char* userAgent = soup_message_headers_get_one(message->request_headers, "User-Agent"); - soup_message_set_status(message, SOUP_STATUS_OK); - soup_message_body_append(message->response_body, SOUP_MEMORY_COPY, userAgent, strlen(userAgent)); - soup_message_body_complete(message->response_body); - } else - soup_message_set_status(message, SOUP_STATUS_NOT_FOUND); + soup_message_set_status(message, SOUP_STATUS_OK); + const char* userAgent = soup_message_headers_get_one(message->request_headers, "User-Agent"); + soup_message_body_append(message->response_body, SOUP_MEMORY_COPY, userAgent, strlen(userAgent)); + soup_message_body_complete(message->response_body); } void beforeAll() diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp index 185c06cfe..7a13d285d 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp @@ -146,8 +146,6 @@ public: test->m_uriSchemeRequest = request; test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(request)); - g_assert(webkit_uri_scheme_request_get_web_view(request) == test->m_webView); - GRefPtr<GInputStream> inputStream = adoptGRef(g_memory_input_stream_new()); test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(inputStream.get())); @@ -293,13 +291,10 @@ static void serverCallback(SoupServer* server, SoupMessage* message, const char* return; } - if (g_str_equal(path, "/")) { - const char* acceptLanguage = soup_message_headers_get_one(message->request_headers, "Accept-Language"); - soup_message_set_status(message, SOUP_STATUS_OK); - soup_message_body_append(message->response_body, SOUP_MEMORY_COPY, acceptLanguage, strlen(acceptLanguage)); - soup_message_body_complete(message->response_body); - } else - soup_message_set_status(message, SOUP_STATUS_NOT_FOUND); + soup_message_set_status(message, SOUP_STATUS_OK); + const char* acceptLanguage = soup_message_headers_get_one(message->request_headers, "Accept-Language"); + soup_message_body_append(message->response_body, SOUP_MEMORY_COPY, acceptLanguage, strlen(acceptLanguage)); + soup_message_body_complete(message->response_body); } class SecurityPolicyTest: public Test { diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp index f5197b936..02e8138de 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp @@ -643,17 +643,6 @@ static void testWebViewRunJavaScript(WebViewTest* test, gconstpointer) g_assert(!error.get()); g_assert(WebViewTest::javascriptResultIsUndefined(javascriptResult)); - javascriptResult = test->runJavaScriptFromGResourceAndWaitUntilFinished("/org/webkit/webkit2gtk/tests/link-title.js", &error.outPtr()); - g_assert(javascriptResult); - g_assert(!error.get()); - valueString.set(WebViewTest::javascriptResultToCString(javascriptResult)); - g_assert_cmpstr(valueString.get(), ==, "WebKitGTK+ Title"); - - javascriptResult = test->runJavaScriptFromGResourceAndWaitUntilFinished("/wrong/path/to/resource.js", &error.outPtr()); - g_assert(!javascriptResult); - g_assert_error(error.get(), G_RESOURCE_ERROR, G_RESOURCE_ERROR_NOT_FOUND); - error.clear(); - javascriptResult = test->runJavaScriptAndWaitUntilFinished("foo();", &error.outPtr()); g_assert(!javascriptResult); g_assert_error(error.get(), WEBKIT_JAVASCRIPT_ERROR, WEBKIT_JAVASCRIPT_ERROR_SCRIPT_FAILED); diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp index 7e7eb0167..04747480e 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp @@ -313,12 +313,6 @@ static void runJavaScriptReadyCallback(GObject*, GAsyncResult* result, WebViewTe g_main_loop_quit(test->m_mainLoop); } -static void runJavaScriptFromGResourceReadyCallback(GObject*, GAsyncResult* result, WebViewTest* test) -{ - test->m_javascriptResult = webkit_web_view_run_javascript_from_gresource_finish(test->m_webView, result, test->m_javascriptError); - g_main_loop_quit(test->m_mainLoop); -} - WebKitJavascriptResult* WebViewTest::runJavaScriptAndWaitUntilFinished(const char* javascript, GError** error) { if (m_javascriptResult) @@ -331,18 +325,6 @@ WebKitJavascriptResult* WebViewTest::runJavaScriptAndWaitUntilFinished(const cha return m_javascriptResult; } -WebKitJavascriptResult* WebViewTest::runJavaScriptFromGResourceAndWaitUntilFinished(const char* resource, GError** error) -{ - if (m_javascriptResult) - webkit_javascript_result_unref(m_javascriptResult); - m_javascriptResult = 0; - m_javascriptError = error; - webkit_web_view_run_javascript_from_gresource(m_webView, resource, 0, reinterpret_cast<GAsyncReadyCallback>(runJavaScriptFromGResourceReadyCallback), this); - g_main_loop_run(m_mainLoop); - - return m_javascriptResult; -} - static char* jsValueToCString(JSGlobalContextRef context, JSValueRef value) { g_assert(value); diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h b/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h index 06f398f96..25209caa3 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h +++ b/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h @@ -55,7 +55,6 @@ public: void keyStroke(unsigned int keyVal, unsigned int keyModifiers = 0); WebKitJavascriptResult* runJavaScriptAndWaitUntilFinished(const char* javascript, GError**); - WebKitJavascriptResult* runJavaScriptFromGResourceAndWaitUntilFinished(const char* resource, GError**); // Javascript result helpers. static char* javascriptResultToCString(WebKitJavascriptResult*); diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/resources/link-title.js b/Source/WebKit2/UIProcess/API/gtk/tests/resources/link-title.js deleted file mode 100644 index 2c824da38..000000000 --- a/Source/WebKit2/UIProcess/API/gtk/tests/resources/link-title.js +++ /dev/null @@ -1 +0,0 @@ -window.document.getElementById('WebKitLink').title; diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/resources/webkit2gtk-tests.gresource.xml b/Source/WebKit2/UIProcess/API/gtk/tests/resources/webkit2gtk-tests.gresource.xml deleted file mode 100644 index 4f1e5a654..000000000 --- a/Source/WebKit2/UIProcess/API/gtk/tests/resources/webkit2gtk-tests.gresource.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<gresources> - <gresource prefix="/org/webkit/webkit2gtk/tests/"> - <file alias="link-title.js">Source/WebKit2/UIProcess/API/gtk/tests/resources/link-title.js</file> - </gresource> -</gresources> diff --git a/Source/WebKit2/UIProcess/API/gtk/webkit2.h b/Source/WebKit2/UIProcess/API/gtk/webkit2.h index 1b4fa86a1..e1f3ba04a 100644 --- a/Source/WebKit2/UIProcess/API/gtk/webkit2.h +++ b/Source/WebKit2/UIProcess/API/gtk/webkit2.h @@ -34,7 +34,6 @@ #include <webkit2/WebKitEditingCommands.h> #include <webkit2/WebKitEnumTypes.h> #include <webkit2/WebKitError.h> -#include <webkit2/WebKitFaviconDatabase.h> #include <webkit2/WebKitFileChooserRequest.h> #include <webkit2/WebKitFindController.h> #include <webkit2/WebKitFormSubmissionRequest.h> diff --git a/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextGroup.h b/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextGroup.h index f26c952c0..f3428fc93 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextGroup.h +++ b/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextGroup.h @@ -36,11 +36,6 @@ WK_EXPORT - (id)initWithIdentifier:(NSString *)identifier; -/* User Content */ - -- (void)addUserStyleSheet:(NSString *)source baseURL:(NSURL *)baseURL whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist mainFrameOnly:(BOOL)mainFrameOnly; -- (void)removeAllUserStyleSheets; - /* Settings */ diff --git a/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextGroup.mm b/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextGroup.mm index 87cffd0e7..338d390ca 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextGroup.mm +++ b/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextGroup.mm @@ -27,14 +27,10 @@ #import "WKBrowsingContextGroup.h" #import "WKBrowsingContextGroupInternal.h" -#import "WKArray.h" #import "WKPageGroup.h" #import "WKPreferences.h" #import "WKRetainPtr.h" #import "WKStringCF.h" -#import "WKURL.h" -#import "WKURLCF.h" -#import <wtf/Vector.h> @interface WKBrowsingContextGroupData : NSObject { @public @@ -85,43 +81,6 @@ WKPreferencesSetPluginsEnabled(WKPageGroupGetPreferences(self._pageGroupRef), allowsPlugIns); } -static WKArrayRef createWKArray(NSArray *array) -{ - NSUInteger count = [array count]; - if (count == 0) - return WKArrayRef(); - - Vector<WKTypeRef> stringVector; - stringVector.reserveInitialCapacity(count); - for (NSUInteger i = 0; i < count; ++i) { - id entry = [array objectAtIndex:i]; - if ([entry isKindOfClass:[NSString class]]) - stringVector.uncheckedAppend(WKStringCreateWithCFString((CFStringRef)entry)); - - } - - return WKArrayCreateAdoptingValues(stringVector.data(), stringVector.size()); -} - --(void)addUserStyleSheet:(NSString *)source baseURL:(NSURL *)baseURL whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist mainFrameOnly:(BOOL)mainFrameOnly -{ - if (!source) - return; - - WKRetainPtr<WKStringRef> wkSource = adoptWK(WKStringCreateWithCFString((CFStringRef)source)); - WKRetainPtr<WKURLRef> wkBaseURL = adoptWK(WKURLCreateWithCFURL((CFURLRef)baseURL)); - WKRetainPtr<WKArrayRef> wkWhitelist = adoptWK(createWKArray(whitelist)); - WKRetainPtr<WKArrayRef> wkBlacklist = adoptWK(createWKArray(blacklist)); - WKUserContentInjectedFrames injectedFrames = mainFrameOnly ? kWKInjectInTopFrameOnly : kWKInjectInAllFrames; - - WKPageGroupAddUserStyleSheet(self._pageGroupRef, wkSource.get(), wkBaseURL.get(), wkWhitelist.get(), wkBlacklist.get(), injectedFrames); -} - -- (void)removeAllUserStyleSheets -{ - WKPageGroupRemoveAllUserStyleSheets(self._pageGroupRef); -} - @end @implementation WKBrowsingContextGroup (Internal) diff --git a/Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm b/Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm index ca1cad582..63c58895f 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm +++ b/Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm @@ -194,8 +194,8 @@ static BOOL isForcingPreviewUpdate; - (uint64_t)_expectedPreviewCallbackForRect:(const IntRect&)rect { for (HashMap<uint64_t, WebCore::IntRect>::iterator iter = _expectedPreviewCallbacks.begin(); iter != _expectedPreviewCallbacks.end(); ++iter) { - if (iter->value == rect) - return iter->key; + if (iter->second == rect) + return iter->first; } return 0; } @@ -229,8 +229,8 @@ static void pageDidDrawToPDF(WKDataRef dataRef, WKErrorRef, void* untypedContext ASSERT([view _isPrintingPreview]); if (data) { - HashMap<WebCore::IntRect, Vector<uint8_t> >::AddResult entry = view->_pagePreviews.add(iter->value, Vector<uint8_t>()); - entry.iterator->value.append(data->bytes(), data->size()); + HashMap<WebCore::IntRect, Vector<uint8_t> >::AddResult entry = view->_pagePreviews.add(iter->second, Vector<uint8_t>()); + entry.iterator->second.append(data->bytes(), data->size()); } view->_expectedPreviewCallbacks.remove(context->callbackID); bool receivedResponseToLatestRequest = view->_latestExpectedPreviewCallback == context->callbackID; @@ -494,7 +494,7 @@ static void prepareDataForPrintingOnSecondaryThread(void* untypedContext) return; } - const Vector<uint8_t>& pdfDataBytes = pagePreviewIterator->value; + const Vector<uint8_t>& pdfDataBytes = pagePreviewIterator->second; RetainPtr<NSData> pdfData(AdoptNS, [[NSData alloc] initWithBytes:pdfDataBytes.data() length:pdfDataBytes.size()]); RetainPtr<PDFDocument> pdfDocument(AdoptNS, [[pdfDocumentClass() alloc] initWithData:pdfData.get()]); diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.mm b/Source/WebKit2/UIProcess/API/mac/WKView.mm index d4b301298..9d69399d4 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKView.mm +++ b/Source/WebKit2/UIProcess/API/mac/WKView.mm @@ -428,7 +428,7 @@ static String commandNameForSelector(SEL selector) static const SelectorNameMap* exceptionMap = createSelectorExceptionMap(); SelectorNameMap::const_iterator it = exceptionMap->find(selector); if (it != exceptionMap->end()) - return it->value; + return it->second; // Remove the trailing colon. // No need to capitalize the command name since Editor command names are @@ -742,7 +742,7 @@ static void validateCommandCallback(WKStringRef commandName, bool isEnabled, int // Add this item to the vector of items for a given command that are awaiting validation. ValidationMap::AddResult addResult = _data->_validationMap.add(commandName, ValidationVector()); - addResult.iterator->value.append(item); + addResult.iterator->second.append(item); if (addResult.isNewEntry) { // If we are not already awaiting validation for this command, start the asynchronous validation process. // FIXME: Theoretically, there is a race here; when we get the answer it might be old, from a previous time diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp index 71688cbe6..db51b85dd 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp @@ -158,7 +158,7 @@ void QQuickWebPagePrivate::updateSize() DrawingAreaProxy* drawingArea = webPageProxy->drawingArea(); if (drawingArea && drawingArea->layerTreeCoordinatorProxy()) - drawingArea->layerTreeCoordinatorProxy()->setContentsSize(WebCore::FloatSize(contentsSize)); + drawingArea->layerTreeCoordinatorProxy()->setContentsSize(contentsSize); q->setSize(scaledSize); diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp index 07ed832ce..b78cae0f3 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp @@ -268,7 +268,6 @@ QQuickWebViewPrivate::QQuickWebViewPrivate(QQuickWebView* viewport) , filePicker(0) , databaseQuotaDialog(0) , colorChooser(0) - , m_betweenLoadCommitAndFirstFrame(false) , m_useDefaultContentItemSize(true) , m_navigatorQtObjectEnabled(false) , m_renderToOffscreenBuffer(false) @@ -331,6 +330,14 @@ void QQuickWebViewPrivate::loadDidStop() emit q->loadingChanged(&loadRequest); } +void QQuickWebViewPrivate::onComponentComplete() +{ + Q_Q(QQuickWebView); + m_pageViewportControllerClient.reset(new PageViewportControllerClientQt(q, pageView.data())); + m_pageViewportController.reset(new PageViewportController(webPageProxy.get(), m_pageViewportControllerClient.data())); + pageView->eventHandler()->setViewportController(m_pageViewportControllerClient.data()); +} + void QQuickWebViewPrivate::setTransparentBackground(bool enable) { webPageProxy->setDrawsTransparentBackground(enable); @@ -363,7 +370,6 @@ void QQuickWebViewPrivate::loadDidCommit() Q_Q(QQuickWebView); ASSERT(q->loading()); - m_betweenLoadCommitAndFirstFrame = true; emit q->navigationHistoryChanged(); emit q->titleChanged(); } @@ -446,16 +452,8 @@ void QQuickWebViewPrivate::setNeedsDisplay() q->page()->d->paint(&painter); return; } - q->page()->update(); -} -void QQuickWebViewPrivate::didRenderFrame() -{ - Q_Q(QQuickWebView); - if (m_betweenLoadCommitAndFirstFrame) { - emit q->experimental()->loadVisuallyCommitted(); - m_betweenLoadCommitAndFirstFrame = false; - } + q->page()->update(); } void QQuickWebViewPrivate::processDidCrash() @@ -480,6 +478,8 @@ void QQuickWebViewPrivate::didRelaunchProcess() { qWarning("WARNING: The web process has been successfully restarted."); + // Reset to default so that the later update can reach the web process. + webPageProxy->setCustomDeviceScaleFactor(0); webPageProxy->drawingArea()->setSize(viewSize(), IntSize()); updateViewportSize(); @@ -820,17 +820,12 @@ void QQuickWebViewLegacyPrivate::updateViewportSize() QSizeF viewportSize = q->boundingRect().size(); if (viewportSize.isEmpty()) return; - - float devicePixelRatio = webPageProxy->deviceScaleFactor(); pageView->setContentsSize(viewportSize); - // Make sure that our scale matches the one passed to setVisibleContentsRect. - pageView->setContentsScale(devicePixelRatio); - // The fixed layout is handled by the FrameView and the drawing area doesn't behave differently // whether its fixed or not. We still need to tell the drawing area which part of it // has to be rendered on tiles, and in desktop mode it's all of it. - webPageProxy->drawingArea()->setSize((viewportSize / devicePixelRatio).toSize(), IntSize()); - webPageProxy->drawingArea()->setVisibleContentsRect(FloatRect(FloatPoint(), FloatSize(viewportSize / devicePixelRatio)), devicePixelRatio, FloatPoint()); + webPageProxy->drawingArea()->setSize(viewportSize.toSize(), IntSize()); + webPageProxy->drawingArea()->setVisibleContentsRect(FloatRect(FloatPoint(), viewportSize), 1, FloatPoint()); } qreal QQuickWebViewLegacyPrivate::zoomFactor() const @@ -858,11 +853,6 @@ void QQuickWebViewFlickablePrivate::onComponentComplete() { QQuickWebViewPrivate::onComponentComplete(); - Q_Q(QQuickWebView); - m_pageViewportControllerClient.reset(new PageViewportControllerClientQt(q, pageView.data())); - m_pageViewportController.reset(new PageViewportController(webPageProxy.get(), m_pageViewportControllerClient.data())); - pageView->eventHandler()->setViewportController(m_pageViewportControllerClient.data()); - // Trigger setting of correct visibility flags after everything was allocated and initialized. _q_onVisibleChanged(); } @@ -878,7 +868,7 @@ void QQuickWebViewFlickablePrivate::updateViewportSize() Q_Q(QQuickWebView); if (m_pageViewportController) - m_pageViewportController->didChangeViewportSize(FloatSize(q->width(), q->height())); + m_pageViewportController->didChangeViewportSize(QSizeF(q->width(), q->height())); } void QQuickWebViewFlickablePrivate::pageDidRequestScroll(const QPoint& pos) @@ -887,6 +877,13 @@ void QQuickWebViewFlickablePrivate::pageDidRequestScroll(const QPoint& pos) m_pageViewportController->pageDidRequestScroll(pos); } +void QQuickWebViewFlickablePrivate::didChangeContentsSize(const QSize& newSize) +{ + QQuickWebViewPrivate::didChangeContentsSize(newSize); + pageView->setContentsSize(newSize); // emits contentsSizeChanged() + m_pageViewportController->didChangeContentsSize(newSize); +} + void QQuickWebViewFlickablePrivate::handleMouseEvent(QMouseEvent* event) { if (!pageView->eventHandler()) @@ -1236,7 +1233,7 @@ void QQuickWebViewExperimental::setDevicePixelRatio(qreal devicePixelRatio) if (0 >= devicePixelRatio || devicePixelRatio == this->devicePixelRatio()) return; - d->webPageProxy->setIntrinsicDeviceScaleFactor(devicePixelRatio); + d->webPageProxy->setCustomDeviceScaleFactor(devicePixelRatio); emit devicePixelRatioChanged(); } diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h index 89e7fbc99..e8b1bf7a1 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h @@ -355,7 +355,6 @@ public Q_SLOTS: void evaluateJavaScript(const QString& script, const QJSValue& value = QJSValue()); Q_SIGNALS: - void loadVisuallyCommitted(); void alertDialogChanged(); void confirmDialogChanged(); void promptDialogChanged(); diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h index 15bf818d7..f172ad68f 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h @@ -70,7 +70,7 @@ public: virtual void initialize(WKContextRef contextRef = 0, WKPageGroupRef pageGroupRef = 0); - virtual void onComponentComplete() { } + virtual void onComponentComplete(); virtual void provisionalLoadDidStart(const WTF::String& url); virtual void didReceiveServerRedirectForProvisionalLoad(const WTF::String& url); @@ -88,9 +88,8 @@ public: int loadProgress() const { return m_loadProgress; } void setNeedsDisplay(); - void didRenderFrame(); - virtual WebKit::PageViewportController* viewportController() const { return 0; } + WebKit::PageViewportController* viewportController() const { return m_pageViewportController.data(); } virtual void updateViewportSize() { } void updateTouchViewportSize(); @@ -131,6 +130,7 @@ public: WebCore::IntSize viewSize() const; void didReceiveMessageFromNavigatorQtObject(const String& message); virtual void pageDidRequestScroll(const QPoint& pos) { } + virtual void didChangeContentsSize(const QSize& newSize) { } void processDidCrash(); void didRelaunchProcess(); PassOwnPtr<WebKit::DrawingAreaProxy> createDrawingAreaProxy(); @@ -172,6 +172,9 @@ protected: QScopedPointer<QQuickWebPage> pageView; QQuickWebView* q_ptr; + QScopedPointer<WebKit::PageViewportController> m_pageViewportController; + QScopedPointer<WebKit::PageViewportControllerClientQt> m_pageViewportControllerClient; + FlickableAxisLocker axisLocker; QQmlComponent* alertDialog; @@ -187,7 +190,6 @@ protected: QList<QUrl> userScripts; - bool m_betweenLoadCommitAndFirstFrame; bool m_useDefaultContentItemSize; bool m_navigatorQtObjectEnabled; bool m_renderToOffscreenBuffer; @@ -218,15 +220,11 @@ public: virtual void onComponentComplete(); virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&); - virtual WebKit::PageViewportController* viewportController() const { return m_pageViewportController.data(); } virtual void updateViewportSize(); virtual void pageDidRequestScroll(const QPoint& pos); + virtual void didChangeContentsSize(const QSize& newSize); virtual void handleMouseEvent(QMouseEvent*); - -private: - QScopedPointer<WebKit::PageViewportController> m_pageViewportController; - QScopedPointer<WebKit::PageViewportControllerClientQt> m_pageViewportControllerClient; }; #endif // qquickwebview_p_p_h diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp index 5f6c16d56..0a7a684cf 100644 --- a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp @@ -167,11 +167,6 @@ void QRawWebViewPrivate::toolTipChanged(const String&, const String& newTooltip) notImplemented(); } -void QRawWebViewPrivate::pageTransitionViewportReady() -{ - m_webPageProxy->commitPageTransitionViewport(); -} - void QRawWebViewPrivate::startDrag(const WebCore::DragData& dragData, PassRefPtr<WebKit::ShareableBitmap> dragImage) { notImplemented(); @@ -324,7 +319,6 @@ void QRawWebView::setActive(bool active) { d->m_active = active; d->m_webPageProxy->viewStateDidChange(WebKit::WebPageProxy::ViewWindowIsActive); - layerTreeRenderer()->setActive(active); } QSize QRawWebView::size() const @@ -358,20 +352,17 @@ WKPageRef QRawWebView::pageRef() return toAPI(d->m_webPageProxy.get()); } -WebKit::LayerTreeRenderer* QRawWebView::layerTreeRenderer() const +void QRawWebView::paint(const QMatrix4x4& transform, float opacity, unsigned paintFlags) { WebKit::DrawingAreaProxy* drawingArea = d->m_webPageProxy->drawingArea(); if (!drawingArea) - return 0; - WebKit::LayerTreeCoordinatorProxy* layerTreeCoordinatorProxy = drawingArea->layerTreeCoordinatorProxy(); - if (!layerTreeCoordinatorProxy) - return 0; - return layerTreeCoordinatorProxy->layerTreeRenderer(); -} + return; -void QRawWebView::paint(const QMatrix4x4& transform, float opacity, unsigned paintFlags) -{ - WebKit::LayerTreeRenderer* renderer = layerTreeRenderer(); + WebKit::LayerTreeCoordinatorProxy* coordinatorProxy = drawingArea->layerTreeCoordinatorProxy(); + if (!coordinatorProxy) + return; + + WebKit::LayerTreeRenderer* renderer = coordinatorProxy->layerTreeRenderer(); if (!renderer) return; diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h index 015815ad8..f8f15b06d 100644 --- a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h +++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h @@ -47,10 +47,6 @@ QT_END_NAMESPACE class QRawWebViewPrivate; -namespace WebKit { -class LayerTreeRenderer; -} - class QRawWebViewClient { public: virtual ~QRawWebViewClient() { } @@ -101,8 +97,6 @@ public: void sendTouchEvent(QTouchEvent*); private: - WebKit::LayerTreeRenderer* layerTreeRenderer() const; - QRawWebViewPrivate* d; }; diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h index 545096d02..55bc85ba0 100644 --- a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h +++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h @@ -82,7 +82,6 @@ public: virtual void setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves); virtual void toolTipChanged(const String&, const String& newTooltip); - virtual void pageTransitionViewportReady(); virtual void startDrag(const WebCore::DragData& dragData, PassRefPtr<WebKit::ShareableBitmap> dragImage); @@ -105,7 +104,6 @@ public: virtual void didRelaunchProcess(); virtual void setViewNeedsDisplay(const WebCore::IntRect& rect); virtual void didChangeContentsSize(const WebCore::IntSize& newSize); - virtual void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect) { } virtual void setCursor(const WebCore::Cursor&); virtual bool isViewFocused() { return m_focused; } diff --git a/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/inspectorserver.pro b/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/inspectorserver.pro index bc5307f2d..4a8d86f80 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/inspectorserver.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/inspectorserver.pro @@ -1,4 +1,4 @@ include(../tests.pri) SOURCES += $${TARGET}.cpp -QT += webkitwidgets-private +QT += webkit-private DEFINES += IMPORT_DIR=\"\\\"$${ROOT_BUILD_DIR}$${QMAKE_DIR_SEP}imports\\\"\" diff --git a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro b/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro index ba8f4cea3..02dc197c7 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro @@ -1,3 +1,3 @@ include(../tests.pri) SOURCES += $${TARGET}.cpp -QT += webkitwidgets-private +QT += webkit-private diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro index 7c72fd2f1..3fd3d4583 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro @@ -3,7 +3,7 @@ SOURCES += tst_qmltests.cpp TARGET = tst_qmltests_DesktopBehavior OBJECTS_DIR = obj_DesktopBehavior/$$activeBuildConfig() -QT += webkitwidgets-private +QT += webkit-private CONFIG += warn_on testcase QT += qmltest diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro index 3e217b369..b340235e4 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro @@ -3,7 +3,7 @@ SOURCES += tst_qmltests.cpp TARGET = tst_qmltests_WebView OBJECTS_DIR = obj_WebView/$$activeBuildConfig() -QT += webkitwidgets-private +QT += webkit-private CONFIG += warn_on testcase QT += qmltest diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_doubleTapToZoom.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_doubleTapToZoom.qml index d21ef211a..691455708 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_doubleTapToZoom.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_doubleTapToZoom.qml @@ -40,7 +40,6 @@ Item { TestCase { name: "DoubleTapToZoom" - when: windowShown property variant test: webView.experimental.test @@ -79,7 +78,7 @@ Item { function test_basic() { webView.url = webView.content - verify(webView.waitForViewportReady()) + verify(webView.waitForLoadSucceeded()) compare(documentSize(), "480x720") 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..f12da5de8 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 @@ -38,7 +38,6 @@ Item { TestCase { name: "FitToView" - when: windowShown property variant test: webView.experimental.test @@ -70,7 +69,7 @@ Item { function test_basic() { webView.url = webView.content - verify(webView.waitForViewportReady()) + verify(webView.waitForLoadSucceeded()) compare(documentSize(), "480x720") compare(test.contentsScale, 1.0) diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_wheelEventHandling.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_wheelEventHandling.qml index aa6d711a1..1fc1559ab 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_wheelEventHandling.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_wheelEventHandling.qml @@ -21,13 +21,12 @@ Item { TestCase { name: "WheelEventHandling" - when: windowShown property variant test: webView.experimental.test function init() { webView.url = Qt.resolvedUrl("../common/test4.html") - verify(webView.waitForViewportReady()) + verify(webView.waitForLoadSucceeded()) webView.contentY = 0 } @@ -39,7 +38,7 @@ Item { scrollSpy.wait() var position = webView.contentY webView.reload() - verify(webView.waitForViewportReady()) + verify(webView.waitForLoadSucceeded()) // The check below will fail if the previous position was not restored after reload. verify(position == webView.contentY) } @@ -47,7 +46,7 @@ Item { function test_wheelScrollEventAfterReload() { scrollSpy.clear() webView.reload() - verify(webView.waitForViewportReady()) + verify(webView.waitForLoadSucceeded()) var centerPoint = Qt.point(webView.width / 2, webView.height / 2) test.wheelEvent(webView, centerPoint.x, centerPoint.y, -500); // The signal spy below will time out if the wheel event did not scroll the content. diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/TestWebView.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/TestWebView.qml index 5a05f9b3e..0dd7bccee 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/TestWebView.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/TestWebView.qml @@ -5,47 +5,43 @@ import QtWebKit.experimental 1.0 WebView { property var loadStatus: null - property var viewportReady: false function waitForLoadSucceeded() { - var success = _waitFor(function() { return loadStatus == WebView.LoadSucceededStatus }) + var timeout = 5000 + var i = 0 + while (i < timeout && loadStatus != WebView.LoadSucceededStatus) { + testResult.wait(50) + i += 50 + } + var success = loadStatus == WebView.LoadSucceededStatus loadStatus = null return success } - function waitForViewportReady() { - // Note: You need to have "when: windowShown" in your TestCase for this to work. - // The viewport is locked until the first frame is rendered, and the rendering isn't - // activated until the WebView is visible in a mapped QQuickView. - return _waitFor(function() { return viewportReady }) - } function waitForLoadFailed() { - var failure = _waitFor(function() { return loadStatus == WebView.LoadFailedStatus }) + var timeout = 5000 + var i = 0 + while (i < timeout && loadStatus != WebView.LoadFailedStatus) { + testResult.wait(50) + i += 50 + } + var failure = loadStatus == WebView.LoadFailedStatus loadStatus = null return failure } function waitForLoadStopped() { - var stop = _waitFor(function() { return loadStatus == WebView.LoadStoppedStatus }) - loadStatus = null - return stop - } - function _waitFor(predicate) { var timeout = 5000 var i = 0 - while (i < timeout && !predicate()) { + while (i < timeout && loadStatus != WebView.LoadStoppedStatus) { testResult.wait(50) i += 50 } - return predicate() + var stop = loadStatus == WebView.LoadStoppedStatus + loadStatus = null + return stop } TestResult { id: testResult } - experimental.onLoadVisuallyCommitted: viewportReady = true - onLoadingChanged: { - loadStatus = loadRequest.status - if (loadRequest.status == WebView.LoadStartedStatus) - viewportReady = false - } - + onLoadingChanged: loadStatus = loadRequest.status } diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro b/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro index bc5307f2d..4a8d86f80 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro @@ -1,4 +1,4 @@ include(../tests.pri) SOURCES += $${TARGET}.cpp -QT += webkitwidgets-private +QT += webkit-private DEFINES += IMPORT_DIR=\"\\\"$${ROOT_BUILD_DIR}$${QMAKE_DIR_SEP}imports\\\"\" 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..5b98ae7b7 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp @@ -440,11 +440,10 @@ void tst_QQuickWebView::inputMethodHints() void tst_QQuickWebView::scrollRequest() { - m_window->setGeometry(0, 0, 300, 400); - m_window->show(); + webView()->setSize(QSizeF(300, 400)); webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/scroll.html"))); - QVERIFY(waitForViewportReady(webView())); + QVERIFY(waitForLoadSucceeded(webView())); // COMPARE with the position requested in the html // Use qRound as that is also used when calculating the position diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro b/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro index ba8f4cea3..02dc197c7 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro @@ -1,3 +1,3 @@ include(../tests.pri) SOURCES += $${TARGET}.cpp -QT += webkitwidgets-private +QT += webkit-private diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp b/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp index 208288d1e..31102b876 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp @@ -27,7 +27,6 @@ #include <WebKit2/WKContext.h> #include <WebKit2/WKPageGroup.h> -#include <WebKit2/WKPageLoadTypes.h> #include <WebKit2/WKPreferences.h> #include <WebKit2/WKPreferencesPrivate.h> #include <WebKit2/WKStringQt.h> @@ -61,18 +60,15 @@ class WebView : public QObject, public QRawWebViewClient { public: WebView(const QSize& size, bool transparent = false) { - m_webView = new QRawWebView(webContext(), webPageGroup(QString()), this); - m_webView->setTransparentBackground(transparent); - m_webView->create(); - WKPageLoaderClient loaderClient; memset(&loaderClient, 0, sizeof(WKPageLoaderClient)); - loaderClient.version = kWKPageLoaderClientCurrentVersion; loaderClient.clientInfo = this; - loaderClient.didLayout = WebView::didLayout; + loaderClient.didFirstVisuallyNonEmptyLayoutForFrame = WebView::finishFirstLayoutForFrame; + m_webView = new QRawWebView(webContext(), webPageGroup(QString()), this); WKPageSetPageLoaderClient(m_webView->pageRef(), &loaderClient); - WKPageListenForLayoutMilestones(m_webView->pageRef(), kWKDidFirstVisuallyNonEmptyLayout); + m_webView->setTransparentBackground(transparent); + m_webView->create(); WKPageSetUseFixedLayout(m_webView->pageRef(), true); m_webView->setSize(size); @@ -122,7 +118,7 @@ public: static_cast<WebView*>(context)->onRepaintDone(); } - static void didLayout(WKPageRef page, WKLayoutMilestones milestones, WKTypeRef userData, const void *clientInfo) + static void finishFirstLayoutForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo) { static_cast<WebView*>(const_cast<void*>(clientInfo))->frameLoaded(); } @@ -156,9 +152,7 @@ public: tst_qrawwebview() : m_resourceDir(QString::fromLatin1(TESTS_SOURCE_DIR "/html/resources")) , m_baseUrl(QUrl::fromLocalFile(TESTS_SOURCE_DIR "/html").toString()) - { - addQtWebProcessToPath(); - } + { } private Q_SLOTS: void paint() { run(&tst_qrawwebview::doPaint, m_resourceDir + "/qwkview_paint.png"); } diff --git a/Source/WebKit2/UIProcess/API/qt/tests/tests.pri b/Source/WebKit2/UIProcess/API/qt/tests/tests.pri index 123b25ce2..a1133530d 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/tests.pri +++ b/Source/WebKit2/UIProcess/API/qt/tests/tests.pri @@ -6,7 +6,7 @@ TARGET = tst_$$TARGET INCLUDEPATH += $$PWD SOURCES += ../util.cpp -QT += testlib webkitwidgets +QT += testlib webkit have?(QTQUICK) { QT += qml quick quick-private HEADERS += ../bytearraytestdata.h \ diff --git a/Source/WebKit2/UIProcess/API/qt/tests/util.cpp b/Source/WebKit2/UIProcess/API/qt/tests/util.cpp index fce3cc7f6..4525e882b 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/util.cpp +++ b/Source/WebKit2/UIProcess/API/qt/tests/util.cpp @@ -57,10 +57,10 @@ bool waitForSignal(QObject* obj, const char* signal, int timeout) return timeoutSpy.isEmpty(); } -static void messageHandler(QtMsgType type, const QMessageLogContext&, const QString& message) +static void messageHandler(QtMsgType type, const char* message) { if (type == QtCriticalMsg) { - fprintf(stderr, "%s\n", qPrintable(message)); + fprintf(stderr, "%s\n", message); return; } // Do nothing @@ -68,7 +68,7 @@ static void messageHandler(QtMsgType type, const QMessageLogContext&, const QStr void suppressDebugOutput() { - qInstallMessageHandler(messageHandler); \ + qInstallMsgHandler(messageHandler); \ if (qgetenv("QT_WEBKIT_SUPPRESS_WEB_PROCESS_OUTPUT").isEmpty()) \ qputenv("QT_WEBKIT_SUPPRESS_WEB_PROCESS_OUTPUT", "1"); } @@ -126,13 +126,6 @@ bool waitForLoadFailed(QQuickWebView* webView, int timeout) return timeoutSpy.isEmpty(); } -bool waitForViewportReady(QQuickWebView* webView, int timeout) -{ - // The viewport is locked until the first frame of a page load is rendered. - // The QQuickView needs to be shown for this to succeed. - return waitForSignal(webView->experimental(), SIGNAL(loadVisuallyCommitted()), timeout); -} - LoadStartedCatcher::LoadStartedCatcher(QQuickWebView* webView) : m_webView(webView) { diff --git a/Source/WebKit2/UIProcess/API/qt/tests/util.h b/Source/WebKit2/UIProcess/API/qt/tests/util.h index 4834029b4..0c14a1ff4 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/util.h +++ b/Source/WebKit2/UIProcess/API/qt/tests/util.h @@ -36,7 +36,6 @@ void suppressDebugOutput(); #if defined(HAVE_QTQUICK) && HAVE_QTQUICK bool waitForLoadSucceeded(QQuickWebView* webView, int timeout = 10000); bool waitForLoadFailed(QQuickWebView* webView, int timeout = 10000); -bool waitForViewportReady(QQuickWebView* webView, int timeout = 10000); class LoadStartedCatcher : public QObject { Q_OBJECT diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp index 77fdc0a26..84f6ebd2f 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp @@ -80,15 +80,15 @@ void CoordinatedBackingStore::updateTile(int id, const IntRect& sourceRect, cons { HashMap<int, CoordinatedBackingStoreTile>::iterator it = m_tiles.find(id); ASSERT(it != m_tiles.end()); - it->value.incrementRepaintCount(); - it->value.setBackBuffer(targetRect, sourceRect, backBuffer, offset); + it->second.incrementRepaintCount(); + it->second.setBackBuffer(targetRect, sourceRect, backBuffer, offset); } PassRefPtr<BitmapTexture> CoordinatedBackingStore::texture() const { HashMap<int, CoordinatedBackingStoreTile>::const_iterator end = m_tiles.end(); for (HashMap<int, CoordinatedBackingStoreTile>::const_iterator it = m_tiles.begin(); it != end; ++it) { - RefPtr<BitmapTexture> texture = it->value.texture(); + RefPtr<BitmapTexture> texture = it->second.texture(); if (texture) return texture; } @@ -112,7 +112,7 @@ void CoordinatedBackingStore::paintToTextureMapper(TextureMapper* textureMapper, HashMap<int, CoordinatedBackingStoreTile>::iterator end = m_tiles.end(); FloatRect coveredRect; for (HashMap<int, CoordinatedBackingStoreTile>::iterator it = m_tiles.begin(); it != end; ++it) { - CoordinatedBackingStoreTile& tile = it->value; + CoordinatedBackingStoreTile& tile = it->second; if (!tile.texture()) continue; @@ -156,7 +156,7 @@ void CoordinatedBackingStore::commitTileOperations(TextureMapper* textureMapper) HashMap<int, CoordinatedBackingStoreTile>::iterator tilesEnd = m_tiles.end(); for (HashMap<int, CoordinatedBackingStoreTile>::iterator it = m_tiles.begin(); it != tilesEnd; ++it) - it->value.swapBuffers(textureMapper); + it->second.swapBuffers(textureMapper); } } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp index 1953afb61..e6f582f22 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp @@ -66,14 +66,14 @@ void LayerTreeCoordinatorProxy::updateTileForLayer(int layerID, int tileID, cons { 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); + uint64_t token = updateInfo.surfaceHandle.graphicsSurfaceToken(); + if (token) { + HashMap<uint64_t, RefPtr<ShareableSurface> >::iterator it = m_surfaces.find(token); if (it == m_surfaces.end()) { surface = ShareableSurface::create(updateInfo.surfaceHandle); - m_surfaces.add(token.frontBufferHandle, surface); + m_surfaces.add(token, surface); } else - surface = it->value; + surface = it->second; } else surface = ShareableSurface::create(updateInfo.surfaceHandle); #else @@ -116,16 +116,10 @@ void LayerTreeCoordinatorProxy::setCompositingLayerFilters(WebLayerID id, const } #endif -void LayerTreeCoordinatorProxy::didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect) +void LayerTreeCoordinatorProxy::didRenderFrame() { dispatchUpdate(bind(&LayerTreeRenderer::flushLayerChanges, m_renderer.get())); updateViewport(); -#if PLATFORM(QT) - m_drawingAreaProxy->page()->didRenderFrame(contentsSize, coveredRect); -#else - UNUSED_PARAM(contentsSize); - UNUSED_PARAM(coveredRect); -#endif } void LayerTreeCoordinatorProxy::createDirectlyCompositedImage(int64_t key, const WebKit::ShareableBitmap::Handle& handle) @@ -180,12 +174,10 @@ void LayerTreeCoordinatorProxy::didChangeScrollPosition(const IntPoint& position dispatchUpdate(bind(&LayerTreeRenderer::didChangeScrollPosition, m_renderer.get(), position)); } -#if USE(GRAPHICS_SURFACE) -void LayerTreeCoordinatorProxy::syncCanvas(uint32_t id, const IntSize& canvasSize, const GraphicsSurfaceToken& token, uint32_t frontBuffer) +void LayerTreeCoordinatorProxy::syncCanvas(uint32_t id, const IntSize& canvasSize, uint64_t graphicsSurfaceToken, uint32_t frontBuffer) { - dispatchUpdate(bind(&LayerTreeRenderer::syncCanvas, m_renderer.get(), id, canvasSize, token, frontBuffer)); + dispatchUpdate(bind(&LayerTreeRenderer::syncCanvas, m_renderer.get(), id, canvasSize, graphicsSurfaceToken, frontBuffer)); } -#endif void LayerTreeCoordinatorProxy::purgeBackingStores() { diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h index b1ef401a4..65a9f5e99 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h @@ -29,7 +29,6 @@ #include "WebLayerTreeInfo.h" #include <WebCore/GraphicsContext.h> #include <WebCore/GraphicsLayer.h> -#include <WebCore/GraphicsSurfaceToken.h> #include <WebCore/IntRect.h> #include <WebCore/IntSize.h> #include <WebCore/RunLoop.h> @@ -64,7 +63,7 @@ public: 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 didRenderFrame(); 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); @@ -74,9 +73,7 @@ public: void updateViewport(); void renderNextFrame(); void didChangeScrollPosition(const WebCore::IntPoint& position); -#if USE(GRAPHICS_SURFACE) - void syncCanvas(uint32_t id, const WebCore::IntSize& canvasSize, const WebCore::GraphicsSurfaceToken&, uint32_t frontBuffer); -#endif + void syncCanvas(uint32_t id, const WebCore::IntSize& canvasSize, uint64_t graphicsSurfaceToken, uint32_t frontBuffer); void purgeBackingStores(); LayerTreeRenderer* layerTreeRenderer() const { return m_renderer.get(); } void setLayerAnimatedOpacity(uint32_t, float); @@ -91,7 +88,7 @@ protected: float m_lastSentScale; WebCore::FloatPoint m_lastSentTrajectoryVector; #if USE(GRAPHICS_SURFACE) - HashMap<WebCore::GraphicsSurfaceToken::BufferHandle, RefPtr<ShareableSurface> > m_surfaces; + HashMap<uint64_t, RefPtr<ShareableSurface> > m_surfaces; #endif }; diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in index b73960021..23869233c 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in @@ -31,11 +31,9 @@ messages -> LayerTreeCoordinatorProxy { RemoveTileForLayer(uint32_t layerID, int tileID) CreateDirectlyCompositedImage(int64_t key, WebKit::ShareableBitmap::Handle handle) DestroyDirectlyCompositedImage(int64_t key) - DidRenderFrame(WebCore::IntSize contentsSize, WebCore::IntRect coveredRect) + DidRenderFrame() DidChangeScrollPosition(WebCore::IntPoint position) -#if USE(GRAPHICS_SURFACE) - SyncCanvas(uint32_t id, WebCore::IntSize canvasSize, WebCore::GraphicsSurfaceToken token, uint32_t frontBuffer) -#endif + SyncCanvas(uint32_t id, WebCore::IntSize canvasSize, uint64_t graphicsSurfaceToken, uint32_t frontBuffer) SetLayerAnimatedOpacity(uint32_t id, float opacity) SetLayerAnimatedTransform(uint32_t id, WebCore::TransformationMatrix transform) } diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp index f053a57a6..b94c66b9d 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp @@ -126,7 +126,7 @@ void LayerTreeRenderer::paintToCurrentGLContext(const TransformationMatrix& matr if (currentRootLayer->opacity() != opacity || currentRootLayer->transform() != matrix) { currentRootLayer->setOpacity(opacity); currentRootLayer->setTransform(matrix); - currentRootLayer->flushCompositingStateForThisLayerOnly(); + currentRootLayer->syncCompositingStateForThisLayerOnly(); } layer->paint(); @@ -183,7 +183,7 @@ void LayerTreeRenderer::adjustPositionForFixedLayers() LayerMap::iterator end = m_fixedLayers.end(); for (LayerMap::iterator it = m_fixedLayers.begin(); it != end; ++it) - toTextureMapperLayer(it->value)->setScrollPositionDeltaIfNeeded(delta); + toTextureMapperLayer(it->second)->setScrollPositionDeltaIfNeeded(delta); } void LayerTreeRenderer::didChangeScrollPosition(const IntPoint& position) @@ -191,12 +191,12 @@ void LayerTreeRenderer::didChangeScrollPosition(const IntPoint& position) m_pendingRenderedContentsScrollPosition = position; } -#if USE(GRAPHICS_SURFACE) -void LayerTreeRenderer::syncCanvas(WebLayerID id, const WebCore::IntSize& canvasSize, const GraphicsSurfaceToken& token, uint32_t frontBuffer) +void LayerTreeRenderer::syncCanvas(WebLayerID id, const WebCore::IntSize& canvasSize, uint64_t graphicsSurfaceToken, uint32_t frontBuffer) { if (canvasSize.isEmpty() || !m_textureMapper) return; +#if USE(GRAPHICS_SURFACE) ensureLayer(id); GraphicsLayer* layer = layerByID(id); @@ -206,18 +206,18 @@ void LayerTreeRenderer::syncCanvas(WebLayerID id, const WebCore::IntSize& canvas canvasBackingStore = TextureMapperSurfaceBackingStore::create(); m_surfaceBackingStores.set(id, canvasBackingStore); } else - canvasBackingStore = it->value; + canvasBackingStore = it->second; - canvasBackingStore->setGraphicsSurface(token, canvasSize, frontBuffer); + canvasBackingStore->setGraphicsSurface(graphicsSurfaceToken, canvasSize, frontBuffer); layer->setContentsToMedia(canvasBackingStore.get()); -} #endif +} void LayerTreeRenderer::setLayerChildren(WebLayerID id, const Vector<WebLayerID>& childIDs) { ensureLayer(id); LayerMap::iterator it = m_layers.find(id); - GraphicsLayer* layer = it->value; + GraphicsLayer* layer = it->second; Vector<GraphicsLayer*> children; for (size_t i = 0; i < childIDs.size(); ++i) { @@ -239,7 +239,7 @@ void LayerTreeRenderer::setLayerFilters(WebLayerID id, const FilterOperations& f LayerMap::iterator it = m_layers.find(id); ASSERT(it != m_layers.end()); - GraphicsLayer* layer = it->value; + GraphicsLayer* layer = it->second; layer->setFilters(filters); } #endif @@ -250,7 +250,7 @@ void LayerTreeRenderer::setLayerState(WebLayerID id, const WebLayerInfo& layerIn LayerMap::iterator it = m_layers.find(id); ASSERT(it != m_layers.end()); - GraphicsLayer* layer = it->value; + GraphicsLayer* layer = it->second; layer->setReplicatedByLayer(layerByID(layerInfo.replica)); layer->setMaskLayer(layerByID(layerInfo.mask)); @@ -377,7 +377,7 @@ void LayerTreeRenderer::assignImageToLayer(GraphicsLayer* layer, int64_t imageID HashMap<int64_t, RefPtr<TextureMapperBackingStore> >::iterator it = m_directlyCompositedImages.find(imageID); ASSERT(it != m_directlyCompositedImages.end()); - layer->setContentsToMedia(it->value.get()); + layer->setContentsToMedia(it->second.get()); } void LayerTreeRenderer::commitTileOperations() @@ -393,7 +393,7 @@ void LayerTreeRenderer::flushLayerChanges() { m_renderedContentsScrollPosition = m_pendingRenderedContentsScrollPosition; - m_rootLayer->flushCompositingState(FloatRect()); + m_rootLayer->syncCompositingState(FloatRect()); commitTileOperations(); // The pending tiles state is on its way for the screen, tell the web process to render the next one. diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h index 0a6ae3b88..4e45678e6 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h @@ -22,13 +22,13 @@ #if USE(COORDINATED_GRAPHICS) #include "BackingStore.h" +#include "GraphicsSurface.h" #include "ShareableSurface.h" #include "TextureMapper.h" #include "TextureMapperBackingStore.h" #include "WebLayerTreeInfo.h" #include <WebCore/GraphicsContext.h> #include <WebCore/GraphicsLayer.h> -#include <WebCore/GraphicsSurface.h> #include <WebCore/IntRect.h> #include <WebCore/IntSize.h> #include <WebCore/RunLoop.h> @@ -68,9 +68,7 @@ public: void setContentsSize(const WebCore::FloatSize&); void setVisibleContentsRect(const WebCore::FloatRect&); void didChangeScrollPosition(const WebCore::IntPoint& position); -#if USE(GRAPHICS_SURFACE) - void syncCanvas(uint32_t id, const WebCore::IntSize& canvasSize, const WebCore::GraphicsSurfaceToken&, uint32_t frontBuffer); -#endif + void syncCanvas(uint32_t id, const WebCore::IntSize& canvasSize, uint64_t graphicsSurfaceToken, uint32_t frontBuffer); void detach(); void appendUpdate(const Function<void()>&); @@ -102,7 +100,7 @@ private: // Reimplementations from WebCore::GraphicsLayerClient. virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double) { } - virtual void notifyFlushRequired(const WebCore::GraphicsLayer*) { } + virtual void notifySyncRequired(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&) { } diff --git a/Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.cpp b/Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.cpp index b26395736..eb06c29d8 100644 --- a/Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.cpp @@ -42,7 +42,7 @@ void GeolocationPermissionRequestManagerProxy::invalidateRequests() PendingRequestMap::const_iterator it = m_pendingRequests.begin(); PendingRequestMap::const_iterator end = m_pendingRequests.end(); for (; it != end; ++it) - it->value->invalidate(); + it->second->invalidate(); m_pendingRequests.clear(); } diff --git a/Source/WebKit2/UIProcess/InspectorServer/WebInspectorServer.cpp b/Source/WebKit2/UIProcess/InspectorServer/WebInspectorServer.cpp index bc585e94d..66d644734 100644 --- a/Source/WebKit2/UIProcess/InspectorServer/WebInspectorServer.cpp +++ b/Source/WebKit2/UIProcess/InspectorServer/WebInspectorServer.cpp @@ -67,7 +67,7 @@ WebInspectorServer::~WebInspectorServer() // Close any remaining open connections. HashMap<unsigned, WebSocketServerConnection*>::iterator end = m_connectionMap.end(); for (HashMap<unsigned, WebSocketServerConnection*>::iterator it = m_connectionMap.begin(); it != end; ++it) { - WebSocketServerConnection* connection = it->value; + WebSocketServerConnection* connection = it->second; WebInspectorProxy* client = m_clientMap.get(connection->identifier()); closeConnection(client, connection); } @@ -78,7 +78,7 @@ int WebInspectorServer::registerPage(WebInspectorProxy* client) #ifndef ASSERT_DISABLED ClientMap::iterator end = m_clientMap.end(); for (ClientMap::iterator it = m_clientMap.begin(); it != end; ++it) - ASSERT(it->value != client); + ASSERT(it->second != client); #endif int pageId = m_nextAvailablePageId++; diff --git a/Source/WebKit2/UIProcess/InspectorServer/WebSocketServerConnection.cpp b/Source/WebKit2/UIProcess/InspectorServer/WebSocketServerConnection.cpp index 6317c62c2..abc805fd7 100644 --- a/Source/WebKit2/UIProcess/InspectorServer/WebSocketServerConnection.cpp +++ b/Source/WebKit2/UIProcess/InspectorServer/WebSocketServerConnection.cpp @@ -106,9 +106,9 @@ void WebSocketServerConnection::sendHTTPResponseHeader(int statusCode, const Str builder.appendLiteral("\r\n"); HTTPHeaderMap::const_iterator end = headerFields.end(); for (HTTPHeaderMap::const_iterator it = headerFields.begin(); it != end; ++it) { - builder.append(it->key); + builder.append(it->first); builder.appendLiteral(": "); - builder.append(it->value); + builder.append(it->second); builder.appendLiteral("\r\n"); } builder.appendLiteral("\r\n"); diff --git a/Source/WebKit2/UIProcess/InspectorServer/qt/WebInspectorServerQt.cpp b/Source/WebKit2/UIProcess/InspectorServer/qt/WebInspectorServerQt.cpp index 11e57cfd5..1882586af 100644 --- a/Source/WebKit2/UIProcess/InspectorServer/qt/WebInspectorServerQt.cpp +++ b/Source/WebKit2/UIProcess/InspectorServer/qt/WebInspectorServerQt.cpp @@ -83,18 +83,18 @@ void WebInspectorServer::buildPageList(Vector<char>& data, String& contentType) builder.appendLiteral("[ "); ClientMap::iterator end = m_clientMap.end(); for (ClientMap::iterator it = m_clientMap.begin(); it != end; ++it) { - WebPageProxy* webPage = it->value->page(); + WebPageProxy* webPage = it->second->page(); if (it != m_clientMap.begin()) builder.appendLiteral(", "); builder.appendLiteral("{ \"id\": "); - builder.appendNumber(it->key); + builder.appendNumber(it->first); builder.appendLiteral(", \"title\": \""); builder.append(webPage->pageTitle()); builder.appendLiteral("\", \"url\": \""); builder.append(webPage->activeURL()); builder.appendLiteral("\", \"inspectorUrl\": \""); builder.append(remoteInspectorPagePath()); - builder.appendNumber(it->key); + builder.appendNumber(it->first); builder.appendLiteral("\" }"); } builder.appendLiteral(" ]"); diff --git a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp index f790de1e8..ba22dda2d 100644 --- a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp +++ b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp @@ -75,8 +75,6 @@ const char* ProcessLauncher::processTypeAsString(ProcessType processType) return "webprocess"; case PluginProcess: return "pluginprocess"; - case NetworkProcess: - return "networkprocess"; } ASSERT_NOT_REACHED(); @@ -95,11 +93,6 @@ bool ProcessLauncher::getProcessTypeFromString(const char* string, ProcessType& return true; } - if (!strcmp(string, "networkprocess")) { - processType = NetworkProcess; - return true; - } - return false; } diff --git a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h index ff600c59c..5945e1e28 100644 --- a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h +++ b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h @@ -48,8 +48,7 @@ public: enum ProcessType { WebProcess, - PluginProcess, - NetworkProcess + PluginProcess }; struct LaunchOptions { diff --git a/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm b/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm index b69bac697..560ceb773 100644 --- a/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm +++ b/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm @@ -82,7 +82,7 @@ struct UUIDHolder : public RefCounted<UUIDHolder> { static void setUpTerminationNotificationHandler(pid_t pid) { #if HAVE(DISPATCH_H) - dispatch_source_t processDiedSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_PROC, pid, DISPATCH_PROC_EXIT, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)); + dispatch_source_t processDiedSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_PROC, pid, DISPATCH_PROC_EXIT, dispatch_get_current_queue()); dispatch_source_set_event_handler(processDiedSource, ^{ int status; waitpid(dispatch_source_get_handle(processDiedSource), &status, 0); @@ -366,22 +366,7 @@ static void createProcess(const ProcessLauncher::LaunchOptions& launchOptions, b CString localization = String(cfLocalization.get()).utf8(); NSBundle *webKit2Bundle = [NSBundle bundleWithIdentifier:@"com.apple.WebKit2"]; - - NSString *processPath; - switch(launchOptions.processType) { - case ProcessLauncher::WebProcess: - processPath = [webKit2Bundle pathForAuxiliaryExecutable:@"WebProcess.app"]; - break; - case ProcessLauncher::PluginProcess: - processPath = [webKit2Bundle pathForAuxiliaryExecutable:@"PluginProcess.app"]; - break; -#if ENABLE(NETWORK_PROCESS) - case ProcessLauncher::NetworkProcess: - processPath = [webKit2Bundle pathForAuxiliaryExecutable:@"NetworkProcess.app"]; - break; -#endif - } - + NSString *processPath = [webKit2Bundle pathForAuxiliaryExecutable:(launchOptions.processType == ProcessLauncher::PluginProcess ? @"PluginProcess.app" : @"WebProcess.app")]; NSString *frameworkExecutablePath = [webKit2Bundle executablePath]; NSString *processAppExecutablePath = [[NSBundle bundleWithPath:processPath] executablePath]; diff --git a/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp b/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp index 60cde5fa0..3cacf04db 100644 --- a/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp +++ b/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp @@ -128,7 +128,7 @@ void ProcessLauncher::launchProcess() mach_port_insert_right(mach_task_self(), connector, connector, MACH_MSG_TYPE_MAKE_SEND); // Register port with a service name to the system. - QString serviceName = QStringLiteral("com.nokia.Qt.WebKit.QtWebProcess-%1-%2"); + QString serviceName = QString("com.nokia.Qt.WebKit.QtWebProcess-%1-%2"); serviceName = serviceName.arg(QString().setNum(getpid()), QString().setNum((size_t)this)); kern_return_t kr = bootstrap_register2(bootstrap_port, const_cast<char*>(serviceName.toUtf8().data()), connector, 0); ASSERT_UNUSED(kr, kr == KERN_SUCCESS); diff --git a/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp b/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp deleted file mode 100644 index fe528351a..000000000 --- a/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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 "NetworkProcessProxy.h" - -#include "NetworkProcessCreationParameters.h" -#include "NetworkProcessMessages.h" -#include <WebCore/RunLoop.h> - -#if ENABLE(NETWORK_PROCESS) - -using namespace WebCore; - -namespace WebKit { - -PassRefPtr<NetworkProcessProxy> NetworkProcessProxy::create() -{ - return adoptRef(new NetworkProcessProxy); -} - -NetworkProcessProxy::NetworkProcessProxy() -{ - ProcessLauncher::LaunchOptions launchOptions; - launchOptions.processType = ProcessLauncher::NetworkProcess; - -#if PLATFORM(MAC) - launchOptions.architecture = ProcessLauncher::LaunchOptions::MatchCurrentArchitecture; - launchOptions.executableHeap = false; -#if HAVE(XPC) - launchOptions.useXPC = false; -#endif -#endif - - m_processLauncher = ProcessLauncher::create(this, launchOptions); -} - -NetworkProcessProxy::~NetworkProcessProxy() -{ - -} - -void NetworkProcessProxy::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) -{ - -} - -void NetworkProcessProxy::didClose(CoreIPC::Connection*) -{ - -} - -void NetworkProcessProxy::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID) -{ - -} - -void NetworkProcessProxy::syncMessageSendTimedOut(CoreIPC::Connection*) -{ - -} - -void NetworkProcessProxy::didFinishLaunching(ProcessLauncher*, CoreIPC::Connection::Identifier connectionIdentifier) -{ - ASSERT(!m_connection); - - if (CoreIPC::Connection::identifierIsNull(connectionIdentifier)) { - // FIXME: Do better cleanup here. - return; - } - - m_connection = CoreIPC::Connection::createServerConnection(connectionIdentifier, this, RunLoop::main()); -#if PLATFORM(MAC) - m_connection->setShouldCloseConnectionOnMachExceptions(); -#endif - - m_connection->open(); - - NetworkProcessCreationParameters parameters; - platformInitializeNetworkProcess(parameters); - - // Initialize the network host process. - m_connection->send(Messages::NetworkProcess::InitializeNetworkProcess(parameters), 0); -} - -} // namespace WebKit - -#endif // ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h b/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h deleted file mode 100644 index 57e37e653..000000000 --- a/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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 NetworkProcessProxy_h -#define NetworkProcessProxy_h - -#if ENABLE(NETWORK_PROCESS) - -#include "Connection.h" -#include "ProcessLauncher.h" -#include "WebProcessProxyMessages.h" -#include <wtf/Deque.h> - -namespace WebKit { - -struct NetworkProcessCreationParameters; - -class NetworkProcessProxy : public RefCounted<NetworkProcessProxy>, CoreIPC::Connection::Client, ProcessLauncher::Client { -public: - static PassRefPtr<NetworkProcessProxy> create(); - ~NetworkProcessProxy(); - -private: - NetworkProcessProxy(); - - void platformInitializeNetworkProcess(NetworkProcessCreationParameters&); - - // CoreIPC::Connection::Client - virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); - virtual void didClose(CoreIPC::Connection*); - virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID); - virtual void syncMessageSendTimedOut(CoreIPC::Connection*); - - // ProcessLauncher::Client - virtual void didFinishLaunching(ProcessLauncher*, CoreIPC::Connection::Identifier); - - // The connection to the network process. - RefPtr<CoreIPC::Connection> m_connection; - - // The process launcher for the network process. - RefPtr<ProcessLauncher> m_processLauncher; - -}; - -} // namespace WebKit - -#endif // ENABLE(NETWORK_PROCESS) - -#endif // NetworkProcessProxy_h diff --git a/Source/WebKit2/UIProcess/Network/mac/NetworkProcessProxyMac.mm b/Source/WebKit2/UIProcess/Network/mac/NetworkProcessProxyMac.mm deleted file mode 100644 index 440cc429f..000000000 --- a/Source/WebKit2/UIProcess/Network/mac/NetworkProcessProxyMac.mm +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 "NetworkProcessProxy.h" - -#import "NetworkProcessCreationParameters.h" - -#if ENABLE(NETWORK_PROCESS) - -using namespace WebCore; - -namespace WebKit { - -void NetworkProcessProxy::platformInitializeNetworkProcess(NetworkProcessCreationParameters& parameters) -{ - parameters.parentProcessName = [[NSProcessInfo processInfo] processName]; -} - -} // namespace WebKit - -#endif // ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/UIProcess/Notifications/NotificationPermissionRequestManagerProxy.cpp b/Source/WebKit2/UIProcess/Notifications/NotificationPermissionRequestManagerProxy.cpp index 4a0c47529..07922985e 100644 --- a/Source/WebKit2/UIProcess/Notifications/NotificationPermissionRequestManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/Notifications/NotificationPermissionRequestManagerProxy.cpp @@ -43,7 +43,7 @@ void NotificationPermissionRequestManagerProxy::invalidateRequests() PendingRequestMap::const_iterator it = m_pendingRequests.begin(); PendingRequestMap::const_iterator end = m_pendingRequests.end(); for (; it != end; ++it) - it->value->invalidate(); + it->second->invalidate(); m_pendingRequests.clear(); } diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp b/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp index 07e1f8497..88e2cf1aa 100644 --- a/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp @@ -47,7 +47,6 @@ PassRefPtr<WebNotificationManagerProxy> WebNotificationManagerProxy::create(WebC WebNotificationManagerProxy::WebNotificationManagerProxy(WebContext* context) : m_context(context) { - m_context->addMessageReceiver(CoreIPC::MessageClassWebNotificationManagerProxy, this); } void WebNotificationManagerProxy::invalidate() diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.h b/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.h index 620915d14..d61b6f661 100644 --- a/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.h +++ b/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.h @@ -27,7 +27,7 @@ #define WebNotificationManagerProxy_h #include "APIObject.h" -#include "MessageReceiver.h" +#include "MessageID.h" #include "WebNotificationProvider.h" #include <WebCore/NotificationClient.h> #include <wtf/HashMap.h> @@ -35,6 +35,12 @@ #include <wtf/PassRefPtr.h> #include <wtf/text/StringHash.h> +namespace CoreIPC { +class ArgumentDecoder; +class ArgumentEncoder; +class Connection; +} + namespace WebKit { class ImmutableArray; @@ -42,7 +48,7 @@ class WebContext; class WebPageProxy; class WebSecurityOrigin; -class WebNotificationManagerProxy : public APIObject, private CoreIPC::MessageReceiver { +class WebNotificationManagerProxy : public APIObject { public: static const Type APIType = TypeNotificationManager; @@ -62,13 +68,13 @@ public: void providerDidUpdateNotificationPolicy(const WebSecurityOrigin*, bool allowed); void providerDidRemoveNotificationPolicies(ImmutableArray* origins); + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + private: explicit WebNotificationManagerProxy(WebContext*); virtual Type type() const { return APIType; } - - // CoreIPC::MessageReceiver - virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE; + void didReceiveWebNotificationManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); // Message handlers diff --git a/Source/WebKit2/UIProcess/PageClient.h b/Source/WebKit2/UIProcess/PageClient.h index c6fb91882..ebf5cd16f 100644 --- a/Source/WebKit2/UIProcess/PageClient.h +++ b/Source/WebKit2/UIProcess/PageClient.h @@ -118,8 +118,6 @@ public: 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; virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&) = 0; virtual void didReceiveMessageFromNavigatorQtObject(const String&) = 0; virtual void updateTextInputState() = 0; diff --git a/Source/WebKit2/UIProcess/PageViewportController.cpp b/Source/WebKit2/UIProcess/PageViewportController.cpp index 02fd3b699..e42006a14 100644 --- a/Source/WebKit2/UIProcess/PageViewportController.cpp +++ b/Source/WebKit2/UIProcess/PageViewportController.cpp @@ -54,6 +54,9 @@ ViewportUpdateDeferrer::~ViewportUpdateDeferrer() return; m_controller->resumeContent(); + + // Make sure that tiles all around the viewport will be requested. + m_controller->syncVisibleContents(); } PageViewportController::PageViewportController(WebKit::WebPageProxy* proxy, PageViewportControllerClient* client) @@ -106,65 +109,15 @@ FloatPoint PageViewportController::clampViewportToContents(const WebCore::FloatP return FloatPoint(clampTo(viewportPos.x(), 0.f, horizontalRange), clampTo(viewportPos.y(), 0.f, verticalRange)); } -void PageViewportController::didCommitLoad() -{ - // Do not count the previous committed page contents as covered. - m_lastFrameCoveredRect = FloatRect(); - - // Reset the position to the top, page/history scroll requests may override this before we re-enable rendering. - applyPositionAfterRenderingContents(FloatPoint()); -} - void PageViewportController::didChangeContentsSize(const IntSize& newSize) { + if (m_viewportSize.isEmpty() || newSize.isEmpty()) + return; + m_contentsSize = newSize; updateMinimumScaleToFit(); -} - -void PageViewportController::didRenderFrame(const IntSize& contentsSize, const IntRect& coveredRect) -{ - if (m_clientContentsSize != contentsSize) { - m_clientContentsSize = contentsSize; - // Only update the viewport's contents dimensions along with its render if the - // size actually changed since animations on the page trigger DidRenderFrame - // messages without causing dimension changes. - m_client->didChangeContentsSize(contentsSize); - } - - m_lastFrameCoveredRect = coveredRect; - - // Apply any scale or scroll position we locked to be set on the viewport - // only when there is something to display there. The scale goes first to - // avoid offsetting our deferred position by scaling at the viewport center. - // All position and scale changes resulting from a web process event should - // go through here to be applied on the viewport to avoid showing incomplete - // tiles to the user during a few milliseconds. - if (m_effectiveScaleIsLocked) { - m_client->setContentsScale(m_effectiveScale, false); - m_effectiveScaleIsLocked = false; - } - if (m_viewportPosIsLocked) { - FloatPoint clampedPos = clampViewportToContents(m_viewportPos, m_effectiveScale); - // There might be rendered frames not covering our requested position yet, wait for it. - if (FloatRect(clampedPos, viewportSizeInContentsCoordinates()).intersects(coveredRect)) { - m_client->setViewportPosition(clampedPos); - m_viewportPosIsLocked = false; - } - } -} - -void PageViewportController::pageTransitionViewportReady() -{ - if (!m_rawAttributes.layoutSize.isEmpty()) { - m_hadUserInteraction = false; - applyScaleAfterRenderingContents(innerBoundedViewportScale(toViewportScale(m_rawAttributes.initialScale))); - } - // At this point we should already have received the first viewport arguments and the requested scroll - // position for the newly loaded page and sent our reactions to the web process. It's now safe to tell - // the web process to start rendering the new page contents and possibly re-use the current tiles. - // This assumes that all messages have been handled in order and that nothing has been pushed back on the event loop. - m_webPageProxy->commitPageTransitionViewport(); + m_client->didChangeContentsSize(); } void PageViewportController::pageDidRequestScroll(const IntPoint& cssPosition) @@ -173,12 +126,7 @@ void PageViewportController::pageDidRequestScroll(const IntPoint& cssPosition) if (m_activeDeferrerCount) return; - FloatRect endVisibleContentRect(clampViewportToContents(cssPosition, m_effectiveScale), viewportSizeInContentsCoordinates()); - if (m_lastFrameCoveredRect.intersects(endVisibleContentRect)) - m_client->setViewportPosition(endVisibleContentRect.location()); - else - // Keep the unclamped position in case the contents size is changed later on. - applyPositionAfterRenderingContents(cssPosition); + m_client->setViewportPosition(clampViewportToContents(cssPosition, m_effectiveScale)); } void PageViewportController::didChangeViewportSize(const FloatSize& newSize) @@ -197,11 +145,8 @@ void PageViewportController::didChangeViewportSize(const FloatSize& newSize) void PageViewportController::didChangeContentsVisibility(const FloatPoint& viewportPos, float viewportScale, const FloatPoint& trajectoryVector) { - if (!m_viewportPosIsLocked) - m_viewportPos = viewportPos; - if (!m_effectiveScaleIsLocked) - m_effectiveScale = viewportScale; - + m_viewportPos = viewportPos; + m_effectiveScale = viewportScale; syncVisibleContents(trajectoryVector); } @@ -211,7 +156,7 @@ void PageViewportController::syncVisibleContents(const FloatPoint& trajectoryVec if (!drawingArea || m_viewportSize.isEmpty() || m_contentsSize.isEmpty()) return; - FloatRect visibleContentsRect(clampViewportToContents(m_viewportPos, m_effectiveScale), viewportSizeInContentsCoordinates()); + FloatRect visibleContentsRect(clampViewportToContents(m_viewportPos, m_effectiveScale), m_viewportSize / m_effectiveScale); visibleContentsRect.intersect(FloatRect(FloatPoint::zero(), m_contentsSize)); drawingArea->setVisibleContentsRect(visibleContentsRect, m_effectiveScale, trajectoryVector); @@ -232,11 +177,6 @@ void PageViewportController::didChangeViewportAttributes(const WebCore::Viewport m_client->didChangeViewportAttributes(); } -WebCore::FloatSize PageViewportController::viewportSizeInContentsCoordinates() const -{ - return WebCore::FloatSize(m_viewportSize.width() / m_effectiveScale, m_viewportSize.height() / m_effectiveScale); -} - void PageViewportController::suspendContent() { if (m_hasSuspendedContent) @@ -248,6 +188,12 @@ void PageViewportController::suspendContent() void PageViewportController::resumeContent() { + if (!m_rawAttributes.layoutSize.isEmpty() && m_rawAttributes.initialScale > 0) { + m_hadUserInteraction = false; + m_client->setContentsScale(innerBoundedViewportScale(toViewportScale(m_rawAttributes.initialScale)), /* isInitialScale */ true); + m_rawAttributes.initialScale = -1; // Mark used. + } + m_client->didResumeContent(); if (!m_hasSuspendedContent) @@ -257,32 +203,15 @@ void PageViewportController::resumeContent() m_webPageProxy->resumeActiveDOMObjectsAndAnimations(); } -void PageViewportController::applyScaleAfterRenderingContents(float scale) -{ - m_effectiveScale = scale; - m_effectiveScaleIsLocked = true; - syncVisibleContents(); -} - -void PageViewportController::applyPositionAfterRenderingContents(const FloatPoint& pos) -{ - m_viewportPos = pos; - m_viewportPosIsLocked = true; - syncVisibleContents(); -} - void PageViewportController::updateMinimumScaleToFit() { - if (m_viewportSize.isEmpty()) - return; - float minimumScale = WebCore::computeMinimumScaleFactorForContentContained(m_rawAttributes, WebCore::roundedIntSize(m_viewportSize), WebCore::roundedIntSize(m_contentsSize)); if (!fuzzyCompare(minimumScale, m_minimumScaleToFit, 0.001)) { m_minimumScaleToFit = minimumScale; if (!m_hadUserInteraction && !hasSuspendedContent()) - applyScaleAfterRenderingContents(toViewportScale(minimumScale)); + m_client->setContentsScale(toViewportScale(minimumScale), true /* isInitialScale */); m_client->didChangeViewportAttributes(); } diff --git a/Source/WebKit2/UIProcess/PageViewportController.h b/Source/WebKit2/UIProcess/PageViewportController.h index d38ddb914..acbb22a58 100644 --- a/Source/WebKit2/UIProcess/PageViewportController.h +++ b/Source/WebKit2/UIProcess/PageViewportController.h @@ -95,21 +95,15 @@ public: void didChangeContentsVisibility(const WebCore::FloatPoint& viewportPos, float viewportScale, const WebCore::FloatPoint& trajectoryVector = WebCore::FloatPoint::zero()); // Notifications from the WebProcess. - void didCommitLoad(); void didChangeContentsSize(const WebCore::IntSize& newSize); void didChangeViewportAttributes(const WebCore::ViewportAttributes&); - void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect); - void pageTransitionViewportReady(); void pageDidRequestScroll(const WebCore::IntPoint& cssPosition); private: float fromViewportScale(float scale) const { return scale / devicePixelRatio(); } float toViewportScale(float scale) const { return scale * devicePixelRatio(); } void syncVisibleContents(const WebCore::FloatPoint &trajectoryVector = WebCore::FloatPoint::zero()); - void applyScaleAfterRenderingContents(float scale); - void applyPositionAfterRenderingContents(const WebCore::FloatPoint& pos); void updateMinimumScaleToFit(); - WebCore::FloatSize viewportSizeInContentsCoordinates() const; WebPageProxy* const m_webPageProxy; PageViewportControllerClient* m_client; @@ -126,13 +120,8 @@ private: WebCore::FloatPoint m_viewportPos; WebCore::FloatSize m_viewportSize; WebCore::FloatSize m_contentsSize; - WebCore::IntSize m_clientContentsSize; float m_effectiveScale; // Should always be cssScale * devicePixelRatio. - bool m_viewportPosIsLocked; - bool m_effectiveScaleIsLocked; - WebCore::FloatRect m_lastFrameCoveredRect; - friend class ViewportUpdateDeferrer; }; diff --git a/Source/WebKit2/UIProcess/PageViewportControllerClient.h b/Source/WebKit2/UIProcess/PageViewportControllerClient.h index 7b05ea854..3d91b9aac 100644 --- a/Source/WebKit2/UIProcess/PageViewportControllerClient.h +++ b/Source/WebKit2/UIProcess/PageViewportControllerClient.h @@ -23,11 +23,6 @@ #include <wtf/Noncopyable.h> -namespace WebCore { -class FloatPoint; -class IntSize; -} - namespace WebKit { class PageViewportController; @@ -42,7 +37,7 @@ public: virtual void setContentsScale(float, bool treatAsInitialValue) = 0; virtual void didResumeContent() = 0; - virtual void didChangeContentsSize(const WebCore::IntSize&) = 0; + virtual void didChangeContentsSize() = 0; virtual void didChangeVisibleContents() = 0; virtual void didChangeViewportAttributes() = 0; diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp index f497895db..cebf4f7b2 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp @@ -74,6 +74,15 @@ void PluginProcessManager::clearSiteData(const PluginModuleInfo& plugin, WebPlug pluginProcess->clearSiteData(webPluginSiteDataManager, sites, flags, maxAgeInSeconds, callbackID); } +void PluginProcessManager::pluginSyncMessageSendTimedOut(const String& pluginPath) +{ + PluginProcessProxy* pluginProcess = pluginProcessWithPath(pluginPath); + if (!pluginProcess) + return; + + pluginProcess->terminate(); +} + PluginProcessProxy* PluginProcessManager::pluginProcessWithPath(const String& pluginPath) { for (size_t i = 0; i < m_pluginProcesses.size(); ++i) { diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h index 37824c4aa..19aafe860 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h @@ -56,6 +56,8 @@ 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); + void pluginSyncMessageSendTimedOut(const String& pluginPath); + private: PluginProcessManager(); diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp index 7796cfe97..cfdff9efb 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp @@ -152,10 +152,10 @@ void PluginProcessProxy::pluginProcessCrashedOrFailedToLaunch() } while (!m_pendingGetSitesReplies.isEmpty()) - didGetSitesWithData(Vector<String>(), m_pendingGetSitesReplies.begin()->key); + didGetSitesWithData(Vector<String>(), m_pendingGetSitesReplies.begin()->first); while (!m_pendingClearSiteDataReplies.isEmpty()) - didClearSiteData(m_pendingClearSiteDataReplies.begin()->key); + didClearSiteData(m_pendingClearSiteDataReplies.begin()->first); // Tell the plug-in process manager to forget about this plug-in process proxy. This may cause us to be deleted. m_pluginProcessManager->removePluginProcessProxy(this); @@ -188,6 +188,10 @@ void PluginProcessProxy::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC: { } +void PluginProcessProxy::syncMessageSendTimedOut(CoreIPC::Connection*) +{ +} + void PluginProcessProxy::didFinishLaunching(ProcessLauncher*, CoreIPC::Connection::Identifier connectionIdentifier) { ASSERT(!m_connection); diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h index 4b50e6b80..e0fe15ff0 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h @@ -101,6 +101,7 @@ private: virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); virtual void didClose(CoreIPC::Connection*); virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID); + virtual void syncMessageSendTimedOut(CoreIPC::Connection*); // ProcessLauncher::Client virtual void didFinishLaunching(ProcessLauncher*, CoreIPC::Connection::Identifier); diff --git a/Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.cpp b/Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.cpp index 246eeb447..a26bbbdb8 100644 --- a/Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.cpp +++ b/Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.cpp @@ -163,6 +163,8 @@ void WebPluginSiteDataManager::getSitesWithData(PassRefPtr<ArrayCallback> prpCal m_pendingGetSitesWithData.set(callbackID, state); state->getSitesWithDataForNextPlugin(); #else + m_webContext->relaunchProcessIfNecessary(); + Vector<PluginModuleInfo> plugins = m_webContext->pluginInfoStore().plugins(); Vector<String> pluginPaths; for (size_t i = 0; i < plugins.size(); ++i) @@ -223,6 +225,8 @@ void WebPluginSiteDataManager::clearSiteData(ImmutableArray* sites, uint64_t fla m_pendingClearSiteData.set(callbackID, state); state->clearSiteDataForNextPlugin(); #else + m_webContext->relaunchProcessIfNecessary(); + Vector<PluginModuleInfo> plugins = m_webContext->pluginInfoStore().plugins(); Vector<String> pluginPaths; for (size_t i = 0; i < plugins.size(); ++i) diff --git a/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp b/Source/WebKit2/UIProcess/Plugins/gtk/PluginProcessProxyGtk.cpp index 3febb069a..fa9339d09 100644 --- a/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp +++ b/Source/WebKit2/UIProcess/Plugins/gtk/PluginProcessProxyGtk.cpp @@ -1,7 +1,5 @@ /* * Copyright (C) 2011 Igalia S.L. - * Copyright (C) 2011 Apple Inc. - * Copyright (C) 2012 Samsung Electronics * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -12,10 +10,10 @@ * 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'' + * 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 THE COPYRIGHT OWNER OR CONTRIBUTORS + * 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 @@ -33,11 +31,10 @@ #include "PluginProcessCreationParameters.h" #include "ProcessExecutablePath.h" #include <WebCore/FileSystem.h> +#include <WebCore/GOwnPtrGtk.h> +#include <glib.h> #include <wtf/text/CString.h> #include <wtf/text/WTFString.h> -#if PLATFORM(GTK) || (PLATFORM(EFL) && ENABLE(GLIB_SUPPORT)) -#include <glib.h> -#endif using namespace WebCore; @@ -49,7 +46,6 @@ void PluginProcessProxy::platformInitializePluginProcess(PluginProcessCreationPa bool PluginProcessProxy::scanPlugin(const String& pluginPath, RawPluginMetaData& result) { -#if PLATFORM(GTK) || (PLATFORM(EFL) && ENABLE(GLIB_SUPPORT)) CString binaryPath = fileSystemRepresentation(executablePathOfPluginProcess()); CString pluginPathCString = fileSystemRepresentation(pluginPath); char* argv[4]; @@ -58,39 +54,27 @@ bool PluginProcessProxy::scanPlugin(const String& pluginPath, RawPluginMetaData& argv[2] = const_cast<char*>(pluginPathCString.data()); argv[3] = 0; - int status; - char* stdOut = 0; - - if (!g_spawn_sync(0, argv, 0, G_SPAWN_STDERR_TO_DEV_NULL, 0, 0, &stdOut, 0, &status, 0)) + gint status; + GOwnPtr<gchar> stdOut; + if (!g_spawn_sync(0, argv, 0, G_SPAWN_STDERR_TO_DEV_NULL, 0, 0, &stdOut.outPtr(), 0, &status, 0)) return false; - - if (!WIFEXITED(status) || WEXITSTATUS(status) != EXIT_SUCCESS) { - free(stdOut); + if (!WIFEXITED(status) || WEXITSTATUS(status) != EXIT_SUCCESS) return false; - } const unsigned kNumLinesExpected = 3; String lines[kNumLinesExpected]; unsigned lineIndex = 0; - - const UChar* current = reinterpret_cast<const UChar*>(stdOut); - + const UChar* current = reinterpret_cast<const UChar*>(stdOut.get()); while (lineIndex < kNumLinesExpected) { const UChar* start = current; while (*current++ != UChar('\n')) { } lines[lineIndex++] = String(start, current - start - 1); } - if (stdOut) - free(stdOut); - result.name.swap(lines[0]); result.description.swap(lines[1]); result.mimeDescription.swap(lines[2]); return !result.mimeDescription.isEmpty(); -#else // PLATFORM(GTK) || (PLATFORM(EFL) && ENABLE(GLIB_SUPPORT)) - return false; -#endif // PLATFORM(GTK) || (PLATFORM(EFL) && ENABLE(GLIB_SUPPORT)) } } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm index 2150c06f2..5137968e6 100644 --- a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm +++ b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm @@ -145,14 +145,7 @@ void PluginProcessProxy::platformInitializePluginProcess(PluginProcessCreationPa bool PluginProcessProxy::getPluginProcessSerialNumber(ProcessSerialNumber& pluginProcessSerialNumber) { pid_t pluginProcessPID = m_processLauncher->processIdentifier(); -#if COMPILER(CLANG) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -#endif return GetProcessForPID(pluginProcessPID, &pluginProcessSerialNumber) == noErr; -#if COMPILER(CLANG) -#pragma clang diagnostic pop -#endif } void PluginProcessProxy::makePluginProcessTheFrontProcess() @@ -161,28 +154,14 @@ void PluginProcessProxy::makePluginProcessTheFrontProcess() if (!getPluginProcessSerialNumber(pluginProcessSerialNumber)) return; -#if COMPILER(CLANG) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -#endif SetFrontProcess(&pluginProcessSerialNumber); -#if COMPILER(CLANG) -#pragma clang diagnostic pop -#endif } void PluginProcessProxy::makeUIProcessTheFrontProcess() { ProcessSerialNumber processSerialNumber; -#if COMPILER(CLANG) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -#endif GetCurrentProcess(&processSerialNumber); SetFrontProcess(&processSerialNumber); -#if COMPILER(CLANG) -#pragma clang diagnostic pop -#endif } void PluginProcessProxy::setFullscreenWindowIsShowing(bool fullscreenWindowIsShowing) @@ -214,14 +193,7 @@ void PluginProcessProxy::exitFullscreen() { // If the plug-in host is the current application then we should bring ourselves to the front when it exits full-screen mode. ProcessSerialNumber frontProcessSerialNumber; -#if COMPILER(CLANG) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -#endif GetFrontProcess(&frontProcessSerialNumber); -#if COMPILER(CLANG) -#pragma clang diagnostic pop -#endif // The UI process must be the front process in order to change the presentation mode. makeUIProcessTheFrontProcess(); @@ -234,24 +206,9 @@ void PluginProcessProxy::exitFullscreen() // If the plug-in process was not the front process, switch back to the previous front process. // (Otherwise we'll keep the UI process as the front process). Boolean isPluginProcessFrontProcess; -#if COMPILER(CLANG) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -#endif SameProcess(&frontProcessSerialNumber, &pluginProcessSerialNumber, &isPluginProcessFrontProcess); -#if COMPILER(CLANG) -#pragma clang diagnostic pop -#endif - if (!isPluginProcessFrontProcess) { -#if COMPILER(CLANG) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -#endif + if (!isPluginProcessFrontProcess) SetFrontProcess(&frontProcessSerialNumber); -#if COMPILER(CLANG) -#pragma clang diagnostic pop -#endif - } } void PluginProcessProxy::setModalWindowIsShowing(bool modalWindowIsShowing) diff --git a/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp b/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp index 4fc41ba21..f43c819fd 100644 --- a/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp @@ -41,7 +41,6 @@ PassRefPtr<WebApplicationCacheManagerProxy> WebApplicationCacheManagerProxy::cre WebApplicationCacheManagerProxy::WebApplicationCacheManagerProxy(WebContext* context) : m_webContext(context) { - m_webContext->addMessageReceiver(CoreIPC::MessageClassWebApplicationCacheManagerProxy, this); } WebApplicationCacheManagerProxy::~WebApplicationCacheManagerProxy() diff --git a/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.h b/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.h index 464621856..597f8d7e1 100644 --- a/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.h +++ b/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.h @@ -29,7 +29,7 @@ #include "APIObject.h" #include "GenericCallback.h" #include "ImmutableArray.h" -#include "MessageReceiver.h" + #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> #include <wtf/Vector.h> @@ -49,7 +49,7 @@ class WebSecurityOrigin; typedef GenericCallback<WKArrayRef> ArrayCallback; -class WebApplicationCacheManagerProxy : public APIObject, private CoreIPC::MessageReceiver { +class WebApplicationCacheManagerProxy : public APIObject { public: static const Type APIType = TypeApplicationCacheManager; @@ -63,6 +63,8 @@ public: void deleteEntriesForOrigin(WebSecurityOrigin*); void deleteAllEntries(); + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + bool shouldTerminate(WebProcessProxy*) const; private: @@ -71,9 +73,7 @@ private: virtual Type type() const { return APIType; } void didGetApplicationCacheOrigins(const Vector<SecurityOriginData>&, uint64_t callbackID); - - // CoreIPC::MessageReceiver - virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE; + void didReceiveWebApplicationCacheManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); WebContext* m_webContext; diff --git a/Source/WebKit2/UIProcess/WebBatteryManagerProxy.cpp b/Source/WebKit2/UIProcess/WebBatteryManagerProxy.cpp index b42b7b021..c3897e81c 100644 --- a/Source/WebKit2/UIProcess/WebBatteryManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebBatteryManagerProxy.cpp @@ -42,7 +42,6 @@ WebBatteryManagerProxy::WebBatteryManagerProxy(WebContext* context) : m_isUpdating(false) , m_context(context) { - m_context->addMessageReceiver(CoreIPC::MessageClassWebBatteryManagerProxy, this); } WebBatteryManagerProxy::~WebBatteryManagerProxy() diff --git a/Source/WebKit2/UIProcess/WebBatteryManagerProxy.h b/Source/WebKit2/UIProcess/WebBatteryManagerProxy.h index 65c6614da..9fa5bdc43 100644 --- a/Source/WebKit2/UIProcess/WebBatteryManagerProxy.h +++ b/Source/WebKit2/UIProcess/WebBatteryManagerProxy.h @@ -29,16 +29,21 @@ #if ENABLE(BATTERY_STATUS) #include "APIObject.h" -#include "MessageReceiver.h" +#include "MessageID.h" #include "WebBatteryProvider.h" #include <wtf/Forward.h> +namespace CoreIPC { +class ArgumentDecoder; +class Connection; +} + namespace WebKit { class WebContext; class WebBatteryStatus; -class WebBatteryManagerProxy : public APIObject, private CoreIPC::MessageReceiver { +class WebBatteryManagerProxy : public APIObject { public: static const Type APIType = TypeBatteryManager; @@ -53,14 +58,13 @@ public: void providerDidChangeBatteryStatus(const WTF::AtomicString&, WebBatteryStatus*); void providerUpdateBatteryStatus(WebBatteryStatus*); + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + private: explicit WebBatteryManagerProxy(WebContext*); virtual Type type() const { return APIType; } - // CoreIPC::MessageReceiver - virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE; - // Implemented in generated WebBatteryManagerProxyMessageReceiver.cpp void didReceiveWebBatteryManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); diff --git a/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp b/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp index 86ba91c08..dbf12ccf0 100644 --- a/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp +++ b/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp @@ -40,8 +40,8 @@ PassRefPtr<WebConnectionToWebProcess> WebConnectionToWebProcess::create(WebProce } WebConnectionToWebProcess::WebConnectionToWebProcess(WebProcessProxy* process, CoreIPC::Connection::Identifier connectionIdentifier, RunLoop* runLoop) - : WebConnection(CoreIPC::Connection::createServerConnection(connectionIdentifier, this, runLoop)) - , m_process(process) + : m_process(process) + , m_connection(CoreIPC::Connection::createServerConnection(connectionIdentifier, this, runLoop)) { #if OS(DARWIN) m_connection->setShouldCloseConnectionOnMachExceptions(); @@ -50,27 +50,42 @@ WebConnectionToWebProcess::WebConnectionToWebProcess(WebProcessProxy* process, C #endif } -// WebConnection - -void WebConnectionToWebProcess::encodeMessageBody(CoreIPC::ArgumentEncoder* argumentEncoder, APIObject* messageBody) +void WebConnectionToWebProcess::invalidate() { - argumentEncoder->encode(WebContextUserMessageEncoder(messageBody)); + m_connection->invalidate(); + m_connection = nullptr; + m_process = 0; } -bool WebConnectionToWebProcess::decodeMessageBody(CoreIPC::ArgumentDecoder* argumentDecoder, RefPtr<APIObject>& messageBody) +// WebConnection + +void WebConnectionToWebProcess::postMessage(const String& messageName, APIObject* messageBody) { - if (!argumentDecoder->decode(WebContextUserMessageDecoder(messageBody, m_process))) - return false; + // We need to check if we have an underlying process here since a user of the API can hold + // onto us and call postMessage even after the process has been invalidated. + if (!m_process) + return; - return true; + m_process->deprecatedSend(WebConnectionLegacyMessage::PostMessage, 0, CoreIPC::In(messageName, WebContextUserMessageEncoder(messageBody))); } // CoreIPC::Connection::Client void WebConnectionToWebProcess::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) { - if (messageID.is<CoreIPC::MessageClassWebConnection>()) { - didReceiveWebConnectionMessage(connection, messageID, arguments); + if (messageID.is<CoreIPC::MessageClassWebConnectionLegacy>()) { + switch (messageID.get<WebConnectionLegacyMessage::Kind>()) { + case WebConnectionLegacyMessage::PostMessage: { + String messageName; + RefPtr<APIObject> messageBody; + WebContextUserMessageDecoder messageDecoder(messageBody, m_process); + if (!arguments->decode(CoreIPC::Out(messageName, messageDecoder))) + return; + + forwardDidReceiveMessageToClient(messageName, messageBody.get()); + return; + } + } return; } @@ -109,6 +124,11 @@ void WebConnectionToWebProcess::didReceiveInvalidMessage(CoreIPC::Connection* co m_client.didClose(this); } +void WebConnectionToWebProcess::syncMessageSendTimedOut(CoreIPC::Connection* connection) +{ + m_process->syncMessageSendTimedOut(connection); +} + #if PLATFORM(WIN) Vector<HWND> WebConnectionToWebProcess::windowsToReceiveSentMessagesWhileWaitingForSyncReply() { diff --git a/Source/WebKit2/UIProcess/WebConnectionToWebProcess.h b/Source/WebKit2/UIProcess/WebConnectionToWebProcess.h index 160813247..f4962e26c 100644 --- a/Source/WebKit2/UIProcess/WebConnectionToWebProcess.h +++ b/Source/WebKit2/UIProcess/WebConnectionToWebProcess.h @@ -33,28 +33,32 @@ namespace WebKit { class WebProcessProxy; -class WebConnectionToWebProcess : public WebConnection, public CoreIPC::Connection::Client { +class WebConnectionToWebProcess : public WebConnection, CoreIPC::Connection::Client { public: static PassRefPtr<WebConnectionToWebProcess> create(WebProcessProxy*, CoreIPC::Connection::Identifier, WebCore::RunLoop*); - WebProcessProxy* webProcessProxy() const { return m_process; } + CoreIPC::Connection* connection() { return m_connection.get(); } + + void invalidate(); + private: WebConnectionToWebProcess(WebProcessProxy*, CoreIPC::Connection::Identifier, WebCore::RunLoop*); // WebConnection - virtual void encodeMessageBody(CoreIPC::ArgumentEncoder*, APIObject*) OVERRIDE; - virtual bool decodeMessageBody(CoreIPC::ArgumentDecoder*, RefPtr<APIObject>&) OVERRIDE; + virtual void postMessage(const String&, APIObject*); // CoreIPC::Connection::Client virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&); virtual void didClose(CoreIPC::Connection*); virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID); + virtual void syncMessageSendTimedOut(CoreIPC::Connection*); #if PLATFORM(WIN) virtual Vector<HWND> windowsToReceiveSentMessagesWhileWaitingForSyncReply(); #endif WebProcessProxy* m_process; + RefPtr<CoreIPC::Connection> m_connection; }; } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebContext.cpp b/Source/WebKit2/UIProcess/WebContext.cpp index d3dab6c74..f0c3580c1 100644 --- a/Source/WebKit2/UIProcess/WebContext.cpp +++ b/Source/WebKit2/UIProcess/WebContext.cpp @@ -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 @@ -28,6 +28,7 @@ #include "DownloadProxy.h" #include "ImmutableArray.h" +#include "InjectedBundleMessageKinds.h" #include "Logging.h" #include "MutableDictionary.h" #include "SandboxExtension.h" @@ -120,45 +121,36 @@ WebContext::WebContext(ProcessModel processModel, const String& injectedBundlePa , m_cacheModel(CacheModelDocumentViewer) , m_memorySamplerEnabled(false) , m_memorySamplerInterval(1400.0) -#if PLATFORM(WIN) - , m_shouldPaintNativeControls(true) - , m_initialHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicyAlways) -#endif - , m_processTerminationEnabled(true) -#if ENABLE(NETWORK_PROCESS) - , m_usesNetworkProcess(false) -#endif -{ - addMessageReceiver(CoreIPC::MessageClassWebContext, this); - addMessageReceiver(CoreIPC::MessageClassDownloadProxy, this); - addMessageReceiver(CoreIPC::MessageClassWebContextLegacy, this); - - // NOTE: These sub-objects must be initialized after m_messageReceiverMap.. - m_applicationCacheManagerProxy = WebApplicationCacheManagerProxy::create(this); + , m_applicationCacheManagerProxy(WebApplicationCacheManagerProxy::create(this)) #if ENABLE(BATTERY_STATUS) - m_batteryManagerProxy = WebBatteryManagerProxy::create(this); + , m_batteryManagerProxy(WebBatteryManagerProxy::create(this)) #endif - m_cookieManagerProxy = WebCookieManagerProxy::create(this); + , m_cookieManagerProxy(WebCookieManagerProxy::create(this)) #if ENABLE(SQL_DATABASE) - m_databaseManagerProxy = WebDatabaseManagerProxy::create(this); + , m_databaseManagerProxy(WebDatabaseManagerProxy::create(this)) #endif - m_geolocationManagerProxy = WebGeolocationManagerProxy::create(this); - m_iconDatabase = WebIconDatabase::create(this); - m_keyValueStorageManagerProxy = WebKeyValueStorageManagerProxy::create(this); - m_mediaCacheManagerProxy = WebMediaCacheManagerProxy::create(this); + , m_geolocationManagerProxy(WebGeolocationManagerProxy::create(this)) + , m_iconDatabase(WebIconDatabase::create(this)) + , m_keyValueStorageManagerProxy(WebKeyValueStorageManagerProxy::create(this)) + , m_mediaCacheManagerProxy(WebMediaCacheManagerProxy::create(this)) #if ENABLE(NETWORK_INFO) - m_networkInfoManagerProxy = WebNetworkInfoManagerProxy::create(this); + , m_networkInfoManagerProxy(WebNetworkInfoManagerProxy::create(this)) #endif - m_notificationManagerProxy = WebNotificationManagerProxy::create(this); - m_pluginSiteDataManager = WebPluginSiteDataManager::create(this); - m_resourceCacheManagerProxy = WebResourceCacheManagerProxy::create(this); + , m_notificationManagerProxy(WebNotificationManagerProxy::create(this)) + , m_pluginSiteDataManager(WebPluginSiteDataManager::create(this)) + , m_resourceCacheManagerProxy(WebResourceCacheManagerProxy::create(this)) #if USE(SOUP) - m_soupRequestManagerProxy = WebSoupRequestManagerProxy::create(this); + , m_soupRequestManagerProxy(WebSoupRequestManagerProxy::create(this)) #endif #if ENABLE(VIBRATION) - m_vibrationProxy = WebVibrationProxy::create(this); + , m_vibrationProxy(WebVibrationProxy::create(this)) #endif - +#if PLATFORM(WIN) + , m_shouldPaintNativeControls(true) + , m_initialHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicyAlways) +#endif + , m_processTerminationEnabled(true) +{ #if !LOG_DISABLED WebKit::initializeLogChannelsIfNecessary(); #endif @@ -183,8 +175,6 @@ WebContext::~WebContext() removeLanguageChangeObserver(this); - m_messageReceiverMap.invalidate(); - m_applicationCacheManagerProxy->invalidate(); m_applicationCacheManagerProxy->clearContext(); @@ -273,8 +263,6 @@ void WebContext::setProcessModel(ProcessModel processModel) // Guard against API misuse. if (!m_processes.isEmpty()) CRASH(); - if (processModel != ProcessModelSharedSecondaryProcess && !m_messagesToInjectedBundlePostedToEmptyContext.isEmpty()) - CRASH(); #if !ENABLE(PLUGIN_PROCESS) // Plugin process is required for multiple web process mode. @@ -313,28 +301,14 @@ void WebContext::textCheckerStateChanged() sendToAllProcesses(Messages::WebProcess::SetTextCheckerState(TextChecker::state())); } -void WebContext::setUsesNetworkProcess(bool usesNetworkProcess) -{ -#if ENABLE(NETWORK_PROCESS) - m_usesNetworkProcess = usesNetworkProcess; -#else - UNUSED_PARAM(usesNetworkProcess); -#endif -} - void WebContext::ensureSharedWebProcess() { if (m_processes.isEmpty()) - createNewWebProcess(); + m_processes.append(createNewWebProcess()); } PassRefPtr<WebProcessProxy> WebContext::createNewWebProcess() { -#if ENABLE(NETWORK_PROCESS) - if (m_usesNetworkProcess) - ensureNetworkProcess(); -#endif - RefPtr<WebProcessProxy> process = WebProcessProxy::create(this); WebProcessCreationParameters parameters; @@ -392,23 +366,6 @@ PassRefPtr<WebProcessProxy> WebContext::createNewWebProcess() injectedBundleInitializationUserData = m_injectedBundleInitializationUserData; process->send(Messages::WebProcess::InitializeWebProcess(parameters, WebContextUserMessageEncoder(injectedBundleInitializationUserData.get())), 0); - m_processes.append(process); - - if (m_processModel == ProcessModelSharedSecondaryProcess) { - for (size_t i = 0; i != m_messagesToInjectedBundlePostedToEmptyContext.size(); ++i) { - pair<String, RefPtr<APIObject> >& message = m_messagesToInjectedBundlePostedToEmptyContext[i]; - - OwnPtr<CoreIPC::ArgumentEncoder> messageData = CoreIPC::ArgumentEncoder::create(0); - - messageData->encode(message.first); - messageData->encode(WebContextUserMessageEncoder(message.second.get())); - process->send(Messages::WebProcess::PostInjectedBundleMessage(CoreIPC::DataReference(messageData->buffer(), messageData->bufferSize())), 0); - } - m_messagesToInjectedBundlePostedToEmptyContext.clear(); - } else - ASSERT(m_messagesToInjectedBundlePostedToEmptyContext.isEmpty()); - - return process.release(); } @@ -419,20 +376,10 @@ void WebContext::warmInitialProcess() return; } - createNewWebProcess(); + m_processes.append(createNewWebProcess()); m_haveInitialEmptyProcess = true; } -#if ENABLE(NETWORK_PROCESS) -void WebContext::ensureNetworkProcess() -{ - if (m_networkProcess) - return; - - m_networkProcess = NetworkProcessProxy::create(); -} -#endif - void WebContext::enableProcessTermination() { m_processTerminationEnabled = true; @@ -499,9 +446,6 @@ void WebContext::disconnectProcess(WebProcessProxy* process) m_visitedLinkProvider.processDidClose(process); - if (m_haveInitialEmptyProcess && process == m_processes.last()) - m_haveInitialEmptyProcess = false; - // FIXME (Multi-WebProcess): <rdar://problem/12239765> All the invalidation calls below are still necessary in multi-process mode, but they should only affect data structures pertaining to the process being disconnected. // Clearing everything causes assertion failures, so it's less trouble to skip that for now. if (m_processModel != ProcessModelSharedSecondaryProcess) { @@ -570,6 +514,7 @@ PassRefPtr<WebPageProxy> WebContext::createWebPage(PageClient* pageClient, WebPa } else { // FIXME (Multi-WebProcess): <rdar://problem/12239661> Consider limiting the number of web processes in per-tab process model. process = createNewWebProcess(); + m_processes.append(process); } } @@ -584,10 +529,10 @@ WebProcessProxy* WebContext::relaunchProcessIfNecessary() if (m_processModel == ProcessModelSharedSecondaryProcess) { ensureSharedWebProcess(); return m_processes[0].get(); + } else { + // FIXME (Multi-WebProcess): What should this do in this model? + return 0; } - - ASSERT_NOT_REACHED(); - return 0; } DownloadProxy* WebContext::download(WebPageProxy* initiatingPage, const ResourceRequest& request) @@ -614,20 +559,15 @@ DownloadProxy* WebContext::download(WebPageProxy* initiatingPage, const Resource void WebContext::postMessageToInjectedBundle(const String& messageName, APIObject* messageBody) { - if (m_processes.isEmpty()) { - if (m_processModel == ProcessModelSharedSecondaryProcess) - m_messagesToInjectedBundlePostedToEmptyContext.append(std::make_pair(messageName, messageBody)); + if (m_processes.isEmpty()) return; - } // FIXME: Return early if the message body contains any references to WKPageRefs/WKFrameRefs etc. since they're local to a process. - OwnPtr<CoreIPC::ArgumentEncoder> messageData = CoreIPC::ArgumentEncoder::create(0); - messageData->encode(messageName); - messageData->encode(WebContextUserMessageEncoder(messageBody)); - for (size_t i = 0; i < m_processes.size(); ++i) { - m_processes[i]->send(Messages::WebProcess::PostInjectedBundleMessage(CoreIPC::DataReference(messageData->buffer(), messageData->bufferSize())), 0); + // FIXME: We should consider returning false from this function if the messageBody cannot be encoded. + // FIXME: Can we encode the message body outside the loop for all the processes? + m_processes[i]->deprecatedSend(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(messageName, WebContextUserMessageEncoder(messageBody))); } } @@ -769,40 +709,100 @@ HashSet<String, CaseFoldingHash> WebContext::pdfAndPostScriptMIMETypes() return mimeTypes; } -void WebContext::addMessageReceiver(CoreIPC::MessageClass messageClass, CoreIPC::MessageReceiver* messageReceiver) -{ - m_messageReceiverMap.addMessageReceiver(messageClass, messageReceiver); -} - -bool WebContext::dispatchMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* argumentDecoder) -{ - return m_messageReceiverMap.dispatchMessage(connection, messageID, argumentDecoder); -} - -bool WebContext::dispatchSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* argumentDecoder, OwnPtr<CoreIPC::ArgumentEncoder>& reply) -{ - return m_messageReceiverMap.dispatchSyncMessage(connection, messageID, argumentDecoder, reply); -} - -void WebContext::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) +void WebContext::didReceiveMessage(WebProcessProxy* process, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) { if (messageID.is<CoreIPC::MessageClassWebContext>()) { - didReceiveWebContextMessage(connection, messageID, arguments); + didReceiveWebContextMessage(process->connection(), messageID, arguments); return; } if (messageID.is<CoreIPC::MessageClassDownloadProxy>()) { if (DownloadProxy* downloadProxy = m_downloads.get(arguments->destinationID()).get()) - downloadProxy->didReceiveDownloadProxyMessage(connection, messageID, arguments); + downloadProxy->didReceiveDownloadProxyMessage(process->connection(), messageID, arguments); return; } + if (messageID.is<CoreIPC::MessageClassWebApplicationCacheManagerProxy>()) { + m_applicationCacheManagerProxy->didReceiveMessage(process->connection(), messageID, arguments); + return; + } + +#if ENABLE(BATTERY_STATUS) + if (messageID.is<CoreIPC::MessageClassWebBatteryManagerProxy>()) { + m_batteryManagerProxy->didReceiveMessage(process->connection(), messageID, arguments); + return; + } +#endif + + if (messageID.is<CoreIPC::MessageClassWebCookieManagerProxy>()) { + m_cookieManagerProxy->didReceiveMessage(process->connection(), messageID, arguments); + return; + } + +#if ENABLE(SQL_DATABASE) + if (messageID.is<CoreIPC::MessageClassWebDatabaseManagerProxy>()) { + m_databaseManagerProxy->didReceiveWebDatabaseManagerProxyMessage(process->connection(), messageID, arguments); + return; + } +#endif + + if (messageID.is<CoreIPC::MessageClassWebGeolocationManagerProxy>()) { + m_geolocationManagerProxy->didReceiveMessage(process->connection(), messageID, arguments); + return; + } + + if (messageID.is<CoreIPC::MessageClassWebIconDatabase>()) { + m_iconDatabase->didReceiveMessage(process->connection(), messageID, arguments); + return; + } + + if (messageID.is<CoreIPC::MessageClassWebKeyValueStorageManagerProxy>()) { + m_keyValueStorageManagerProxy->didReceiveMessage(process->connection(), messageID, arguments); + return; + } + + if (messageID.is<CoreIPC::MessageClassWebMediaCacheManagerProxy>()) { + m_mediaCacheManagerProxy->didReceiveMessage(process->connection(), messageID, arguments); + return; + } + +#if ENABLE(NETWORK_INFO) + if (messageID.is<CoreIPC::MessageClassWebNetworkInfoManagerProxy>()) { + m_networkInfoManagerProxy->didReceiveMessage(process->connection(), messageID, arguments); + return; + } +#endif + + if (messageID.is<CoreIPC::MessageClassWebNotificationManagerProxy>()) { + m_notificationManagerProxy->didReceiveMessage(process->connection(), messageID, arguments); + return; + } + + if (messageID.is<CoreIPC::MessageClassWebResourceCacheManagerProxy>()) { + m_resourceCacheManagerProxy->didReceiveWebResourceCacheManagerProxyMessage(process->connection(), messageID, arguments); + return; + } + +#if USE(SOUP) + if (messageID.is<CoreIPC::MessageClassWebSoupRequestManagerProxy>()) { + m_soupRequestManagerProxy->didReceiveMessage(process->connection(), messageID, arguments); + return; + } +#endif + +#if ENABLE(VIBRATION) + if (messageID.is<CoreIPC::MessageClassWebVibrationProxy>()) { + m_vibrationProxy->didReceiveMessage(process->connection(), messageID, arguments); + return; + } +#endif + switch (messageID.get<WebContextLegacyMessage::Kind>()) { case WebContextLegacyMessage::PostMessage: { String messageName; RefPtr<APIObject> messageBody; - WebContextUserMessageDecoder messageDecoder(messageBody, WebProcessProxy::fromConnection(connection)); + WebContextUserMessageDecoder messageDecoder(messageBody, process); if (!arguments->decode(CoreIPC::Out(messageName, messageDecoder))) return; @@ -816,26 +816,38 @@ void WebContext::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Mes ASSERT_NOT_REACHED(); } -void WebContext::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, OwnPtr<CoreIPC::ArgumentEncoder>& reply) +void WebContext::didReceiveSyncMessage(WebProcessProxy* process, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, OwnPtr<CoreIPC::ArgumentEncoder>& reply) { if (messageID.is<CoreIPC::MessageClassWebContext>()) { - didReceiveSyncWebContextMessage(connection, messageID, arguments, reply); + didReceiveSyncWebContextMessage(process->connection(), messageID, arguments, reply); return; } if (messageID.is<CoreIPC::MessageClassDownloadProxy>()) { if (DownloadProxy* downloadProxy = m_downloads.get(arguments->destinationID()).get()) - downloadProxy->didReceiveSyncDownloadProxyMessage(connection, messageID, arguments, reply); + downloadProxy->didReceiveSyncDownloadProxyMessage(process->connection(), messageID, arguments, reply); return; } + if (messageID.is<CoreIPC::MessageClassWebIconDatabase>()) { + m_iconDatabase->didReceiveSyncMessage(process->connection(), messageID, arguments, reply); + return; + } + +#if ENABLE(NETWORK_INFO) + if (messageID.is<CoreIPC::MessageClassWebNetworkInfoManagerProxy>()) { + m_networkInfoManagerProxy->didReceiveSyncMessage(process->connection(), messageID, arguments, reply); + return; + } +#endif + switch (messageID.get<WebContextLegacyMessage::Kind>()) { case WebContextLegacyMessage::PostSynchronousMessage: { // FIXME: We should probably encode something in the case that the arguments do not decode correctly. String messageName; RefPtr<APIObject> messageBody; - WebContextUserMessageDecoder messageDecoder(messageBody, WebProcessProxy::fromConnection(connection)); + WebContextUserMessageDecoder messageDecoder(messageBody, process); if (!arguments->decode(CoreIPC::Out(messageName, messageDecoder))) return; @@ -958,7 +970,7 @@ static PassRefPtr<MutableDictionary> createDictionaryFromHashMap(const HashMap<S RefPtr<MutableDictionary> result = MutableDictionary::create(); HashMap<String, uint64_t>::const_iterator end = map.end(); for (HashMap<String, uint64_t>::const_iterator it = map.begin(); it != end; ++it) - result->set(it->key, RefPtr<WebUInt64>(WebUInt64::create(it->value)).get()); + result->set(it->first, RefPtr<WebUInt64>(WebUInt64::create(it->second)).get()); return result; } diff --git a/Source/WebKit2/UIProcess/WebContext.h b/Source/WebKit2/UIProcess/WebContext.h index 11a338d3c..2de4a71c6 100644 --- a/Source/WebKit2/UIProcess/WebContext.h +++ b/Source/WebKit2/UIProcess/WebContext.h @@ -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 @@ -28,13 +28,11 @@ #include "APIObject.h" #include "GenericCallback.h" -#include "MessageReceiver.h" -#include "MessageReceiverMap.h" #include "PluginInfoStore.h" #include "ProcessModel.h" #include "VisitedLinkProvider.h" -#include "WebContextConnectionClient.h" #include "WebContextInjectedBundleClient.h" +#include "WebContextConnectionClient.h" #include "WebDownloadClient.h" #include "WebHistoryClient.h" #include "WebProcessProxy.h" @@ -46,10 +44,6 @@ #include <wtf/text/StringHash.h> #include <wtf/text/WTFString.h> -#if ENABLE(NETWORK_PROCESS) -#include "NetworkProcessProxy.h" -#endif - namespace WebKit { class DownloadProxy; @@ -81,7 +75,7 @@ struct WebProcessCreationParameters; typedef GenericCallback<WKDictionaryRef> DictionaryCallback; -class WebContext : public APIObject, private CoreIPC::MessageReceiver { +class WebContext : public APIObject { public: static const Type APIType = TypeContext; @@ -90,10 +84,6 @@ public: static const Vector<WebContext*>& allContexts(); - void addMessageReceiver(CoreIPC::MessageClass, CoreIPC::MessageReceiver*); - bool dispatchMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); - bool dispatchSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&); - void initializeInjectedBundleClient(const WKContextInjectedBundleClient*); void initializeConnectionClient(const WKContextConnectionClient*); void initializeHistoryClient(const WKContextHistoryClient*); @@ -150,9 +140,8 @@ public: void addVisitedLink(const String&); void addVisitedLinkHash(WebCore::LinkHash); - // MessageReceiver. - virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE; - virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&) OVERRIDE; + void didReceiveMessage(WebProcessProxy*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + void didReceiveSyncMessage(WebProcessProxy*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&); void setCacheModel(CacheModel); CacheModel cacheModel() const { return m_cacheModel; } @@ -241,8 +230,6 @@ public: void textCheckerStateChanged(); - void setUsesNetworkProcess(bool); - private: WebContext(ProcessModel, const String& injectedBundlePath); @@ -250,11 +237,7 @@ private: void platformInitializeWebProcess(WebProcessCreationParameters&); void platformInvalidateContext(); - -#if ENABLE(NETWORK_PROCESS) - void ensureNetworkProcess(); -#endif - + #if PLATFORM(MAC) void getPasteboardTypes(const String& pasteboardName, Vector<String>& pasteboardTypes); void getPasteboardPathnamesForType(const String& pasteboardName, const String& pasteboardType, Vector<String>& pathnames); @@ -324,10 +307,6 @@ private: bool m_alwaysUsesComplexTextCodePath; bool m_shouldUseFontSmoothing; - // Messages that were posted before any pages were created. - // The client should use initialization messages instead, so that a restarted process would get the same state. - Vector<pair<String, RefPtr<APIObject> > > m_messagesToInjectedBundlePostedToEmptyContext; - CacheModel m_cacheModel; WebDownloadClient m_downloadClient; @@ -375,15 +354,8 @@ private: String m_overrideLocalStorageDirectory; bool m_processTerminationEnabled; - -#if ENABLE(NETWORK_PROCESS) - RefPtr<NetworkProcessProxy> m_networkProcess; - bool m_usesNetworkProcess; -#endif HashMap<uint64_t, RefPtr<DictionaryCallback> > m_dictionaryCallbacks; - - CoreIPC::MessageReceiverMap m_messageReceiverMap; }; template<typename U> inline void WebContext::sendToAllProcesses(const U& message) @@ -398,9 +370,7 @@ template<typename U> inline void WebContext::sendToAllProcesses(const U& message template<typename U> void WebContext::sendToAllProcessesRelaunchingThemIfNecessary(const U& message) { -// FIXME (Multi-WebProcess): WebContext doesn't track processes that have exited, so it cannot relaunch these. Perhaps this functionality won't be needed in this mode. - if (m_processModel == ProcessModelSharedSecondaryProcess) - relaunchProcessIfNecessary(); + relaunchProcessIfNecessary(); sendToAllProcesses(message); } diff --git a/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp b/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp index aa33ce62f..cc9b23eb6 100644 --- a/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp @@ -41,7 +41,6 @@ PassRefPtr<WebCookieManagerProxy> WebCookieManagerProxy::create(WebContext* cont WebCookieManagerProxy::WebCookieManagerProxy(WebContext* context) : m_webContext(context) { - m_webContext->addMessageReceiver(CoreIPC::MessageClassWebCookieManagerProxy, this); } WebCookieManagerProxy::~WebCookieManagerProxy() diff --git a/Source/WebKit2/UIProcess/WebCookieManagerProxy.h b/Source/WebKit2/UIProcess/WebCookieManagerProxy.h index 6981c0d06..cf1c15b05 100644 --- a/Source/WebKit2/UIProcess/WebCookieManagerProxy.h +++ b/Source/WebKit2/UIProcess/WebCookieManagerProxy.h @@ -29,7 +29,6 @@ #include "APIObject.h" #include "GenericCallback.h" #include "ImmutableArray.h" -#include "MessageReceiver.h" #include "WebCookieManagerProxyClient.h" #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> @@ -49,7 +48,7 @@ class WebProcessProxy; typedef GenericCallback<WKArrayRef> ArrayCallback; typedef GenericCallback<WKHTTPCookieAcceptPolicy, HTTPCookieAcceptPolicy> HTTPCookieAcceptPolicyCallback; -class WebCookieManagerProxy : public APIObject, private CoreIPC::MessageReceiver { +class WebCookieManagerProxy : public APIObject { public: static const Type APIType = TypeCookieManager; @@ -75,6 +74,8 @@ public: void setCookiePersistentStorage(const String& storagePath, uint32_t storageType); #endif + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + bool shouldTerminate(WebProcessProxy*) const; private: @@ -87,8 +88,6 @@ private: void cookiesDidChange(); - // CoreIPC::MessageReceiver - virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE; void didReceiveWebCookieManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); #if PLATFORM(MAC) diff --git a/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp b/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp index a3fda6556..b4331d45c 100644 --- a/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp @@ -94,7 +94,6 @@ PassRefPtr<WebDatabaseManagerProxy> WebDatabaseManagerProxy::create(WebContext* WebDatabaseManagerProxy::WebDatabaseManagerProxy(WebContext* webContext) : m_webContext(webContext) { - m_webContext->addMessageReceiver(CoreIPC::MessageClassWebDatabaseManagerProxy, this); } WebDatabaseManagerProxy::~WebDatabaseManagerProxy() @@ -232,11 +231,6 @@ void WebDatabaseManagerProxy::didModifyDatabase(const String& originIdentifier, m_client.didModifyDatabase(this, origin.get(), databaseIdentifier); } -void WebDatabaseManagerProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) -{ - didReceiveWebDatabaseManagerProxyMessage(connection, messageID, arguments); -} - } // namespace WebKit #endif // ENABLE(SQL_DATABASE) diff --git a/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.h b/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.h index b724a847d..fe920bb03 100644 --- a/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.h +++ b/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.h @@ -31,12 +31,17 @@ #include "APIObject.h" #include "Arguments.h" #include "GenericCallback.h" -#include "MessageReceiver.h" #include "OriginAndDatabases.h" #include "WebDatabaseManagerProxyClient.h" #include <wtf/HashMap.h> #include <wtf/PassRefPtr.h> +namespace CoreIPC { +class ArgumentDecoder; +class Connection; +class MessageID; +} + namespace WebKit { class WebContext; @@ -45,7 +50,7 @@ class WebSecurityOrigin; typedef GenericCallback<WKArrayRef> ArrayCallback; -class WebDatabaseManagerProxy : public APIObject, private CoreIPC::MessageReceiver { +class WebDatabaseManagerProxy : public APIObject { public: static const Type APIType = TypeDatabaseManager; @@ -73,6 +78,8 @@ public: static String databaseDetailsExpectedUsageKey(); static String databaseDetailsCurrentUsageKey(); + void didReceiveWebDatabaseManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + bool shouldTerminate(WebProcessProxy*) const; private: @@ -80,10 +87,6 @@ private: virtual Type type() const { return APIType; } - // CoreIPC::MessageReceiver - virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE; - void didReceiveWebDatabaseManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); - // Message handlers. void didGetDatabasesByOrigin(const Vector<OriginAndDatabases>& originAndDatabases, uint64_t callbackID); void didGetDatabaseOrigins(const Vector<String>& originIdentifiers, uint64_t callbackID); diff --git a/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.cpp b/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.cpp index fe71ecaa4..9dc13bcc9 100644 --- a/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.cpp @@ -94,9 +94,9 @@ void WebFullScreenManagerProxy::requestExitFullScreen() m_page->process()->send(Messages::WebFullScreenManager::RequestExitFullScreen(), m_page->pageID()); } -void WebFullScreenManagerProxy::supportsFullScreen(bool withKeyboard, bool& supports) +void WebFullScreenManagerProxy::supportsFullScreen(bool /*withKeyboard*/, bool& supports) { - supports = !withKeyboard; + supports = true; } } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp b/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp index e20d1eebd..af49f9bc1 100644 --- a/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp @@ -40,7 +40,6 @@ WebGeolocationManagerProxy::WebGeolocationManagerProxy(WebContext* context) : m_isUpdating(false) , m_context(context) { - m_context->addMessageReceiver(CoreIPC::MessageClassWebGeolocationManagerProxy, this); } WebGeolocationManagerProxy::~WebGeolocationManagerProxy() diff --git a/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.h b/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.h index 8f4102b61..65d7b7a7e 100644 --- a/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.h +++ b/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.h @@ -27,16 +27,21 @@ #define WebGeolocationManagerProxy_h #include "APIObject.h" -#include "MessageReceiver.h" +#include "MessageID.h" #include "WebGeolocationProvider.h" #include <wtf/text/WTFString.h> +namespace CoreIPC { +class ArgumentDecoder; +class Connection; +} + namespace WebKit { class WebContext; class WebGeolocationPosition; -class WebGeolocationManagerProxy : public APIObject, private CoreIPC::MessageReceiver { +class WebGeolocationManagerProxy : public APIObject { public: static const Type APIType = TypeGeolocationManager; @@ -51,14 +56,13 @@ public: void providerDidChangePosition(WebGeolocationPosition*); void providerDidFailToDeterminePosition(const String& errorMessage = String()); + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + private: explicit WebGeolocationManagerProxy(WebContext*); virtual Type type() const { return APIType; } - // CoreIPC::MessageReceiver - virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE; - // Implemented in generated WebGeolocationManagerProxyMessageReceiver.cpp void didReceiveWebGeolocationManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); diff --git a/Source/WebKit2/UIProcess/WebIconDatabase.cpp b/Source/WebKit2/UIProcess/WebIconDatabase.cpp index 8b71e89e0..41c2617bf 100644 --- a/Source/WebKit2/UIProcess/WebIconDatabase.cpp +++ b/Source/WebKit2/UIProcess/WebIconDatabase.cpp @@ -54,7 +54,6 @@ WebIconDatabase::WebIconDatabase(WebContext* context) , m_urlImportCompleted(false) , m_databaseCleanupDisabled(false) { - m_webContext->addMessageReceiver(CoreIPC::MessageClassWebIconDatabase, this); } void WebIconDatabase::invalidate() @@ -181,11 +180,6 @@ void WebIconDatabase::getLoadDecisionForIconURL(const String& iconURL, uint64_t m_webContext->sendToAllProcesses(Messages::WebIconDatabaseProxy::ReceivedIconLoadDecision((int)decision, callbackID)); } -void WebIconDatabase::didReceiveIconForPageURL(const String& pageURL) -{ - notifyIconDataReadyForPageURL(pageURL); -} - Image* WebIconDatabase::imageForPageURL(const String& pageURL, const WebCore::IntSize& iconSize) { if (!m_webContext || !m_iconDatabaseImpl || !m_iconDatabaseImpl->isOpen() || pageURL.isEmpty()) @@ -209,11 +203,6 @@ bool WebIconDatabase::isOpen() return m_iconDatabaseImpl && m_iconDatabaseImpl->isOpen(); } -bool WebIconDatabase::isUrlImportCompleted() -{ - return m_urlImportCompleted; -} - void WebIconDatabase::removeAllIcons() { m_iconDatabaseImpl->removeAllIcons(); @@ -235,6 +224,11 @@ void WebIconDatabase::initializeIconDatabaseClient(const WKIconDatabaseClient* c } // WebCore::IconDatabaseClient +bool WebIconDatabase::performImport() +{ + // WebKit2 icon database doesn't currently support importing any old icon database formats. + return true; +} void WebIconDatabase::didImportIconURLForPageURL(const String& pageURL) { @@ -243,7 +237,7 @@ void WebIconDatabase::didImportIconURLForPageURL(const String& pageURL) void WebIconDatabase::didImportIconDataForPageURL(const String& pageURL) { - notifyIconDataReadyForPageURL(pageURL); + didChangeIconForPageURL(pageURL); } void WebIconDatabase::didChangeIconForPageURL(const String& pageURL) @@ -269,14 +263,14 @@ void WebIconDatabase::didFinishURLImport() HashMap<uint64_t, String>::iterator end = m_pendingLoadDecisionURLMap.end(); for (; i != end; ++i) { - LOG(IconDatabase, "WK2 UIProcess performing delayed callback on callback ID %i for page url %s", (int)i->key, i->value.ascii().data()); - IconLoadDecision decision = m_iconDatabaseImpl->synchronousLoadDecisionForIconURL(i->value, 0); + LOG(IconDatabase, "WK2 UIProcess performing delayed callback on callback ID %i for page url %s", (int)i->first, i->second.ascii().data()); + IconLoadDecision decision = m_iconDatabaseImpl->synchronousLoadDecisionForIconURL(i->second, 0); // Decisions should never be unknown after the inital import is complete ASSERT(decision != IconLoadUnknown); // FIXME (Multi-WebProcess): <rdar://problem/12240223> We need to know which connection to send this message to. - m_webContext->sendToAllProcesses(Messages::WebIconDatabaseProxy::ReceivedIconLoadDecision(static_cast<int>(decision), i->key)); + m_webContext->sendToAllProcesses(Messages::WebIconDatabaseProxy::ReceivedIconLoadDecision(static_cast<int>(decision), i->first)); } m_pendingLoadDecisionURLMap.clear(); @@ -294,10 +288,4 @@ void WebIconDatabase::didReceiveSyncMessage(CoreIPC::Connection* connection, Cor didReceiveSyncWebIconDatabaseMessage(connection, messageID, decoder, reply); } -void WebIconDatabase::notifyIconDataReadyForPageURL(const String& pageURL) -{ - m_iconDatabaseClient.iconDataReadyForPageURL(this, WebURL::create(pageURL).get()); - didChangeIconForPageURL(pageURL); -} - } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebIconDatabase.h b/Source/WebKit2/UIProcess/WebIconDatabase.h index 8643a481d..d808ef0d9 100644 --- a/Source/WebKit2/UIProcess/WebIconDatabase.h +++ b/Source/WebKit2/UIProcess/WebIconDatabase.h @@ -54,7 +54,7 @@ namespace WebKit { class WebContext; -class WebIconDatabase : public APIObject, public WebCore::IconDatabaseClient, private CoreIPC::MessageReceiver { +class WebIconDatabase : public APIObject, public WebCore::IconDatabaseClient { public: static const Type APIType = TypeIconDatabase; @@ -77,12 +77,10 @@ public: void synchronousLoadDecisionForIconURL(const String&, int&) const; void getLoadDecisionForIconURL(const String&, uint64_t callbackID); - void didReceiveIconForPageURL(const String&); WebCore::Image* imageForPageURL(const String&, const WebCore::IntSize& iconSize = WebCore::IntSize(32, 32)); WebCore::NativeImagePtr nativeImageForPageURL(const String&, const WebCore::IntSize& iconSize = WebCore::IntSize(32, 32)); bool isOpen(); - bool isUrlImportCompleted(); void removeAllIcons(); void checkIntegrityBeforeOpening(); @@ -90,27 +88,25 @@ public: void initializeIconDatabaseClient(const WKIconDatabaseClient*); -private: - WebIconDatabase(WebContext*); - - virtual Type type() const { return APIType; } - // WebCore::IconDatabaseClient + virtual bool performImport(); virtual void didImportIconURLForPageURL(const String&); virtual void didImportIconDataForPageURL(const String&); virtual void didChangeIconForPageURL(const String&); virtual void didRemoveAllIcons(); virtual void didFinishURLImport(); + + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&); - // CoreIPC::MessageReceiver - virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE; - virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&) OVERRIDE; +private: + WebIconDatabase(WebContext*); + + virtual Type type() const { return APIType; } void didReceiveWebIconDatabaseMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); void didReceiveSyncWebIconDatabaseMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&); - void notifyIconDataReadyForPageURL(const String&); - WebContext* m_webContext; OwnPtr<WebCore::IconDatabase> m_iconDatabaseImpl; diff --git a/Source/WebKit2/UIProcess/WebIconDatabase.messages.in b/Source/WebKit2/UIProcess/WebIconDatabase.messages.in index 400adb081..b68a0a742 100644 --- a/Source/WebKit2/UIProcess/WebIconDatabase.messages.in +++ b/Source/WebKit2/UIProcess/WebIconDatabase.messages.in @@ -32,5 +32,4 @@ messages -> WebIconDatabase { SynchronousLoadDecisionForIconURL(WTF::String iconURL) -> (int loadDecision) GetLoadDecisionForIconURL(WTF::String iconURL, uint64_t callbackID) - DidReceiveIconForPageURL(WTF::String pageURL) } diff --git a/Source/WebKit2/UIProcess/WebIconDatabaseClient.cpp b/Source/WebKit2/UIProcess/WebIconDatabaseClient.cpp index 4fbfd3ccd..e0de3664e 100644 --- a/Source/WebKit2/UIProcess/WebIconDatabaseClient.cpp +++ b/Source/WebKit2/UIProcess/WebIconDatabaseClient.cpp @@ -47,12 +47,4 @@ void WebIconDatabaseClient::didRemoveAllIcons(WebIconDatabase* iconDatabase) m_client.didRemoveAllIcons(toAPI(iconDatabase), m_client.clientInfo); } -void WebIconDatabaseClient::iconDataReadyForPageURL(WebIconDatabase* iconDatabase, WebURL* url) -{ - if (!m_client.iconDataReadyForPageURL) - return; - - m_client.iconDataReadyForPageURL(toAPI(iconDatabase), toAPI(url), m_client.clientInfo); -} - } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebIconDatabaseClient.h b/Source/WebKit2/UIProcess/WebIconDatabaseClient.h index 5fe2fea43..801ec12a8 100644 --- a/Source/WebKit2/UIProcess/WebIconDatabaseClient.h +++ b/Source/WebKit2/UIProcess/WebIconDatabaseClient.h @@ -39,7 +39,6 @@ class WebIconDatabaseClient : public APIClient<WKIconDatabaseClient, kWKIconData public: void didChangeIconForPageURL(WebIconDatabase*, WebURL*); void didRemoveAllIcons(WebIconDatabase*); - void iconDataReadyForPageURL(WebIconDatabase*, WebURL*); }; } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.h b/Source/WebKit2/UIProcess/WebInspectorProxy.h index 6922b7d73..b80700429 100644 --- a/Source/WebKit2/UIProcess/WebInspectorProxy.h +++ b/Source/WebKit2/UIProcess/WebInspectorProxy.h @@ -189,7 +189,7 @@ private: virtual void windowReceivedMessage(HWND, UINT message, WPARAM, LPARAM); #endif -#if PLATFORM(GTK) || PLATFORM(EFL) +#if PLATFORM(GTK) void createInspectorWindow(); #endif diff --git a/Source/WebKit2/UIProcess/WebIntentData.cpp b/Source/WebKit2/UIProcess/WebIntentData.cpp index c6d8c64ba..632aa3b75 100644 --- a/Source/WebKit2/UIProcess/WebIntentData.cpp +++ b/Source/WebKit2/UIProcess/WebIntentData.cpp @@ -78,7 +78,7 @@ PassRefPtr<ImmutableDictionary> WebIntentData::extras() const ImmutableDictionary::MapType wkExtras; HashMap<String, String>::const_iterator end = m_store.extras.end(); for (HashMap<String, String>::const_iterator it = m_store.extras.begin(); it != end; ++it) - wkExtras.set(it->key, WebString::create(it->value)); + wkExtras.set(it->first, WebString::create(it->second)); return ImmutableDictionary::adopt(wkExtras); } diff --git a/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.cpp b/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.cpp index 454d082f5..8b3332aa5 100644 --- a/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.cpp @@ -41,7 +41,6 @@ PassRefPtr<WebKeyValueStorageManagerProxy> WebKeyValueStorageManagerProxy::creat WebKeyValueStorageManagerProxy::WebKeyValueStorageManagerProxy(WebContext* context) : m_webContext(context) { - m_webContext->addMessageReceiver(CoreIPC::MessageClassWebKeyValueStorageManagerProxy, this); } WebKeyValueStorageManagerProxy::~WebKeyValueStorageManagerProxy() diff --git a/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.h b/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.h index 9c63142f6..2be77c351 100644 --- a/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.h +++ b/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.h @@ -29,11 +29,17 @@ #include "APIObject.h" #include "GenericCallback.h" #include "ImmutableArray.h" -#include "MessageReceiver.h" + #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> #include <wtf/Vector.h> +namespace CoreIPC { + class ArgumentDecoder; + class Connection; + class MessageID; +} + namespace WebKit { struct SecurityOriginData; @@ -43,7 +49,7 @@ class WebSecurityOrigin; typedef GenericCallback<WKArrayRef> ArrayCallback; -class WebKeyValueStorageManagerProxy : public APIObject, private CoreIPC::MessageReceiver { +class WebKeyValueStorageManagerProxy : public APIObject { public: static const Type APIType = TypeKeyValueStorageManager; @@ -57,6 +63,8 @@ public: void deleteEntriesForOrigin(WebSecurityOrigin*); void deleteAllEntries(); + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + bool shouldTerminate(WebProcessProxy*) const; private: @@ -65,9 +73,7 @@ private: virtual Type type() const { return APIType; } void didGetKeyValueStorageOrigins(const Vector<SecurityOriginData>&, uint64_t callbackID); - - // CoreIPC::MessageReceiver - virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE; + void didReceiveWebKeyValueStorageManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); WebContext* m_webContext; diff --git a/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.cpp b/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.cpp index 81cf98f56..ce4a78c64 100644 --- a/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.cpp @@ -40,7 +40,6 @@ PassRefPtr<WebMediaCacheManagerProxy> WebMediaCacheManagerProxy::create(WebConte WebMediaCacheManagerProxy::WebMediaCacheManagerProxy(WebContext* context) : m_webContext(context) { - m_webContext->addMessageReceiver(CoreIPC::MessageClassWebMediaCacheManagerProxy, this); } WebMediaCacheManagerProxy::~WebMediaCacheManagerProxy() diff --git a/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.h b/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.h index 48e88e0fc..adc68c4ab 100644 --- a/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.h +++ b/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.h @@ -29,11 +29,17 @@ #include "APIObject.h" #include "GenericCallback.h" #include "ImmutableArray.h" -#include "MessageReceiver.h" + #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> #include <wtf/Vector.h> +namespace CoreIPC { + class ArgumentDecoder; + class Connection; + class MessageID; +} + namespace WebKit { class WebContext; @@ -41,7 +47,7 @@ class WebProcessProxy; typedef GenericCallback<WKArrayRef> ArrayCallback; -class WebMediaCacheManagerProxy : public APIObject, private CoreIPC::MessageReceiver { +class WebMediaCacheManagerProxy : public APIObject { public: static const Type APIType = TypeMediaCacheManager; @@ -55,6 +61,8 @@ public: void clearCacheForHostname(const String&); void clearCacheForAllHostnames(); + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + bool shouldTerminate(WebProcessProxy*) const; private: @@ -63,9 +71,7 @@ private: virtual Type type() const { return APIType; } void didGetHostnamesWithMediaCache(const Vector<String>&, uint64_t callbackID); - - // CoreIPC::MessageReceiver - virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE; + void didReceiveWebMediaCacheManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); WebContext* m_webContext; diff --git a/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.cpp b/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.cpp index 21a399bc0..9bacced06 100644 --- a/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.cpp @@ -43,7 +43,6 @@ WebNetworkInfoManagerProxy::WebNetworkInfoManagerProxy(WebContext* context) : m_isUpdating(false) , m_context(context) { - m_context->addMessageReceiver(CoreIPC::MessageClassWebNetworkInfoManagerProxy, this); } WebNetworkInfoManagerProxy::~WebNetworkInfoManagerProxy() @@ -73,7 +72,7 @@ void WebNetworkInfoManagerProxy::didReceiveMessage(CoreIPC::Connection* connecti didReceiveWebNetworkInfoManagerProxyMessage(connection, messageID, arguments); } -void WebNetworkInfoManagerProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, OwnPtr<CoreIPC::ArgumentEncoder>& reply) +void WebNetworkInfoManagerProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, WTF::OwnPtr<CoreIPC::ArgumentEncoder>& reply) { didReceiveSyncWebNetworkInfoManagerProxyMessage(connection, messageID, arguments, reply); } diff --git a/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.h b/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.h index 2c4ef7c67..b7298553c 100644 --- a/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.h +++ b/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.h @@ -29,16 +29,22 @@ #if ENABLE(NETWORK_INFO) #include "APIObject.h" -#include "MessageReceiver.h" +#include "MessageID.h" #include "WebNetworkInfoProvider.h" #include <wtf/Forward.h> +namespace CoreIPC { +class ArgumentDecoder; +class ArgumentEncoder; +class Connection; +} + namespace WebKit { class WebContext; class WebNetworkInfo; -class WebNetworkInfoManagerProxy : public APIObject, private CoreIPC::MessageReceiver { +class WebNetworkInfoManagerProxy : public APIObject { public: static const Type APIType = TypeNetworkInfoManager; @@ -52,18 +58,17 @@ public: void providerDidChangeNetworkInformation(const WTF::AtomicString& eventType, WebNetworkInfo*); + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, WTF::OwnPtr<CoreIPC::ArgumentEncoder>&); + private: explicit WebNetworkInfoManagerProxy(WebContext*); virtual Type type() const { return APIType; } - // CoreIPC::MessageReceiver - virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE; - virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&) OVERRIDE; - // Implemented in generated WebNetworkInfoManagerProxyMessageReceiver.cpp void didReceiveWebNetworkInfoManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); - void didReceiveSyncWebNetworkInfoManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&); + void didReceiveSyncWebNetworkInfoManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, WTF::OwnPtr<CoreIPC::ArgumentEncoder>&); void startUpdating(); void stopUpdating(); diff --git a/Source/WebKit2/UIProcess/WebPageGroup.cpp b/Source/WebKit2/UIProcess/WebPageGroup.cpp index 0cdbf817d..72588d4d7 100644 --- a/Source/WebKit2/UIProcess/WebPageGroup.cpp +++ b/Source/WebKit2/UIProcess/WebPageGroup.cpp @@ -26,7 +26,6 @@ #include "config.h" #include "WebPageGroup.h" -#include "WebPageGroupProxyMessages.h" #include "WebPageProxy.h" #include "WebPreferences.h" #include <wtf/HashMap.h> @@ -129,65 +128,4 @@ void WebPageGroup::preferencesDidChange() } } -static Vector<String> toStringVector(ImmutableArray* array) -{ - Vector<String> patternVector; - if (!array) - return patternVector; - - size_t size = array->size(); - if (!size) - return patternVector; - - patternVector.reserveInitialCapacity(size); - for (size_t i = 0; i < size; ++i) { - WebString* webString = array->at<WebString>(i); - ASSERT(webString); - patternVector.uncheckedAppend(webString->string()); - } - - return patternVector; -} - -void WebPageGroup::addUserStyleSheet(const String& source, const String& baseURL, ImmutableArray* whitelist, ImmutableArray* blacklist, WebCore::UserContentInjectedFrames injectedFrames, WebCore::UserStyleLevel level) -{ - if (source.isEmpty()) - return; - - WebCore::UserStyleSheet userStyleSheet = WebCore::UserStyleSheet(source, (baseURL.isEmpty() ? WebCore::blankURL() : WebCore::KURL(WebCore::KURL(), baseURL)), toStringVector(whitelist), toStringVector(blacklist), injectedFrames, level); - - m_data.userStyleSheets.append(userStyleSheet); - sendToAllProcessesInGroup(Messages::WebPageGroupProxy::AddUserStyleSheet(userStyleSheet), m_data.pageGroupID); -} - -void WebPageGroup::addUserScript(const String& source, const String& baseURL, ImmutableArray* whitelist, ImmutableArray* blacklist, WebCore::UserContentInjectedFrames injectedFrames, WebCore::UserScriptInjectionTime injectionTime) -{ - if (source.isEmpty()) - return; - - WebCore::UserScript userScript = WebCore::UserScript(source, (baseURL.isEmpty() ? WebCore::blankURL() : WebCore::KURL(WebCore::KURL(), baseURL)), toStringVector(whitelist), toStringVector(blacklist), injectionTime, injectedFrames); - - m_data.userScripts.append(userScript); - sendToAllProcessesInGroup(Messages::WebPageGroupProxy::AddUserScript(userScript), m_data.pageGroupID); -} - -void WebPageGroup::removeAllUserStyleSheets() -{ - m_data.userStyleSheets.clear(); - sendToAllProcessesInGroup(Messages::WebPageGroupProxy::RemoveAllUserStyleSheets(), m_data.pageGroupID); -} - -void WebPageGroup::removeAllUserScripts() -{ - m_data.userScripts.clear(); - sendToAllProcessesInGroup(Messages::WebPageGroupProxy::RemoveAllUserScripts(), m_data.pageGroupID); -} - -void WebPageGroup::removeAllUserContent() -{ - m_data.userStyleSheets.clear(); - m_data.userScripts.clear(); - sendToAllProcessesInGroup(Messages::WebPageGroupProxy::RemoveAllUserContent(), m_data.pageGroupID); -} - } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebPageGroup.h b/Source/WebKit2/UIProcess/WebPageGroup.h index 176b9ee46..ccc14bd91 100644 --- a/Source/WebKit2/UIProcess/WebPageGroup.h +++ b/Source/WebKit2/UIProcess/WebPageGroup.h @@ -28,8 +28,6 @@ #include "APIObject.h" #include "WebPageGroupData.h" -#include "WebPageProxy.h" -#include "WebProcessProxy.h" #include <wtf/Forward.h> #include <wtf/HashSet.h> @@ -58,37 +56,16 @@ public: void setPreferences(WebPreferences*); WebPreferences* preferences() const; void preferencesDidChange(); - - void addUserStyleSheet(const String& source, const String& baseURL, ImmutableArray* whitelist, ImmutableArray* blacklist, WebCore::UserContentInjectedFrames, WebCore::UserStyleLevel); - void addUserScript(const String& source, const String& baseURL, ImmutableArray* whitelist, ImmutableArray* blacklist, WebCore::UserContentInjectedFrames, WebCore::UserScriptInjectionTime); - void removeAllUserStyleSheets(); - void removeAllUserScripts(); - void removeAllUserContent(); private: WebPageGroup(const String& identifier, bool visibleToInjectedBundle, bool visibleToHistoryClient); virtual Type type() const { return APIType; } - - template<typename MessageType> void sendToAllProcessesInGroup(const MessageType&, uint64_t destinationID); WebPageGroupData m_data; mutable RefPtr<WebPreferences> m_preferences; HashSet<WebPageProxy*> m_pages; }; - -template<typename MessageType> inline void WebPageGroup::sendToAllProcessesInGroup(const MessageType& message, uint64_t destinationID) -{ - HashSet<WebProcessProxy*> processesSeen; - for (HashSet<WebPageProxy*>::const_iterator it = m_pages.begin(), end = m_pages.end(); it != end; ++it) { - WebProcessProxy* webProcessProxy = (*it)->process(); - ASSERT(webProcessProxy); - if (!processesSeen.add(webProcessProxy).isNewEntry) - continue; - if (webProcessProxy->canSendMessage()) - webProcessProxy->send(message, destinationID); - } -} } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp index 7ef4a249f..a0e9ee7f7 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.cpp +++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp @@ -34,6 +34,7 @@ #include "DrawingAreaProxy.h" #include "EventDispatcherMessages.h" #include "FindIndicator.h" +#include "InjectedBundleMessageKinds.h" #include "Logging.h" #include "MessageID.h" #include "NativeWebKeyboardEvent.h" @@ -107,10 +108,6 @@ #include "ArgumentCodersGtk.h" #endif -#if USE(SOUP) -#include "WebSoupRequestManagerProxy.h" -#endif - #ifndef NDEBUG #include <wtf/RefCountedLeakCounter.h> #endif @@ -223,8 +220,6 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> p , m_canShortCircuitHorizontalWheelEvents(true) , m_mainFrameIsPinnedToLeftSide(false) , m_mainFrameIsPinnedToRightSide(false) - , m_mainFrameIsPinnedToTopSide(false) - , m_mainFrameIsPinnedToBottomSide(false) , m_pageCount(0) , m_renderTreeSize(0) , m_shouldSendEventsSynchronously(false) @@ -234,10 +229,6 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> p , m_visibilityState(PageVisibilityStateVisible) #endif { -#if ENABLE(PAGE_VISIBILITY_API) - if (!m_isVisible) - m_visibilityState = PageVisibilityStateHidden; -#endif #ifndef NDEBUG webPageProxyCounter.increment(); #endif @@ -286,21 +277,6 @@ bool WebPageProxy::isValid() return m_isValid; } -PassRefPtr<ImmutableArray> WebPageProxy::relatedPages() const -{ - Vector<WebPageProxy*> pages = m_process->pages(); - ASSERT(pages.contains(this)); - - Vector<RefPtr<APIObject> > result; - result.reserveCapacity(pages.size() - 1); - for (size_t i = 0; i < pages.size(); ++i) { - if (pages[i] != this) - result.append(pages[i]); - } - - return ImmutableArray::adopt(result); -} - void WebPageProxy::initializeLoaderClient(const WKPageLoaderClient* loadClient) { m_loaderClient.initialize(loadClient); @@ -366,13 +342,10 @@ void WebPageProxy::initializeContextMenuClient(const WKPageContextMenuClient* cl void WebPageProxy::reattachToWebProcess() { ASSERT(!isValid()); - ASSERT(m_process); - ASSERT(!m_process->isValid()); - ASSERT(!m_process->isLaunching()); m_isValid = true; - m_process = m_process->context()->createNewWebProcess(); + m_process = m_process->context()->relaunchProcessIfNecessary(); m_process->addExistingWebPage(this, m_pageID); initializeWebPage(); @@ -415,8 +388,6 @@ void WebPageProxy::initializeWebPage() #if ENABLE(PAGE_VISIBILITY_API) m_process->send(Messages::WebPage::SetVisibilityState(m_visibilityState, /* isInitialState */ true), m_pageID); -#elif ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING) - m_process->send(Messages::WebPage::SetVisibilityState(m_isVisible ? PageVisibilityStateVisible : PageVisibilityStateHidden, /* isInitialState */ true), m_pageID); #endif } @@ -477,8 +448,6 @@ void WebPageProxy::close() m_mainFrameIsPinnedToLeftSide = false; m_mainFrameIsPinnedToRightSide = false; - m_mainFrameIsPinnedToTopSide = false; - m_mainFrameIsPinnedToBottomSide = false; m_visibleScrollerThumbRect = IntRect(); @@ -776,9 +745,18 @@ String WebPageProxy::committedURL() const bool WebPageProxy::canShowMIMEType(const String& mimeType) const { - if (MIMETypeRegistry::canShowMIMEType(mimeType)) + if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType)) return true; + if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType)) + return true; + + if (MIMETypeRegistry::isSupportedMediaMIMEType(mimeType)) + return true; + + if (mimeType.startsWith("text/", false)) + return !MIMETypeRegistry::isUnsupportedTextMIMEType(mimeType); + String newMimeType = mimeType; PluginModuleInfo plugin = m_process->context()->pluginInfoStore().findPlugin(newMimeType, KURL()); if (!plugin.path.isNull()) @@ -861,11 +839,6 @@ void WebPageProxy::viewStateDidChange(ViewStateFlags flags) // stop the unresponsiveness timer here. m_process->responsivenessTimer()->stop(); } - -#if ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING) && !ENABLE(PAGE_VISIBILITY_API) - PageVisibilityState visibilityState = m_isVisible ? PageVisibilityStateVisible : PageVisibilityStateHidden; - m_process->send(Messages::WebPage::SetVisibilityState(visibilityState, false), m_pageID); -#endif } } @@ -888,7 +861,7 @@ void WebPageProxy::viewStateDidChange(ViewStateFlags flags) #if ENABLE(PAGE_VISIBILITY_API) PageVisibilityState visibilityState = PageVisibilityStateHidden; - if (m_isVisible) + if (m_pageClient->isViewVisible()) visibilityState = PageVisibilityStateVisible; if (visibilityState != m_visibilityState) { @@ -963,14 +936,6 @@ void WebPageProxy::setViewportSize(const IntSize& size) m_process->send(Messages::WebPage::SetViewportSize(size), m_pageID); } - -void WebPageProxy::commitPageTransitionViewport() -{ - if (!isValid()) - return; - - process()->send(Messages::WebPage::CommitPageTransitionViewport(), m_pageID); -} #endif #if ENABLE(DRAG_SUPPORT) @@ -2101,8 +2066,6 @@ void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, const String& mimeTyp // any wheel events and dispatch them to the WKView when necessary. m_mainFrameIsPinnedToLeftSide = true; m_mainFrameIsPinnedToRightSide = true; - m_mainFrameIsPinnedToTopSide = true; - m_mainFrameIsPinnedToBottomSide = true; } m_pageClient->didCommitLoadForMainFrame(frameHasCustomRepresentation); } @@ -2741,6 +2704,41 @@ void WebPageProxy::setMediaVolume(float volume) m_process->send(Messages::WebPage::SetMediaVolume(volume), m_pageID); } +#if PLATFORM(QT) +void WebPageProxy::didFindZoomableArea(const IntPoint& target, const IntRect& area) +{ + m_pageClient->didFindZoomableArea(target, area); +} + +void WebPageProxy::findZoomableAreaForPoint(const IntPoint& point, const IntSize& area) +{ + if (!isValid()) + return; + + m_process->send(Messages::WebPage::FindZoomableAreaForPoint(point, area), m_pageID); +} + +void WebPageProxy::didReceiveMessageFromNavigatorQtObject(const String& contents) +{ + m_pageClient->didReceiveMessageFromNavigatorQtObject(contents); +} + +void WebPageProxy::authenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password) +{ + m_pageClient->handleAuthenticationRequiredRequest(hostname, realm, prefilledUsername, username, password); +} + +void WebPageProxy::proxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password) +{ + m_pageClient->handleProxyAuthenticationRequiredRequest(hostname, port, prefilledUsername, username, password); +} + +void WebPageProxy::certificateVerificationRequest(const String& hostname, bool& ignoreErrors) +{ + m_pageClient->handleCertificateVerificationRequest(hostname, ignoreErrors); +} +#endif // PLATFORM(QT). + #if PLATFORM(QT) || PLATFORM(EFL) void WebPageProxy::handleDownloadRequest(DownloadProxy* download) { @@ -2964,7 +2962,8 @@ NativeWebMouseEvent* WebPageProxy::currentlyProcessedMouseDownEvent() void WebPageProxy::postMessageToInjectedBundle(const String& messageName, APIObject* messageBody) { - process()->send(Messages::WebPage::PostInjectedBundleMessage(messageName, WebContextUserMessageEncoder(messageBody)), m_pageID); + // FIXME: We should consider returning false from this function if the messageBody cannot be encoded. + process()->deprecatedSend(InjectedBundleMessage::PostMessageToPage, m_pageID, CoreIPC::In(messageName, WebContextUserMessageEncoder(messageBody))); } #if PLATFORM(GTK) @@ -3616,8 +3615,6 @@ void WebPageProxy::processDidCrash() m_mainFrameIsPinnedToLeftSide = false; m_mainFrameIsPinnedToRightSide = false; - m_mainFrameIsPinnedToTopSide = false; - m_mainFrameIsPinnedToBottomSide = false; m_visibleScrollerThumbRect = IntRect(); @@ -3866,12 +3863,10 @@ void WebPageProxy::didChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, m_pageClient->didChangeScrollbarsForMainFrame(); } -void WebPageProxy::didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide, bool pinnedToTopSide, bool pinnedToBottomSide) +void WebPageProxy::didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide) { m_mainFrameIsPinnedToLeftSide = pinnedToLeftSide; m_mainFrameIsPinnedToRightSide = pinnedToRightSide; - m_mainFrameIsPinnedToTopSide = pinnedToTopSide; - m_mainFrameIsPinnedToBottomSide = pinnedToBottomSide; } void WebPageProxy::didChangePageCount(unsigned pageCount) @@ -4108,11 +4103,4 @@ void WebPageProxy::dictationAlternatives(uint64_t dictationContext, Vector<Strin #endif // PLATFORM(MAC) -#if USE(SOUP) -void WebPageProxy::didReceiveURIRequest(String uriString, uint64_t requestID) -{ - m_process->context()->soupRequestManagerProxy()->didReceiveURIRequest(uriString, this, requestID); -} -#endif - } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h index eede6b96f..4cbafa3a9 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.h +++ b/Source/WebKit2/UIProcess/WebPageProxy.h @@ -356,7 +356,6 @@ public: bool maintainsInactiveSelection() const { return m_maintainsInactiveSelection; } void setMaintainsInactiveSelection(bool); #if PLATFORM(QT) - void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect); void registerApplicationScheme(const String& scheme); void resolveApplicationSchemeRequest(QtNetworkRequestData); void sendApplicationSchemeReply(const QQuickNetworkReply*); @@ -419,7 +418,6 @@ public: #endif #if USE(TILED_BACKING_STORE) void setViewportSize(const WebCore::IntSize&); - void commitPageTransitionViewport(); #endif void handleMouseEvent(const NativeWebMouseEvent&); @@ -496,8 +494,6 @@ public: bool isPinnedToLeftSide() const { return m_mainFrameIsPinnedToLeftSide; } bool isPinnedToRightSide() const { return m_mainFrameIsPinnedToRightSide; } - bool isPinnedToTopSide() const { return m_mainFrameIsPinnedToTopSide; } - bool isPinnedToBottomSide() const { return m_mainFrameIsPinnedToBottomSide; } void setPaginationMode(WebCore::Pagination::Mode); WebCore::Pagination::Mode paginationMode() const { return m_paginationMode; } @@ -625,8 +621,6 @@ public: bool isValid(); - PassRefPtr<ImmutableArray> relatedPages() const; - const String& urlAtProcessExit() const { return m_urlAtProcessExit; } WebFrameProxy::LoadState loadStateAtProcessExit() const { return m_loadStateAtProcessExit; } @@ -723,6 +717,7 @@ public: #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL) void setAcceleratedCompositingWindowId(uint64_t nativeWindowId); + void invalidateWidget(); #endif void setSuppressVisibilityUpdates(bool flag) { m_suppressVisibilityUpdates = flag; } @@ -838,7 +833,7 @@ private: void notifyScrollerThumbIsVisibleInRect(const WebCore::IntRect&); void recommendedScrollbarStyleDidChange(int32_t newStyle); void didChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar); - void didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide, bool pinnedToTopSide, bool pinnedToBottomSide); + void didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide); void didChangePageCount(unsigned); void didFailToInitializePlugin(const String& mimeType); void didBlockInsecurePluginVersion(const String& mimeType, const String& urlString); @@ -855,7 +850,6 @@ private: #endif #if PLATFORM(QT) - void pageTransitionViewportReady(); void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&); #endif @@ -1001,10 +995,6 @@ private: #endif #endif // PLATFORM(MAC) -#if USE(SOUP) - void didReceiveURIRequest(String uriString, uint64_t requestID); -#endif - void clearLoadDependentCallbacks(); void performDragControllerAction(DragControllerAction, WebCore::DragData*, const String& dragStorageName, const SandboxExtension::Handle&, const SandboxExtension::HandleArray&); @@ -1198,8 +1188,6 @@ private: bool m_mainFrameIsPinnedToLeftSide; bool m_mainFrameIsPinnedToRightSide; - bool m_mainFrameIsPinnedToTopSide; - bool m_mainFrameIsPinnedToBottomSide; unsigned m_pageCount; diff --git a/Source/WebKit2/UIProcess/WebPageProxy.messages.in b/Source/WebKit2/UIProcess/WebPageProxy.messages.in index 77ac830f2..3a755e1dd 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.messages.in +++ b/Source/WebKit2/UIProcess/WebPageProxy.messages.in @@ -29,7 +29,7 @@ messages -> WebPageProxy { RunJavaScriptConfirm(uint64_t frameID, WTF::String message) -> (bool result) RunJavaScriptPrompt(uint64_t frameID, WTF::String message, WTF::String defaultValue) -> (WTF::String result) ShouldInterruptJavaScript() -> (bool shouldInterupt) - MouseDidMoveOverElement(WebKit::WebHitTestResult::Data hitTestResultData, uint32_t modifiers, WebKit::InjectedBundleUserMessageEncoder userData) Variadic + MouseDidMoveOverElement(WebKit::WebHitTestResult::Data hitTestResultData, uint32_t modifiers, WebKit::InjectedBundleUserMessageEncoder userData); UnavailablePluginButtonClicked(uint32_t pluginUnavailabilityReason, WTF::String mimeType, WTF::String url, WTF::String pluginsPageURL) DidChangeViewportProperties(WebCore::ViewportAttributes attributes) DidReceiveEvent(uint32_t type, bool handled) @@ -63,7 +63,7 @@ messages -> WebPageProxy { NotifyScrollerThumbIsVisibleInRect(WebCore::IntRect scrollerThumb) RecommendedScrollbarStyleDidChange(int32_t newStyle) DidChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar) - DidChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide, bool pinnedToTopSide, bool pinnedToBottomSide) + DidChangeScrollOffsetPinningForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar) DidChangePageCount(unsigned pageCount); DidFailToInitializePlugin(WTF::String mimeType) DidBlockInsecurePluginVersion(WTF::String mimeType, WTF::String urlString) @@ -73,7 +73,6 @@ messages -> WebPageProxy { PageDidRequestScroll(WebCore::IntPoint point) #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) @@ -95,17 +94,17 @@ messages -> WebPageProxy { #endif # Policy messages - DecidePolicyForResponse(uint64_t frameID, WebCore::ResourceResponse response, WebCore::ResourceRequest request, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData) -> (bool receivedPolicyAction, uint64_t policyAction, uint64_t downloadID) Variadic - DecidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, WebCore::ResourceRequest request, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData) -> (bool receivedPolicyAction, uint64_t policyAction, uint64_t downloadID) Variadic - DecidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, WebCore::ResourceRequest request, WTF::String frameName, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData) Variadic - UnableToImplementPolicy(uint64_t frameID, WebCore::ResourceError error, WebKit::InjectedBundleUserMessageEncoder userData) Variadic + DecidePolicyForResponse(uint64_t frameID, WebCore::ResourceResponse response, WebCore::ResourceRequest request, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData) -> (bool receivedPolicyAction, uint64_t policyAction, uint64_t downloadID) + DecidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, WebCore::ResourceRequest request, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData) -> (bool receivedPolicyAction, uint64_t policyAction, uint64_t downloadID) + DecidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, WebCore::ResourceRequest request, WTF::String frameName, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData) + UnableToImplementPolicy(uint64_t frameID, WebCore::ResourceError error, WebKit::InjectedBundleUserMessageEncoder userData) # Intent messages #if ENABLE(WEB_INTENTS) - DidReceiveIntentForFrame(uint64_t frameID, WebKit::IntentData intent, WebKit::InjectedBundleUserMessageEncoder userData) Variadic + DidReceiveIntentForFrame(uint64_t frameID, WebKit::IntentData intent, WebKit::InjectedBundleUserMessageEncoder userData) #endif #if ENABLE(WEB_INTENTS_TAG) - RegisterIntentServiceForFrame(uint64_t frameID, WebKit::IntentServiceInfo serviceInfo, WebKit::InjectedBundleUserMessageEncoder userData) Variadic + RegisterIntentServiceForFrame(uint64_t frameID, WebKit::IntentServiceInfo serviceInfo, WebKit::InjectedBundleUserMessageEncoder userData); #endif # Progress messages @@ -120,23 +119,23 @@ messages -> WebPageProxy { DidRestoreFrameFromPageCache(uint64_t frameID, uint64_t parentFrameID); # Frame load messages - DidCommitLoadForFrame(uint64_t frameID, WTF::String mimeType, bool hasCustomRepresentation, WebKit::PlatformCertificateInfo certificateInfo, WebKit::InjectedBundleUserMessageEncoder userData) Variadic - DidFailLoadForFrame(uint64_t frameID, WebCore::ResourceError error, WebKit::InjectedBundleUserMessageEncoder userData) Variadic - DidFailProvisionalLoadForFrame(uint64_t frameID, WebCore::ResourceError error, WebKit::InjectedBundleUserMessageEncoder userData) Variadic - DidFinishDocumentLoadForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData) Variadic - DidFinishLoadForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData) Variadic - DidFirstLayoutForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData) Variadic - DidFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData) Variadic - DidNewFirstVisuallyNonEmptyLayout(WebKit::InjectedBundleUserMessageEncoder userData) Variadic - DidLayout(uint32_t type, WebKit::InjectedBundleUserMessageEncoder userData) Variadic - DidReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, WTF::String url, WebKit::InjectedBundleUserMessageEncoder userData) Variadic - DidRemoveFrameFromHierarchy(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData) Variadic - DidStartProvisionalLoadForFrame(uint64_t frameID, WTF::String url, WTF::String unreachableURL, WebKit::InjectedBundleUserMessageEncoder userData) Variadic - DidReceiveTitleForFrame(uint64_t frameID, WTF::String title, WebKit::InjectedBundleUserMessageEncoder userData) Variadic - DidDisplayInsecureContentForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData) Variadic - DidRunInsecureContentForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData) Variadic - DidDetectXSSForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData) Variadic - DidSameDocumentNavigationForFrame(uint64_t frameID, uint32_t type, WTF::String url, WebKit::InjectedBundleUserMessageEncoder userData) Variadic + DidCommitLoadForFrame(uint64_t frameID, WTF::String mimeType, bool hasCustomRepresentation, WebKit::PlatformCertificateInfo certificateInfo, WebKit::InjectedBundleUserMessageEncoder userData) + DidFailLoadForFrame(uint64_t frameID, WebCore::ResourceError error, WebKit::InjectedBundleUserMessageEncoder userData) + DidFailProvisionalLoadForFrame(uint64_t frameID, WebCore::ResourceError error, WebKit::InjectedBundleUserMessageEncoder userData) + DidFinishDocumentLoadForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData) + DidFinishLoadForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData) + DidFirstLayoutForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData) + DidFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData) + DidNewFirstVisuallyNonEmptyLayout(WebKit::InjectedBundleUserMessageEncoder userData) + DidLayout(uint32_t type, WebKit::InjectedBundleUserMessageEncoder userData) + DidReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, WTF::String url, WebKit::InjectedBundleUserMessageEncoder userData) + DidRemoveFrameFromHierarchy(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData) + DidStartProvisionalLoadForFrame(uint64_t frameID, WTF::String url, WTF::String unreachableURL, WebKit::InjectedBundleUserMessageEncoder userData) + DidReceiveTitleForFrame(uint64_t frameID, WTF::String title, WebKit::InjectedBundleUserMessageEncoder userData) + DidDisplayInsecureContentForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData) + DidRunInsecureContentForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData) + DidDetectXSSForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData) + DidSameDocumentNavigationForFrame(uint64_t frameID, uint32_t type, WTF::String url, WebKit::InjectedBundleUserMessageEncoder userData) FrameDidBecomeFrameSet(uint64_t frameID, bool value) @@ -156,7 +155,7 @@ messages -> WebPageProxy { DidFinishLoadingDataForCustomRepresentation(WTF::String suggestedFilename, CoreIPC::DataReference data) # Forms messages - WillSubmitForm(uint64_t frameID, uint64_t sourceFrameID, WebKit::StringPairVector textFieldValues, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData) Variadic + WillSubmitForm(uint64_t frameID, uint64_t sourceFrameID, WebKit::StringPairVector textFieldValues, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData) # Callback messages VoidCallback(uint64_t callbackID) @@ -179,6 +178,10 @@ messages -> WebPageProxy { BindAccessibilityTree(WTF::String plugID) #endif +#if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL) + InvalidateWidget() +#endif + # BackForward messages BackForwardAddItem(uint64_t itemID) BackForwardGoToItem(uint64_t itemID) -> (WebKit::SandboxExtension::Handle sandboxExtensionHandle) @@ -187,7 +190,7 @@ messages -> WebPageProxy { BackForwardForwardListCount() -> (int32_t count) BackForwardClear() ShouldGoToBackForwardListItem(uint64_t itemID) -> (bool shouldGoToBackForwardListItem) - WillGoToBackForwardListItem(uint64_t itemID, WebKit::InjectedBundleUserMessageEncoder userData) Variadic + WillGoToBackForwardListItem(uint64_t itemID, WebKit::InjectedBundleUserMessageEncoder userData) # Undo/Redo messages RegisterEditCommandForUndo(uint64_t commandID, uint32_t editAction) @@ -219,7 +222,7 @@ messages -> WebPageProxy { #if ENABLE(CONTEXT_MENUS) # ContextMenu messages - ShowContextMenu(WebCore::IntPoint menuLocation, WebKit::WebHitTestResult::Data hitTestResultData, Vector<WebKit::WebContextMenuItemData> items, WebKit::InjectedBundleUserMessageEncoder userData) Variadic + ShowContextMenu(WebCore::IntPoint menuLocation, WebKit::WebHitTestResult::Data hitTestResultData, Vector<WebKit::WebContextMenuItemData> items, WebKit::InjectedBundleUserMessageEncoder userData) #endif # Authentication messages @@ -325,9 +328,4 @@ messages -> WebPageProxy { # Search popup menus SaveRecentSearches(WTF::String name, Vector<String> searchItems) LoadRecentSearches(WTF::String name) -> (Vector<String> result) - -#if USE(SOUP) - # Soup custom URI request messages - DidReceiveURIRequest(WTF::String uriString, uint64_t requestID); -#endif } diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.cpp b/Source/WebKit2/UIProcess/WebProcessProxy.cpp index 4114a2851..579783eed 100644 --- a/Source/WebKit2/UIProcess/WebProcessProxy.cpp +++ b/Source/WebKit2/UIProcess/WebProcessProxy.cpp @@ -46,10 +46,7 @@ #include <wtf/text/WTFString.h> #if PLATFORM(MAC) -#include "SimplePDFPlugin.h" -#if ENABLE(PDFKIT_PLUGIN) -#include "PDFPlugin.h" -#endif +#include "BuiltInPDFView.h" #endif using namespace WebCore; @@ -105,16 +102,6 @@ WebProcessProxy::~WebProcessProxy() } } -WebProcessProxy* WebProcessProxy::fromConnection(CoreIPC::Connection* connection) -{ - ASSERT(connection); - WebConnectionToWebProcess* webConnection = static_cast<WebConnectionToWebProcess*>(connection->client()); - - WebProcessProxy* webProcessProxy = webConnection->webProcessProxy(); - ASSERT(webProcessProxy->connection() == connection); - return webProcessProxy; -} - void WebProcessProxy::connect() { ASSERT(!m_processLauncher); @@ -199,13 +186,6 @@ void WebProcessProxy::removeWebPage(uint64_t pageID) m_pageMap.remove(pageID); } -Vector<WebPageProxy*> WebProcessProxy::pages() const -{ - Vector<WebPageProxy*> result; - copyValuesToVector(m_pageMap, result); - return result; -} - #if ENABLE(WEB_INTENTS) void WebProcessProxy::removeMessagePortChannel(uint64_t channelID) { @@ -273,9 +253,9 @@ bool WebProcessProxy::checkURLReceivedFromWebProcess(const KURL& url) // Items in back/forward list have been already checked. // One case where we don't have sandbox extensions for file URLs in b/f list is if the list has been reinstated after a crash or a browser restart. for (WebBackForwardListItemMap::iterator iter = m_backForwardListItemMap.begin(), end = m_backForwardListItemMap.end(); iter != end; ++iter) { - if (KURL(KURL(), iter->value->url()).fileSystemPath() == path) + if (KURL(KURL(), iter->second->url()).fileSystemPath() == path) return true; - if (KURL(KURL(), iter->value->originalURL()).fileSystemPath() == path) + if (KURL(KURL(), iter->second->originalURL()).fileSystemPath() == path) return true; } @@ -298,15 +278,15 @@ void WebProcessProxy::addBackForwardItem(uint64_t itemID, const String& original WebBackForwardListItemMap::AddResult result = m_backForwardListItemMap.add(itemID, 0); if (result.isNewEntry) { - result.iterator->value = WebBackForwardListItem::create(originalURL, url, title, backForwardData.data(), backForwardData.size(), itemID); + result.iterator->second = WebBackForwardListItem::create(originalURL, url, title, backForwardData.data(), backForwardData.size(), itemID); return; } // Update existing item. - result.iterator->value->setOriginalURL(originalURL); - result.iterator->value->setURL(url); - result.iterator->value->setTitle(title); - result.iterator->value->setBackForwardData(backForwardData.data(), backForwardData.size()); + result.iterator->second->setOriginalURL(originalURL); + result.iterator->second->setURL(url); + result.iterator->second->setTitle(title); + result.iterator->second->setBackForwardData(backForwardData.data(), backForwardData.size()); } void WebProcessProxy::sendDidGetPlugins(uint64_t requestID, PassOwnPtr<Vector<PluginInfo> > pluginInfos) @@ -318,12 +298,8 @@ void WebProcessProxy::sendDidGetPlugins(uint64_t requestID, PassOwnPtr<Vector<Pl #if PLATFORM(MAC) // Add built-in PDF last, so that it's not used when a real plug-in is installed. // NOTE: This has to be done on the main thread as it calls localizedString(). - if (!m_context->omitPDFSupport()) { -#if ENABLE(PDFKIT_PLUGIN) - plugins->append(PDFPlugin::pluginInfo()); -#endif - plugins->append(SimplePDFPlugin::pluginInfo()); - } + if (!m_context->omitPDFSupport()) + plugins->append(BuiltInPDFView::pluginInfo()); #endif send(Messages::WebProcess::DidGetPlugins(requestID, *plugins), 0); @@ -376,6 +352,11 @@ void WebProcessProxy::getPluginProcessConnection(const String& pluginPath, PassR PluginProcessManager::shared().getPluginProcessConnection(m_context->pluginInfoStore(), pluginPath, reply); } +void WebProcessProxy::pluginSyncMessageSendTimedOut(const String& pluginPath) +{ + PluginProcessManager::shared().pluginSyncMessageSendTimedOut(pluginPath); +} + #else void WebProcessProxy::didGetSitesWithPluginData(const Vector<String>& sites, uint64_t callbackID) @@ -392,14 +373,39 @@ void WebProcessProxy::didClearPluginSiteData(uint64_t callbackID) void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) { - if (m_context->dispatchMessage(connection, messageID, arguments)) - return; - if (messageID.is<CoreIPC::MessageClassWebProcessProxy>()) { didReceiveWebProcessProxyMessage(connection, messageID, arguments); return; } + if (messageID.is<CoreIPC::MessageClassWebContext>() + || messageID.is<CoreIPC::MessageClassWebContextLegacy>() + || messageID.is<CoreIPC::MessageClassDownloadProxy>() + || messageID.is<CoreIPC::MessageClassWebApplicationCacheManagerProxy>() +#if ENABLE(BATTERY_STATUS) + || messageID.is<CoreIPC::MessageClassWebBatteryManagerProxy>() +#endif + || messageID.is<CoreIPC::MessageClassWebCookieManagerProxy>() + || messageID.is<CoreIPC::MessageClassWebDatabaseManagerProxy>() + || messageID.is<CoreIPC::MessageClassWebGeolocationManagerProxy>() + || messageID.is<CoreIPC::MessageClassWebIconDatabase>() + || messageID.is<CoreIPC::MessageClassWebKeyValueStorageManagerProxy>() + || messageID.is<CoreIPC::MessageClassWebMediaCacheManagerProxy>() +#if ENABLE(NETWORK_INFO) + || messageID.is<CoreIPC::MessageClassWebNetworkInfoManagerProxy>() +#endif + || messageID.is<CoreIPC::MessageClassWebNotificationManagerProxy>() +#if USE(SOUP) + || messageID.is<CoreIPC::MessageClassWebSoupRequestManagerProxy>() +#endif +#if ENABLE(VIBRATION) + || messageID.is<CoreIPC::MessageClassWebVibrationProxy>() +#endif + || messageID.is<CoreIPC::MessageClassWebResourceCacheManagerProxy>()) { + m_context->didReceiveMessage(this, messageID, arguments); + return; + } + uint64_t pageID = arguments->destinationID(); if (!pageID) return; @@ -413,14 +419,20 @@ void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC void WebProcessProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, OwnPtr<CoreIPC::ArgumentEncoder>& reply) { - if (m_context->dispatchSyncMessage(connection, messageID, arguments, reply)) - return; - if (messageID.is<CoreIPC::MessageClassWebProcessProxy>()) { didReceiveSyncWebProcessProxyMessage(connection, messageID, arguments, reply); return; } + if (messageID.is<CoreIPC::MessageClassWebContext>() || messageID.is<CoreIPC::MessageClassWebContextLegacy>() +#if ENABLE(NETWORK_INFO) + || messageID.is<CoreIPC::MessageClassWebNetworkInfoManagerProxy>() +#endif + || messageID.is<CoreIPC::MessageClassDownloadProxy>() || messageID.is<CoreIPC::MessageClassWebIconDatabase>()) { + m_context->didReceiveSyncMessage(this, messageID, arguments, reply); + return; + } + uint64_t pageID = arguments->destinationID(); if (!pageID) return; @@ -461,6 +473,10 @@ void WebProcessProxy::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::Me terminate(); } +void WebProcessProxy::syncMessageSendTimedOut(CoreIPC::Connection*) +{ +} + void WebProcessProxy::didBecomeUnresponsive(ResponsivenessTimer*) { Vector<RefPtr<WebPageProxy> > pages; @@ -549,7 +565,7 @@ size_t WebProcessProxy::frameCountInPage(WebPageProxy* page) const { size_t result = 0; for (HashMap<uint64_t, RefPtr<WebFrameProxy> >::const_iterator iter = m_frameMap.begin(); iter != m_frameMap.end(); ++iter) { - if (iter->value->page() == page) + if (iter->second->page() == page) ++result; } return result; diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.h b/Source/WebKit2/UIProcess/WebProcessProxy.h index 45a9524a9..c4fd3c929 100644 --- a/Source/WebKit2/UIProcess/WebProcessProxy.h +++ b/Source/WebKit2/UIProcess/WebProcessProxy.h @@ -63,8 +63,6 @@ public: static PassRefPtr<WebProcessProxy> create(PassRefPtr<WebContext>); ~WebProcessProxy(); - static WebProcessProxy* fromConnection(CoreIPC::Connection*); - void terminate(); template<typename T> bool send(const T& message, uint64_t destinationID, unsigned messageSendFlags = 0); @@ -86,7 +84,6 @@ public: PassRefPtr<WebPageProxy> createWebPage(PageClient*, WebContext*, WebPageGroup*); void addExistingWebPage(WebPageProxy*, uint64_t pageID); void removeWebPage(uint64_t pageID); - Vector<WebPageProxy*> pages() const; #if ENABLE(WEB_INTENTS) void removeMessagePortChannel(uint64_t channelID); @@ -145,6 +142,7 @@ private: void getPluginPath(const String& mimeType, const String& urlString, String& pluginPath, bool& blocked); #if ENABLE(PLUGIN_PROCESS) void getPluginProcessConnection(const String& pluginPath, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>); + void pluginSyncMessageSendTimedOut(const String& pluginPath); #else void didGetSitesWithPluginData(const Vector<String>& sites, uint64_t callbackID); void didClearPluginSiteData(uint64_t callbackID); @@ -164,6 +162,7 @@ private: virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&); virtual void didClose(CoreIPC::Connection*); virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID); + virtual void syncMessageSendTimedOut(CoreIPC::Connection*); #if PLATFORM(WIN) virtual Vector<HWND> windowsToReceiveSentMessagesWhileWaitingForSyncReply(); #endif diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.messages.in b/Source/WebKit2/UIProcess/WebProcessProxy.messages.in index 6df22ca86..2c3d58b93 100644 --- a/Source/WebKit2/UIProcess/WebProcessProxy.messages.in +++ b/Source/WebKit2/UIProcess/WebProcessProxy.messages.in @@ -38,6 +38,7 @@ messages -> WebProcessProxy { GetPluginPath(WTF::String mimeType, WTF::String urlString) -> (WTF::String pluginPath, bool blocked) #if ENABLE(PLUGIN_PROCESS) GetPluginProcessConnection(WTF::String pluginPath) -> (CoreIPC::Attachment connectionHandle, bool supportsAsynchronousInitialization) Delayed + PluginSyncMessageSendTimedOut(WTF::String pluginPath) #endif #if !ENABLE(PLUGIN_PROCESS) void DidGetSitesWithPluginData(Vector<WTF::String> sites, uint64_t callbackID) diff --git a/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.cpp b/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.cpp index 3c2980797..60bf1a1ba 100644 --- a/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.cpp @@ -45,7 +45,6 @@ PassRefPtr<WebResourceCacheManagerProxy> WebResourceCacheManagerProxy::create(We WebResourceCacheManagerProxy::WebResourceCacheManagerProxy(WebContext* webContext) : m_webContext(webContext) { - m_webContext->addMessageReceiver(CoreIPC::MessageClassWebResourceCacheManagerProxy, this); } WebResourceCacheManagerProxy::~WebResourceCacheManagerProxy() @@ -65,6 +64,7 @@ bool WebResourceCacheManagerProxy::shouldTerminate(WebProcessProxy*) const void WebResourceCacheManagerProxy::getCacheOrigins(PassRefPtr<ArrayCallback> prpCallback) { RefPtr<ArrayCallback> callback = prpCallback; + m_webContext->relaunchProcessIfNecessary(); uint64_t callbackID = callback->callbackID(); m_arrayCallbacks.set(callbackID, callback.release()); @@ -95,9 +95,4 @@ void WebResourceCacheManagerProxy::clearCacheForAllOrigins(ResourceCachesToClear m_webContext->sendToAllProcessesRelaunchingThemIfNecessary(Messages::WebResourceCacheManager::ClearCacheForAllOrigins(cachesToClear)); } -void WebResourceCacheManagerProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) -{ - didReceiveWebResourceCacheManagerProxyMessage(connection, messageID, arguments); -} - } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.h b/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.h index 9e59b641f..f0c7bb549 100644 --- a/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.h +++ b/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.h @@ -29,11 +29,16 @@ #include "APIObject.h" #include "Arguments.h" #include "GenericCallback.h" -#include "MessageReceiver.h" #include "ResourceCachesToClear.h" #include <wtf/HashMap.h> #include <wtf/PassRefPtr.h> +namespace CoreIPC { +class ArgumentDecoder; +class Connection; +class MessageID; +} + namespace WebKit { struct SecurityOriginData; @@ -43,7 +48,7 @@ class WebSecurityOrigin; typedef GenericCallback<WKArrayRef> ArrayCallback; -class WebResourceCacheManagerProxy : public APIObject, private CoreIPC::MessageReceiver { +class WebResourceCacheManagerProxy : public APIObject { public: static const Type APIType = TypeCacheManager; @@ -57,6 +62,8 @@ public: void clearCacheForOrigin(WebSecurityOrigin*, ResourceCachesToClear); void clearCacheForAllOrigins(ResourceCachesToClear); + void didReceiveWebResourceCacheManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + bool shouldTerminate(WebProcessProxy*) const; private: @@ -64,10 +71,6 @@ private: virtual Type type() const { return APIType; } - // CoreIPC::MessageReceiver - virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE; - void didReceiveWebResourceCacheManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); - // Message handlers. void didGetCacheOrigins(const Vector<SecurityOriginData>& originIdentifiers, uint64_t callbackID); diff --git a/Source/WebKit2/UIProcess/WebVibrationProxy.cpp b/Source/WebKit2/UIProcess/WebVibrationProxy.cpp index 0590f30cc..9a5f7f264 100644 --- a/Source/WebKit2/UIProcess/WebVibrationProxy.cpp +++ b/Source/WebKit2/UIProcess/WebVibrationProxy.cpp @@ -40,7 +40,6 @@ PassRefPtr<WebVibrationProxy> WebVibrationProxy::create(WebContext* context) WebVibrationProxy::WebVibrationProxy(WebContext* context) : m_context(context) { - m_context->addMessageReceiver(CoreIPC::MessageClassWebVibrationProxy, this); } WebVibrationProxy::~WebVibrationProxy() diff --git a/Source/WebKit2/UIProcess/WebVibrationProxy.h b/Source/WebKit2/UIProcess/WebVibrationProxy.h index 676d3a497..4e69e96fa 100644 --- a/Source/WebKit2/UIProcess/WebVibrationProxy.h +++ b/Source/WebKit2/UIProcess/WebVibrationProxy.h @@ -29,15 +29,20 @@ #if ENABLE(VIBRATION) #include "APIObject.h" -#include "MessageReceiver.h" +#include "MessageID.h" #include "WebVibrationProvider.h" #include <wtf/Forward.h> +namespace CoreIPC { +class ArgumentDecoder; +class Connection; +} + namespace WebKit { class WebContext; -class WebVibrationProxy : public APIObject, private CoreIPC::MessageReceiver { +class WebVibrationProxy : public APIObject { public: static const Type APIType = TypeVibration; @@ -49,14 +54,13 @@ public: void initializeProvider(const WKVibrationProvider*); + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + private: explicit WebVibrationProxy(WebContext*); virtual Type type() const { return APIType; } - // CoreIPC::MessageReceiver - virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE; - // Implemented in generated WebVibrationProxyMessageReceiver.cpp void didReceiveWebVibrationProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); diff --git a/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp b/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp index 7f69c2efb..538356610 100644 --- a/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp +++ b/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp @@ -29,7 +29,6 @@ #if ENABLE(INSPECTOR) #include "WebProcessProxy.h" -#include "ewk_settings.h" #include "ewk_view.h" #include "ewk_view_private.h" #include <WebCore/NotImplemented.h> @@ -39,73 +38,22 @@ namespace WebKit { -static void resizeInspectorWindow(Ecore_Evas* inspectorWindow) -{ - Evas_Object* inspectorView = evas_object_name_find(ecore_evas_get(inspectorWindow), "inspector"); - if (!inspectorView) - return; - - int width, height; - ecore_evas_geometry_get(inspectorWindow, 0, 0, &width, &height); - - evas_object_move(inspectorView, 0, 0); - evas_object_resize(inspectorView, width, height); -} - -static void destroyInspectorWindow(Ecore_Evas* inspectorWindow) -{ - Evas_Object* inspectorView = evas_object_name_find(ecore_evas_get(inspectorWindow), "inspector"); - if (inspectorView) - evas_object_smart_callback_call(inspectorView, "inspector,view,close", 0); -} - -static void closeInspectorWindow(void* userData, Evas_Object*, void*) -{ - WebInspectorProxy* inspectorProxy = static_cast<WebInspectorProxy*>(userData); - - inspectorProxy->close(); -} - -void WebInspectorProxy::createInspectorWindow() -{ - ecore_evas_title_set(m_inspectorWindow, "Web Inspector"); - ecore_evas_callback_resize_set(m_inspectorWindow, resizeInspectorWindow); - ecore_evas_callback_delete_request_set(m_inspectorWindow, destroyInspectorWindow); - ecore_evas_show(m_inspectorWindow); - - evas_object_name_set(m_inspectorView, "inspector"); - evas_object_move(m_inspectorView, 0, 0); - evas_object_resize(m_inspectorView, initialWindowWidth, initialWindowHeight); - evas_object_show(m_inspectorView); - - evas_object_focus_set(m_inspectorView, true); -} - WebPageProxy* WebInspectorProxy::platformCreateInspectorPage() { ASSERT(m_page); - m_inspectorWindow = ecore_evas_new(0, 0, 0, initialWindowWidth, initialWindowHeight, 0); + m_inspectorWindow = ecore_evas_buffer_new(initialWindowWidth, initialWindowHeight); 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"); - - Ewk_Settings* settings = ewk_view_settings_get(m_inspectorView); - ewk_settings_file_access_from_file_urls_allowed_set(settings, true); - return ewk_view_page_get(m_inspectorView); } void WebInspectorProxy::platformOpen() { - if (m_isAttached) - platformAttach(); - else - createInspectorWindow(); - - evas_object_smart_callback_add(m_inspectorView, "inspector,view,close", closeInspectorWindow, this); + notImplemented(); } void WebInspectorProxy::platformDidClose() diff --git a/Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp b/Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp index 8981ceeb1..2a3b3078d 100644 --- a/Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp +++ b/Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp @@ -83,14 +83,4 @@ void WebPageProxy::setThemePath(const String& themePath) process()->send(Messages::WebPage::SetThemePath(themePath), m_pageID, 0); } -void WebPageProxy::createPluginContainer(uint64_t&) -{ - notImplemented(); -} - -void WebPageProxy::windowedPluginGeometryDidChange(const WebCore::IntRect&, const WebCore::IntRect&, uint64_t) -{ - notImplemented(); -} - } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp index d35aeff60..71c7bbe3c 100644 --- a/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp +++ b/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp @@ -53,8 +53,8 @@ String WebContext::platformDefaultDatabaseDirectory() const String WebContext::platformDefaultIconDatabasePath() const { - GOwnPtr<gchar> databaseDirectory(g_build_filename(g_get_user_data_dir(), "webkitgtk", "icondatabase", NULL)); - return WebCore::filenameToString(databaseDirectory.get()); + // FIXME: Implement. + return WTF::String(); } String WebContext::platformDefaultLocalStorageDirectory() const diff --git a/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp index 6b01bb027..80881bfe7 100644 --- a/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp +++ b/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp @@ -114,6 +114,11 @@ void WebPageProxy::setAcceleratedCompositingWindowId(uint64_t nativeWindowId) { process()->send(Messages::WebPage::SetAcceleratedCompositingWindowId(nativeWindowId), m_pageID); } + +void WebPageProxy::invalidateWidget() +{ + webkitWebViewBaseQueueDrawOfAcceleratedCompositingResults(WEBKIT_WEB_VIEW_BASE(static_cast<PageClientImpl*>(m_pageClient)->viewWidget())); +} #endif } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/mac/WebContextMac.mm b/Source/WebKit2/UIProcess/mac/WebContextMac.mm index bbb981c9c..68c8e1125 100644 --- a/Source/WebKit2/UIProcess/mac/WebContextMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebContextMac.mm @@ -77,6 +77,12 @@ void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& para { parameters.presenterApplicationPid = getpid(); + if (!omitPDFSupport()) { + // We want to use a PDF view in the UI process for PDF MIME types. + HashSet<String, CaseFoldingHash> mimeType = pdfAndPostScriptMIMETypes(); + parameters.mimeTypesWithCustomRepresentation.appendRange(mimeType.begin(), mimeType.end()); + } + parameters.parentProcessName = [[NSProcessInfo processInfo] processName]; RetainPtr<CFStringRef> cachePath(AdoptCF, WKCopyFoundationCacheDirectory()); @@ -94,7 +100,10 @@ void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& para #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 parameters.shouldForceScreenFontSubstitution = [[NSUserDefaults standardUserDefaults] boolForKey:@"NSFontDefaultScreenFontSubstitutionEnabled"]; #endif - parameters.shouldEnableKerningAndLigaturesByDefault = [[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitKerningAndLigaturesEnabledByDefault"]; + +#if ENABLE(PLUGIN_PROCESS) + parameters.disablePluginProcessMessageTimeout = [[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitDisablePluginProcessMessageTimeout"]; +#endif #if USE(ACCELERATED_COMPOSITING) && HAVE(HOSTED_CORE_ANIMATION) #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 diff --git a/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm index 530a2f587..eb442fde5 100644 --- a/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm @@ -96,7 +96,7 @@ static const CGFloat windowContentBorderThickness = 55; // depend on this for enforcing the height constraints, so a small delay isn't terrible. Most // of the time the views will already have the correct frames because of autoresizing masks. - dispatch_after(DISPATCH_TIME_NOW, dispatch_get_main_queue(), ^{ + dispatch_after(DISPATCH_TIME_NOW, dispatch_get_current_queue(), ^{ if (!_inspectorProxy) return; static_cast<WebInspectorProxy*>(_inspectorProxy)->inspectedViewFrameDidChange(); diff --git a/Source/WebKit2/UIProcess/mac/WebProcessProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebProcessProxyMac.mm index a182faa42..73f3ddc02 100644 --- a/Source/WebKit2/UIProcess/mac/WebProcessProxyMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebProcessProxyMac.mm @@ -149,20 +149,6 @@ bool WebProcessProxy::fullKeyboardAccessEnabled() return [WKFullKeyboardAccessWatcher fullKeyboardAccessEnabled]; } -#if HAVE(XPC) -static bool shouldUseXPC() -{ - if (id value = [[NSUserDefaults standardUserDefaults] objectForKey:@"WebKit2UseXPCServiceForWebProcess"]) - return [value boolValue]; - -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 - return true; -#else - return false; -#endif -} -#endif - void WebProcessProxy::platformConnect(ProcessLauncher::LaunchOptions& launchOptions) { // We want the web process to match the architecture of the UI process. @@ -170,7 +156,7 @@ void WebProcessProxy::platformConnect(ProcessLauncher::LaunchOptions& launchOpti launchOptions.executableHeap = false; #if HAVE(XPC) - launchOptions.useXPC = shouldUseXPC(); + launchOptions.useXPC = [[NSUserDefaults standardUserDefaults] boolForKey:@"WebKit2UseXPCServiceForWebProcess"]; #endif } diff --git a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp index cbc26e68b..9e2531f57 100644 --- a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp +++ b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp @@ -322,6 +322,8 @@ void PageViewportControllerClientQt::setContentsScale(float localScale, bool tre setContentRectVisiblePositionAtScale(QPointF(), localScale); } else scaleContent(localScale); + + updateViewportController(); } void PageViewportControllerClientQt::setContentsRectToNearestValidBounds() @@ -333,7 +335,6 @@ void PageViewportControllerClientQt::setContentsRectToNearestValidBounds() void PageViewportControllerClientQt::didResumeContent() { - // Make sure that tiles all around the viewport will be requested. updateViewportController(); } @@ -467,10 +468,8 @@ void PageViewportControllerClientQt::pinchGestureCancelled() m_scaleUpdateDeferrer.reset(); } -void PageViewportControllerClientQt::didChangeContentsSize(const IntSize& newSize) +void PageViewportControllerClientQt::didChangeContentsSize() { - m_pageItem->setContentsSize(QSizeF(newSize)); - // Emit for testing purposes, so that it can be verified that // we didn't do scale adjustment. emit m_viewportItem->experimental()->test()->contentsScaleCommitted(); @@ -493,14 +492,18 @@ void PageViewportControllerClientQt::didChangeVisibleContents() void PageViewportControllerClientQt::didChangeViewportAttributes() { + // Make sure we apply the new initial scale when deferring ends. + ViewportUpdateDeferrer guard(m_controller); + emit m_viewportItem->experimental()->test()->devicePixelRatioChanged(); emit m_viewportItem->experimental()->test()->viewportChanged(); } -void PageViewportControllerClientQt::updateViewportController(const QPointF& trajectory) +void PageViewportControllerClientQt::updateViewportController(const QPointF& trajectory, qreal scale) { FloatPoint viewportPos = m_viewportItem->mapToWebContent(QPointF()); - m_controller->didChangeContentsVisibility(viewportPos, m_pageItem->contentsScale(), trajectory); + float viewportScale = (scale < 0) ? m_pageItem->contentsScale() : scale; + m_controller->didChangeContentsVisibility(viewportPos, viewportScale, trajectory); } void PageViewportControllerClientQt::scaleContent(qreal itemScale, const QPointF& centerInCSSCoordinates) diff --git a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.h b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.h index 7c5ceea58..bd0e1731b 100644 --- a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.h +++ b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.h @@ -51,7 +51,7 @@ public: virtual void setContentsScale(float scale, bool treatAsInitialValue); virtual void didResumeContent(); - virtual void didChangeContentsSize(const WebCore::IntSize&); + virtual void didChangeContentsSize(); virtual void didChangeVisibleContents(); virtual void didChangeViewportAttributes(); @@ -124,7 +124,7 @@ private: QRectF nearestValidVisibleContentsRect() const; void setContentsRectToNearestValidBounds(); - void updateViewportController(const QPointF& trajectory = QPointF()); + void updateViewportController(const QPointF& trajectory = QPointF(), qreal scale = -1); void setContentRectVisiblePositionAtScale(const QPointF& location, qreal itemScale); void animateContentRectVisible(const QRectF& contentRect); void scaleContent(qreal itemScale, const QPointF& centerInCSSCoordinates = QPointF()); diff --git a/Source/WebKit2/UIProcess/qt/QtPageClient.cpp b/Source/WebKit2/UIProcess/qt/QtPageClient.cpp index 7737f6529..d5a5f7ece 100644 --- a/Source/WebKit2/UIProcess/qt/QtPageClient.cpp +++ b/Source/WebKit2/UIProcess/qt/QtPageClient.cpp @@ -73,16 +73,6 @@ void QtPageClient::setViewNeedsDisplay(const WebCore::IntRect& rect) QQuickWebViewPrivate::get(m_webView)->setNeedsDisplay(); } -void QtPageClient::didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect) -{ - // The viewport has to be notified first so that the viewport position - // is adjusted before the loadVisuallyCommitted() signal. - PageViewportController* pvc = QQuickWebViewPrivate::get(m_webView)->viewportController(); - if (pvc) - pvc->didRenderFrame(contentsSize, coveredRect); - QQuickWebViewPrivate::get(m_webView)->didRenderFrame(); -} - void QtPageClient::pageDidRequestScroll(const IntPoint& pos) { QQuickWebViewPrivate::get(m_webView)->pageDidRequestScroll(pos); @@ -100,9 +90,7 @@ void QtPageClient::didRelaunchProcess() void QtPageClient::didChangeContentsSize(const IntSize& newSize) { - PageViewportController* pvc = QQuickWebViewPrivate::get(m_webView)->viewportController(); - if (pvc) - pvc->didChangeContentsSize(newSize); + QQuickWebViewPrivate::get(m_webView)->didChangeContentsSize(newSize); } void QtPageClient::didChangeViewportProperties(const WebCore::ViewportAttributes& attr) @@ -232,13 +220,6 @@ void QtPageClient::flashBackingStoreUpdates(const Vector<IntRect>&) notImplemented(); } -void QtPageClient::pageTransitionViewportReady() -{ - PageViewportController* pvc = QQuickWebViewPrivate::get(m_webView)->viewportController(); - if (pvc) - pvc->pageTransitionViewportReady(); -} - void QtPageClient::didFindZoomableArea(const IntPoint& target, const IntRect& area) { ASSERT(m_eventHandler); diff --git a/Source/WebKit2/UIProcess/qt/QtPageClient.h b/Source/WebKit2/UIProcess/qt/QtPageClient.h index e493ce8ad..2e367570a 100644 --- a/Source/WebKit2/UIProcess/qt/QtPageClient.h +++ b/Source/WebKit2/UIProcess/qt/QtPageClient.h @@ -43,7 +43,6 @@ public: // QQuickWebView. virtual void setViewNeedsDisplay(const WebCore::IntRect&); - virtual void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect); virtual WebCore::IntSize viewSize(); virtual bool isViewFocused(); virtual bool isViewVisible(); @@ -100,7 +99,6 @@ public: virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects); virtual void findStringInCustomRepresentation(const String&, WebKit::FindOptions, unsigned maxMatchCount) { } virtual void countStringMatchesInCustomRepresentation(const String&, WebKit::FindOptions, unsigned maxMatchCount) { } - virtual void pageTransitionViewportReady(); virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&); virtual void updateTextInputState(); virtual void doneWithGestureEvent(const WebGestureEvent&, bool wasEventHandled); diff --git a/Source/WebKit2/UIProcess/qt/QtPanGestureRecognizer.cpp b/Source/WebKit2/UIProcess/qt/QtPanGestureRecognizer.cpp index a9c4e7a00..0aaa06690 100644 --- a/Source/WebKit2/UIProcess/qt/QtPanGestureRecognizer.cpp +++ b/Source/WebKit2/UIProcess/qt/QtPanGestureRecognizer.cpp @@ -38,6 +38,9 @@ QtPanGestureRecognizer::QtPanGestureRecognizer(QtWebPageEventHandler* eventHandl bool QtPanGestureRecognizer::update(const QTouchEvent::TouchPoint& touchPoint, qint64 eventTimestampMillis) { + if (!viewportController()) + return false; + m_lastPosition = touchPoint.pos(); m_lastEventTimestampMillis = eventTimestampMillis; @@ -45,8 +48,7 @@ bool QtPanGestureRecognizer::update(const QTouchEvent::TouchPoint& touchPoint, q case NoGesture: m_state = GestureRecognitionStarted; m_firstScreenPosition = touchPoint.screenPos(); - if (viewportController()) - viewportController()->cancelScrollAnimation(); + viewportController()->cancelScrollAnimation(); return false; case GestureRecognitionStarted: { // To start the gesture, the delta from start in screen coordinates @@ -56,13 +58,11 @@ bool QtPanGestureRecognizer::update(const QTouchEvent::TouchPoint& touchPoint, q return false; m_state = GestureRecognized; - if (viewportController()) - viewportController()->panGestureStarted(touchPoint.pos(), eventTimestampMillis); + viewportController()->panGestureStarted(touchPoint.pos(), eventTimestampMillis); return true; } case GestureRecognized: - if (viewportController()) - viewportController()->panGestureRequestUpdate(touchPoint.pos(), eventTimestampMillis); + viewportController()->panGestureRequestUpdate(touchPoint.pos(), eventTimestampMillis); return true; default: ASSERT_NOT_REACHED(); @@ -75,8 +75,8 @@ void QtPanGestureRecognizer::finish(const QTouchEvent::TouchPoint& touchPoint, q if (m_state == NoGesture) return; - if (viewportController()) - viewportController()->panGestureEnded(touchPoint.pos(), eventTimestampMillis); + ASSERT(viewportController()); + viewportController()->panGestureEnded(touchPoint.pos(), eventTimestampMillis); reset(); } @@ -85,10 +85,8 @@ void QtPanGestureRecognizer::cancel() if (m_state == NoGesture) return; - if (viewportController()) { - viewportController()->panGestureEnded(m_lastPosition, m_lastEventTimestampMillis); - viewportController()->panGestureCancelled(); - } + viewportController()->panGestureEnded(m_lastPosition, m_lastEventTimestampMillis); + viewportController()->panGestureCancelled(); reset(); } diff --git a/Source/WebKit2/UIProcess/qt/QtPinchGestureRecognizer.cpp b/Source/WebKit2/UIProcess/qt/QtPinchGestureRecognizer.cpp index 7fa58014f..a10367a40 100644 --- a/Source/WebKit2/UIProcess/qt/QtPinchGestureRecognizer.cpp +++ b/Source/WebKit2/UIProcess/qt/QtPinchGestureRecognizer.cpp @@ -48,6 +48,7 @@ QtPinchGestureRecognizer::QtPinchGestureRecognizer(QtWebPageEventHandler* eventH bool QtPinchGestureRecognizer::update(const QTouchEvent::TouchPoint& point1, const QTouchEvent::TouchPoint& point2) { + ASSERT(viewportController()); const qreal currentFingerDistance = QLineF(point1.screenPos(), point2.screenPos()).length(); switch (m_state) { case NoGesture: @@ -59,8 +60,7 @@ bool QtPinchGestureRecognizer::update(const QTouchEvent::TouchPoint& point1, con if (pinchDistance < pinchInitialTriggerDistanceThreshold) return false; m_state = GestureRecognized; - if (viewportController()) - viewportController()->pinchGestureStarted(computePinchCenter(point1, point2)); + viewportController()->pinchGestureStarted(computePinchCenter(point1, point2)); // We reset the initial span distance to the current distance of the // touch points in order to avoid the jump caused by the events which @@ -72,8 +72,7 @@ bool QtPinchGestureRecognizer::update(const QTouchEvent::TouchPoint& point1, con case GestureRecognized: const qreal totalScaleFactor = currentFingerDistance / m_initialFingerDistance; const QPointF touchCenterInViewCoordinates = computePinchCenter(point1, point2); - if (viewportController()) - viewportController()->pinchGestureRequestUpdate(touchCenterInViewCoordinates, totalScaleFactor); + viewportController()->pinchGestureRequestUpdate(touchCenterInViewCoordinates, totalScaleFactor); return true; break; } @@ -87,8 +86,8 @@ void QtPinchGestureRecognizer::finish() if (m_state == NoGesture) return; - if (viewportController()) - viewportController()->pinchGestureEnded(); + ASSERT(viewportController()); + viewportController()->pinchGestureEnded(); reset(); } @@ -97,8 +96,8 @@ void QtPinchGestureRecognizer::cancel() if (m_state == NoGesture) return; - if (viewportController()) - viewportController()->pinchGestureCancelled(); + ASSERT(viewportController()); + viewportController()->pinchGestureCancelled(); reset(); } diff --git a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp index 592bb371c..afdfa6fcd 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp @@ -90,11 +90,11 @@ QImage QtWebIconDatabaseClient::iconImageForPageURL(const WTF::String& pageURL, WebCore::IntSize size(iconSize.width(), iconSize.height()); - QPixmap* nativeImage = m_iconDatabase->nativeImageForPageURL(pageURL, size); + QImage* nativeImage = m_iconDatabase->nativeImageForPageURL(pageURL, size); if (!nativeImage) return QImage(); - return nativeImage->toImage(); + return *nativeImage; } void QtWebIconDatabaseClient::retainIconForPageURL(const String& pageURL) diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp index fdc92355f..819d4a0a2 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp @@ -167,18 +167,18 @@ void QtWebPageEventHandler::handleHoverLeaveEvent(QHoverEvent* ev) { // To get the correct behavior of mouseout, we need to turn the Leave event of our webview into a mouse move // to a very far region. - QHoverEvent fakeEvent(QEvent::HoverMove, QPoint(INT_MIN, INT_MIN), ev->oldPosF()); + QTransform fromItemTransform = m_webPage->transformFromItem(); + QHoverEvent fakeEvent(QEvent::HoverMove, QPoint(INT_MIN, INT_MIN), fromItemTransform.map(ev->oldPosF())); fakeEvent.setTimestamp(ev->timestamp()); - // This will apply the transform on the event. handleHoverMoveEvent(&fakeEvent); } void QtWebPageEventHandler::handleHoverMoveEvent(QHoverEvent* ev) { - QMouseEvent me(QEvent::MouseMove, ev->posF(), Qt::NoButton, Qt::NoButton, Qt::NoModifier); + QTransform fromItemTransform = m_webPage->transformFromItem(); + QMouseEvent me(QEvent::MouseMove, fromItemTransform.map(ev->posF()), Qt::NoButton, Qt::NoButton, Qt::NoModifier); me.setAccepted(ev->isAccepted()); me.setTimestamp(ev->timestamp()); - // This will apply the transform on the event. handleMouseMoveEvent(&me); } @@ -450,38 +450,7 @@ void QtWebPageEventHandler::doneWithGestureEvent(const WebGestureEvent& event, b void QtWebPageEventHandler::handleInputEvent(const QInputEvent* event) { - if (m_viewportController) { - switch (event->type()) { - case QEvent::MouseButtonPress: - case QEvent::TouchBegin: - ASSERT(!m_viewportController->panGestureActive()); - ASSERT(!m_viewportController->pinchGestureActive()); - m_viewportController->touchBegin(); - - // The page viewport controller might still be animating kinetic scrolling or a scale animation - // such as double-tap to zoom or the bounce back effect. A touch stops the kinetic scrolling - // where as it does not stop the scale animation. - // The gesture recognizer stops the kinetic scrolling animation if needed. - break; - case QEvent::MouseMove: - case QEvent::TouchUpdate: - // The scale animation can only be interrupted by a pinch gesture, which will then take over. - if (m_viewportController->scaleAnimationActive() && m_pinchGestureRecognizer.isRecognized()) - m_viewportController->interruptScaleAnimation(); - break; - case QEvent::MouseButtonRelease: - case QEvent::TouchEnd: - m_viewportController->touchEnd(); - break; - default: - break; - } - - // If the scale animation is active we don't pass the event to the recognizers. In the future - // we would want to queue the event here and repost then when the animation ends. - if (m_viewportController->scaleAnimationActive()) - return; - } + ASSERT(m_viewportController); bool isMouseEvent = false; @@ -489,22 +458,45 @@ void QtWebPageEventHandler::handleInputEvent(const QInputEvent* event) case QEvent::MouseButtonPress: isMouseEvent = true; m_isMouseButtonPressed = true; + // Fall through. + case QEvent::TouchBegin: + ASSERT(!m_viewportController->panGestureActive()); + ASSERT(!m_viewportController->pinchGestureActive()); + m_viewportController->touchBegin(); + + // The interaction engine might still be animating kinetic scrolling or a scale animation + // such as double-tap to zoom or the bounce back effect. A touch stops the kinetic scrolling + // where as it does not stop the scale animation. + // The gesture recognizer stops the kinetic scrolling animation if needed. break; case QEvent::MouseMove: if (!m_isMouseButtonPressed) return; + isMouseEvent = true; + // Fall through. + case QEvent::TouchUpdate: + // The scale animation can only be interrupted by a pinch gesture, which will then take over. + if (m_viewportController->scaleAnimationActive() && m_pinchGestureRecognizer.isRecognized()) + m_viewportController->interruptScaleAnimation(); break; case QEvent::MouseButtonRelease: isMouseEvent = true; m_isMouseButtonPressed = false; + // Fall through. + case QEvent::TouchEnd: + m_viewportController->touchEnd(); break; - case QEvent::MouseButtonDblClick: - return; default: - break; + ASSERT(event->type() == QEvent::MouseButtonDblClick); + return; } + // If the scale animation is active we don't pass the event to the recognizers. In the future + // we would want to queue the event here and repost then when the animation ends. + if (m_viewportController->scaleAnimationActive()) + return; + QList<QTouchEvent::TouchPoint> activeTouchPoints; QTouchEvent::TouchPoint currentTouchPoint; qint64 eventTimestampMillis = event->timestamp(); @@ -576,6 +568,9 @@ void QtWebPageEventHandler::handleInputEvent(const QInputEvent* event) #if ENABLE(TOUCH_EVENTS) void QtWebPageEventHandler::doneWithTouchEvent(const NativeWebTouchEvent& event, bool wasEventHandled) { + if (!m_viewportController) + return; + if (wasEventHandled || event.type() == WebEvent::TouchCancel) { m_panGestureRecognizer.cancel(); m_pinchGestureRecognizer.cancel(); diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp index b877ca8df..0e9c5cfb4 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp @@ -62,9 +62,6 @@ void QtWebPageLoadClient::didReceiveServerRedirectForProvisionalLoad(const WTF:: void QtWebPageLoadClient::didCommitLoad() { - PageViewportController* pvc = m_webView->d_func()->viewportController(); - if (pvc) - pvc->didCommitLoad(); m_webView->d_func()->loadDidCommit(); } diff --git a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp index e5a7829c0..ef6d5477d 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,44 +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); -} - -void WebPageProxy::findZoomableAreaForPoint(const IntPoint& point, const IntSize& area) -{ - if (!isValid()) - return; - - m_process->send(Messages::WebPage::FindZoomableAreaForPoint(point, area), m_pageID); -} - -void WebPageProxy::didReceiveMessageFromNavigatorQtObject(const String& contents) -{ - m_pageClient->didReceiveMessageFromNavigatorQtObject(contents); -} - -void WebPageProxy::authenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password) -{ - m_pageClient->handleAuthenticationRequiredRequest(hostname, realm, prefilledUsername, username, password); -} - -void WebPageProxy::proxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password) -{ - m_pageClient->handleProxyAuthenticationRequiredRequest(hostname, port, prefilledUsername, username, password); -} - -void WebPageProxy::certificateVerificationRequest(const String& hostname, bool& ignoreErrors) -{ - m_pageClient->handleCertificateVerificationRequest(hostname, ignoreErrors); -} - #if PLUGIN_ARCHITECTURE(X11) void WebPageProxy::createPluginContainer(uint64_t& windowID) { diff --git a/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerClient.cpp b/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerClient.cpp index c5d7e3bf7..be2c6cc66 100644 --- a/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerClient.cpp +++ b/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerClient.cpp @@ -24,12 +24,12 @@ namespace WebKit { -bool WebSoupRequestManagerClient::didReceiveURIRequest(WebSoupRequestManagerProxy* soupRequestManager, WebURL* url, WebPageProxy* initiaingPage, uint64_t requestID) +bool WebSoupRequestManagerClient::didReceiveURIRequest(WebSoupRequestManagerProxy* soupRequestManager, WebURL* url, uint64_t requestID) { if (!m_client.didReceiveURIRequest) return false; - m_client.didReceiveURIRequest(toAPI(soupRequestManager), toAPI(url), toAPI(initiaingPage), requestID, m_client.clientInfo); + m_client.didReceiveURIRequest(toAPI(soupRequestManager), toAPI(url), requestID, m_client.clientInfo); return true; } diff --git a/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerClient.h b/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerClient.h index e247fecd7..dc1755e5a 100644 --- a/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerClient.h +++ b/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerClient.h @@ -30,7 +30,7 @@ class WebURL; class WebSoupRequestManagerClient : public APIClient<WKSoupRequestManagerClient, kWKSoupRequestManagerClientCurrentVersion> { public: - bool didReceiveURIRequest(WebSoupRequestManagerProxy*, WebURL*, WebPageProxy*, uint64_t requestID); + bool didReceiveURIRequest(WebSoupRequestManagerProxy*, WebURL*, uint64_t requestID); void didFailToLoadURIRequest(WebSoupRequestManagerProxy*, uint64_t requestID); }; diff --git a/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.cpp b/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.cpp index e2bf3423d..c766b0adb 100644 --- a/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.cpp @@ -35,7 +35,6 @@ WebSoupRequestManagerProxy::WebSoupRequestManagerProxy(WebContext* context) : m_webContext(context) , m_loadFailed(false) { - m_webContext->addMessageReceiver(CoreIPC::MessageClassWebSoupRequestManagerProxy, this); } WebSoupRequestManagerProxy::~WebSoupRequestManagerProxy() @@ -77,9 +76,9 @@ void WebSoupRequestManagerProxy::didReceiveURIRequestData(const WebData* request m_webContext->sendToAllProcesses(Messages::WebSoupRequestManager::DidReceiveURIRequestData(requestData->dataReference(), requestID)); } -void WebSoupRequestManagerProxy::didReceiveURIRequest(const String& uriString, WebPageProxy* initiaingPage, uint64_t requestID) +void WebSoupRequestManagerProxy::didReceiveURIRequest(const String& uriString, uint64_t requestID) { - if (!m_client.didReceiveURIRequest(this, WebURL::create(uriString).get(), initiaingPage, requestID)) + if (!m_client.didReceiveURIRequest(this, WebURL::create(uriString).get(), requestID)) didHandleURIRequest(WebData::create(0, 0).get(), 0, String(), requestID); } diff --git a/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.h b/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.h index 6a3d6e826..92bd63e1e 100644 --- a/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.h +++ b/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.h @@ -21,18 +21,23 @@ #define WebSoupRequestManagerProxy_h #include "APIObject.h" -#include "MessageReceiver.h" #include "WebSoupRequestManagerClient.h" #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> #include <wtf/text/WTFString.h> +namespace CoreIPC { +class ArgumentDecoder; +class Connection; +class MessageID; +} + namespace WebKit { class WebContext; class WebData; -class WebSoupRequestManagerProxy : public APIObject, private CoreIPC::MessageReceiver { +class WebSoupRequestManagerProxy : public APIObject { public: static const Type APIType = TypeSoupRequestManager; @@ -49,15 +54,15 @@ public: void didReceiveURIRequestData(const WebData*, uint64_t requestID); void didFailToLoadURIRequest(uint64_t requestID); - void didReceiveURIRequest(const String& uriString, WebPageProxy*, uint64_t requestID); + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); private: WebSoupRequestManagerProxy(WebContext*); virtual Type type() const { return APIType; } - // CoreIPC::MessageReceiver - virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE; + void didReceiveURIRequest(const String& uriString, uint64_t requestID); + void didReceiveWebSoupRequestManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); WebContext* m_webContext; diff --git a/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.messages.in b/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.messages.in index 18058f5c7..81591a493 100644 --- a/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.messages.in +++ b/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.messages.in @@ -21,5 +21,6 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. messages -> WebSoupRequestManagerProxy { + DidReceiveURIRequest(WTF::String uriString, uint64_t requestID); DidFailToLoadURIRequest(uint64_t requestID); } |