summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/WebProcess
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-16 16:25:10 +0100
committerBen Murdoch <benm@google.com>2011-05-23 18:54:14 +0100
commitab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb (patch)
treedb769fadd053248f85db67434a5b275224defef7 /Source/WebKit2/WebProcess
parent52e2557aeb8477967e97fd24f20f8f407a10fa15 (diff)
downloadexternal_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.zip
external_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.tar.gz
external_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.tar.bz2
Merge WebKit at r76408: Initial merge by git.
Change-Id: I5b91decbd693ccbf5c1b8354b37cd68cc9a1ea53
Diffstat (limited to 'Source/WebKit2/WebProcess')
-rw-r--r--Source/WebKit2/WebProcess/Downloads/Download.h1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp10
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h4
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp5
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h2
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp5
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h1
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.h3
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp7
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp1
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h3
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm28
-rw-r--r--Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.h3
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp20
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h4
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp2
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h3
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp7
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm272
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm2
-rw-r--r--Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp2
-rw-r--r--Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h2
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp14
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DrawingArea.h7
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in4
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp62
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h16
-rw-r--r--Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp18
-rw-r--r--Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h3
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebFrame.cpp29
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebFrame.h3
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPage.cpp77
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPage.h9
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPage.messages.in4
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm7
-rw-r--r--Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp10
-rw-r--r--Source/WebKit2/WebProcess/com.apple.WebProcess.sb4
-rw-r--r--Source/WebKit2/WebProcess/mac/WebProcessMac.mm6
-rw-r--r--Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm8
39 files changed, 589 insertions, 79 deletions
diff --git a/Source/WebKit2/WebProcess/Downloads/Download.h b/Source/WebKit2/WebProcess/Downloads/Download.h
index 2319ec7..bacdd01 100644
--- a/Source/WebKit2/WebProcess/Downloads/Download.h
+++ b/Source/WebKit2/WebProcess/Downloads/Download.h
@@ -63,7 +63,6 @@ class WebPage;
class Download : public CoreIPC::MessageSender<Download> {
WTF_MAKE_NONCOPYABLE(Download);
-
public:
static PassOwnPtr<Download> create(uint64_t downloadID, const WebCore::ResourceRequest&);
~Download();
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
index 9410642..f02044c 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
@@ -85,6 +85,11 @@ JSGlobalContextRef WKBundleFrameGetJavaScriptContext(WKBundleFrameRef frameRef)
return toImpl(frameRef)->jsContext();
}
+WKBundleFrameRef WKBundleFrameForJavaScriptContext(JSContextRef context)
+{
+ return toAPI(WebFrame::frameForContext(context));
+}
+
JSGlobalContextRef WKBundleFrameGetJavaScriptContextForWorld(WKBundleFrameRef frameRef, WKBundleScriptWorldRef worldRef)
{
return toImpl(frameRef)->jsContextForWorld(toImpl(worldRef));
@@ -197,3 +202,8 @@ WK_EXPORT WKSize WKBundleFrameGetScrollOffset(WKBundleFrameRef frameRef)
return toAPI(view->scrollOffset());
}
+
+WKStringRef WKBundleFrameCopySuggestedFilenameForResourceWithURL(WKBundleFrameRef frameRef, WKURLRef urlRef)
+{
+ return toCopiedAPI(toImpl(frameRef)->suggestedFilenameForResourceWithURL(WebCore::KURL(WebCore::KURL(), toImpl(urlRef)->string())));
+}
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
index a6a20b2..59c2d75 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
@@ -46,6 +46,8 @@ WK_EXPORT WKURLRef WKBundleFrameCopyProvisionalURL(WKBundleFrameRef frame);
WK_EXPORT JSGlobalContextRef WKBundleFrameGetJavaScriptContext(WKBundleFrameRef frame);
WK_EXPORT JSGlobalContextRef WKBundleFrameGetJavaScriptContextForWorld(WKBundleFrameRef frame, WKBundleScriptWorldRef world);
+WK_EXPORT WKBundleFrameRef WKBundleFrameForJavaScriptContext(JSContextRef context);
+
WK_EXPORT JSValueRef WKBundleFrameGetJavaScriptWrapperForNodeForWorld(WKBundleFrameRef frame, WKBundleNodeHandleRef nodeHandle, WKBundleScriptWorldRef world);
WK_EXPORT JSValueRef WKBundleFrameGetJavaScriptWrapperForRangeForWorld(WKBundleFrameRef frame, WKBundleRangeHandleRef rangeHandle, WKBundleScriptWorldRef world);
@@ -57,6 +59,8 @@ WK_EXPORT WKRect WKBundleFrameGetContentBounds(WKBundleFrameRef frame);
WK_EXPORT WKRect WKBundleFrameGetVisibleContentBounds(WKBundleFrameRef frame);
WK_EXPORT WKSize WKBundleFrameGetScrollOffset(WKBundleFrameRef frame);
+WK_EXPORT WKStringRef WKBundleFrameCopySuggestedFilenameForResourceWithURL(WKBundleFrameRef frame, WKURLRef url);
+
#ifdef __cplusplus
}
#endif
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp
index 86d913b..bf853d1 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp
@@ -49,6 +49,11 @@ WKRect WKBundleNodeHandleGetElementBounds(WKBundleNodeHandleRef nodeHandleRef)
return toAPI(toImpl(nodeHandleRef)->elementBounds());
}
+WKRect WKBundleNodeHandleGetRenderRect(WKBundleNodeHandleRef nodeHandleRef, bool* isReplaced)
+{
+ return toAPI(toImpl(nodeHandleRef)->renderRect(isReplaced));
+}
+
void WKBundleNodeHandleSetHTMLInputElementValueForUser(WKBundleNodeHandleRef htmlInputElementHandleRef, WKStringRef valueRef)
{
toImpl(htmlInputElementHandleRef)->setHTMLInputElementValueForUser(toWTFString(valueRef));
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h
index 854677b..8953ff8 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h
@@ -40,6 +40,8 @@ WK_EXPORT WKBundleNodeHandleRef WKBundleNodeHandleCreate(JSContextRef context, J
/* Additional DOM Operations */
WK_EXPORT WKRect WKBundleNodeHandleGetElementBounds(WKBundleNodeHandleRef nodeHandle);
+WK_EXPORT WKRect WKBundleNodeHandleGetRenderRect(WKBundleNodeHandleRef nodeHandle, bool* isReplaced);
+
/* HTMLInputElement Specific Operations */
WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementValueForUser(WKBundleNodeHandleRef htmlInputElementHandle, WKStringRef value);
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp
index e9370c6..6ee3b31 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp
@@ -104,6 +104,11 @@ IntRect InjectedBundleNodeHandle::elementBounds() const
return static_cast<Element*>(m_node.get())->boundsInWindowSpace();
}
+
+IntRect InjectedBundleNodeHandle::renderRect(bool* isReplaced) const
+{
+ return m_node.get()->renderRect(isReplaced);
+}
void InjectedBundleNodeHandle::setHTMLInputElementValueForUser(const String& value)
{
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h b/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h
index eff4600..a02f7f2 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h
@@ -56,6 +56,7 @@ public:
// Additional DOM Operations
// Note: These should only be operations that are not exposed to JavaScript.
WebCore::IntRect elementBounds() const;
+ WebCore::IntRect renderRect(bool*) const;
void setHTMLInputElementValueForUser(const String&);
bool isHTMLInputElementAutofilled() const;
void setHTMLInputElementAutofilled(bool);
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.h b/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.h
index 6737bd4..3518221 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.h
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.h
@@ -40,7 +40,8 @@ namespace WebKit {
class NPRuntimeObjectMap;
// NPJSObject is an NPObject that wraps a JSObject.
-class NPJSObject : public NPObject, Noncopyable {
+class NPJSObject : public NPObject {
+ WTF_MAKE_NONCOPYABLE(NPJSObject);
public:
static NPJSObject* create(NPRuntimeObjectMap* objectMap, JSC::JSObject* jsObject);
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
index 566d48d..ba21db1 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
@@ -766,10 +766,11 @@ static void NPN_UnscheduleTimer(NPP instance, uint32_t timerID)
}
#if PLATFORM(MAC)
-static NPError NPN_PopUpContextMenu(NPP instance, NPMenu* menu)
+static NPError NPN_PopUpContextMenu(NPP npp, NPMenu* menu)
{
- notImplemented();
- return NPERR_GENERIC_ERROR;
+ RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp);
+
+ return plugin->popUpContextMenu(menu);
}
static NPBool NPN_ConvertPoint(NPP npp, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double* destX, double* destY, NPCoordinateSpace destSpace)
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
index 0beade2..5674ba5 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
@@ -67,6 +67,7 @@ NetscapePlugin::NetscapePlugin(PassRefPtr<NetscapePluginModule> pluginModule)
#if PLATFORM(MAC)
, m_drawingModel(static_cast<NPDrawingModel>(-1))
, m_eventModel(static_cast<NPEventModel>(-1))
+ , m_currentMouseEvent(0)
, m_pluginHasFocus(false)
, m_windowHasFocus(false)
#ifndef NP_NO_CARBON
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
index fb5d37e..95ff714 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
@@ -54,6 +54,7 @@ public:
NPError setDrawingModel(NPDrawingModel);
NPError setEventModel(NPEventModel);
NPBool convertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double& destX, double& destY, NPCoordinateSpace destSpace);
+ NPError popUpContextMenu(NPMenu*);
#ifndef NP_NO_CARBON
WindowRef windowRef() const;
@@ -205,6 +206,8 @@ private:
NPEventModel m_eventModel;
RetainPtr<PlatformLayer> m_pluginLayer;
+ NPCocoaEvent* m_currentMouseEvent;
+
bool m_pluginHasFocus;
bool m_windowHasFocus;
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
index 1240ed7..d57e8d1 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
@@ -157,6 +157,20 @@ NPBool NetscapePlugin::convertPoint(double sourceX, double sourceY, NPCoordinate
return true;
}
+
+NPError NetscapePlugin::popUpContextMenu(NPMenu* npMenu)
+{
+ if (!m_currentMouseEvent)
+ return NPERR_GENERIC_ERROR;
+
+ double screenX, screenY;
+ if (!convertPoint(m_currentMouseEvent->data.mouse.pluginX, m_currentMouseEvent->data.mouse.pluginY, NPCoordinateSpacePlugin, screenX, screenY, NPCoordinateSpaceScreen))
+ ASSERT_NOT_REACHED();
+
+ WKPopupContextMenu(reinterpret_cast<NSMenu *>(npMenu), NSMakePoint(screenX, screenY));
+ return NPERR_NO_ERROR;
+}
+
#ifndef NP_NO_CARBON
typedef HashMap<WindowRef, NetscapePlugin*> WindowMap;
@@ -474,7 +488,19 @@ bool NetscapePlugin::platformHandleMouseEvent(const WebMouseEvent& mouseEvent)
switch (m_eventModel) {
case NPEventModelCocoa: {
NPCocoaEvent event = initializeMouseEvent(mouseEvent, m_frameRect.location());
- return NPP_HandleEvent(&event);
+
+ NPCocoaEvent* previousMouseEvent = m_currentMouseEvent;
+ m_currentMouseEvent = &event;
+
+ // Protect against NPP_HandleEvent causing the plug-in to be destroyed, since we
+ // access m_currentMouseEvent afterwards.
+ RefPtr<NetscapePlugin> protect(this);
+
+ bool returnValue = NPP_HandleEvent(&event);
+
+ m_currentMouseEvent = previousMouseEvent;
+
+ return returnValue;
}
#ifndef NP_NO_CARBON
diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.h b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.h
index d7ba853..8b60f17 100644
--- a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.h
+++ b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.h
@@ -38,7 +38,8 @@ namespace WebKit {
class PluginProcessConnection;
-class PluginProcessConnectionManager : Noncopyable {
+class PluginProcessConnectionManager {
+ WTF_MAKE_NONCOPYABLE(PluginProcessConnectionManager);
public:
static PluginProcessConnectionManager& shared();
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
index ffca3fa..6da6c6e 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
*
* Redistribution and use in source and binary forms, with or without
@@ -173,13 +173,12 @@ void WebChromeClient::show()
bool WebChromeClient::canRunModal()
{
- notImplemented();
- return false;
+ return m_page->canRunModal();
}
void WebChromeClient::runModal()
{
- notImplemented();
+ m_page->runModal();
}
void WebChromeClient::setToolbarsVisible(bool toolbarsAreVisible)
@@ -364,16 +363,16 @@ void WebChromeClient::invalidateContentsForSlowScroll(const IntRect& rect, bool)
m_page->drawingArea()->setNeedsDisplay(rect);
}
-void WebChromeClient::scroll(const IntSize& scrollDelta, const IntRect& scrollRect, const IntRect&)
+void WebChromeClient::scroll(const IntSize& scrollOffset, const IntRect& scrollRect, const IntRect& clipRect)
{
m_page->pageDidScroll();
- m_page->drawingArea()->scroll(scrollRect, scrollDelta);
+ m_page->drawingArea()->scroll(intersection(scrollRect, clipRect), scrollOffset);
}
#if ENABLE(TILED_BACKING_STORE)
-void WebChromeClient::delegatedScrollRequested(const IntSize& scrollDelta)
+void WebChromeClient::delegatedScrollRequested(const IntSize& scrollOffset)
{
- m_page->pageDidRequestScroll(scrollDelta);
+ m_page->pageDidRequestScroll(scrollOffset);
}
#endif
@@ -466,9 +465,10 @@ void WebChromeClient::setToolTip(const String& toolTip, TextDirection)
m_page->send(Messages::WebPageProxy::SetToolTip(m_cachedToolTip));
}
-void WebChromeClient::print(Frame*)
+void WebChromeClient::print(Frame* frame)
{
- notImplemented();
+ WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame();
+ m_page->sendSync(Messages::WebPageProxy::PrintFrame(webFrame->frameID()), Messages::WebPageProxy::PrintFrame::Reply());
}
#if ENABLE(DATABASE)
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
index 44c3658..d749833 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
@@ -107,9 +107,9 @@ private:
virtual void invalidateWindow(const WebCore::IntRect&, bool);
virtual void invalidateContentsAndWindow(const WebCore::IntRect&, bool);
virtual void invalidateContentsForSlowScroll(const WebCore::IntRect&, bool);
- virtual void scroll(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& scrollRect, const WebCore::IntRect& clipRect);
+ virtual void scroll(const WebCore::IntSize& scrollOffset, const WebCore::IntRect& scrollRect, const WebCore::IntRect& clipRect);
#if ENABLE(TILED_BACKING_STORE)
- virtual void delegatedScrollRequested(const WebCore::IntSize& scrollDelta);
+ virtual void delegatedScrollRequested(const WebCore::IntSize& scrollOffset);
#endif
virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) const;
virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) const;
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp
index d11017f..e3d401d 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp
@@ -50,6 +50,7 @@ DragSourceAction WebDragClient::dragSourceActionMaskForPoint(const IntPoint& win
return DragSourceActionAny;
}
+#if !PLATFORM(MAC)
void WebDragClient::startDrag(DragImageRef, const IntPoint&, const IntPoint&, Clipboard*, Frame*, bool)
{
}
@@ -59,6 +60,7 @@ DragImageRef WebDragClient::createDragImageForLink(KURL&, const String&, Frame*)
notImplemented();
return 0;
}
+#endif
void WebDragClient::dragControllerDestroyed()
{
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h
index ce123c8..6f7cf85 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h
@@ -48,6 +48,9 @@ private:
virtual void startDrag(WebCore::DragImageRef dragImage, const WebCore::IntPoint& dragImageOrigin, const WebCore::IntPoint& eventPos, WebCore::Clipboard*, WebCore::Frame*, bool linkDrag = false);
virtual WebCore::DragImageRef createDragImageForLink(WebCore::KURL&, const String& label, WebCore::Frame*);
+#if PLATFORM(MAC)
+ virtual void declareAndWriteDragImage(NSPasteboard*, DOMElement*, NSURL*, NSString*, WebCore::Frame*);
+#endif
virtual void dragControllerDestroyed();
WebPage* m_page;
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
index 4567f35..49b31ef 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
@@ -63,6 +63,13 @@ static String formatLocalizedString(String format, ...)
RetainPtr<CFStringRef> result(AdoptCF, CFStringCreateWithFormatAndArguments(0, 0, formatCFString.get(), arguments));
va_end(arguments);
return result.get();
+#elif PLATFORM(QT)
+ va_list arguments;
+ va_start(arguments, format);
+ QString result;
+ result.vsprintf(format.latin1().data(), arguments);
+ va_end(arguments);
+ return result;
#else
notImplemented();
return format;
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm
new file mode 100644
index 0000000..9952e3f
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm
@@ -0,0 +1,272 @@
+/*
+ * 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
+ * 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 "PasteboardTypes.h"
+#import "ShareableBitmap.h"
+#import "WebCoreArgumentCoders.h"
+#import "WebDragClient.h"
+#import "WebPage.h"
+#import "WebPageProxyMessages.h"
+#import <WebCore/CachedImage.h>
+#import <WebCore/DOMPrivate.h>
+#import <WebCore/DOMElementInternal.h>
+#import <WebCore/FrameView.h>
+#import <WebCore/GraphicsContext.h>
+#import <WebCore/LegacyWebArchive.h>
+#import <WebCore/RenderImage.h>
+#import <WebCore/StringTruncator.h>
+#import <wtf/StdLibExtras.h>
+#import <WebKit/WebKitNSStringExtras.h>
+#import <WebKit/WebNSURLExtras.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+const float DragLabelBorderX = 4;
+//Keep border_y in synch with DragController::LinkDragBorderInset
+const float DragLabelBorderY = 2;
+const float DragLabelRadius = 5;
+const float LabelBorderYOffset = 2;
+
+const float MinDragLabelWidthBeforeClip = 120;
+const float MaxDragLabelWidth = 320;
+
+const float DragLinkLabelFontsize = 11;
+const float DragLinkUrlFontSize = 10;
+
+using namespace WebCore;
+
+static Font& fontFromNSFont(NSFont *font)
+{
+ static NSFont *currentFont;
+ DEFINE_STATIC_LOCAL(Font, currentRenderer, ());
+
+ if ([font isEqual:currentFont])
+ return currentRenderer;
+ if (currentFont)
+ CFRelease(currentFont);
+ currentFont = font;
+ CFRetain(currentFont);
+ currentRenderer = Font(FontPlatformData(font, [font pointSize]), ![[NSGraphicsContext currentContext] isDrawingToScreen]);
+ return currentRenderer;
+}
+
+void WebDragClient::startDrag(DragImageRef dragImage, const IntPoint& at, const IntPoint& eventPos, Clipboard* clipboard, Frame* frame, bool linkDrag)
+{
+ if (!frame)
+ return;
+ ASSERT(clipboard);
+
+ NSImage *dragNSImage = dragImage.get();
+ RefPtr<ShareableBitmap> dragShareableImage = ShareableBitmap::createShareable(IntSize([dragNSImage size]));
+ OwnPtr<GraphicsContext> graphicsContext = dragShareableImage->createGraphicsContext();
+
+ [NSGraphicsContext saveGraphicsState];
+ NSGraphicsContext* bitmapContext = [NSGraphicsContext graphicsContextWithGraphicsPort:graphicsContext->platformContext() flipped:YES];
+ [NSGraphicsContext setCurrentContext: bitmapContext];
+
+ [dragNSImage drawInRect:NSMakeRect(0, 0, [dragNSImage size].width , [dragNSImage size].height) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1];
+ [NSGraphicsContext restoreGraphicsState];
+
+ SharedMemory::Handle handle;
+ if (!dragShareableImage->createHandle(handle))
+ return;
+ IntPoint clientPoint(at);
+ m_page->send(Messages::WebPageProxy::SetDragImage(clientPoint, IntSize([dragNSImage size]), handle, linkDrag));
+}
+
+DragImageRef WebDragClient::createDragImageForLink(KURL& url, const String& title, Frame* frame)
+{
+ if (!frame)
+ return nil;
+ NSString *label = 0;
+ if (!title.isEmpty())
+ label = title;
+ NSURL *cocoaURL = url;
+ NSString *urlString = [cocoaURL _web_userVisibleString];
+
+ BOOL drawURLString = YES;
+ BOOL clipURLString = NO;
+ BOOL clipLabelString = NO;
+
+ if (!label) {
+ drawURLString = NO;
+ label = urlString;
+ }
+
+ NSFont *labelFont = [[NSFontManager sharedFontManager] convertFont:[NSFont systemFontOfSize:DragLinkLabelFontsize]
+ toHaveTrait:NSBoldFontMask];
+ NSFont *urlFont = [NSFont systemFontOfSize:DragLinkUrlFontSize];
+ NSSize labelSize;
+ labelSize.width = [label _web_widthWithFont: labelFont];
+ labelSize.height = [labelFont ascender] - [labelFont descender];
+ if (labelSize.width > MaxDragLabelWidth){
+ labelSize.width = MaxDragLabelWidth;
+ clipLabelString = YES;
+ }
+
+ NSSize imageSize;
+ imageSize.width = labelSize.width + DragLabelBorderX * 2;
+ imageSize.height = labelSize.height + DragLabelBorderY * 2;
+ if (drawURLString) {
+ NSSize urlStringSize;
+ urlStringSize.width = [urlString _web_widthWithFont: urlFont];
+ urlStringSize.height = [urlFont ascender] - [urlFont descender];
+ imageSize.height += urlStringSize.height;
+ if (urlStringSize.width > MaxDragLabelWidth) {
+ imageSize.width = max(MaxDragLabelWidth + DragLabelBorderY * 2, MinDragLabelWidthBeforeClip);
+ clipURLString = YES;
+ } else
+ imageSize.width = max(labelSize.width + DragLabelBorderX * 2, urlStringSize.width + DragLabelBorderX * 2);
+ }
+ NSImage *dragImage = [[[NSImage alloc] initWithSize: imageSize] autorelease];
+ [dragImage lockFocus];
+
+ [[NSColor colorWithDeviceRed: 0.7f green: 0.7f blue: 0.7f alpha: 0.8f] set];
+
+ // Drag a rectangle with rounded corners
+ NSBezierPath *path = [NSBezierPath bezierPath];
+ [path appendBezierPathWithOvalInRect: NSMakeRect(0, 0, DragLabelRadius * 2, DragLabelRadius * 2)];
+ [path appendBezierPathWithOvalInRect: NSMakeRect(0, imageSize.height - DragLabelRadius * 2, DragLabelRadius * 2, DragLabelRadius * 2)];
+ [path appendBezierPathWithOvalInRect: NSMakeRect(imageSize.width - DragLabelRadius * 2, imageSize.height - DragLabelRadius * 2, DragLabelRadius * 2, DragLabelRadius * 2)];
+ [path appendBezierPathWithOvalInRect: NSMakeRect(imageSize.width - DragLabelRadius * 2, 0, DragLabelRadius * 2, DragLabelRadius * 2)];
+
+ [path appendBezierPathWithRect: NSMakeRect(DragLabelRadius, 0, imageSize.width - DragLabelRadius * 2, imageSize.height)];
+ [path appendBezierPathWithRect: NSMakeRect(0, DragLabelRadius, DragLabelRadius + 10, imageSize.height - 2 * DragLabelRadius)];
+ [path appendBezierPathWithRect: NSMakeRect(imageSize.width - DragLabelRadius - 20, DragLabelRadius, DragLabelRadius + 20, imageSize.height - 2 * DragLabelRadius)];
+ [path fill];
+
+ NSColor *topColor = [NSColor colorWithDeviceWhite:0.0f alpha:0.75f];
+ NSColor *bottomColor = [NSColor colorWithDeviceWhite:1.0f alpha:0.5f];
+ if (drawURLString) {
+ if (clipURLString)
+ //urlString = [WebStringTruncator centerTruncateString: urlString toWidth:imageSize.width - (DragLabelBorderX * 2) withFont:urlFont];
+ urlString = StringTruncator::centerTruncate(urlString, imageSize.width - (DragLabelBorderX * 2), fontFromNSFont(urlFont));
+ [urlString _web_drawDoubledAtPoint:NSMakePoint(DragLabelBorderX, DragLabelBorderY - [urlFont descender])
+ withTopColor:topColor bottomColor:bottomColor font:urlFont];
+ }
+
+ if (clipLabelString)
+ //label = [WebStringTruncator rightTruncateString: label toWidth:imageSize.width - (DragLabelBorderX * 2) withFont:labelFont];
+ label = StringTruncator::rightTruncate(label, imageSize.width - (DragLabelBorderX * 2), fontFromNSFont(labelFont));
+ [label _web_drawDoubledAtPoint:NSMakePoint (DragLabelBorderX, imageSize.height - LabelBorderYOffset - [labelFont pointSize])
+ withTopColor:topColor bottomColor:bottomColor font:labelFont];
+
+ [dragImage unlockFocus];
+
+ return dragImage;
+}
+
+static void writeURL(NSPasteboard* pasteboard, NSURL* URL, NSString* title, NSArray* types)
+{
+ ASSERT(URL);
+
+ if (![title length]) {
+ title = [[URL path] lastPathComponent];
+ if (![title length])
+ title = [URL _web_userVisibleString];
+ }
+
+ if ([types containsObject:NSURLPboardType])
+ [URL writeToPasteboard:pasteboard];
+ if ([types containsObject:PasteboardTypes::WebURLPboardType])
+ [pasteboard setString:[URL _web_originalDataAsString] forType:PasteboardTypes::WebURLPboardType];
+ if ([types containsObject:PasteboardTypes::WebURLNamePboardType])
+ [pasteboard setString:title forType:PasteboardTypes::WebURLNamePboardType];
+ if ([types containsObject:NSStringPboardType])
+ [pasteboard setString:[URL _web_userVisibleString] forType:NSStringPboardType];
+ if ([types containsObject:PasteboardTypes::WebURLsWithTitlesPboardType]) {
+ NSArray* URLs = [NSArray arrayWithObject:URL];
+ unsigned count = [URLs count];
+
+ if (!count || [pasteboard availableTypeFromArray:[NSArray arrayWithObject:PasteboardTypes::WebURLsWithTitlesPboardType]] == nil)
+ return;
+
+ NSArray* titles = [NSArray arrayWithObject:title];
+
+ if (count != [titles count])
+ titles = nil;
+
+ NSMutableArray* URLStrings = [NSMutableArray arrayWithCapacity:count];
+ NSMutableArray* titlesOrEmptyStrings = [NSMutableArray arrayWithCapacity:count];
+ for (unsigned index = 0; index < count; ++index) {
+ [URLStrings addObject:[[URLs objectAtIndex:index] _web_originalDataAsString]];
+ [titlesOrEmptyStrings addObject:(titles == nil) ? @"" : [[titles objectAtIndex:index] _webkit_stringByTrimmingWhitespace]];
+ }
+
+ [pasteboard setPropertyList:[NSArray arrayWithObjects:URLStrings, titlesOrEmptyStrings, nil]
+ forType:PasteboardTypes::WebURLsWithTitlesPboardType];
+ }
+}
+
+static void writeImage(NSPasteboard* pasteboard, NSImage *image, DOMElement* element, NSURL* URL, NSString* title, LegacyWebArchive* archive, NSArray* types)
+{
+ ASSERT(image || element);
+ ASSERT(URL);
+
+ writeURL(pasteboard, URL, title, types);
+
+ if ([types containsObject:NSTIFFPboardType]) {
+ // FIXME: we should add handling of promised types.
+ if (image)
+ [pasteboard setData:[image TIFFRepresentation] forType:NSTIFFPboardType];
+ else if (element)
+ [pasteboard setData:[element _imageTIFFRepresentation] forType:NSTIFFPboardType];
+ }
+
+ if (archive && [types containsObject:PasteboardTypes::WebArchivePboardType])
+ [pasteboard setData:[[(NSData *)archive->rawDataRepresentation().get() retain] autorelease] forType:PasteboardTypes::WebArchivePboardType];
+}
+
+void WebDragClient::declareAndWriteDragImage(NSPasteboard* pasteboard, DOMElement* element, NSURL* URL, NSString* title, WebCore::Frame*)
+{
+ ASSERT(element);
+ ASSERT(pasteboard && pasteboard == [NSPasteboard pasteboardWithName:NSDragPboard]);
+
+ NSString *extension = @"";
+ if (RenderObject* renderer = core(element)->renderer()) {
+ if (renderer->isImage()) {
+ if (CachedImage* image = toRenderImage(renderer)->cachedImage()) {
+ extension = image->image()->filenameExtension();
+ if (![extension length])
+ return;
+ }
+ }
+ }
+
+ RefPtr<LegacyWebArchive> archive = LegacyWebArchive::create(core(element));
+ NSMutableArray *types = [[NSMutableArray alloc] initWithObjects:NSFilesPromisePboardType, nil];
+ [types addObjectsFromArray:(archive) ? PasteboardTypes::forImagesWithArchive() : PasteboardTypes::forImages()];
+ [pasteboard declareTypes:types owner:nil];
+ writeImage(pasteboard, nil, element, URL, title, archive.get(), types);
+ [types release];
+
+ NSArray *extensions = [[NSArray alloc] initWithObjects:extension, nil];
+ [pasteboard setPropertyList:extensions forType:NSFilesPromisePboardType];
+ [extensions release];
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
index 90b9a64..f81b627 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
@@ -93,6 +93,8 @@ void InitWebCoreSystemInterface(void)
#if !defined(BUILDING_ON_SNOW_LEOPARD)
INIT(CreateCTTypesetterWithUniCharProviderAndOptions);
+ INIT(MakeScrollbarPainter);
+ INIT(ScrollbarPainterPaint);
#else
INIT(GetHyphenationLocationBeforeIndex);
#endif
diff --git a/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp b/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp
index 513621c..d629ced 100644
--- a/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp
@@ -49,7 +49,7 @@ ChunkedUpdateDrawingArea::~ChunkedUpdateDrawingArea()
{
}
-void ChunkedUpdateDrawingArea::scroll(const IntRect& scrollRect, const IntSize& scrollDelta)
+void ChunkedUpdateDrawingArea::scroll(const IntRect& scrollRect, const IntSize& scrollOffset)
{
// FIXME: Do something much smarter.
setNeedsDisplay(scrollRect);
diff --git a/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h b/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h
index ac4b424..08aa3e7 100644
--- a/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h
+++ b/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h
@@ -40,7 +40,7 @@ public:
virtual ~ChunkedUpdateDrawingArea();
virtual void setNeedsDisplay(const WebCore::IntRect&);
- virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollDelta);
+ virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
virtual void display();
#if USE(ACCELERATED_COMPOSITING)
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp b/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp
index 3b76aaf..ea5b443 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp
@@ -40,31 +40,33 @@
#include "TiledDrawingArea.h"
#endif
+#include "WebPageCreationParameters.h"
+
namespace WebKit {
-PassRefPtr<DrawingArea> DrawingArea::create(DrawingAreaInfo::Type type, DrawingAreaInfo::Identifier identifier, WebPage* webPage)
+PassRefPtr<DrawingArea> DrawingArea::create(WebPage* webPage, const WebPageCreationParameters& parameters)
{
- switch (type) {
+ switch (parameters.drawingAreaInfo.type) {
case DrawingAreaInfo::None:
ASSERT_NOT_REACHED();
break;
case DrawingAreaInfo::Impl:
#ifdef __APPLE__
- return DrawingAreaImpl::create(identifier, webPage);
+ return DrawingAreaImpl::create(webPage, parameters);
#else
return 0;
#endif
case DrawingAreaInfo::ChunkedUpdate:
- return adoptRef(new ChunkedUpdateDrawingArea(identifier, webPage));
+ return adoptRef(new ChunkedUpdateDrawingArea(parameters.drawingAreaInfo.identifier, webPage));
#if USE(ACCELERATED_COMPOSITING) && PLATFORM(MAC)
case DrawingAreaInfo::LayerBacked:
- return adoptRef(new LayerBackedDrawingArea(identifier, webPage));
+ return adoptRef(new LayerBackedDrawingArea(parameters.drawingAreaInfo.identifier, webPage));
#endif
#if ENABLE(TILED_BACKING_STORE)
case DrawingAreaInfo::Tiled:
- return adoptRef(new TiledDrawingArea(identifier, webPage));
+ return adoptRef(new TiledDrawingArea(parameters.drawingAreaInfo.identifier, webPage));
#endif
}
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.h b/Source/WebKit2/WebProcess/WebPage/DrawingArea.h
index 75f0b00..713994d 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingArea.h
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.h
@@ -40,11 +40,12 @@ namespace WebCore {
namespace WebKit {
class WebPage;
+class WebPageCreationParameters;
class DrawingArea : public RefCounted<DrawingArea> {
public:
// FIXME: It might make sense to move this create function into a factory style class.
- static PassRefPtr<DrawingArea> create(DrawingAreaInfo::Type, DrawingAreaInfo::Identifier, WebPage*);
+ static PassRefPtr<DrawingArea> create(WebPage*, const WebPageCreationParameters&);
virtual ~DrawingArea();
#ifdef __APPLE__
@@ -52,7 +53,7 @@ public:
#endif
virtual void setNeedsDisplay(const WebCore::IntRect&) = 0;
- virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollDelta) = 0;
+ virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) = 0;
virtual void pageBackgroundTransparencyChanged() { }
@@ -81,6 +82,8 @@ private:
// FIXME: These should be pure virtual.
virtual void setSize(const WebCore::IntSize&) { }
virtual void didUpdate() { }
+ virtual void suspendPainting() { }
+ virtual void resumePainting() { }
};
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in b/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in
index 6c628fb..682ef5a 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in
@@ -22,5 +22,7 @@
messages -> DrawingArea {
SetSize(WebCore::IntSize size)
- DidUpdate()
+ DidUpdate()
+ SuspendPainting()
+ ResumePainting()
}
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
index ab4655a..2063bd6 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
@@ -29,6 +29,7 @@
#include "ShareableBitmap.h"
#include "UpdateInfo.h"
#include "WebPage.h"
+#include "WebPageCreationParameters.h"
#include "WebProcess.h"
#include <WebCore/GraphicsContext.h>
@@ -40,18 +41,19 @@ using namespace WebCore;
namespace WebKit {
-PassRefPtr<DrawingAreaImpl> DrawingAreaImpl::create(DrawingAreaInfo::Identifier identifier, WebPage* webPage)
+PassRefPtr<DrawingAreaImpl> DrawingAreaImpl::create(WebPage* webPage, const WebPageCreationParameters& parameters)
{
- return adoptRef(new DrawingAreaImpl(identifier, webPage));
+ return adoptRef(new DrawingAreaImpl(webPage, parameters));
}
DrawingAreaImpl::~DrawingAreaImpl()
{
}
-DrawingAreaImpl::DrawingAreaImpl(DrawingAreaInfo::Identifier identifier, WebPage* webPage)
- : DrawingArea(DrawingAreaInfo::Impl, identifier, webPage)
+DrawingAreaImpl::DrawingAreaImpl(WebPage* webPage, const WebPageCreationParameters& parameters)
+ : DrawingArea(DrawingAreaInfo::Impl, parameters.drawingAreaInfo.identifier, webPage)
, m_isWaitingForDidUpdate(false)
+ , m_isPaintingSuspended(!parameters.isVisible)
, m_displayTimer(WebProcess::shared().runLoop(), this, &DrawingAreaImpl::display)
{
}
@@ -65,7 +67,7 @@ void DrawingAreaImpl::setNeedsDisplay(const IntRect& rect)
scheduleDisplay();
}
-void DrawingAreaImpl::scroll(const IntRect& scrollRect, const IntSize& scrollDelta)
+void DrawingAreaImpl::scroll(const IntRect& scrollRect, const IntSize& scrollOffset)
{
if (!m_scrollRect.isEmpty() && scrollRect != m_scrollRect) {
unsigned scrollArea = scrollRect.width() * scrollRect.height();
@@ -81,7 +83,7 @@ void DrawingAreaImpl::scroll(const IntRect& scrollRect, const IntSize& scrollDel
// Just repaint the entire current scroll rect, we'll scroll the new rect instead.
setNeedsDisplay(m_scrollRect);
m_scrollRect = IntRect();
- m_scrollDelta = IntSize();
+ m_scrollOffset = IntSize();
}
// Get the part of the dirty region that is in the scroll rect.
@@ -92,19 +94,19 @@ void DrawingAreaImpl::scroll(const IntRect& scrollRect, const IntSize& scrollDel
m_dirtyRegion.subtract(scrollRect);
// Move the dirty parts.
- Region movedDirtyRegionInScrollRect = intersect(translate(dirtyRegionInScrollRect, scrollDelta), scrollRect);
+ Region movedDirtyRegionInScrollRect = intersect(translate(dirtyRegionInScrollRect, scrollOffset), scrollRect);
// And add them back.
m_dirtyRegion.unite(movedDirtyRegionInScrollRect);
}
// Compute the scroll repaint region.
- Region scrollRepaintRegion = subtract(scrollRect, translate(scrollRect, scrollDelta));
+ Region scrollRepaintRegion = subtract(scrollRect, translate(scrollRect, scrollOffset));
m_dirtyRegion.unite(scrollRepaintRegion);
m_scrollRect = scrollRect;
- m_scrollDelta += scrollDelta;
+ m_scrollOffset += scrollOffset;
}
void DrawingAreaImpl::attachCompositingContext()
@@ -139,9 +141,15 @@ void DrawingAreaImpl::setSize(const IntSize& size)
m_webPage->setSize(size);
m_webPage->layoutIfNeeded();
- // FIXME: Repaint.
+ UpdateInfo updateInfo;
+
+ if (m_isPaintingSuspended) {
+ updateInfo.timestamp = currentTime();
+ updateInfo.viewSize = m_webPage->size();
+ } else
+ display(updateInfo);
- m_webPage->send(Messages::DrawingAreaProxy::DidSetSize());
+ m_webPage->send(Messages::DrawingAreaProxy::DidSetSize(updateInfo));
}
void DrawingAreaImpl::didUpdate()
@@ -152,11 +160,31 @@ void DrawingAreaImpl::didUpdate()
display();
}
+void DrawingAreaImpl::suspendPainting()
+{
+ ASSERT(!m_isPaintingSuspended);
+
+ m_isPaintingSuspended = true;
+ m_displayTimer.stop();
+}
+
+void DrawingAreaImpl::resumePainting()
+{
+ ASSERT(m_isPaintingSuspended);
+
+ m_isPaintingSuspended = false;
+
+ // FIXME: Repaint if needed.
+}
+
void DrawingAreaImpl::scheduleDisplay()
{
if (m_isWaitingForDidUpdate)
return;
+ if (m_isPaintingSuspended)
+ return;
+
if (m_dirtyRegion.isEmpty())
return;
@@ -168,6 +196,11 @@ void DrawingAreaImpl::scheduleDisplay()
void DrawingAreaImpl::display()
{
+ ASSERT(!m_isWaitingForDidUpdate);
+
+ if (m_isPaintingSuspended)
+ return;
+
if (m_dirtyRegion.isEmpty())
return;
@@ -201,6 +234,8 @@ static bool shouldPaintBoundsRect(const IntRect& bounds, const Vector<IntRect>&
void DrawingAreaImpl::display(UpdateInfo& updateInfo)
{
+ ASSERT(!m_isPaintingSuspended);
+
// FIXME: It would be better if we could avoid painting altogether when there is a custom representation.
if (m_webPage->mainFrameHasCustomRepresentation())
return;
@@ -214,11 +249,11 @@ void DrawingAreaImpl::display(UpdateInfo& updateInfo)
}
updateInfo.scrollRect = m_scrollRect;
- updateInfo.scrollDelta = m_scrollDelta;
+ updateInfo.scrollOffset = m_scrollOffset;
m_dirtyRegion = Region();
m_scrollRect = IntRect();
- m_scrollDelta = IntSize();
+ m_scrollOffset = IntSize();
RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(bounds.size());
if (!bitmap->createHandle(updateInfo.bitmapHandle))
@@ -228,6 +263,7 @@ void DrawingAreaImpl::display(UpdateInfo& updateInfo)
m_webPage->layoutIfNeeded();
+ updateInfo.timestamp = currentTime();
updateInfo.viewSize = m_webPage->size();
updateInfo.updateRectBounds = bounds;
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
index 1f1b2e2..e008adc 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
@@ -36,15 +36,15 @@ struct UpdateInfo;
class DrawingAreaImpl : public DrawingArea {
public:
- static PassRefPtr<DrawingAreaImpl> create(DrawingAreaInfo::Identifier, WebPage*);
+ static PassRefPtr<DrawingAreaImpl> create(WebPage*, const WebPageCreationParameters&);
virtual ~DrawingAreaImpl();
private:
- DrawingAreaImpl(DrawingAreaInfo::Identifier, WebPage*);
+ DrawingAreaImpl(WebPage*, const WebPageCreationParameters&);
// DrawingArea
virtual void setNeedsDisplay(const WebCore::IntRect&);
- virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollDelta);
+ virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
virtual void attachCompositingContext();
virtual void detachCompositingContext();
virtual void setRootCompositingLayer(WebCore::GraphicsLayer*);
@@ -55,6 +55,8 @@ private:
// CoreIPC message handlers.
virtual void setSize(const WebCore::IntSize&);
virtual void didUpdate();
+ virtual void suspendPainting();
+ virtual void resumePainting();
void scheduleDisplay();
void display();
@@ -62,12 +64,16 @@ private:
Region m_dirtyRegion;
WebCore::IntRect m_scrollRect;
- WebCore::IntSize m_scrollDelta;
+ WebCore::IntSize m_scrollOffset;
// Whether we're waiting for a DidUpdate message. Used for throttling paints so that the
// web process won't paint more frequent than the UI process can handle.
bool m_isWaitingForDidUpdate;
-
+
+ // Whether painting is suspended. We'll still keep track of the dirty region but we
+ // won't paint until painting has resumed again.
+ bool m_isPaintingSuspended;
+
RunLoop::Timer<DrawingAreaImpl> m_displayTimer;
};
diff --git a/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp b/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp
index 8a81cca..b104b29 100644
--- a/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp
@@ -34,6 +34,8 @@
#include "WebPage.h"
#include "WebProcess.h"
#include <WebCore/GraphicsLayer.h>
+#include <WebCore/Page.h>
+#include <WebCore/Settings.h>
using namespace WebCore;
@@ -45,6 +47,12 @@ LayerBackedDrawingArea::LayerBackedDrawingArea(DrawingAreaInfo::Identifier ident
, m_attached(false)
, m_shouldPaint(true)
{
+ m_hostingLayer = GraphicsLayer::create(this);
+ m_hostingLayer->setDrawsContent(false);
+#ifndef NDEBUG
+ m_hostingLayer->setName("DrawingArea hosting layer");
+#endif
+ m_hostingLayer->setSize(webPage->size());
m_backingLayer = GraphicsLayer::create(this);
m_backingLayer->setDrawsContent(true);
m_backingLayer->setContentsOpaque(webPage->drawsBackground() && !webPage->drawsTransparentBackground());
@@ -53,6 +61,7 @@ LayerBackedDrawingArea::LayerBackedDrawingArea(DrawingAreaInfo::Identifier ident
m_backingLayer->setName("DrawingArea backing layer");
#endif
m_backingLayer->setSize(webPage->size());
+ m_hostingLayer->addChild(m_backingLayer.get());
platformInit();
}
@@ -61,7 +70,7 @@ LayerBackedDrawingArea::~LayerBackedDrawingArea()
platformClear();
}
-void LayerBackedDrawingArea::scroll(const IntRect& scrollRect, const IntSize& scrollDelta)
+void LayerBackedDrawingArea::scroll(const IntRect& scrollRect, const IntSize& scrollOffset)
{
// FIXME: Do something much smarter.
setNeedsDisplay(scrollRect);
@@ -99,6 +108,7 @@ void LayerBackedDrawingArea::setSize(const IntSize& viewSize)
ASSERT(m_shouldPaint);
ASSERT_ARG(viewSize, !viewSize.isEmpty());
+ m_hostingLayer->setSize(viewSize);
m_backingLayer->setSize(viewSize);
scheduleCompositingLayerSync();
@@ -183,14 +193,12 @@ void LayerBackedDrawingArea::paintContents(const GraphicsLayer*, GraphicsContext
bool LayerBackedDrawingArea::showDebugBorders() const
{
- // FIXME: get from settings;
- return false;
+ return m_webPage->corePage()->settings()->showDebugBorders();
}
bool LayerBackedDrawingArea::showRepaintCounter() const
{
- // FIXME: get from settings;
- return false;
+ return m_webPage->corePage()->settings()->showRepaintCounter();
}
#if !PLATFORM(MAC) && !PLATFORM(WIN)
diff --git a/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h b/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h
index 1b49de2..ed05cc7 100644
--- a/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h
+++ b/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h
@@ -56,7 +56,7 @@ public:
virtual ~LayerBackedDrawingArea();
virtual void setNeedsDisplay(const WebCore::IntRect&);
- virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollDelta);
+ virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
virtual void display();
virtual void pageBackgroundTransparencyChanged();
@@ -106,6 +106,7 @@ private:
RunLoop::Timer<LayerBackedDrawingArea> m_syncTimer;
+ OwnPtr<WebCore::GraphicsLayer> m_hostingLayer;
OwnPtr<WebCore::GraphicsLayer> m_backingLayer;
#if PLATFORM(MAC)
#if HAVE(HOSTED_CORE_ANIMATION)
diff --git a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
index c5f117e..42eacc1 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
@@ -34,9 +34,11 @@
#include "WebPageProxyMessages.h"
#include "WebProcess.h"
#include <JavaScriptCore/APICast.h>
+#include <JavaScriptCore/JSContextRef.h>
#include <JavaScriptCore/JSLock.h>
#include <JavaScriptCore/JSValueRef.h>
#include <WebCore/AnimationController.h>
+#include <WebCore/ArchiveResource.h>
#include <WebCore/CSSComputedStyleDeclaration.h>
#include <WebCore/Chrome.h>
#include <WebCore/DocumentLoader.h>
@@ -455,6 +457,17 @@ JSGlobalContextRef WebFrame::jsContextForWorld(InjectedBundleScriptWorld* world)
return toGlobalRef(m_coreFrame->script()->globalObject(world->coreWorld())->globalExec());
}
+WebFrame* WebFrame::frameForContext(JSContextRef context)
+{
+ JSObjectRef globalObjectRef = JSContextGetGlobalObject(context);
+ JSC::JSObject* globalObjectObj = toJS(globalObjectRef);
+ if (strcmp(globalObjectObj->classInfo()->className, "JSDOMWindowShell") != 0)
+ return 0;
+
+ Frame* coreFrame = static_cast<JSDOMWindowShell*>(globalObjectObj)->window()->impl()->frame();
+ return static_cast<WebFrameLoaderClient*>(coreFrame->loader()->client())->webFrame();
+}
+
JSValueRef WebFrame::jsWrapperForWorld(InjectedBundleNodeHandle* nodeHandle, InjectedBundleScriptWorld* world)
{
JSDOMWindow* globalObject = m_coreFrame->script()->globalObject(world->coreWorld());
@@ -514,4 +527,20 @@ String WebFrame::provisionalURL() const
return m_coreFrame->loader()->provisionalDocumentLoader()->url().string();
}
+String WebFrame::suggestedFilenameForResourceWithURL(const KURL& url) const
+{
+ if (!m_coreFrame)
+ return String();
+
+ DocumentLoader* loader = m_coreFrame->loader()->documentLoader();
+ if (!loader)
+ return String();
+
+ RefPtr<ArchiveResource> resource = loader->subresource(url);
+ if (!resource)
+ return String();
+
+ return resource->response().suggestedFilename();
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/WebFrame.h b/Source/WebKit2/WebProcess/WebPage/WebFrame.h
index 3ded6f6..f254e7a 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebFrame.h
+++ b/Source/WebKit2/WebProcess/WebPage/WebFrame.h
@@ -90,6 +90,8 @@ public:
JSGlobalContextRef jsContext();
JSGlobalContextRef jsContextForWorld(InjectedBundleScriptWorld*);
+ static WebFrame* frameForContext(JSContextRef);
+
JSValueRef jsWrapperForWorld(InjectedBundleNodeHandle*, InjectedBundleScriptWorld*);
JSValueRef jsWrapperForWorld(InjectedBundleRangeHandle*, InjectedBundleScriptWorld*);
@@ -107,6 +109,7 @@ public:
bool allowsFollowingLink(const WebCore::KURL&) const;
String provisionalURL() const;
+ String suggestedFilenameForResourceWithURL(const WebCore::KURL&) const;
// Simple listener class used by plug-ins to know when frames finish or fail loading.
class LoadListener {
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
index 2259387..af236e9 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -37,6 +37,7 @@
#include "PluginProxy.h"
#include "PluginView.h"
#include "PrintInfo.h"
+#include "RunLoop.h"
#include "SessionState.h"
#include "ShareableBitmap.h"
#include "WebBackForwardList.h"
@@ -149,6 +150,8 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
, m_findController(this)
, m_geolocationPermissionRequestManager(this)
, m_pageID(pageID)
+ , m_canRunModal(parameters.canRunModal)
+ , m_isRunningModal(false)
{
ASSERT(m_pageID);
@@ -182,7 +185,7 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
platformInitialize();
Settings::setMinDOMTimerInterval(0.004);
- m_drawingArea = DrawingArea::create(parameters.drawingAreaInfo.type, parameters.drawingAreaInfo.identifier, this);
+ m_drawingArea = DrawingArea::create(this, parameters);
m_mainFrame = WebFrame::createMainFrame(this);
setDrawsBackground(parameters.drawsBackground);
@@ -322,7 +325,9 @@ void WebPage::changeAcceleratedCompositingMode(WebCore::GraphicsLayer* layer)
if (newDrawingAreaInfo.type != drawingArea()->info().type) {
m_drawingArea = 0;
if (newDrawingAreaInfo.type != DrawingAreaInfo::None) {
- m_drawingArea = DrawingArea::create(newDrawingAreaInfo.type, newDrawingAreaInfo.identifier, this);
+ WebPageCreationParameters parameters;
+ parameters.drawingAreaInfo = newDrawingAreaInfo;
+ m_drawingArea = DrawingArea::create(this, parameters);
m_drawingArea->setNeedsDisplay(IntRect(IntPoint(0, 0), m_viewSize));
}
}
@@ -375,6 +380,11 @@ void WebPage::close()
m_drawingArea.clear();
WebProcess::shared().removeWebPage(m_pageID);
+
+ if (m_isRunningModal) {
+ m_isRunningModal = false;
+ WebProcess::shared().runLoop()->stop();
+ }
}
void WebPage::tryClose()
@@ -429,6 +439,15 @@ void WebPage::loadPlainTextString(const String& string)
loadData(sharedBuffer, "text/plain", "utf-16", blankURL(), KURL());
}
+void WebPage::stopLoadingFrame(uint64_t frameID)
+{
+ WebFrame* frame = WebProcess::shared().webFrame(frameID);
+ if (!frame)
+ return;
+
+ frame->coreFrame()->loader()->stopForUserCancel();
+}
+
void WebPage::stopLoading()
{
m_mainFrame->coreFrame()->loader()->stopForUserCancel();
@@ -1134,6 +1153,23 @@ void WebPage::getMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID)
send(Messages::WebPageProxy::DataCallback(dataReference, callbackID));
}
+void WebPage::getResourceDataFromFrame(uint64_t frameID, const String& resourceURL, uint64_t callbackID)
+{
+ CoreIPC::DataReference dataReference;
+
+ RefPtr<SharedBuffer> buffer;
+ if (WebFrame* frame = WebProcess::shared().webFrame(frameID)) {
+ if (DocumentLoader* loader = frame->coreFrame()->loader()->documentLoader()) {
+ if (RefPtr<ArchiveResource> subresource = loader->subresource(KURL(KURL(), resourceURL))) {
+ if (buffer = subresource->data())
+ dataReference = CoreIPC::DataReference(reinterpret_cast<const uint8_t*>(buffer->data()), buffer->size());
+ }
+ }
+ }
+
+ send(Messages::WebPageProxy::DataCallback(dataReference, callbackID));
+}
+
void WebPage::getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID)
{
CoreIPC::DataReference dataReference;
@@ -1290,6 +1326,20 @@ void WebPage::performDragControllerAction(uint64_t action, WebCore::IntPoint cli
}
}
+void WebPage::dragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation)
+{
+ IntPoint adjustedClientPosition(clientPosition.x() + m_page->dragController()->dragOffset().x(), clientPosition.y() + m_page->dragController()->dragOffset().y());
+ IntPoint adjustedGlobalPosition(globalPosition.x() + m_page->dragController()->dragOffset().x(), globalPosition.y() + m_page->dragController()->dragOffset().y());
+
+ m_page->dragController()->dragEnded();
+ FrameView* view = m_page->mainFrame()->view();
+ if (!view)
+ return;
+ // FIXME: These are fake modifier keys here, but they should be real ones instead.
+ PlatformMouseEvent event(adjustedClientPosition, adjustedGlobalPosition, LeftButton, MouseEventMoved, 0, false, false, false, false, currentTime());
+ m_page->mainFrame()->eventHandler()->dragSourceEndedAt(event, (DragOperation)operation);
+}
+
WebEditCommand* WebPage::webEditCommand(uint64_t commandID)
{
return m_editCommandMap.get(commandID).get();
@@ -1590,7 +1640,13 @@ void WebPage::SandboxExtensionTracker::beginLoad(WebFrame* frame, const SandboxE
{
ASSERT(frame->isMainFrame());
- ASSERT(!m_pendingProvisionalSandboxExtension);
+ // If we get two beginLoad calls in succession, without a provisional load starting, then
+ // m_pendingProvisionalSandboxExtension will be non-null. Invalidate and null out the extension if that is the case.
+ if (m_pendingProvisionalSandboxExtension) {
+ m_pendingProvisionalSandboxExtension->invalidate();
+ m_pendingProvisionalSandboxExtension = nullptr;
+ }
+
m_pendingProvisionalSandboxExtension = SandboxExtension::create(handle);
}
@@ -1633,7 +1689,7 @@ void WebPage::SandboxExtensionTracker::didFailProvisionalLoad(WebFrame* frame)
return;
m_provisionalSandboxExtension->invalidate();
- m_provisionalSandboxExtension = 0;
+ m_provisionalSandboxExtension = nullptr;
}
bool WebPage::hasLocalDataForURL(const KURL& url)
@@ -1754,4 +1810,17 @@ void WebPage::drawRectToPDF(uint64_t frameID, const WebCore::IntRect& rect, Vect
}
#endif
+void WebPage::runModal()
+{
+ if (m_isClosed)
+ return;
+ if (m_isRunningModal)
+ return;
+
+ m_isRunningModal = true;
+ send(Messages::WebPageProxy::RunModal());
+ RunLoop::run();
+ ASSERT(!m_isRunningModal);
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h
index 7649ab6..d29400f 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h
@@ -200,6 +200,7 @@ public:
bool drawsTransparentBackground() const { return m_drawsTransparentBackground; }
void stopLoading();
+ void stopLoadingFrame(uint64_t frameID);
void setDefersLoading(bool deferLoading);
#if USE(ACCELERATED_COMPOSITING)
@@ -300,6 +301,7 @@ public:
void replaceSelectionWithText(WebCore::Frame*, const String&);
void performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WTF::String& dragStorageName, uint32_t flags);
+ void dragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation);
void beginPrinting(uint64_t frameID, const PrintInfo&);
void endPrinting();
@@ -310,6 +312,9 @@ public:
bool mainFrameHasCustomRepresentation() const;
+ bool canRunModal() const { return m_canRunModal; }
+ void runModal();
+
private:
WebPage(uint64_t pageID, const WebPageCreationParameters&);
@@ -364,6 +369,7 @@ private:
void getContentsAsString(uint64_t callbackID);
void getMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID);
+ void getResourceDataFromFrame(uint64_t frameID, const String& resourceURL, uint64_t callbackID);
void getRenderTreeExternalRepresentation(uint64_t callbackID);
void getSelectionOrContentsAsString(uint64_t callbackID);
void getSourceForFrame(uint64_t frameID, uint64_t callbackID);
@@ -492,6 +498,9 @@ private:
SandboxExtensionTracker m_sandboxExtensionTracker;
uint64_t m_pageID;
+
+ bool m_canRunModal;
+ bool m_isRunningModal;
};
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
index bd6bf1a..e001864 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
@@ -46,6 +46,8 @@ messages -> WebPage {
LoadURLRequest(WebCore::ResourceRequest request, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
Reload(bool reloadFromOrigin)
StopLoading()
+
+ StopLoadingFrame(uint64_t frameID)
RestoreSessionAndNavigateToCurrentItem(WebKit::SessionState state)
@@ -56,6 +58,7 @@ messages -> WebPage {
# Callbacks.
GetContentsAsString(uint64_t callbackID)
GetMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID)
+ GetResourceDataFromFrame(uint64_t frameID, WTF::String resourceURL, uint64_t callbackID)
GetRenderTreeExternalRepresentation(uint64_t callbackID)
GetSelectionOrContentsAsString(uint64_t callbackID)
GetSourceForFrame(uint64_t frameID, uint64_t callbackID)
@@ -98,6 +101,7 @@ messages -> WebPage {
# Drag and drop.
PerformDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, WTF::String dragStorageName, uint32_t flags)
+ DragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation)
# Popup menu.
DidChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm
index f8b7e71..24fa124 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm
+++ b/Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm
@@ -44,7 +44,7 @@ void LayerBackedDrawingArea::platformInit()
{
setUpUpdateLayoutRunLoopObserver();
- [m_backingLayer->platformLayer() setGeometryFlipped:YES];
+ [m_hostingLayer->platformLayer() setGeometryFlipped:YES];
#if HAVE(HOSTED_CORE_ANIMATION)
attachCompositingContext();
#endif
@@ -80,7 +80,7 @@ void LayerBackedDrawingArea::attachCompositingContext()
#if HAVE(HOSTED_CORE_ANIMATION)
mach_port_t serverPort = WebProcess::shared().compositingRenderServerPort();
m_remoteLayerRef = WKCARemoteLayerClientMakeWithServerPort(serverPort);
- WKCARemoteLayerClientSetLayer(m_remoteLayerRef.get(), m_backingLayer->platformLayer());
+ WKCARemoteLayerClientSetLayer(m_remoteLayerRef.get(), m_hostingLayer->platformLayer());
uint32_t contextID = WKCARemoteLayerClientGetClientId(m_remoteLayerRef.get());
WebProcess::shared().connection()->sendSync(DrawingAreaProxyLegacyMessage::AttachCompositingContext, m_webPage->pageID(), CoreIPC::In(contextID), CoreIPC::Out());
@@ -115,9 +115,10 @@ void LayerBackedDrawingArea::scheduleCompositingLayerSync()
void LayerBackedDrawingArea::syncCompositingLayers()
{
+ m_hostingLayer->syncCompositingStateForThisLayerOnly();
m_backingLayer->syncCompositingStateForThisLayerOnly();
- bool didSync = m_webPage->corePage()->mainFrame()->view()->syncCompositingStateRecursive();
+ bool didSync = m_webPage->corePage()->mainFrame()->view()->syncCompositingStateIncludingSubframes();
if (!didSync) {
}
diff --git a/Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp b/Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp
index c07e1f5..cae79c2 100644
--- a/Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp
@@ -27,16 +27,6 @@
#include "LayerBackedDrawingArea.h"
-#include "DrawingAreaProxyMessageKinds.h"
-#include "WebPage.h"
-#include "WebProcess.h"
-#include <WebCore/Frame.h>
-#include <WebCore/FrameView.h>
-#include <WebCore/GraphicsLayer.h>
-#include <WebCore/Page.h>
-#include <WebCore/WKCACFLayerRenderer.h>
-#include <WebCore/WebCoreInstanceHandle.h>
-
using namespace WebCore;
namespace WebKit {
diff --git a/Source/WebKit2/WebProcess/com.apple.WebProcess.sb b/Source/WebKit2/WebProcess/com.apple.WebProcess.sb
index 2123c95..df57bde 100644
--- a/Source/WebKit2/WebProcess/com.apple.WebProcess.sb
+++ b/Source/WebKit2/WebProcess/com.apple.WebProcess.sb
@@ -124,6 +124,10 @@
(allow process-fork)
(allow process-exec (literal "/System/Library/Frameworks/QTKit.framework/Versions/A/Resources/QTKitServer") (with no-sandbox))
+;; FIXME: Once <rdar://problem/8900275> has been fixed, these rules can be removed.
+(allow mach-lookup (global-name "com.apple.pubsub.ipc"))
+(allow network-outbound (regex #"^/private/tmp/launch-[^/]+/Render"))
+
;; FIXME: Investigate these.
(allow appleevent-send (appleevent-destination "com.apple.WebProcess"))
(allow mach-lookup (global-name-regex #"^EPPC-"))
diff --git a/Source/WebKit2/WebProcess/mac/WebProcessMac.mm b/Source/WebKit2/WebProcess/mac/WebProcessMac.mm
index c899fcb..d394c98 100644
--- a/Source/WebKit2/WebProcess/mac/WebProcessMac.mm
+++ b/Source/WebKit2/WebProcess/mac/WebProcessMac.mm
@@ -151,6 +151,12 @@ void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters
{
initializeSandbox(parameters);
+ if (!parameters.parentProcessName.isNull()) {
+ // FIXME (WebKit2) <rdar://problem/8728860> WebKit2 needs to be localized
+ NSString *applicationName = [NSString stringWithFormat:@"%@ Web Content", (NSString *)parameters.parentProcessName];
+ WKSetVisibleApplicationName((CFStringRef)applicationName);
+ }
+
if (!parameters.nsURLCachePath.isNull()) {
NSUInteger cacheMemoryCapacity = parameters.nsURLCacheMemoryCapacity;
NSUInteger cacheDiskCapacity = parameters.nsURLCacheDiskCapacity;
diff --git a/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm b/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm
index 5cefb59..a44dc23 100644
--- a/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm
+++ b/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm
@@ -80,14 +80,6 @@ int WebProcessMain(const CommandLine& commandLine)
WTF::initializeMainThread();
RunLoop::initializeMainRunLoop();
- // Set the visible application name.
- String parentProcessName = commandLine["parentprocessname"];
- if (!parentProcessName.isNull()) {
- // FIXME: Localization!
- NSString *applicationName = [NSString stringWithFormat:@"%@ Web Content", (NSString *)parentProcessName];
- WKSetVisibleApplicationName((CFStringRef)applicationName);
- }
-
// Create the connection.
WebProcess::shared().initialize(serverPort, RunLoop::main());