summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/WebProcess/WebPage
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/WebPage
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/WebPage')
-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
16 files changed, 215 insertions, 52 deletions
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 {