summaryrefslogtreecommitdiff
path: root/Source/WebKit2/WebProcess
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-11-23 15:08:59 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-11-23 15:09:20 +0100
commit061d58bc0fa016cfeed744fd3e4663460635d69b (patch)
treead9b8b032c803e1c9054c23fa1b7a0f1976bf98f /Source/WebKit2/WebProcess
parent470286ecfe79d59df14944e5b5d34630fc739391 (diff)
downloadqtwebkit-061d58bc0fa016cfeed744fd3e4663460635d69b.tar.gz
Imported WebKit commit 8eb048315f36fa33731f28694630fe4a3c2cbc99 (http://svn.webkit.org/repository/webkit/trunk@135602)
New snapshot that fixes various bugs Change-Id: Icb6ce541a26a9f500d087821ce4b83a8d8a5474a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Source/WebKit2/WebProcess')
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp5
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp22
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h2
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp5
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp2
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp42
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebContextMenu.h4
-rw-r--r--Source/WebKit2/WebProcess/WebProcess.h3
10 files changed, 74 insertions, 13 deletions
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
index 95273a704..e7d5611f0 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
@@ -77,6 +77,11 @@ void WKBundleActivateMacFontAscentHack(WKBundleRef bundleRef)
toImpl(bundleRef)->activateMacFontAscentHack();
}
+void WKBundleSetCacheModel(WKBundleRef bundleRef, uint32_t cacheModel)
+{
+ toImpl(bundleRef)->setCacheModel(cacheModel);
+}
+
void WKBundleGarbageCollectJavaScriptObjects(WKBundleRef bundleRef)
{
toImpl(bundleRef)->garbageCollectJavaScriptObjects();
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
index 53ddf6107..005811ac0 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
@@ -30,13 +30,19 @@
#include "InjectedBundleBackForwardList.h"
#include "InjectedBundleNodeHandle.h"
#include "WKAPICast.h"
+#include "WKArray.h"
#include "WKBundleAPICast.h"
+#include "WKRetainPtr.h"
+#include "WKString.h"
+#include "WebContextMenu.h"
+#include "WebContextMenuItem.h"
#include "WebFrame.h"
#include "WebFullScreenManager.h"
#include "WebImage.h"
#include "WebPage.h"
#include "WebRenderLayer.h"
#include "WebRenderObject.h"
+#include "WebString.h"
#include "WebURL.h"
#include "WebURLRequest.h"
@@ -145,6 +151,22 @@ WKBundleFrameRef WKBundlePageGetMainFrame(WKBundlePageRef pageRef)
return toAPI(toImpl(pageRef)->mainWebFrame());
}
+WKArrayRef WKBundlePageCopyContextMenuItemTitles(WKBundlePageRef pageRef)
+{
+#if ENABLE(CONTEXT_MENUS)
+ WebContextMenu* contextMenu = toImpl(pageRef)->contextMenu();
+ const Vector<WebContextMenuItemData> &items = contextMenu->items();
+ size_t arrayLength = items.size();
+ OwnArrayPtr<WKTypeRef> itemNames = adoptArrayPtr(new WKTypeRef[arrayLength]);
+ for (size_t i = 0; i < arrayLength; ++i)
+ itemNames[i] = WKStringCreateWithUTF8CString(items[i].title().utf8().data());
+
+ return WKArrayCreateAdoptingValues(itemNames.get(), arrayLength);
+#else
+ return 0;
+#endif
+}
+
void* WKAccessibilityRootObject(WKBundlePageRef pageRef)
{
#if HAVE(ACCESSIBILITY)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h
index 11b20dc93..d769fb4c1 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h
@@ -77,6 +77,8 @@ WK_EXPORT bool WKBundlePageCanShowMIMEType(WKBundlePageRef, WKStringRef mimeType
WK_EXPORT void* WKAccessibilityRootObject(WKBundlePageRef);
WK_EXPORT void* WKAccessibilityFocusedObject(WKBundlePageRef);
+WK_EXPORT WKArrayRef WKBundlePageCopyContextMenuItemTitles(WKBundlePageRef);
+
#ifdef __cplusplus
}
#endif
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
index 15b2e7c85..2cacb5976 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
@@ -41,6 +41,7 @@ WK_EXPORT void WKBundleSetShouldTrackVisitedLinks(WKBundleRef bundle, bool shoul
WK_EXPORT void WKBundleSetAlwaysAcceptCookies(WKBundleRef bundle, bool);
WK_EXPORT void WKBundleRemoveAllVisitedLinks(WKBundleRef bundle);
WK_EXPORT void WKBundleActivateMacFontAscentHack(WKBundleRef bundle);
+WK_EXPORT void WKBundleSetCacheModel(WKBundleRef bundle, uint32_t cacheModel);
// Will make WebProcess ignore this preference until a preferences change notification, only for WebKitTestRunner use.
WK_EXPORT void WKBundleOverrideBoolPreferenceForTestRunner(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKStringRef preference, bool enabled);
WK_EXPORT void WKBundleSetAllowUniversalAccessFromFileURLs(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
index 317911a9d..1b2c83099 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
@@ -141,6 +141,11 @@ void InjectedBundle::removeAllVisitedLinks()
PageGroup::removeAllVisitedLinks();
}
+void InjectedBundle::setCacheModel(uint32_t cacheModel)
+{
+ WebProcess::shared().setCacheModel(cacheModel);
+}
+
void InjectedBundle::overrideBoolPreferenceForTestRunner(WebPageGroupProxy* pageGroup, const String& preference, bool enabled)
{
const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages();
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h
index c621f2483..fd716d3d3 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h
@@ -107,6 +107,7 @@ public:
void setShouldTrackVisitedLinks(bool);
void setAlwaysAcceptCookies(bool);
void removeAllVisitedLinks();
+ void setCacheModel(uint32_t);
void activateMacFontAscentHack();
void overrideBoolPreferenceForTestRunner(WebPageGroupProxy*, const String& preference, bool enabled);
void overrideXSSAuditorEnabledForTestRunner(WebPageGroupProxy* pageGroup, bool enabled);
diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp
index c167d3abb..e5639cf79 100644
--- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp
@@ -748,7 +748,7 @@ void CoordinatedGraphicsLayer::removeTile(int tileID)
void CoordinatedGraphicsLayer::updateContentBuffers()
{
- if (!drawsContent()) {
+ if (!drawsContent() || !contentsAreVisible() || m_size.isEmpty()) {
m_mainBackingStore.clear();
m_previousBackingStore.clear();
return;
diff --git a/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp b/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp
index 3273bdc09..d21af0301 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp
@@ -66,6 +66,32 @@ void WebContextMenu::show()
if (!view)
return;
+ Vector<WebContextMenuItemData> menuItems;
+ RefPtr<APIObject> userData;
+ menuItemsWithUserData(menuItems, userData);
+ WebHitTestResult::Data webHitTestResultData(controller->hitTestResult());
+
+ // Mark the WebPage has having a shown context menu then notify the UIProcess.
+ m_page->contextMenuShowing();
+ m_page->send(Messages::WebPageProxy::ShowContextMenu(view->contentsToWindow(controller->hitTestResult().roundedPointInInnerNodeFrame()), webHitTestResultData, menuItems, InjectedBundleUserMessageEncoder(userData.get())));
+}
+
+void WebContextMenu::itemSelected(const WebContextMenuItemData& item)
+{
+ ContextMenuItem coreItem(ActionType, static_cast<ContextMenuAction>(item.action()), item.title());
+ m_page->corePage()->contextMenuController()->contextMenuItemSelected(&coreItem);
+}
+
+void WebContextMenu::menuItemsWithUserData(Vector<WebContextMenuItemData> &menuItems, RefPtr<APIObject>& userData) const
+{
+ ContextMenuController* controller = m_page->corePage()->contextMenuController();
+ if (!controller)
+ return;
+
+ ContextMenu* menu = controller->contextMenu();
+ if (!menu)
+ return;
+
// Give the bundle client a chance to process the menu.
#if USE(CROSS_PLATFORM_CONTEXT_MENUS)
const Vector<ContextMenuItem>& coreItems = menu->items();
@@ -74,22 +100,18 @@ void WebContextMenu::show()
#endif
Vector<WebContextMenuItemData> proposedMenu = kitItems(coreItems, menu);
Vector<WebContextMenuItemData> newMenu;
- RefPtr<APIObject> userData;
RefPtr<InjectedBundleHitTestResult> hitTestResult = InjectedBundleHitTestResult::create(controller->hitTestResult());
if (m_page->injectedBundleContextMenuClient().getCustomMenuFromDefaultItems(m_page, hitTestResult.get(), proposedMenu, newMenu, userData))
proposedMenu = newMenu;
-
- WebHitTestResult::Data webHitTestResultData(controller->hitTestResult());
-
- // Mark the WebPage has having a shown context menu then notify the UIProcess.
- m_page->contextMenuShowing();
- m_page->send(Messages::WebPageProxy::ShowContextMenu(view->contentsToWindow(controller->hitTestResult().roundedPointInInnerNodeFrame()), webHitTestResultData, proposedMenu, InjectedBundleUserMessageEncoder(userData.get())));
+ menuItems = proposedMenu;
}
-void WebContextMenu::itemSelected(const WebContextMenuItemData& item)
+Vector<WebContextMenuItemData> WebContextMenu::items() const
{
- ContextMenuItem coreItem(ActionType, static_cast<ContextMenuAction>(item.action()), item.title());
- m_page->corePage()->contextMenuController()->contextMenuItemSelected(&coreItem);
+ Vector<WebContextMenuItemData> menuItems;
+ RefPtr<APIObject> userData;
+ menuItemsWithUserData(menuItems, userData);
+ return menuItems;
}
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/WebContextMenu.h b/Source/WebKit2/WebProcess/WebPage/WebContextMenu.h
index c8a5f5a46..b4fa66ee3 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebContextMenu.h
+++ b/Source/WebKit2/WebProcess/WebPage/WebContextMenu.h
@@ -43,10 +43,12 @@ public:
void show();
void itemSelected(const WebContextMenuItemData&);
+ Vector<WebContextMenuItemData> items() const;
private:
WebContextMenu(WebPage*);
-
+ void menuItemsWithUserData(Vector<WebContextMenuItemData>&, RefPtr<APIObject>&) const;
+
WebPage* m_page;
};
diff --git a/Source/WebKit2/WebProcess/WebProcess.h b/Source/WebKit2/WebProcess/WebProcess.h
index eddccc153..82e6cc8f2 100644
--- a/Source/WebKit2/WebProcess/WebProcess.h
+++ b/Source/WebKit2/WebProcess/WebProcess.h
@@ -208,6 +208,8 @@ public:
WebResourceLoadScheduler& webResourceLoadScheduler() { return m_webResourceLoadScheduler; }
#endif
+ void setCacheModel(uint32_t);
+
private:
WebProcess();
@@ -234,7 +236,6 @@ private:
void visitedLinkStateChanged(const Vector<WebCore::LinkHash>& linkHashes);
void allVisitedLinkStateChanged();
- void setCacheModel(uint32_t);
void platformSetCacheModel(CacheModel);
static void calculateCacheSizes(CacheModel cacheModel, uint64_t memorySize, uint64_t diskFreeSize,
unsigned& cacheTotalCapacity, unsigned& cacheMinDeadCapacity, unsigned& cacheMaxDeadCapacity, double& deadDecodedDataDeletionInterval,