diff options
| author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-09-14 16:29:47 +0200 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-09-14 16:29:47 +0200 |
| commit | d0424a769059c84ae20beb3c217812792ea6726b (patch) | |
| tree | 6f94a5c3db8c52c6694ee56498542a6c35417350 /Source/WebKit2/WebProcess/InjectedBundle | |
| parent | 88a04ac016f57c2d78e714682445dff2e7db4ade (diff) | |
| download | qtwebkit-d0424a769059c84ae20beb3c217812792ea6726b.tar.gz | |
Imported WebKit commit 37c5e5041d39a14ea0d429a77ebd352e4bd26516 (http://svn.webkit.org/repository/webkit/trunk@128608)
New snapshot that enables WebKit2 build on Windows (still some bugs) and allows for WebKit to be built with qmake && make
Diffstat (limited to 'Source/WebKit2/WebProcess/InjectedBundle')
10 files changed, 100 insertions, 5 deletions
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp index 14fccdc64..276f7d3cb 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp @@ -25,11 +25,12 @@ #include "config.h" #include "WKBundle.h" -#include "WKBundlePrivate.h" +#include "ImmutableArray.h" #include "InjectedBundle.h" #include "WKAPICast.h" #include "WKBundleAPICast.h" +#include "WKBundlePrivate.h" using namespace WebKit; @@ -248,7 +249,18 @@ uint64_t WKBundleGetAppCacheUsageForOrigin(WKBundleRef bundleRef, WKStringRef or void WKBundleSetApplicationCacheOriginQuota(WKBundleRef bundleRef, WKStringRef origin, uint64_t bytes) { - return toImpl(bundleRef)->setApplicationCacheOriginQuota(toImpl(origin)->string(), bytes); + toImpl(bundleRef)->setApplicationCacheOriginQuota(toImpl(origin)->string(), bytes); +} + +void WKBundleResetApplicationCacheOriginQuota(WKBundleRef bundleRef, WKStringRef origin) +{ + toImpl(bundleRef)->resetApplicationCacheOriginQuota(toImpl(origin)->string()); +} + +WKArrayRef WKBundleCopyOriginsWithApplicationCache(WKBundleRef bundleRef) +{ + RefPtr<ImmutableArray> origins = toImpl(bundleRef)->originsWithApplicationCache(); + return toAPI(origins.release().leakRef()); } void WKBundleSetMinimumTimerInterval(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, double seconds) @@ -286,6 +298,12 @@ void WKBundleSetPageVisibilityState(WKBundleRef bundleRef, WKBundlePageRef pageR toImpl(bundleRef)->setPageVisibilityState(toImpl(pageRef), state, isInitialState); } +size_t WKBundleGetWorkerThreadCount(WKBundleRef) +{ + // Actually do not need argument here, keeping it however for consistency. + return InjectedBundle::workerThreadCount(); +} + void WKBundleSetUserStyleSheetLocation(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKStringRef location) { toImpl(bundleRef)->setUserStyleSheetLocation(toImpl(pageGroupRef), toImpl(location)->string()); @@ -306,3 +324,7 @@ uint64_t WKBundleGetWebNotificationID(WKBundleRef bundleRef, JSContextRef contex return toImpl(bundleRef)->webNotificationID(context, notification); } +void WKBundleSetTabKeyCyclesThroughElements(WKBundleRef bundleRef, WKBundlePageRef pageRef, bool enabled) +{ + toImpl(bundleRef)->setTabKeyCyclesThroughElements(toImpl(pageRef), enabled); +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp index 4f86778bd..d32b5618c 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp @@ -262,3 +262,12 @@ WKDataRef WKBundleFrameCopyWebArchiveFilteringSubframes(WKBundleFrameRef frameRe return 0; } + +bool WKBundleFrameCallShouldCloseOnWebView(WKBundleFrameRef frameRef) +{ + Frame* coreFrame = toImpl(frameRef)->coreFrame(); + if (!coreFrame) + return true; + + return coreFrame->loader()->shouldClose(); +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h index a786b2557..98722f856 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h @@ -52,6 +52,7 @@ WK_EXPORT void WKBundleFrameClearOpener(WKBundleFrameRef frame); WK_EXPORT bool WKBundleFrameContainsAnyFormElements(WKBundleFrameRef frame); WK_EXPORT void WKBundleFrameSetTextDirection(WKBundleFrameRef frame, WKStringRef); +WK_EXPORT bool WKBundleFrameCallShouldCloseOnWebView(WKBundleFrameRef frame); #ifdef __cplusplus } diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h index 8bc7670cf..206e1e9c3 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h @@ -236,6 +236,7 @@ typedef bool (*WKBundlePageShouldRubberBandInDirectionCallback)(WKBundlePageRef typedef WKBundlePageUIElementVisibility (*WKBundlePageStatusBarIsVisibleCallback)(WKBundlePageRef page, const void *clientInfo); typedef WKBundlePageUIElementVisibility (*WKBundlePageMenuBarIsVisibleCallback)(WKBundlePageRef page, const void *clientInfo); typedef WKBundlePageUIElementVisibility (*WKBundlePageToolbarsAreVisibleCallback)(WKBundlePageRef page, const void *clientInfo); +typedef void (*WKBundlePageReachedAppCacheOriginQuotaCallback)(WKBundlePageRef page, WKSecurityOriginRef origin, int64_t totalBytesNeeded, const void *clientInfo); struct WKBundlePageUIClient { int version; @@ -254,10 +255,13 @@ struct WKBundlePageUIClient { WKBundlePageStatusBarIsVisibleCallback statusBarIsVisible; WKBundlePageMenuBarIsVisibleCallback menuBarIsVisible; WKBundlePageToolbarsAreVisibleCallback toolbarsAreVisible; + + // Version 1. + WKBundlePageReachedAppCacheOriginQuotaCallback didReachApplicationCacheOriginQuota; }; typedef struct WKBundlePageUIClient WKBundlePageUIClient; -enum { kWKBundlePageUIClientCurrentVersion = 0 }; +enum { kWKBundlePageUIClientCurrentVersion = 1 }; // Editor client typedef bool (*WKBundlePageShouldBeginEditingCallback)(WKBundlePageRef page, WKBundleRangeHandleRef range, const void* clientInfo); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h index e979791c9..3a1512aaf 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h @@ -99,6 +99,8 @@ WK_EXPORT void WKBundleClearApplicationCacheForOrigin(WKBundleRef bundle, WKStri WK_EXPORT void WKBundleSetAppCacheMaximumSize(WKBundleRef bundle, uint64_t size); WK_EXPORT uint64_t WKBundleGetAppCacheUsageForOrigin(WKBundleRef bundle, WKStringRef origin); WK_EXPORT void WKBundleSetApplicationCacheOriginQuota(WKBundleRef bundle, WKStringRef origin, uint64_t bytes); +WK_EXPORT void WKBundleResetApplicationCacheOriginQuota(WKBundleRef bundle, WKStringRef origin); +WK_EXPORT WKArrayRef WKBundleCopyOriginsWithApplicationCache(WKBundleRef bundle); // Garbage collection API WK_EXPORT void WKBundleGarbageCollectJavaScriptObjects(WKBundleRef bundle); @@ -109,6 +111,10 @@ WK_EXPORT bool WKBundleIsProcessingUserGesture(WKBundleRef bundle); WK_EXPORT void WKBundleSetPageVisibilityState(WKBundleRef bundle, WKBundlePageRef page, int state, bool isInitialState); +WK_EXPORT size_t WKBundleGetWorkerThreadCount(WKBundleRef bundle); + +WK_EXPORT void WKBundleSetTabKeyCyclesThroughElements(WKBundleRef bundle, WKBundlePageRef page, bool enabled); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp index cd0634906..a7de64e8a 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp @@ -67,6 +67,7 @@ #include <WebCore/SecurityPolicy.h> #include <WebCore/Settings.h> #include <WebCore/UserGestureIndicator.h> +#include <WebCore/WorkerThread.h> #include <wtf/OwnArrayPtr.h> #include <wtf/PassOwnArrayPtr.h> @@ -358,6 +359,26 @@ void InjectedBundle::setApplicationCacheOriginQuota(const String& originString, cacheStorage().storeUpdatedQuotaForOrigin(origin.get(), bytes); } +void InjectedBundle::resetApplicationCacheOriginQuota(const String& originString) +{ + RefPtr<SecurityOrigin> origin = SecurityOrigin::createFromString(originString); + cacheStorage().storeUpdatedQuotaForOrigin(origin.get(), cacheStorage().defaultOriginQuota()); +} + +PassRefPtr<ImmutableArray> InjectedBundle::originsWithApplicationCache() +{ + HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash> origins; + cacheStorage().getOriginsWithCache(origins); + Vector< RefPtr<APIObject> > originsVector; + + HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash>::iterator it = origins.begin(); + HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash>::iterator end = origins.end(); + for ( ; it != end; ++it) + originsVector.append(WebString::create((*it)->databaseIdentifier())); + + return ImmutableArray::adopt(originsVector); +} + int InjectedBundle::numberOfPages(WebFrame* frame, double pageWidthInPixels, double pageHeightInPixels) { Frame* coreFrame = frame ? frame->coreFrame() : 0; @@ -570,6 +591,15 @@ void InjectedBundle::setPageVisibilityState(WebPage* page, int state, bool isIni #endif } +size_t InjectedBundle::workerThreadCount() +{ +#if ENABLE(WORKERS) + return WebCore::WorkerThread::workerThreadCount(); +#else + return 0; +#endif +} + void InjectedBundle::setUserStyleSheetLocation(WebPageGroupProxy* pageGroup, const String& location) { const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages(); @@ -616,4 +646,9 @@ uint64_t InjectedBundle::webNotificationID(JSContextRef jsContext, JSValueRef js #endif } +void InjectedBundle::setTabKeyCyclesThroughElements(WebPage* page, bool enabled) +{ + page->corePage()->setTabKeyCyclesThroughElements(enabled); +} + } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h index 6e40013df..404a50593 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h @@ -150,6 +150,8 @@ public: void setAppCacheMaximumSize(uint64_t); uint64_t appCacheUsageForOrigin(const String& origin); void setApplicationCacheOriginQuota(const String& origin, uint64_t); + void resetApplicationCacheOriginQuota(const String& origin); + PassRefPtr<ImmutableArray> originsWithApplicationCache(); // Garbage collection API void garbageCollectJavaScriptObjects(); @@ -171,6 +173,10 @@ public: void setPageVisibilityState(WebPage*, int state, bool isInitialState); + static size_t workerThreadCount(); + + void setTabKeyCyclesThroughElements(WebPage*, bool enabled); + private: explicit InjectedBundle(const String&); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp index 29c70dfb4..428135481 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp @@ -91,7 +91,7 @@ InjectedBundleNavigationAction::InjectedBundleNavigationAction(WebFrame* frame, , m_mouseButton(WebMouseEvent::NoButton) { if (const MouseEvent* mouseEvent = mouseEventForNavigationAction(navigationAction)) { - m_hitTestResult = InjectedBundleHitTestResult::create(frame->coreFrame()->eventHandler()->hitTestResultAtPoint(mouseEvent->absoluteLocation())); + m_hitTestResult = InjectedBundleHitTestResult::create(frame->coreFrame()->eventHandler()->hitTestResultAtPoint(mouseEvent->absoluteLocation(), false)); m_mouseButton = mouseButtonForMouseEvent(mouseEvent); } diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp index b8c9c6206..2ef9ca76f 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp @@ -28,8 +28,9 @@ #include "InjectedBundleHitTestResult.h" #include "WKAPICast.h" -#include "WebGraphicsContext.h" #include "WKBundleAPICast.h" +#include "WebGraphicsContext.h" +#include "WebSecurityOrigin.h" #include <wtf/text/WTFString.h> using namespace WebCore; @@ -146,4 +147,12 @@ WKBundlePageUIElementVisibility InjectedBundlePageUIClient::toolbarsAreVisible(W return m_client.toolbarsAreVisible(toAPI(page), m_client.clientInfo); } +void InjectedBundlePageUIClient::didReachApplicationCacheOriginQuota(WebPage* page, WebSecurityOrigin* origin, int64_t totalBytesNeeded) +{ + if (!m_client.didReachApplicationCacheOriginQuota) + return; + + m_client.didReachApplicationCacheOriginQuota(toAPI(page), toAPI(origin), totalBytesNeeded, m_client.clientInfo); +} + } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h index de2928aa5..b8a48271f 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h @@ -42,6 +42,7 @@ namespace WebKit { class APIObject; class WebFrame; class WebPage; +class WebSecurityOrigin; class InjectedBundlePageUIClient : public APIClient<WKBundlePageUIClient, kWKBundlePageUIClientCurrentVersion> { public: @@ -64,6 +65,8 @@ public: WKBundlePageUIElementVisibility statusBarIsVisible(WebPage*); WKBundlePageUIElementVisibility menuBarIsVisible(WebPage*); WKBundlePageUIElementVisibility toolbarsAreVisible(WebPage*); + + void didReachApplicationCacheOriginQuota(WebPage*, WebSecurityOrigin*, int64_t totalBytesNeeded); }; } // namespace WebKit |
