summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/WebProcess/WebPage
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/WebProcess/WebPage')
-rw-r--r--Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp15
-rw-r--r--Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp5
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DrawingArea.h15
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in2
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp192
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h24
-rw-r--r--Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/FindController.cpp20
-rw-r--r--Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp7
-rw-r--r--Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h7
-rw-r--r--Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp59
-rw-r--r--Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h69
-rw-r--r--Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp18
-rw-r--r--Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp17
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebEditCommand.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebFrame.cpp94
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebFrame.h6
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebInspector.cpp14
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebInspector.h29
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPage.cpp321
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPage.h68
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPage.messages.in36
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/gtk/ChunkedUpdateDrawingAreaGtk.cpp56
-rw-r--r--Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm3
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm23
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h96
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm279
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm75
-rw-r--r--Source/WebKit2/WebProcess/WebPage/qt/ChunkedUpdateDrawingAreaQt.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp5
-rw-r--r--Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp7
-rw-r--r--Source/WebKit2/WebProcess/WebPage/win/ChunkedUpdateDrawingAreaWin.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp5
-rw-r--r--Source/WebKit2/WebProcess/WebPage/win/WebInspectorWin.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp22
45 files changed, 1415 insertions, 189 deletions
diff --git a/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp b/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp
index d629ced..f5100aa 100644
--- a/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "ChunkedUpdateDrawingArea.h"
#include "DrawingAreaMessageKinds.h"
@@ -89,12 +90,18 @@ void ChunkedUpdateDrawingArea::display()
UpdateChunk updateChunk(dirtyRect);
paintIntoUpdateChunk(&updateChunk);
- WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::Update, m_webPage->pageID(), CoreIPC::In(updateChunk));
+ WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::Update, m_webPage->pageID(), CoreIPC::In(updateChunk));
m_isWaitingForUpdate = true;
m_displayTimer.stop();
}
+void ChunkedUpdateDrawingArea::forceRepaint()
+{
+ m_isWaitingForUpdate = false;
+ display();
+}
+
void ChunkedUpdateDrawingArea::scheduleDisplay()
{
if (m_paintingIsSuspended)
@@ -132,7 +139,7 @@ void ChunkedUpdateDrawingArea::setSize(const IntSize& viewSize)
ASSERT(!m_displayTimer.isActive());
// Painting is suspended, just send back an empty update chunk.
- WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(UpdateChunk()));
+ WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(UpdateChunk()));
return;
}
@@ -142,7 +149,7 @@ void ChunkedUpdateDrawingArea::setSize(const IntSize& viewSize)
m_displayTimer.stop();
- WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(updateChunk));
+ WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(updateChunk));
}
void ChunkedUpdateDrawingArea::suspendPainting()
@@ -161,7 +168,7 @@ void ChunkedUpdateDrawingArea::resumePainting(bool forceRepaint)
if (forceRepaint) {
// Just set the dirty rect to the entire page size.
- m_dirtyRect = IntRect(IntPoint(0, 0), m_webPage->size());
+ m_dirtyRect = m_webPage->bounds();
}
// Schedule a display.
diff --git a/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h b/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h
index 08aa3e7..d32ed4c 100644
--- a/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h
+++ b/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h
@@ -42,6 +42,7 @@ public:
virtual void setNeedsDisplay(const WebCore::IntRect&);
virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
virtual void display();
+ virtual void forceRepaint();
#if USE(ACCELERATED_COMPOSITING)
virtual void attachCompositingContext() { }
diff --git a/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp b/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp
index e5de52f..1649fb1 100644
--- a/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "DecoderAdapter.h"
#include "WebCoreArgumentCoders.h"
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp b/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp
index ea5b443..10a8dbf 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp
@@ -23,12 +23,13 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "DrawingArea.h"
// Subclasses
#include "ChunkedUpdateDrawingArea.h"
-#ifdef __APPLE__
+#if PLATFORM(MAC) || PLATFORM(WIN)
#include "DrawingAreaImpl.h"
#endif
@@ -52,7 +53,7 @@ PassRefPtr<DrawingArea> DrawingArea::create(WebPage* webPage, const WebPageCreat
break;
case DrawingAreaInfo::Impl:
-#ifdef __APPLE__
+#if PLATFORM(MAC) || PLATFORM(WIN)
return DrawingAreaImpl::create(webPage, parameters);
#else
return 0;
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.h b/Source/WebKit2/WebProcess/WebPage/DrawingArea.h
index 713994d..de256b6 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingArea.h
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.h
@@ -40,7 +40,7 @@ namespace WebCore {
namespace WebKit {
class WebPage;
-class WebPageCreationParameters;
+struct WebPageCreationParameters;
class DrawingArea : public RefCounted<DrawingArea> {
public:
@@ -48,17 +48,22 @@ public:
static PassRefPtr<DrawingArea> create(WebPage*, const WebPageCreationParameters&);
virtual ~DrawingArea();
-#ifdef __APPLE__
+#if PLATFORM(MAC) || PLATFORM(WIN)
void didReceiveDrawingAreaMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
#endif
virtual void setNeedsDisplay(const WebCore::IntRect&) = 0;
virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) = 0;
+ // FIXME: These should be pure virtual.
virtual void pageBackgroundTransparencyChanged() { }
-
virtual void onPageClose() { }
-
+ virtual void forceRepaint() { }
+
+ virtual void didInstallPageOverlay() { }
+ virtual void didUninstallPageOverlay() { }
+ virtual void setPageOverlayNeedsDisplay(const WebCore::IntRect&) { }
+
#if USE(ACCELERATED_COMPOSITING)
virtual void attachCompositingContext() = 0;
virtual void detachCompositingContext() = 0;
@@ -80,7 +85,7 @@ protected:
private:
// CoreIPC message handlers.
// FIXME: These should be pure virtual.
- virtual void setSize(const WebCore::IntSize&) { }
+ virtual void setSize(const WebCore::IntSize& size, const WebCore::IntSize& scrollOffset) { }
virtual void didUpdate() { }
virtual void suspendPainting() { }
virtual void resumePainting() { }
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in b/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in
index 682ef5a..ec09e18 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in
@@ -21,7 +21,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
messages -> DrawingArea {
- SetSize(WebCore::IntSize size)
+ SetSize(WebCore::IntSize size, WebCore::IntSize scrollOffset)
DidUpdate()
SuspendPainting()
ResumePainting()
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
index 2063bd6..6d65fae 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
@@ -23,9 +23,11 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "DrawingAreaImpl.h"
#include "DrawingAreaProxyMessages.h"
+#include "LayerTreeContext.h"
#include "ShareableBitmap.h"
#include "UpdateInfo.h"
#include "WebPage.h"
@@ -33,7 +35,7 @@
#include "WebProcess.h"
#include <WebCore/GraphicsContext.h>
-#ifndef __APPLE__
+#if !PLATFORM(MAC) && !PLATFORM(WIN)
#error "This drawing area is not ready for use by other ports yet."
#endif
@@ -41,6 +43,12 @@ using namespace WebCore;
namespace WebKit {
+static uint64_t generateSequenceNumber()
+{
+ static uint64_t sequenceNumber;
+ return ++sequenceNumber;
+}
+
PassRefPtr<DrawingAreaImpl> DrawingAreaImpl::create(WebPage* webPage, const WebPageCreationParameters& parameters)
{
return adoptRef(new DrawingAreaImpl(webPage, parameters));
@@ -48,27 +56,50 @@ PassRefPtr<DrawingAreaImpl> DrawingAreaImpl::create(WebPage* webPage, const WebP
DrawingAreaImpl::~DrawingAreaImpl()
{
+ if (m_layerTreeHost)
+ m_layerTreeHost->invalidate();
}
DrawingAreaImpl::DrawingAreaImpl(WebPage* webPage, const WebPageCreationParameters& parameters)
: DrawingArea(DrawingAreaInfo::Impl, parameters.drawingAreaInfo.identifier, webPage)
+ , m_inSetSize(false)
, m_isWaitingForDidUpdate(false)
, m_isPaintingSuspended(!parameters.isVisible)
, m_displayTimer(WebProcess::shared().runLoop(), this, &DrawingAreaImpl::display)
+ , m_exitCompositingTimer(WebProcess::shared().runLoop(), this, &DrawingAreaImpl::exitAcceleratedCompositingMode)
{
}
void DrawingAreaImpl::setNeedsDisplay(const IntRect& rect)
{
- if (rect.isEmpty())
+ IntRect dirtyRect = rect;
+ dirtyRect.intersect(m_webPage->bounds());
+
+ if (dirtyRect.isEmpty())
return;
- m_dirtyRegion.unite(rect);
+ if (m_layerTreeHost) {
+ ASSERT(m_dirtyRegion.isEmpty());
+
+ m_layerTreeHost->setNonCompositedContentsNeedDisplay(dirtyRect);
+ return;
+ }
+
+ m_dirtyRegion.unite(dirtyRect);
scheduleDisplay();
}
void DrawingAreaImpl::scroll(const IntRect& scrollRect, const IntSize& scrollOffset)
{
+ if (m_layerTreeHost) {
+ ASSERT(m_scrollRect.isEmpty());
+ ASSERT(m_scrollOffset.isEmpty());
+ ASSERT(m_dirtyRegion.isEmpty());
+
+ m_layerTreeHost->scrollNonCompositedContents(scrollRect, scrollOffset);
+ return;
+ }
+
if (!m_scrollRect.isEmpty() && scrollRect != m_scrollRect) {
unsigned scrollArea = scrollRect.width() * scrollRect.height();
unsigned currentScrollArea = m_scrollRect.width() * m_scrollRect.height();
@@ -109,6 +140,36 @@ void DrawingAreaImpl::scroll(const IntRect& scrollRect, const IntSize& scrollOff
m_scrollOffset += scrollOffset;
}
+void DrawingAreaImpl::forceRepaint()
+{
+ m_isWaitingForDidUpdate = false;
+ display();
+}
+
+void DrawingAreaImpl::didInstallPageOverlay()
+{
+ if (m_layerTreeHost)
+ m_layerTreeHost->didInstallPageOverlay();
+}
+
+void DrawingAreaImpl::didUninstallPageOverlay()
+{
+ if (m_layerTreeHost)
+ m_layerTreeHost->didUninstallPageOverlay();
+
+ setNeedsDisplay(m_webPage->bounds());
+}
+
+void DrawingAreaImpl::setPageOverlayNeedsDisplay(const IntRect& rect)
+{
+ if (m_layerTreeHost) {
+ m_layerTreeHost->setPageOverlayNeedsDisplay(rect);
+ return;
+ }
+
+ setNeedsDisplay(rect);
+}
+
void DrawingAreaImpl::attachCompositingContext()
{
}
@@ -117,12 +178,31 @@ void DrawingAreaImpl::detachCompositingContext()
{
}
-void DrawingAreaImpl::setRootCompositingLayer(WebCore::GraphicsLayer*)
+void DrawingAreaImpl::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
{
+ if (graphicsLayer) {
+ if (!m_layerTreeHost) {
+ // We're actually entering accelerated compositing mode.
+ enterAcceleratedCompositingMode(graphicsLayer);
+ } else {
+ m_exitCompositingTimer.stop();
+ // We're already in accelerated compositing mode, but the root compositing layer changed.
+ m_layerTreeHost->setRootCompositingLayer(graphicsLayer);
+ }
+ } else {
+ if (m_layerTreeHost) {
+ // We'll exit accelerated compositing mode on a timer, to avoid re-entering
+ // compositing code via display() and layout.
+ exitAcceleratedCompositingModeSoon();
+ }
+ }
}
void DrawingAreaImpl::scheduleCompositingLayerSync()
{
+ if (!m_layerTreeHost)
+ return;
+ m_layerTreeHost->scheduleLayerFlush();
}
void DrawingAreaImpl::syncCompositingLayers()
@@ -133,27 +213,48 @@ void DrawingAreaImpl::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID
{
}
-void DrawingAreaImpl::setSize(const IntSize& size)
+void DrawingAreaImpl::setSize(const WebCore::IntSize& size, const WebCore::IntSize& scrollOffset)
{
+ ASSERT(!m_inSetSize);
+ m_inSetSize = true;
+
// Set this to false since we're about to call display().
m_isWaitingForDidUpdate = false;
m_webPage->setSize(size);
m_webPage->layoutIfNeeded();
+ m_webPage->scrollMainFrameIfNotAtMaxScrollPosition(scrollOffset);
UpdateInfo updateInfo;
+ LayerTreeContext layerTreeContext;
- if (m_isPaintingSuspended) {
- updateInfo.timestamp = currentTime();
+ if (m_layerTreeHost) {
+ m_layerTreeHost->sizeDidChange(size);
+ layerTreeContext = m_layerTreeHost->layerTreeContext();
+ }
+
+ if (m_isPaintingSuspended || m_layerTreeHost)
updateInfo.viewSize = m_webPage->size();
- } else
+ else {
+ m_dirtyRegion.unite(m_webPage->bounds());
+
+ // The display here should not cause layout to happen, so we can't enter accelerated compositing mode here.
display(updateInfo);
+ ASSERT(!m_layerTreeHost);
+ }
- m_webPage->send(Messages::DrawingAreaProxy::DidSetSize(updateInfo));
+ m_webPage->send(Messages::DrawingAreaProxy::DidSetSize(generateSequenceNumber(), updateInfo, layerTreeContext));
+
+ m_inSetSize = false;
}
void DrawingAreaImpl::didUpdate()
{
+ // We might get didUpdate messages from the UI process even after we've
+ // entered accelerated compositing mode. Ignore them.
+ if (m_layerTreeHost)
+ return;
+
m_isWaitingForDidUpdate = false;
// Display if needed.
@@ -174,7 +275,62 @@ void DrawingAreaImpl::resumePainting()
m_isPaintingSuspended = false;
- // FIXME: Repaint if needed.
+ // FIXME: We shouldn't always repaint everything here.
+ setNeedsDisplay(m_webPage->bounds());
+}
+
+void DrawingAreaImpl::enterAcceleratedCompositingMode(GraphicsLayer* graphicsLayer)
+{
+ m_exitCompositingTimer.stop();
+
+ ASSERT(!m_layerTreeHost);
+
+ m_layerTreeHost = LayerTreeHost::create(m_webPage);
+ m_layerTreeHost->setRootCompositingLayer(graphicsLayer);
+
+ // Non-composited content will now be handled exclusively by the layer tree host.
+ m_dirtyRegion = Region();
+ m_scrollRect = IntRect();
+ m_scrollOffset = IntSize();
+ m_displayTimer.stop();
+ m_isWaitingForDidUpdate = false;
+
+ if (!m_inSetSize)
+ m_webPage->send(Messages::DrawingAreaProxy::EnterAcceleratedCompositingMode(generateSequenceNumber(), m_layerTreeHost->layerTreeContext()));
+}
+
+void DrawingAreaImpl::exitAcceleratedCompositingMode()
+{
+ m_exitCompositingTimer.stop();
+
+ ASSERT(m_layerTreeHost);
+
+ m_layerTreeHost->invalidate();
+ m_layerTreeHost = nullptr;
+
+ if (m_inSetSize)
+ return;
+
+ UpdateInfo updateInfo;
+ if (m_isPaintingSuspended)
+ updateInfo.viewSize = m_webPage->size();
+ else {
+ m_dirtyRegion = m_webPage->bounds();
+ display(updateInfo);
+ }
+
+ // Send along a complete update of the page so we can paint the contents right after we exit the
+ // accelerated compositing mode, eliminiating flicker.
+ if (!m_inSetSize)
+ m_webPage->send(Messages::DrawingAreaProxy::ExitAcceleratedCompositingMode(generateSequenceNumber(), updateInfo));
+}
+
+void DrawingAreaImpl::exitAcceleratedCompositingModeSoon()
+{
+ if (m_exitCompositingTimer.isActive())
+ return;
+
+ m_exitCompositingTimer.startOneShot(0);
}
void DrawingAreaImpl::scheduleDisplay()
@@ -196,6 +352,7 @@ void DrawingAreaImpl::scheduleDisplay()
void DrawingAreaImpl::display()
{
+ ASSERT(!m_layerTreeHost);
ASSERT(!m_isWaitingForDidUpdate);
if (m_isPaintingSuspended)
@@ -207,7 +364,13 @@ void DrawingAreaImpl::display()
UpdateInfo updateInfo;
display(updateInfo);
- m_webPage->send(Messages::DrawingAreaProxy::Update(updateInfo));
+ if (m_layerTreeHost) {
+ // The call to update caused layout which turned on accelerated compositing.
+ // Don't send an Update message in this case.
+ return;
+ }
+
+ m_webPage->send(Messages::DrawingAreaProxy::Update(generateSequenceNumber(), updateInfo));
m_isWaitingForDidUpdate = true;
}
@@ -235,6 +398,8 @@ static bool shouldPaintBoundsRect(const IntRect& bounds, const Vector<IntRect>&
void DrawingAreaImpl::display(UpdateInfo& updateInfo)
{
ASSERT(!m_isPaintingSuspended);
+ ASSERT(!m_layerTreeHost);
+ ASSERT(!m_webPage->size().isEmpty());
// FIXME: It would be better if we could avoid painting altogether when there is a custom representation.
if (m_webPage->mainFrameHasCustomRepresentation())
@@ -263,7 +428,6 @@ void DrawingAreaImpl::display(UpdateInfo& updateInfo)
m_webPage->layoutIfNeeded();
- updateInfo.timestamp = currentTime();
updateInfo.viewSize = m_webPage->size();
updateInfo.updateRectBounds = bounds;
@@ -271,9 +435,11 @@ void DrawingAreaImpl::display(UpdateInfo& updateInfo)
for (size_t i = 0; i < rects.size(); ++i) {
m_webPage->drawRect(*graphicsContext, rects[i]);
+ if (m_webPage->hasPageOverlay())
+ m_webPage->drawPageOverlay(*graphicsContext, rects[i]);
updateInfo.updateRects.append(rects[i]);
}
-
+
// Layout can trigger more calls to setNeedsDisplay and we don't want to process them
// until the UI process has painted the update, so we stop the timer here.
m_displayTimer.stop();
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
index e008adc..cbb94c2 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
@@ -27,12 +27,13 @@
#define DrawingAreaImpl_h
#include "DrawingArea.h"
+#include "LayerTreeHost.h"
#include "Region.h"
#include "RunLoop.h"
namespace WebKit {
-struct UpdateInfo;
+class UpdateInfo;
class DrawingAreaImpl : public DrawingArea {
public:
@@ -45,6 +46,12 @@ private:
// DrawingArea
virtual void setNeedsDisplay(const WebCore::IntRect&);
virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
+ virtual void forceRepaint();
+
+ virtual void didInstallPageOverlay();
+ virtual void didUninstallPageOverlay();
+ virtual void setPageOverlayNeedsDisplay(const WebCore::IntRect&);
+
virtual void attachCompositingContext();
virtual void detachCompositingContext();
virtual void setRootCompositingLayer(WebCore::GraphicsLayer*);
@@ -53,11 +60,15 @@ private:
virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
// CoreIPC message handlers.
- virtual void setSize(const WebCore::IntSize&);
+ virtual void setSize(const WebCore::IntSize&, const WebCore::IntSize& scrollOffset);
virtual void didUpdate();
virtual void suspendPainting();
virtual void resumePainting();
+ void enterAcceleratedCompositingMode(WebCore::GraphicsLayer*);
+ void exitAcceleratedCompositingModeSoon();
+ void exitAcceleratedCompositingMode();
+
void scheduleDisplay();
void display();
void display(UpdateInfo&);
@@ -65,7 +76,10 @@ private:
Region m_dirtyRegion;
WebCore::IntRect m_scrollRect;
WebCore::IntSize m_scrollOffset;
-
+
+ // Whether we're currently processing a setSize message.
+ bool m_inSetSize;
+
// 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;
@@ -75,6 +89,10 @@ private:
bool m_isPaintingSuspended;
RunLoop::Timer<DrawingAreaImpl> m_displayTimer;
+ RunLoop::Timer<DrawingAreaImpl> m_exitCompositingTimer;
+
+ // The layer tree host that handles accelerated compositing.
+ RefPtr<LayerTreeHost> m_layerTreeHost;
};
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp b/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp
index 00edcce..590010b 100644
--- a/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "EncoderAdapter.h"
#include "DataReference.h"
diff --git a/Source/WebKit2/WebProcess/WebPage/FindController.cpp b/Source/WebKit2/WebProcess/WebPage/FindController.cpp
index 9b8669d..8e9dba7 100644
--- a/Source/WebKit2/WebProcess/WebPage/FindController.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/FindController.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "FindController.h"
#include "ShareableBitmap.h"
@@ -151,22 +152,30 @@ bool FindController::updateFindIndicator(Frame* selectedFrame, bool isShowingOve
if (!selectedFrame)
return false;
+ IntRect selectionRect = enclosingIntRect(selectedFrame->selection()->bounds());
+
// We want the selection rect in window coordinates.
- IntRect selectionRectInWindowCoordinates = selectedFrame->view()->contentsToWindow(enclosingIntRect(selectedFrame->selection()->bounds()));
+ IntRect selectionRectInWindowCoordinates = selectedFrame->view()->contentsToWindow(selectionRect);
Vector<FloatRect> textRects;
selectedFrame->selection()->getClippedVisibleTextRectangles(textRects);
// Create a backing store and paint the find indicator text into it.
- RefPtr<ShareableBitmap> findIndicatorTextBackingStore = ShareableBitmap::createShareable(selectionRectInWindowCoordinates.size());
+ RefPtr<ShareableBitmap> findIndicatorTextBackingStore = ShareableBitmap::createShareable(selectionRect.size());
+ if (!findIndicatorTextBackingStore)
+ return false;
+
OwnPtr<GraphicsContext> graphicsContext = findIndicatorTextBackingStore->createGraphicsContext();
- graphicsContext->translate(-selectionRectInWindowCoordinates.x(), -selectionRectInWindowCoordinates.y());
+ IntRect paintRect = selectionRect;
+ paintRect.move(selectedFrame->view()->frameRect().x(), selectedFrame->view()->frameRect().y());
+ paintRect.move(-selectedFrame->view()->scrollOffset());
+
+ graphicsContext->translate(-paintRect.x(), -paintRect.y());
selectedFrame->view()->setPaintBehavior(PaintBehaviorSelectionOnly | PaintBehaviorForceBlackText | PaintBehaviorFlattenCompositingLayers);
selectedFrame->document()->updateLayout();
- graphicsContext->clip(selectionRectInWindowCoordinates);
- selectedFrame->view()->paint(graphicsContext.get(), selectionRectInWindowCoordinates);
+ selectedFrame->view()->paint(graphicsContext.get(), paintRect);
selectedFrame->view()->setPaintBehavior(PaintBehaviorNormal);
SharedMemory::Handle handle;
@@ -259,7 +268,6 @@ static Color overlayBackgroundColor()
void FindController::drawRect(PageOverlay*, GraphicsContext& graphicsContext, const IntRect& dirtyRect)
{
Vector<IntRect> rects = rectsForTextMatches();
- ASSERT(!rects.isEmpty());
// Draw the background.
graphicsContext.fillRect(dirtyRect, overlayBackgroundColor(), ColorSpaceSRGB);
diff --git a/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp b/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp
index b104b29..44b3bd6 100644
--- a/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp
@@ -23,10 +23,11 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if USE(ACCELERATED_COMPOSITING)
-
+#include "config.h"
#include "LayerBackedDrawingArea.h"
+#if USE(ACCELERATED_COMPOSITING)
+
#include "DrawingAreaMessageKinds.h"
#include "DrawingAreaProxyMessageKinds.h"
#include "MessageID.h"
@@ -121,7 +122,7 @@ void LayerBackedDrawingArea::setSize(const IntSize& viewSize)
if (m_webPage->drawingArea() != this)
return;
- WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(viewSize));
+ WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(viewSize));
}
void LayerBackedDrawingArea::suspendPainting()
diff --git a/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h b/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h
index ed05cc7..400c8c5 100644
--- a/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h
+++ b/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h
@@ -35,11 +35,8 @@
#if PLATFORM(MAC)
#include <wtf/RetainPtr.h>
-#ifdef __OBJC__
-@class CALayer;
-#else
-class CALayer;
-#endif
+OBJC_CLASS NSPopUpButtonCell;
+OBJC_CLASS WKView;
typedef struct __WKCARemoteLayerClientRef *WKCARemoteLayerClientRef;
#endif
diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp
new file mode 100644
index 0000000..1112d39
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "LayerTreeHost.h"
+
+#if PLATFORM(MAC)
+#include "LayerTreeHostMac.h"
+#endif
+
+#if !PLATFORM(MAC) && !PLATFORM(WIN)
+#error "This class is not ready for use by other ports yet."
+#endif
+
+using namespace WebCore;
+
+namespace WebKit {
+
+PassRefPtr<LayerTreeHost> LayerTreeHost::create(WebPage* webPage)
+{
+#if PLATFORM(MAC)
+ return LayerTreeHostMac::create(webPage);
+#endif
+
+ return 0;
+}
+
+LayerTreeHost::LayerTreeHost(WebPage* webPage)
+ : m_webPage(webPage)
+{
+}
+
+LayerTreeHost::~LayerTreeHost()
+{
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h
new file mode 100644
index 0000000..4ca1137
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+
+#ifndef LayerTreeHost_h
+#define LayerTreeHost_h
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+ class IntRect;
+ class IntSize;
+ class GraphicsLayer;
+}
+
+namespace WebKit {
+
+class LayerTreeContext;
+class WebPage;
+
+class LayerTreeHost : public RefCounted<LayerTreeHost> {
+public:
+ static PassRefPtr<LayerTreeHost> create(WebPage*);
+ virtual ~LayerTreeHost();
+
+ virtual const LayerTreeContext& layerTreeContext() = 0;
+ virtual void scheduleLayerFlush() = 0;
+ virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) = 0;
+ virtual void invalidate() = 0;
+
+ virtual void setNonCompositedContentsNeedDisplay(const WebCore::IntRect&) = 0;
+ virtual void scrollNonCompositedContents(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) = 0;
+ virtual void sizeDidChange(const WebCore::IntSize& newSize) = 0;
+
+ virtual void didInstallPageOverlay() = 0;
+ virtual void didUninstallPageOverlay() = 0;
+ virtual void setPageOverlayNeedsDisplay(const WebCore::IntRect&) = 0;
+
+protected:
+ explicit LayerTreeHost(WebPage*);
+
+ WebPage* m_webPage;
+};
+
+} // namespace WebKit
+
+#endif // LayerTreeHost_h
diff --git a/Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp b/Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp
index 091f460..67c1165 100644
--- a/Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "PageOverlay.h"
#include "WebPage.h"
@@ -30,6 +31,7 @@
#include <WebCore/FrameView.h>
#include <WebCore/GraphicsContext.h>
#include <WebCore/Page.h>
+#include <WebCore/ScrollbarTheme.h>
using namespace WebCore;
@@ -55,12 +57,14 @@ IntRect PageOverlay::bounds() const
FrameView* frameView = webPage()->corePage()->mainFrame()->view();
int width = frameView->width();
- if (frameView->verticalScrollbar())
- width -= frameView->verticalScrollbar()->width();
int height = frameView->height();
- if (frameView->horizontalScrollbar())
- height -= frameView->horizontalScrollbar()->height();
-
+
+ if (!ScrollbarTheme::nativeTheme()->usesOverlayScrollbars()) {
+ if (frameView->verticalScrollbar())
+ width -= frameView->verticalScrollbar()->width();
+ if (frameView->horizontalScrollbar())
+ height -= frameView->horizontalScrollbar()->height();
+ }
return IntRect(0, 0, width, height);
}
@@ -71,10 +75,10 @@ void PageOverlay::setPage(WebPage* webPage)
m_client->didMoveToWebPage(this, webPage);
}
-void PageOverlay::setNeedsDisplay(const WebCore::IntRect& dirtyRect)
+void PageOverlay::setNeedsDisplay(const IntRect& dirtyRect)
{
if (m_webPage)
- m_webPage->drawingArea()->setNeedsDisplay(dirtyRect);
+ m_webPage->drawingArea()->setPageOverlayNeedsDisplay(dirtyRect);
}
void PageOverlay::setNeedsDisplay()
diff --git a/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp b/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp
index 74aa4b2..f27f14f 100644
--- a/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp
@@ -23,10 +23,11 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if ENABLE(TILED_BACKING_STORE)
-
+#include "config.h"
#include "TiledDrawingArea.h"
+#if ENABLE(TILED_BACKING_STORE)
+
#include "DrawingAreaMessageKinds.h"
#include "DrawingAreaProxyMessageKinds.h"
#include "MessageID.h"
@@ -81,7 +82,7 @@ void TiledDrawingArea::display()
IntRect dirtyRect = m_dirtyRect;
m_dirtyRect = IntRect();
- WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::Invalidate, m_webPage->pageID(), CoreIPC::In(dirtyRect));
+ WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::Invalidate, m_webPage->pageID(), CoreIPC::In(dirtyRect));
m_displayTimer.stop();
}
@@ -106,7 +107,7 @@ void TiledDrawingArea::setSize(const IntSize& viewSize)
scheduleDisplay();
- WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(viewSize));
+ WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(viewSize));
}
void TiledDrawingArea::suspendPainting()
@@ -141,7 +142,7 @@ void TiledDrawingArea::updateTile(int tileID, const IntRect& dirtyRect, float sc
paintIntoUpdateChunk(&updateChunk, scale);
unsigned pendingUpdateCount = m_pendingUpdates.size();
- WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::TileUpdated, m_webPage->pageID(), CoreIPC::In(tileID, updateChunk, scale, pendingUpdateCount));
+ WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::TileUpdated, m_webPage->pageID(), CoreIPC::In(tileID, updateChunk, scale, pendingUpdateCount));
}
void TiledDrawingArea::tileUpdateTimerFired()
@@ -155,7 +156,7 @@ void TiledDrawingArea::tileUpdateTimerFired()
updateTile(update.tileID, update.dirtyRect, update.scale);
if (m_pendingUpdates.isEmpty())
- WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::AllTileUpdatesProcessed, m_webPage->pageID(), CoreIPC::In());
+ WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::AllTileUpdatesProcessed, m_webPage->pageID(), CoreIPC::In());
else
m_tileUpdateTimer.startOneShot(0.001);
}
@@ -185,7 +186,7 @@ void TiledDrawingArea::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageI
if (it != m_pendingUpdates.end()) {
m_pendingUpdates.remove(it);
if (m_pendingUpdates.isEmpty()) {
- WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::AllTileUpdatesProcessed, m_webPage->pageID(), CoreIPC::In());
+ WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::AllTileUpdatesProcessed, m_webPage->pageID(), CoreIPC::In());
m_tileUpdateTimer.stop();
}
}
@@ -221,7 +222,7 @@ void TiledDrawingArea::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageI
UpdateChunk updateChunk(IntRect(IntPoint(contentsRect.x() * targetScale, contentsRect.y() * targetScale), targetSize));
paintIntoUpdateChunk(&updateChunk, targetScale);
- WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::SnapshotTaken, m_webPage->pageID(), CoreIPC::In(updateChunk));
+ WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::SnapshotTaken, m_webPage->pageID(), CoreIPC::In(updateChunk));
break;
}
default:
diff --git a/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp b/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp
index 21f4fba..7b958bf 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebBackForwardListProxy.h"
#include "DataReference.h"
diff --git a/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp b/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp
index b496128..35058de 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "config.h"
#include "WebContextMenu.h"
#include "ContextMenuState.h"
diff --git a/Source/WebKit2/WebProcess/WebPage/WebEditCommand.cpp b/Source/WebKit2/WebProcess/WebPage/WebEditCommand.cpp
index 198cb6d..dce1a68 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebEditCommand.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebEditCommand.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebEditCommand.h"
namespace WebKit {
diff --git a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
index 42eacc1..fa4dc2c 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebFrame.h"
#include "DownloadManager.h"
@@ -334,7 +335,7 @@ String WebFrame::url() const
if (!m_coreFrame)
return String();
- return m_coreFrame->loader()->url().string();
+ return m_coreFrame->document()->url().string();
}
String WebFrame::innerText() const
@@ -457,6 +458,81 @@ JSGlobalContextRef WebFrame::jsContextForWorld(InjectedBundleScriptWorld* world)
return toGlobalRef(m_coreFrame->script()->globalObject(world->coreWorld())->globalExec());
}
+IntRect WebFrame::contentBounds() const
+{
+ if (!m_coreFrame)
+ return IntRect();
+
+ FrameView* view = m_coreFrame->view();
+ if (!view)
+ return IntRect();
+
+ return IntRect(0, 0, view->contentsWidth(), view->contentsHeight());
+}
+
+IntRect WebFrame::visibleContentBounds() const
+{
+ if (!m_coreFrame)
+ return IntRect();
+
+ FrameView* view = m_coreFrame->view();
+ if (!view)
+ return IntRect();
+
+ IntRect contentRect = view->visibleContentRect(true);
+ return IntRect(0, 0, contentRect.width(), contentRect.height());
+}
+
+IntRect WebFrame::visibleContentBoundsExcludingScrollbars() const
+{
+ if (!m_coreFrame)
+ return IntRect();
+
+ FrameView* view = m_coreFrame->view();
+ if (!view)
+ return IntRect();
+
+ IntRect contentRect = view->visibleContentRect(false);
+ return IntRect(0, 0, contentRect.width(), contentRect.height());
+}
+
+IntSize WebFrame::scrollOffset() const
+{
+ if (!m_coreFrame)
+ return IntSize();
+
+ FrameView* view = m_coreFrame->view();
+ if (!view)
+ return IntSize();
+
+ return view->scrollOffset();
+}
+
+bool WebFrame::getDocumentBackgroundColor(double* red, double* green, double* blue, double* alpha)
+{
+ if (!m_coreFrame)
+ return false;
+ Document* document = m_coreFrame->document();
+ if (!document)
+ return false;
+
+ Element* rootElementToUse = document->body();
+ if (!rootElementToUse)
+ rootElementToUse = document->documentElement();
+ if (!rootElementToUse)
+ return false;
+
+ RenderObject* renderer = rootElementToUse->renderer();
+ if (!renderer)
+ return false;
+ Color color = renderer->style()->visitedDependentColor(CSSPropertyBackgroundColor);
+ if (!color.isValid())
+ return false;
+
+ color.getRGBA(*red, *green, *blue, *alpha);
+ return true;
+}
+
WebFrame* WebFrame::frameForContext(JSContextRef context)
{
JSObjectRef globalObjectRef = JSContextGetGlobalObject(context);
@@ -543,4 +619,20 @@ String WebFrame::suggestedFilenameForResourceWithURL(const KURL& url) const
return resource->response().suggestedFilename();
}
+String WebFrame::mimeTypeForResourceWithURL(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 resource->mimeType();
+
+ return page()->cachedResponseMIMETypeForURL(url);
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/WebFrame.h b/Source/WebKit2/WebProcess/WebPage/WebFrame.h
index f254e7a..3c63cf3 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebFrame.h
+++ b/Source/WebKit2/WebProcess/WebPage/WebFrame.h
@@ -89,6 +89,11 @@ public:
JSValueRef computedStyleIncludingVisitedInfo(JSObjectRef element);
JSGlobalContextRef jsContext();
JSGlobalContextRef jsContextForWorld(InjectedBundleScriptWorld*);
+ WebCore::IntRect contentBounds() const;
+ WebCore::IntRect visibleContentBounds() const;
+ WebCore::IntRect visibleContentBoundsExcludingScrollbars() const;
+ WebCore::IntSize scrollOffset() const;
+ bool getDocumentBackgroundColor(double* red, double* green, double* blue, double* alpha);
static WebFrame* frameForContext(JSContextRef);
@@ -110,6 +115,7 @@ public:
String provisionalURL() const;
String suggestedFilenameForResourceWithURL(const WebCore::KURL&) const;
+ String mimeTypeForResourceWithURL(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/WebInspector.cpp b/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp
index 559b8b6..4b3fdaf 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebInspector.h"
#if ENABLE(INSPECTOR)
@@ -38,6 +39,11 @@ using namespace WebCore;
namespace WebKit {
+PassRefPtr<WebInspector> WebInspector::create(WebPage* page)
+{
+ return adoptRef(new WebInspector(page));
+}
+
WebInspector::WebInspector(WebPage* page)
: m_page(page)
, m_inspectorPage(0)
@@ -91,9 +97,14 @@ void WebInspector::close()
m_page->corePage()->inspectorController()->close();
}
+void WebInspector::evaluateScriptForTest(long callID, const String& script)
+{
+ m_page->corePage()->inspectorController()->evaluateForTestInFrontend(callID, script);
+}
+
void WebInspector::showConsole()
{
- m_page->corePage()->inspectorController()->showPanel(InspectorController::ConsolePanel);
+ m_page->corePage()->inspectorController()->showConsole();
}
void WebInspector::startJavaScriptDebugging()
@@ -121,7 +132,6 @@ void WebInspector::stopJavaScriptProfiling()
{
#if ENABLE(JAVASCRIPT_DEBUGGER)
m_page->corePage()->inspectorController()->stopUserInitiatedProfiling();
- m_page->corePage()->inspectorController()->showPanel(InspectorController::ProfilesPanel);
#endif
}
diff --git a/Source/WebKit2/WebProcess/WebPage/WebInspector.h b/Source/WebKit2/WebProcess/WebPage/WebInspector.h
index 21a7529..517ae8e 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebInspector.h
+++ b/Source/WebKit2/WebProcess/WebPage/WebInspector.h
@@ -28,6 +28,7 @@
#if ENABLE(INSPECTOR)
+#include "APIObject.h"
#include "Connection.h"
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
@@ -37,11 +38,11 @@ namespace WebKit {
class WebPage;
struct WebPageCreationParameters;
-class WebInspector {
- WTF_MAKE_NONCOPYABLE(WebInspector);
-
+class WebInspector : public APIObject {
public:
- explicit WebInspector(WebPage*);
+ static const Type APIType = TypeBundleInspector;
+
+ static PassRefPtr<WebInspector> create(WebPage*);
WebPage* page() const { return m_page; }
WebPage* inspectorPage() const { return m_inspectorPage; }
@@ -49,10 +50,23 @@ public:
// Implemented in generated WebInspectorMessageReceiver.cpp
void didReceiveWebInspectorMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+ // Called by WebInspector messages
+ void show();
+ void close();
+
+ void evaluateScriptForTest(long callID, const String& script);
+
+ void startPageProfiling();
+ void stopPageProfiling();
+
private:
friend class WebInspectorClient;
friend class WebInspectorFrontendClient;
+ explicit WebInspector(WebPage*);
+
+ virtual Type type() const { return APIType; }
+
// Called from WebInspectorClient
WebPage* createInspectorPage();
@@ -63,10 +77,6 @@ private:
// Implemented in platform WebInspector file
String localizedStringsURL() const;
- // Called by WebInspector messages
- void show();
- void close();
-
void showConsole();
void startJavaScriptDebugging();
@@ -75,9 +85,6 @@ private:
void startJavaScriptProfiling();
void stopJavaScriptProfiling();
- void startPageProfiling();
- void stopPageProfiling();
-
WebPage* m_page;
WebPage* m_inspectorPage;
};
diff --git a/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.cpp b/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.cpp
index d42e313..bcf3e80 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebOpenPanelResultListener.h"
namespace WebKit {
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
index af236e9..462d352 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebPage.h"
#include "Arguments.h"
@@ -254,6 +255,16 @@ void WebPage::initializeInjectedBundleLoaderClient(WKBundlePageLoaderClient* cli
m_loaderClient.initialize(client);
}
+void WebPage::initializeInjectedBundlePolicyClient(WKBundlePagePolicyClient* client)
+{
+ m_policyClient.initialize(client);
+}
+
+void WebPage::initializeInjectedBundleResourceLoadClient(WKBundlePageResourceLoadClient* client)
+{
+ m_resourceLoadClient.initialize(client);
+}
+
void WebPage::initializeInjectedBundleUIClient(WKBundlePageUIClient* client)
{
m_uiClient.initialize(client);
@@ -313,6 +324,11 @@ void WebPage::changeAcceleratedCompositingMode(WebCore::GraphicsLayer* layer)
if (m_isClosed)
return;
+ // With the new drawing area we don't need to inform the UI process when the accelerated
+ // compositing mode changes.
+ if (m_drawingArea->info().type == DrawingAreaInfo::Impl)
+ return;
+
bool compositing = layer;
// Tell the UI process that accelerated compositing changed. It may respond by changing
@@ -342,6 +358,7 @@ void WebPage::enterAcceleratedCompositingMode(GraphicsLayer* layer)
void WebPage::exitAcceleratedCompositingMode()
{
changeAcceleratedCompositingMode(0);
+ m_drawingArea->setRootCompositingLayer(0);
}
#endif
@@ -463,20 +480,26 @@ void WebPage::reload(bool reloadFromOrigin)
m_mainFrame->coreFrame()->loader()->reload(reloadFromOrigin);
}
-void WebPage::goForward(uint64_t backForwardItemID)
+void WebPage::goForward(uint64_t backForwardItemID, const SandboxExtension::Handle& sandboxExtensionHandle)
{
+ m_sandboxExtensionTracker.beginLoad(m_mainFrame.get(), sandboxExtensionHandle);
+
HistoryItem* item = WebBackForwardListProxy::itemForID(backForwardItemID);
m_page->goToItem(item, FrameLoadTypeForward);
}
-void WebPage::goBack(uint64_t backForwardItemID)
+void WebPage::goBack(uint64_t backForwardItemID, const SandboxExtension::Handle& sandboxExtensionHandle)
{
+ m_sandboxExtensionTracker.beginLoad(m_mainFrame.get(), sandboxExtensionHandle);
+
HistoryItem* item = WebBackForwardListProxy::itemForID(backForwardItemID);
m_page->goToItem(item, FrameLoadTypeBack);
}
-void WebPage::goToBackForwardItem(uint64_t backForwardItemID)
+void WebPage::goToBackForwardItem(uint64_t backForwardItemID, const SandboxExtension::Handle& sandboxExtensionHandle)
{
+ m_sandboxExtensionTracker.beginLoad(m_mainFrame.get(), sandboxExtensionHandle);
+
HistoryItem* item = WebBackForwardListProxy::itemForID(backForwardItemID);
m_page->goToItem(item, FrameLoadTypeIndexedBackForward);
}
@@ -553,6 +576,27 @@ void WebPage::resizeToContentsIfNeeded()
}
#endif
+void WebPage::scrollMainFrameIfNotAtMaxScrollPosition(const IntSize& scrollOffset)
+{
+ Frame* frame = m_page->mainFrame();
+
+ IntPoint scrollPosition = frame->view()->scrollPosition();
+ IntPoint maximumScrollPosition = frame->view()->maximumScrollPosition();
+
+ // If the current scroll position in a direction is the max scroll position
+ // we don't want to scroll at all.
+ IntSize newScrollOffset;
+ if (scrollPosition.x() < maximumScrollPosition.x())
+ newScrollOffset.setWidth(scrollOffset.width());
+ if (scrollPosition.y() < maximumScrollPosition.y())
+ newScrollOffset.setHeight(scrollOffset.height());
+
+ if (newScrollOffset.isZero())
+ return;
+
+ frame->view()->setScrollPosition(frame->view()->scrollPosition() + newScrollOffset);
+}
+
void WebPage::drawRect(GraphicsContext& graphicsContext, const IntRect& rect)
{
graphicsContext.save();
@@ -560,12 +604,19 @@ void WebPage::drawRect(GraphicsContext& graphicsContext, const IntRect& rect)
m_mainFrame->coreFrame()->view()->paint(&graphicsContext, rect);
graphicsContext.restore();
- if (m_pageOverlay) {
- graphicsContext.save();
- graphicsContext.clip(rect);
- m_pageOverlay->drawRect(graphicsContext, rect);
- graphicsContext.restore();
- }
+ // FIXME: Remove this code once we're using the new drawing area on mac and windows.
+ if (m_pageOverlay && m_drawingArea->info().type != DrawingAreaInfo::Impl)
+ drawPageOverlay(graphicsContext, rect);
+}
+
+void WebPage::drawPageOverlay(GraphicsContext& graphicsContext, const IntRect& rect)
+{
+ ASSERT(m_pageOverlay);
+
+ graphicsContext.save();
+ graphicsContext.clip(rect);
+ m_pageOverlay->drawRect(graphicsContext, rect);
+ graphicsContext.restore();
}
double WebPage::textZoomFactor() const
@@ -614,6 +665,8 @@ void WebPage::scaleWebView(double scale, const IntPoint& origin)
if (!frame)
return;
frame->scalePage(scale, origin);
+
+ send(Messages::WebPageProxy::ViewScaleFactorDidChange(scale));
}
double WebPage::viewScaleFactor() const
@@ -660,6 +713,9 @@ void WebPage::installPageOverlay(PassRefPtr<PageOverlay> pageOverlay)
m_pageOverlay = pageOverlay;
m_pageOverlay->setPage(this);
+
+ m_drawingArea->didInstallPageOverlay();
+
m_pageOverlay->setNeedsDisplay();
}
@@ -670,7 +726,8 @@ void WebPage::uninstallPageOverlay(PageOverlay* pageOverlay)
m_pageOverlay->setPage(0);
m_pageOverlay = nullptr;
- m_drawingArea->setNeedsDisplay(IntRect(IntPoint(0, 0), m_viewSize));
+
+ m_drawingArea->didUninstallPageOverlay();
}
PassRefPtr<WebImage> WebPage::snapshotInViewCoordinates(const IntRect& rect, ImageOptions options)
@@ -697,7 +754,7 @@ PassRefPtr<WebImage> WebPage::snapshotInViewCoordinates(const IntRect& rect, Ima
return snapshot.release();
}
-PassRefPtr<WebImage> WebPage::snapshotInDocumentCoordinates(const IntRect& rect, ImageOptions options)
+PassRefPtr<WebImage> WebPage::scaledSnapshotInDocumentCoordinates(const IntRect& rect, double scaleFactor, ImageOptions options)
{
FrameView* frameView = m_mainFrame->coreFrame()->view();
if (!frameView)
@@ -708,10 +765,18 @@ PassRefPtr<WebImage> WebPage::snapshotInDocumentCoordinates(const IntRect& rect,
PaintBehavior oldBehavior = frameView->paintBehavior();
frameView->setPaintBehavior(oldBehavior | PaintBehaviorFlattenCompositingLayers);
- RefPtr<WebImage> snapshot = WebImage::create(rect.size(), options);
- OwnPtr<WebCore::GraphicsContext> graphicsContext = snapshot->bitmap()->createGraphicsContext();
+ bool scale = scaleFactor != 1;
+ IntSize size = rect.size();
+ if (scale)
+ size = IntSize(ceil(rect.width() * scaleFactor), ceil(rect.height() * scaleFactor));
+ RefPtr<WebImage> snapshot = WebImage::create(size, options);
+ OwnPtr<WebCore::GraphicsContext> graphicsContext = snapshot->bitmap()->createGraphicsContext();
graphicsContext->save();
+
+ if (scale)
+ graphicsContext->scale(FloatSize(scaleFactor, scaleFactor));
+
graphicsContext->translate(-rect.x(), -rect.y());
frameView->paintContents(graphicsContext.get(), rect);
graphicsContext->restore();
@@ -721,6 +786,11 @@ PassRefPtr<WebImage> WebPage::snapshotInDocumentCoordinates(const IntRect& rect,
return snapshot.release();
}
+PassRefPtr<WebImage> WebPage::snapshotInDocumentCoordinates(const IntRect& rect, ImageOptions options)
+{
+ return scaledSnapshotInDocumentCoordinates(rect, 1, options);
+}
+
void WebPage::pageDidScroll()
{
// Hide the find indicator.
@@ -909,6 +979,26 @@ void WebPage::keyEvent(const WebKeyboardEvent& keyboardEvent)
send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(keyboardEvent.type()), handled));
}
+#if ENABLE(GESTURE_EVENTS)
+static bool handleGestureEvent(const WebGestureEvent& gestureEvent, Page* page)
+{
+ Frame* frame = page->mainFrame();
+ if (!frame->view())
+ return false;
+
+ PlatformGestureEvent platformGestureEvent = platform(gestureEvent);
+ return frame->eventHandler()->handleGestureEvent(platformGestureEvent);
+}
+
+void WebPage::gestureEvent(const WebGestureEvent& gestureEvent)
+{
+ CurrentEvent currentEvent(gestureEvent);
+
+ bool handled = handleGestureEvent(gestureEvent, m_page.get());
+ send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(gestureEvent.type()), handled));
+}
+#endif
+
void WebPage::validateMenuItem(const String& commandName)
{
bool isEnabled = false;
@@ -952,10 +1042,10 @@ uint64_t WebPage::restoreSession(const SessionState& sessionState)
return currentItemID;
}
-void WebPage::restoreSessionAndNavigateToCurrentItem(const SessionState& sessionState)
+void WebPage::restoreSessionAndNavigateToCurrentItem(const SessionState& sessionState, const SandboxExtension::Handle& sandboxExtensionHandle)
{
if (uint64_t currentItemID = restoreSession(sessionState))
- goToBackForwardItem(currentItemID);
+ goToBackForwardItem(currentItemID, sandboxExtensionHandle);
}
#if ENABLE(TOUCH_EVENTS)
@@ -1022,6 +1112,30 @@ void WebPage::setDrawsTransparentBackground(bool drawsTransparentBackground)
m_drawingArea->setNeedsDisplay(IntRect(IntPoint(0, 0), m_viewSize));
}
+void WebPage::viewWillStartLiveResize()
+{
+ if (!m_page)
+ return;
+
+ // FIXME: This should propagate to all ScrollableAreas.
+ if (Frame* frame = m_page->focusController()->focusedOrMainFrame()) {
+ if (FrameView* view = frame->view())
+ view->willStartLiveResize();
+ }
+}
+
+void WebPage::viewWillEndLiveResize()
+{
+ if (!m_page)
+ return;
+
+ // FIXME: This should propagate to all ScrollableAreas.
+ if (Frame* frame = m_page->focusController()->focusedOrMainFrame()) {
+ if (FrameView* view = frame->view())
+ view->willEndLiveResize();
+ }
+}
+
void WebPage::setFocused(bool isFocused)
{
m_page->focusController()->setFocused(isFocused);
@@ -1161,7 +1275,7 @@ void WebPage::getResourceDataFromFrame(uint64_t frameID, const String& resourceU
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())
+ if ((buffer = subresource->data()))
dataReference = CoreIPC::DataReference(reinterpret_cast<const uint8_t*>(buffer->data()), buffer->size());
}
}
@@ -1187,6 +1301,12 @@ void WebPage::getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID)
send(Messages::WebPageProxy::DataCallback(dataReference, callbackID));
}
+void WebPage::forceRepaint(uint64_t callbackID)
+{
+ m_drawingArea->forceRepaint();
+ send(Messages::WebPageProxy::VoidCallback(callbackID));
+}
+
void WebPage::preferencesDidChange(const WebPreferencesStore& store)
{
WebPreferencesStore::removeTestRunnerOverrides();
@@ -1224,12 +1344,15 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
settings->setJavaScriptCanOpenWindowsAutomatically(store.getBoolValueForKey(WebPreferencesKey::javaScriptCanOpenWindowsAutomaticallyKey()));
settings->setForceFTPDirectoryListings(store.getBoolValueForKey(WebPreferencesKey::forceFTPDirectoryListingsKey()));
settings->setDNSPrefetchingEnabled(store.getBoolValueForKey(WebPreferencesKey::dnsPrefetchingEnabledKey()));
+#if ENABLE(WEB_ARCHIVE)
settings->setWebArchiveDebugModeEnabled(store.getBoolValueForKey(WebPreferencesKey::webArchiveDebugModeEnabledKey()));
+#endif
settings->setLocalFileContentSniffingEnabled(store.getBoolValueForKey(WebPreferencesKey::localFileContentSniffingEnabledKey()));
settings->setUsesPageCache(store.getBoolValueForKey(WebPreferencesKey::usesPageCacheKey()));
settings->setAuthorAndUserStylesEnabled(store.getBoolValueForKey(WebPreferencesKey::authorAndUserStylesEnabledKey()));
settings->setPaginateDuringLayoutEnabled(store.getBoolValueForKey(WebPreferencesKey::paginateDuringLayoutEnabledKey()));
settings->setDOMPasteAllowed(store.getBoolValueForKey(WebPreferencesKey::domPasteAllowedKey()));
+ settings->setJavaScriptCanAccessClipboard(store.getBoolValueForKey(WebPreferencesKey::javaScriptCanAccessClipboardKey()));
settings->setShouldPrintBackgrounds(store.getBoolValueForKey(WebPreferencesKey::shouldPrintBackgroundsKey()));
settings->setMinimumFontSize(store.getUInt32ValueForKey(WebPreferencesKey::minimumFontSizeKey()));
@@ -1245,6 +1368,7 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
#endif
settings->setShowDebugBorders(store.getBoolValueForKey(WebPreferencesKey::compositingBordersVisibleKey()));
settings->setShowRepaintCounter(store.getBoolValueForKey(WebPreferencesKey::compositingRepaintCountersVisibleKey()));
+ settings->setWebGLEnabled(store.getBoolValueForKey(WebPreferencesKey::webGLEnabledKey()));
#if ENABLE(DATABASE)
AbstractDatabase::setIsAvailable(store.getBoolValueForKey(WebPreferencesKey::databasesEnabledKey()));
@@ -1259,7 +1383,7 @@ WebInspector* WebPage::inspector()
if (m_isClosed)
return 0;
if (!m_inspector)
- m_inspector = adoptPtr(new WebInspector(this));
+ m_inspector = WebInspector::create(this);
return m_inspector.get();
}
#endif
@@ -1296,6 +1420,37 @@ bool WebPage::handleEditingKeyboardEvent(KeyboardEvent* evt)
}
#endif
+#if PLATFORM(WIN)
+void WebPage::performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WebCore::DragDataMap& dataMap, uint32_t flags)
+{
+ if (!m_page) {
+ send(Messages::WebPageProxy::DidPerformDragControllerAction(DragOperationNone));
+ return;
+ }
+
+ DragData dragData(dataMap, clientPosition, globalPosition, static_cast<DragOperation>(draggingSourceOperationMask), static_cast<DragApplicationFlags>(flags));
+ switch (action) {
+ case DragControllerActionEntered:
+ send(Messages::WebPageProxy::DidPerformDragControllerAction(m_page->dragController()->dragEntered(&dragData)));
+ break;
+
+ case DragControllerActionUpdated:
+ send(Messages::WebPageProxy::DidPerformDragControllerAction(m_page->dragController()->dragUpdated(&dragData)));
+ break;
+
+ case DragControllerActionExited:
+ m_page->dragController()->dragExited(&dragData);
+ break;
+
+ case DragControllerActionPerformDrag:
+ m_page->dragController()->performDrag(&dragData);
+ break;
+
+ default:
+ ASSERT_NOT_REACHED();
+ }
+}
+#else
void WebPage::performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const String& dragStorageName, uint32_t flags)
{
if (!m_page) {
@@ -1325,6 +1480,7 @@ void WebPage::performDragControllerAction(uint64_t action, WebCore::IntPoint cli
ASSERT_NOT_REACHED();
}
}
+#endif
void WebPage::dragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation)
{
@@ -1433,6 +1589,13 @@ void WebPage::didCancelForOpenPanel()
m_activeOpenPanelResultListener = 0;
}
+#if ENABLE(WEB_PROCESS_SANDBOX)
+void WebPage::extendSandboxForFileFromOpenPanel(const SandboxExtension::Handle& handle)
+{
+ SandboxExtension::create(handle)->consumePermanently();
+}
+#endif
+
void WebPage::didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed)
{
m_geolocationPermissionRequestManager.didReceiveGeolocationPermissionDecision(geolocationID, allowed);
@@ -1563,7 +1726,7 @@ void WebPage::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Messag
return;
}
-#ifdef __APPLE__
+#if PLATFORM(MAC) || PLATFORM(WIN)
if (messageID.is<CoreIPC::MessageClassDrawingArea>()) {
if (m_drawingArea)
m_drawingArea->didReceiveDrawingAreaMessage(connection, messageID, arguments);
@@ -1650,11 +1813,39 @@ void WebPage::SandboxExtensionTracker::beginLoad(WebFrame* frame, const SandboxE
m_pendingProvisionalSandboxExtension = SandboxExtension::create(handle);
}
+static bool shouldReuseCommittedSandboxExtension(WebFrame* frame)
+{
+ ASSERT(frame->isMainFrame());
+
+ FrameLoader* frameLoader = frame->coreFrame()->loader();
+ FrameLoadType frameLoadType = frameLoader->loadType();
+
+ // If the page is being reloaded, it should reuse whatever extension is committed.
+ if (frameLoadType == FrameLoadTypeReload || frameLoadType == FrameLoadTypeReloadFromOrigin)
+ return true;
+
+ DocumentLoader* documentLoader = frameLoader->documentLoader();
+ DocumentLoader* provisionalDocumentLoader = frameLoader->provisionalDocumentLoader();
+ if (!documentLoader || !provisionalDocumentLoader)
+ return false;
+
+ if (documentLoader->url().isLocalFile() && provisionalDocumentLoader->url().isLocalFile()
+ && provisionalDocumentLoader->triggeringAction().type() == NavigationTypeLinkClicked)
+ return true;
+
+ return false;
+}
+
void WebPage::SandboxExtensionTracker::didStartProvisionalLoad(WebFrame* frame)
{
if (!frame->isMainFrame())
return;
+ if (shouldReuseCommittedSandboxExtension(frame)) {
+ m_pendingProvisionalSandboxExtension = m_committedSandboxExtension.release();
+ ASSERT(!m_committedSandboxExtension);
+ }
+
ASSERT(!m_provisionalSandboxExtension);
m_provisionalSandboxExtension = m_pendingProvisionalSandboxExtension.release();
@@ -1749,6 +1940,9 @@ void WebPage::beginPrinting(uint64_t frameID, const PrintInfo& printInfo)
m_printContext = adoptPtr(new PrintContext(coreFrame));
m_printContext->begin(printInfo.availablePaperWidth, printInfo.availablePaperHeight);
+
+ float fullPageHeight;
+ m_printContext->computePageRects(FloatRect(0, 0, printInfo.availablePaperWidth, printInfo.availablePaperHeight), 0, 0, printInfo.pageSetupScaleFactor, fullPageHeight, true);
}
void WebPage::endPrinting()
@@ -1756,57 +1950,90 @@ void WebPage::endPrinting()
m_printContext = nullptr;
}
-void WebPage::computePagesForPrinting(uint64_t frameID, const PrintInfo& printInfo, Vector<IntRect>& resultPageRects, double& resultTotalScaleFactorForPrinting)
+void WebPage::computePagesForPrinting(uint64_t frameID, const PrintInfo& printInfo, uint64_t callbackID)
{
- beginPrinting(frameID, printInfo);
+ Vector<IntRect> resultPageRects;
+ double resultTotalScaleFactorForPrinting = 1;
- WebFrame* frame = WebProcess::shared().webFrame(frameID);
- if (!frame)
- return;
-
- float fullPageHeight;
- m_printContext->computePageRects(FloatRect(0, 0, printInfo.availablePaperWidth, printInfo.availablePaperHeight), 0, 0, printInfo.pageSetupScaleFactor, fullPageHeight, true);
+ beginPrinting(frameID, printInfo);
- resultTotalScaleFactorForPrinting = m_printContext->computeAutomaticScaleFactor(printInfo.availablePaperWidth) * printInfo.pageSetupScaleFactor;
- resultPageRects = m_printContext->pageRects();
+ if (m_printContext) {
+ resultPageRects = m_printContext->pageRects();
+ resultTotalScaleFactorForPrinting = m_printContext->computeAutomaticScaleFactor(FloatSize(printInfo.availablePaperWidth, printInfo.availablePaperHeight)) * printInfo.pageSetupScaleFactor;
+ }
// If we're asked to print, we should actually print at least a blank page.
if (resultPageRects.isEmpty())
resultPageRects.append(IntRect(0, 0, 1, 1));
+
+ send(Messages::WebPageProxy::ComputedPagesCallback(resultPageRects, resultTotalScaleFactorForPrinting, callbackID));
}
#if PLATFORM(MAC)
// FIXME: Find a better place for Mac specific code.
-void WebPage::drawRectToPDF(uint64_t frameID, const WebCore::IntRect& rect, Vector<uint8_t>& pdfData)
+void WebPage::drawRectToPDF(uint64_t frameID, const WebCore::IntRect& rect, uint64_t callbackID)
{
WebFrame* frame = WebProcess::shared().webFrame(frameID);
- if (!frame)
- return;
+ Frame* coreFrame = frame ? frame->coreFrame() : 0;
- Frame* coreFrame = frame->coreFrame();
- if (!coreFrame)
- return;
+ RetainPtr<CFMutableDataRef> pdfPageData(AdoptCF, CFDataCreateMutable(0, 0));
- ASSERT(coreFrame->document()->printing());
+ if (coreFrame) {
+ ASSERT(coreFrame->document()->printing());
+
+ // FIXME: Use CGDataConsumerCreate with callbacks to avoid copying the data.
+ RetainPtr<CGDataConsumerRef> pdfDataConsumer(AdoptCF, CGDataConsumerCreateWithCFData(pdfPageData.get()));
+
+ CGRect mediaBox = CGRectMake(0, 0, rect.width(), rect.height());
+ RetainPtr<CGContextRef> context(AdoptCF, CGPDFContextCreate(pdfDataConsumer.get(), &mediaBox, 0));
+ RetainPtr<CFDictionaryRef> pageInfo(AdoptCF, CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+ CGPDFContextBeginPage(context.get(), pageInfo.get());
+
+ GraphicsContext ctx(context.get());
+ ctx.scale(FloatSize(1, -1));
+ ctx.translate(0, -rect.height());
+ m_printContext->spoolRect(ctx, rect);
+
+ CGPDFContextEndPage(context.get());
+ CGPDFContextClose(context.get());
+ }
+
+ send(Messages::WebPageProxy::DataCallback(CoreIPC::DataReference(CFDataGetBytePtr(pdfPageData.get()), CFDataGetLength(pdfPageData.get())), callbackID));
+}
+
+void WebPage::drawPagesToPDF(uint64_t frameID, uint32_t first, uint32_t count, uint64_t callbackID)
+{
+ WebFrame* frame = WebProcess::shared().webFrame(frameID);
+ Frame* coreFrame = frame ? frame->coreFrame() : 0;
RetainPtr<CFMutableDataRef> pdfPageData(AdoptCF, CFDataCreateMutable(0, 0));
- // FIXME: Use CGDataConsumerCreate with callbacks to avoid copying the data.
- RetainPtr<CGDataConsumerRef> pdfDataConsumer(AdoptCF, CGDataConsumerCreateWithCFData(pdfPageData.get()));
+ if (coreFrame) {
+ ASSERT(coreFrame->document()->printing());
- CGRect mediaBox = CGRectMake(0, 0, frame->size().width(), frame->size().height());
- RetainPtr<CGContextRef> context(AdoptCF, CGPDFContextCreate(pdfDataConsumer.get(), &mediaBox, 0));
- CFDictionaryRef pageInfo = CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
- CGPDFContextBeginPage(context.get(), pageInfo);
+ // FIXME: Use CGDataConsumerCreate with callbacks to avoid copying the data.
+ RetainPtr<CGDataConsumerRef> pdfDataConsumer(AdoptCF, CGDataConsumerCreateWithCFData(pdfPageData.get()));
- GraphicsContext ctx(context.get());
- m_printContext->spoolRect(ctx, rect);
+ CGRect mediaBox = m_printContext->pageCount() ? m_printContext->pageRect(0) : CGRectMake(0, 0, 1, 1);
+ RetainPtr<CGContextRef> context(AdoptCF, CGPDFContextCreate(pdfDataConsumer.get(), &mediaBox, 0));
+ for (uint32_t page = first; page < first + count; ++page) {
+ if (page >= m_printContext->pageCount())
+ break;
- CGPDFContextEndPage(context.get());
- CGPDFContextClose(context.get());
+ RetainPtr<CFDictionaryRef> pageInfo(AdoptCF, CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+ CGPDFContextBeginPage(context.get(), pageInfo.get());
+
+ GraphicsContext ctx(context.get());
+ ctx.scale(FloatSize(1, -1));
+ ctx.translate(0, -m_printContext->pageRect(page).height());
+ m_printContext->spoolPage(ctx, page, m_printContext->pageRect(page).width());
+
+ CGPDFContextEndPage(context.get());
+ }
+ CGPDFContextClose(context.get());
+ }
- pdfData.resize(CFDataGetLength(pdfPageData.get()));
- CFDataGetBytes(pdfPageData.get(), CFRangeMake(0, pdfData.size()), pdfData.data());
+ send(Messages::WebPageProxy::DataCallback(CoreIPC::DataReference(CFDataGetBytePtr(pdfPageData.get()), CFDataGetLength(pdfPageData.get())), callbackID));
}
#endif
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h
index d29400f..89087b0 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h
@@ -35,11 +35,14 @@
#include "InjectedBundlePageEditorClient.h"
#include "InjectedBundlePageFormClient.h"
#include "InjectedBundlePageLoaderClient.h"
+#include "InjectedBundlePagePolicyClient.h"
+#include "InjectedBundlePageResourceLoadClient.h"
#include "InjectedBundlePageUIClient.h"
#include "MessageSender.h"
#include "Plugin.h"
#include "SandboxExtension.h"
#include "WebEditCommand.h"
+#include <WebCore/DragData.h>
#include <WebCore/Editor.h>
#include <WebCore/FrameLoaderTypes.h>
#include <WebCore/IntRect.h>
@@ -55,11 +58,7 @@
#if PLATFORM(MAC)
#include <wtf/RetainPtr.h>
-#ifdef __OBJC__
-@class AccessibilityWebPageObject;
-#else
-class AccessibilityWebPageObject;
-#endif
+OBJC_CLASS AccessibilityWebPageObject;
#endif
namespace CoreIPC {
@@ -100,6 +99,10 @@ struct PrintInfo;
struct WebPageCreationParameters;
struct WebPreferencesStore;
+#if ENABLE(GESTURE_EVENTS)
+class WebGestureEvent;
+#endif
+
#if ENABLE(TOUCH_EVENTS)
class WebTouchEvent;
#endif
@@ -122,12 +125,15 @@ public:
void setSize(const WebCore::IntSize&);
const WebCore::IntSize& size() const { return m_viewSize; }
-
+ WebCore::IntRect bounds() const { return WebCore::IntRect(WebCore::IntPoint(), size()); }
+
InjectedBundleBackForwardList* backForwardList();
DrawingArea* drawingArea() const { return m_drawingArea.get(); }
WebPageGroupProxy* pageGroup() const { return m_pageGroup.get(); }
+ void scrollMainFrameIfNotAtMaxScrollPosition(const WebCore::IntSize& scrollOffset);
+
#if ENABLE(INSPECTOR)
WebInspector* inspector();
#endif
@@ -135,6 +141,7 @@ public:
// -- Called by the DrawingArea.
// FIXME: We could genericize these into a DrawingArea client interface. Would that be beneficial?
void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect&);
+ void drawPageOverlay(WebCore::GraphicsContext&, const WebCore::IntRect&);
void layoutIfNeeded();
// -- Called from WebCore clients.
@@ -165,12 +172,16 @@ public:
void initializeInjectedBundleEditorClient(WKBundlePageEditorClient*);
void initializeInjectedBundleFormClient(WKBundlePageFormClient*);
void initializeInjectedBundleLoaderClient(WKBundlePageLoaderClient*);
+ void initializeInjectedBundlePolicyClient(WKBundlePagePolicyClient*);
+ void initializeInjectedBundleResourceLoadClient(WKBundlePageResourceLoadClient*);
void initializeInjectedBundleUIClient(WKBundlePageUIClient*);
InjectedBundlePageContextMenuClient& injectedBundleContextMenuClient() { return m_contextMenuClient; }
InjectedBundlePageEditorClient& injectedBundleEditorClient() { return m_editorClient; }
InjectedBundlePageFormClient& injectedBundleFormClient() { return m_formClient; }
InjectedBundlePageLoaderClient& injectedBundleLoaderClient() { return m_loaderClient; }
+ InjectedBundlePagePolicyClient& injectedBundlePolicyClient() { return m_policyClient; }
+ InjectedBundlePageResourceLoadClient& injectedBundleResourceLoadClient() { return m_resourceLoadClient; }
InjectedBundlePageUIClient& injectedBundleUIClient() { return m_uiClient; }
bool findStringFromInjectedBundle(const String&, FindOptions);
@@ -224,9 +235,11 @@ public:
void installPageOverlay(PassRefPtr<PageOverlay>);
void uninstallPageOverlay(PageOverlay*);
+ bool hasPageOverlay() const { return m_pageOverlay; }
PassRefPtr<WebImage> snapshotInViewCoordinates(const WebCore::IntRect&, ImageOptions);
PassRefPtr<WebImage> snapshotInDocumentCoordinates(const WebCore::IntRect&, ImageOptions);
+ PassRefPtr<WebImage> scaledSnapshotInDocumentCoordinates(const WebCore::IntRect&, double scaleFactor, ImageOptions);
static const WebEvent* currentEvent();
@@ -247,6 +260,7 @@ public:
WebContextMenu* contextMenu();
bool hasLocalDataForURL(const WebCore::KURL&);
+ String cachedResponseMIMETypeForURL(const WebCore::KURL&);
static bool canHandleRequest(const WebCore::ResourceRequest&);
@@ -271,7 +285,7 @@ public:
static void getLocationAndLengthFromRange(WebCore::Range*, uint64_t& location, uint64_t& length);
#if PLATFORM(MAC)
- void sendAccessibilityPresenterToken(const CoreIPC::DataReference&);
+ void registerUIProcessAccessibilityTokens(const CoreIPC::DataReference& elemenToken, const CoreIPC::DataReference& windowToken);
AccessibilityWebPageObject* accessibilityRemoteObject();
WebCore::IntPoint accessibilityPosition() const { return m_accessibilityPosition; }
@@ -300,14 +314,19 @@ public:
#endif
void replaceSelectionWithText(WebCore::Frame*, const String&);
+#if PLATFORM(WIN)
+ void performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WebCore::DragDataMap&, uint32_t flags);
+#else
void performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WTF::String& dragStorageName, uint32_t flags);
+#endif
void dragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation);
void beginPrinting(uint64_t frameID, const PrintInfo&);
void endPrinting();
- void computePagesForPrinting(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& resultPageRects, double& resultTotalScaleFactorForPrinting);
+ void computePagesForPrinting(uint64_t frameID, const PrintInfo&, uint64_t callbackID);
#if PLATFORM(MAC)
- void drawRectToPDF(uint64_t frameID, const WebCore::IntRect&, Vector<uint8_t>& pdfData);
+ void drawRectToPDF(uint64_t frameID, const WebCore::IntRect&, uint64_t callbackID);
+ void drawPagesToPDF(uint64_t frameID, uint32_t first, uint32_t count, uint64_t callbackID);
#endif
bool mainFrameHasCustomRepresentation() const;
@@ -336,37 +355,44 @@ private:
// Actions
void tryClose();
- void loadURL(const String&, const SandboxExtension::Handle& sandboxExtensionHandle);
- void loadURLRequest(const WebCore::ResourceRequest&, const SandboxExtension::Handle& sandboxExtensionHandle);
+ void loadURL(const String&, const SandboxExtension::Handle&);
+ void loadURLRequest(const WebCore::ResourceRequest&, const SandboxExtension::Handle&);
void loadHTMLString(const String& htmlString, const String& baseURL);
void loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL);
void loadPlainTextString(const String&);
void reload(bool reloadFromOrigin);
- void goForward(uint64_t);
- void goBack(uint64_t);
- void goToBackForwardItem(uint64_t);
+ void goForward(uint64_t, const SandboxExtension::Handle&);
+ void goBack(uint64_t, const SandboxExtension::Handle&);
+ void goToBackForwardItem(uint64_t, const SandboxExtension::Handle&);
void setActive(bool);
void setFocused(bool);
void setInitialFocus(bool);
void setWindowResizerSize(const WebCore::IntSize&);
void setIsInWindow(bool);
+ void validateMenuItem(const String&);
+ void executeEditCommand(const String&);
+
void mouseEvent(const WebMouseEvent&);
void wheelEvent(const WebWheelEvent&);
void keyEvent(const WebKeyboardEvent&);
- void validateMenuItem(const String&);
- void executeEditCommand(const String&);
+#if ENABLE(GESTURE_EVENTS)
+ void gestureEvent(const WebGestureEvent&);
+#endif
#if ENABLE(TOUCH_EVENTS)
void touchEvent(const WebTouchEvent&);
#endif
uint64_t restoreSession(const SessionState&);
- void restoreSessionAndNavigateToCurrentItem(const SessionState&);
+ void restoreSessionAndNavigateToCurrentItem(const SessionState&, const SandboxExtension::Handle&);
void didRemoveBackForwardItem(uint64_t);
void setDrawsBackground(bool);
void setDrawsTransparentBackground(bool);
+ void viewWillStartLiveResize();
+ void viewWillEndLiveResize();
+
void getContentsAsString(uint64_t callbackID);
void getMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID);
void getResourceDataFromFrame(uint64_t frameID, const String& resourceURL, uint64_t callbackID);
@@ -375,6 +401,7 @@ private:
void getSourceForFrame(uint64_t frameID, uint64_t callbackID);
void getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID);
void runJavaScriptInMainFrame(const String&, uint64_t callbackID);
+ void forceRepaint(uint64_t callbackID);
void preferencesDidChange(const WebPreferencesStore&);
void platformPreferencesDidChange(const WebPreferencesStore&);
@@ -406,6 +433,9 @@ private:
void didChooseFilesForOpenPanel(const Vector<String>&);
void didCancelForOpenPanel();
+#if ENABLE(WEB_PROCESS_SANDBOX)
+ void extendSandboxForFileFromOpenPanel(const SandboxExtension::Handle&);
+#endif
void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed);
@@ -477,6 +507,8 @@ private:
InjectedBundlePageEditorClient m_editorClient;
InjectedBundlePageFormClient m_formClient;
InjectedBundlePageLoaderClient m_loaderClient;
+ InjectedBundlePagePolicyClient m_policyClient;
+ InjectedBundlePageResourceLoadClient m_resourceLoadClient;
InjectedBundlePageUIClient m_uiClient;
#if ENABLE(TILED_BACKING_STORE)
@@ -487,7 +519,7 @@ private:
RefPtr<PageOverlay> m_pageOverlay;
#if ENABLE(INSPECTOR)
- OwnPtr<WebInspector> m_inspector;
+ RefPtr<WebInspector> m_inspector;
#endif
RefPtr<WebPopupMenu> m_activePopupMenu;
RefPtr<WebContextMenu> m_contextMenu;
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
index e001864..e47a013 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
@@ -1,4 +1,4 @@
-# Copyright (C) 2010 Apple Inc. All rights reserved.
+# Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -29,16 +29,22 @@ messages -> WebPage {
SetDrawsBackground(bool drawsBackground)
SetDrawsTransparentBackground(bool drawsTransparentBackground)
+ ViewWillStartLiveResize()
+ ViewWillEndLiveResize()
+
KeyEvent(WebKit::WebKeyboardEvent event)
MouseEvent(WebKit::WebMouseEvent event)
WheelEvent(WebKit::WebWheelEvent event)
+#if ENABLE(GESTURE_EVENTS)
+ GestureEvent(WebKit::WebGestureEvent event)
+#endif
#if ENABLE(TOUCH_EVENTS)
TouchEvent(WebKit::WebTouchEvent event)
#endif
- GoBack(uint64_t backForwardItemID)
- GoForward(uint64_t backForwardItemID)
- GoToBackForwardItem(uint64_t backForwardItemID)
+ GoBack(uint64_t backForwardItemID, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
+ GoForward(uint64_t backForwardItemID, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
+ GoToBackForwardItem(uint64_t backForwardItemID, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
LoadHTMLString(WTF::String htmlString, WTF::String baseURL)
LoadAlternateHTMLString(WTF::String htmlString, WTF::String baseURL, WTF::String unreachableURL);
LoadPlainTextString(WTF::String string)
@@ -49,7 +55,7 @@ messages -> WebPage {
StopLoadingFrame(uint64_t frameID)
- RestoreSessionAndNavigateToCurrentItem(WebKit::SessionState state)
+ RestoreSessionAndNavigateToCurrentItem(WebKit::SessionState state, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
DidRemoveBackForwardItem(uint64_t backForwardItemID)
@@ -65,6 +71,9 @@ messages -> WebPage {
GetWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID)
RunJavaScriptInMainFrame(WTF::String script, uint64_t callbackID)
+ # FIXME: This should be a drawing area message.
+ ForceRepaint(uint64_t callbackID)
+
PreferencesDidChange(WebKit::WebPreferencesStore store)
SetUserAgent(WTF::String userAgent)
@@ -100,7 +109,12 @@ messages -> WebPage {
CountStringMatches(WTF::String string, uint32_t findOptions, unsigned maxMatchCount)
# Drag and drop.
+#if PLATFORM(WIN)
+ PerformDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, HashMap<UINT,Vector<String>> dataMap, uint32_t flags)
+#endif
+#if !PLATFORM(WIN)
PerformDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, WTF::String dragStorageName, uint32_t flags)
+#endif
DragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation)
# Popup menu.
@@ -113,6 +127,9 @@ messages -> WebPage {
# Open panel.
DidChooseFilesForOpenPanel(Vector<WTF::String> fileURLs)
DidCancelForOpenPanel()
+#if ENABLE(WEB_PROCESS_SANDBOX)
+ ExtendSandboxForFileFromOpenPanel(WebKit::SandboxExtension::Handle sandboxExtensionHandle)
+#endif
# Spelling and grammar.
AdvanceToNextMisspelling(bool startBeforeSelection)
@@ -133,11 +150,12 @@ messages -> WebPage {
SetWindowResizerSize(WebCore::IntSize intersectsView)
# Printing.
- BeginPrinting(uint64_t frameID, WebKit::PrintInfo printInfo);
+ BeginPrinting(uint64_t frameID, WebKit::PrintInfo printInfo)
EndPrinting();
- ComputePagesForPrinting(uint64_t frameID, WebKit::PrintInfo printInfo) -> (Vector<WebCore::IntRect> pageRects, double totalScaleFactorForPrinting)
+ ComputePagesForPrinting(uint64_t frameID, WebKit::PrintInfo printInfo, uint64_t callbackID)
#if PLATFORM(MAC)
- DrawRectToPDF(uint64_t frameID, WebCore::IntRect rect) -> (Vector<uint8_t> pdfData)
+ DrawRectToPDF(uint64_t frameID, WebCore::IntRect rect, uint64_t callbackID)
+ DrawPagesToPDF(uint64_t frameID, uint32_t first, uint32_t count, uint64_t callbackID)
#endif
// FIXME: This a dummy message, to avoid breaking the build for platforms that don't require
@@ -153,7 +171,7 @@ messages -> WebPage {
GetMarkedRange() -> (uint64_t location, uint64_t length)
CharacterIndexForPoint(WebCore::IntPoint point) -> (uint64_t result)
FirstRectForCharacterRange(uint64_t location, uint64_t length) -> (WebCore::IntRect resultRect)
- SendAccessibilityPresenterToken(CoreIPC::DataReference token)
+ RegisterUIProcessAccessibilityTokens(CoreIPC::DataReference elemenToken, CoreIPC::DataReference windowToken)
#endif
#if PLATFORM(WIN)
ConfirmComposition(WTF::String compositionString)
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp b/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp
index 67109ec..3bd20c8 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebPageGroupProxy.h"
#include "WebProcess.h"
diff --git a/Source/WebKit2/WebProcess/WebPage/gtk/ChunkedUpdateDrawingAreaGtk.cpp b/Source/WebKit2/WebProcess/WebPage/gtk/ChunkedUpdateDrawingAreaGtk.cpp
new file mode 100644
index 0000000..313ad3f
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebPage/gtk/ChunkedUpdateDrawingAreaGtk.cpp
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
+ * Copyright (C) 2011 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ChunkedUpdateDrawingArea.h"
+
+#include "RefPtrCairo.h"
+#include "UpdateChunk.h"
+#include "WebPage.h"
+
+#include <WebCore/GraphicsContext.h>
+#include <WebCore/IntRect.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void ChunkedUpdateDrawingArea::paintIntoUpdateChunk(UpdateChunk* updateChunk)
+{
+ ASSERT(!updateChunk->isEmpty());
+
+ RefPtr<cairo_surface_t> image = updateChunk->createImage();
+ RefPtr<cairo_t> cr = cairo_create(image.get());
+ GraphicsContext gc(cr.get());
+ gc.save();
+ IntRect rect = updateChunk->rect();
+ gc.translate(-rect.x(), -rect.y());
+ m_webPage->drawRect(gc, updateChunk->rect());
+ gc.restore();
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp b/Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp
index 4697f62..36bde01 100644
--- a/Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebInspector.h"
#if ENABLE(INSPECTOR)
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm b/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm
index fa4aa1a..c88ab7e 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm
+++ b/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#import "config.h"
#import "AccessibilityWebPageObject.h"
#import "WebFrame.h"
@@ -32,6 +33,7 @@
#import <WebCore/FrameView.h>
#import <WebCore/ScrollView.h>
#import <WebCore/Scrollbar.h>
+#import <WebKitSystemInterface.h>
using namespace WebCore;
using namespace WebKit;
@@ -70,6 +72,7 @@ using namespace WebKit;
- (void)dealloc
{
+ WKUnregisterUniqueIdForElement(self);
[m_accessibilityChildren release];
[m_attributeNames release];
[m_parent release];
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp b/Source/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp
index 6bcecfd..b39598f 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "ChunkedUpdateDrawingArea.h"
#include "UpdateChunk.h"
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm
index 24fa124..25a1dfd 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm
+++ b/Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm
@@ -23,18 +23,19 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if USE(ACCELERATED_COMPOSITING)
+#import "config.h"
+#import "LayerBackedDrawingArea.h"
-#include "LayerBackedDrawingArea.h"
+#if USE(ACCELERATED_COMPOSITING)
-#include "DrawingAreaProxyMessageKinds.h"
-#include "WebKitSystemInterface.h"
-#include "WebPage.h"
-#include "WebProcess.h"
-#include <WebCore/Frame.h>
-#include <WebCore/FrameView.h>
-#include <WebCore/GraphicsLayer.h>
-#include <WebCore/Page.h>
+#import "DrawingAreaProxyMessageKinds.h"
+#import "WebKitSystemInterface.h"
+#import "WebPage.h"
+#import "WebProcess.h"
+#import <WebCore/Frame.h>
+#import <WebCore/FrameView.h>
+#import <WebCore/GraphicsLayer.h>
+#import <WebCore/Page.h>
using namespace WebCore;
@@ -83,7 +84,7 @@ void LayerBackedDrawingArea::attachCompositingContext()
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());
+ WebProcess::shared().connection()->deprecatedSendSync(DrawingAreaProxyLegacyMessage::AttachCompositingContext, m_webPage->pageID(), CoreIPC::In(contextID), CoreIPC::Out());
#endif
}
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h
new file mode 100644
index 0000000..016f0d6
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h
@@ -0,0 +1,96 @@
+/*
+ * 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.
+ */
+
+#ifndef LayerTreeHostMac_h
+#define LayerTreeHostMac_h
+
+#include "LayerTreeContext.h"
+#include "LayerTreeHost.h"
+#include <WebCore/GraphicsLayerClient.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/RetainPtr.h>
+
+typedef struct __WKCARemoteLayerClientRef* WKCARemoteLayerClientRef;
+
+namespace WebKit {
+
+class LayerTreeHostMac : public LayerTreeHost, WebCore::GraphicsLayerClient {
+public:
+ static PassRefPtr<LayerTreeHostMac> create(WebPage*);
+ ~LayerTreeHostMac();
+
+private:
+ explicit LayerTreeHostMac(WebPage*);
+
+ // LayerTreeHost.
+ virtual const LayerTreeContext& layerTreeContext();
+ virtual void scheduleLayerFlush();
+ virtual void setRootCompositingLayer(WebCore::GraphicsLayer*);
+ virtual void invalidate();
+
+ virtual void setNonCompositedContentsNeedDisplay(const WebCore::IntRect&);
+ virtual void scrollNonCompositedContents(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
+ virtual void sizeDidChange(const WebCore::IntSize& newSize);
+
+ virtual void didInstallPageOverlay();
+ virtual void didUninstallPageOverlay();
+ virtual void setPageOverlayNeedsDisplay(const WebCore::IntRect&);
+
+ // GraphicsLayerClient
+ virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time);
+ virtual void notifySyncRequired(const WebCore::GraphicsLayer*);
+ virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect);
+ virtual bool showDebugBorders() const;
+ virtual bool showRepaintCounter() const;
+
+ static void flushPendingLayerChangesRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void*);
+ void flushPendingLayerChangesRunLoopObserverCallback();
+ bool flushPendingLayerChanges();
+
+ void createPageOverlayLayer();
+ void destroyPageOverlayLayer();
+
+ // The context for this layer tree.
+ LayerTreeContext m_layerTreeContext;
+
+ // Whether the layer tree host is valid or not.
+ bool m_isValid;
+
+ // The root layer.
+ OwnPtr<WebCore::GraphicsLayer> m_rootLayer;
+
+ // The layer which contains all non-composited content.
+ OwnPtr<WebCore::GraphicsLayer> m_nonCompositedContentLayer;
+
+ // The page overlay layer. Will be null if there's no page overlay.
+ OwnPtr<WebCore::GraphicsLayer> m_pageOverlayLayer;
+
+ RetainPtr<WKCARemoteLayerClientRef> m_remoteLayerClient;
+ RetainPtr<CFRunLoopObserverRef> m_flushPendingLayerChangesRunLoopObserver;
+};
+
+} // namespace WebKit
+
+#endif // LayerTreeHostMac_h
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm
new file mode 100644
index 0000000..9734aec
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm
@@ -0,0 +1,279 @@
+/*
+ * 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 "config.h"
+#import "LayerTreeHostMac.h"
+
+#import "WebPage.h"
+#import "WebProcess.h"
+#import <QuartzCore/CATransaction.h>
+#import <WebCore/Frame.h>
+#import <WebCore/FrameView.h>
+#import <WebCore/Page.h>
+#import <WebCore/Settings.h>
+#import <WebKitSystemInterface.h>
+
+@interface CATransaction (Details)
++ (void)synchronize;
+@end
+
+using namespace WebCore;
+
+namespace WebKit {
+
+PassRefPtr<LayerTreeHostMac> LayerTreeHostMac::create(WebPage* webPage)
+{
+ return adoptRef(new LayerTreeHostMac(webPage));
+}
+
+LayerTreeHostMac::LayerTreeHostMac(WebPage* webPage)
+ : LayerTreeHost(webPage)
+ , m_isValid(true)
+{
+ mach_port_t serverPort = WebProcess::shared().compositingRenderServerPort();
+ m_remoteLayerClient = WKCARemoteLayerClientMakeWithServerPort(serverPort);
+
+ // Create a root layer.
+ m_rootLayer = GraphicsLayer::create(this);
+#ifndef NDEBUG
+ m_rootLayer->setName("LayerTreeHost root layer");
+#endif
+ m_rootLayer->setDrawsContent(false);
+ m_rootLayer->setSize(webPage->size());
+
+ [m_rootLayer->platformLayer() setGeometryFlipped:YES];
+
+ m_nonCompositedContentLayer = GraphicsLayer::create(this);
+#ifndef NDEBUG
+ m_nonCompositedContentLayer->setName("LayerTreeHost non-composited content");
+#endif
+ m_nonCompositedContentLayer->setDrawsContent(true);
+ m_nonCompositedContentLayer->setContentsOpaque(m_webPage->drawsBackground() && !m_webPage->drawsTransparentBackground());
+ m_nonCompositedContentLayer->setSize(webPage->size());
+
+ m_rootLayer->addChild(m_nonCompositedContentLayer.get());
+
+ WKCARemoteLayerClientSetLayer(m_remoteLayerClient.get(), m_rootLayer->platformLayer());
+
+ if (m_webPage->hasPageOverlay())
+ createPageOverlayLayer();
+
+ scheduleLayerFlush();
+
+ m_layerTreeContext.contextID = WKCARemoteLayerClientGetClientId(m_remoteLayerClient.get());
+}
+
+LayerTreeHostMac::~LayerTreeHostMac()
+{
+ ASSERT(!m_isValid);
+ ASSERT(!m_flushPendingLayerChangesRunLoopObserver);
+ ASSERT(!m_remoteLayerClient);
+ ASSERT(!m_rootLayer);
+}
+
+const LayerTreeContext& LayerTreeHostMac::layerTreeContext()
+{
+ return m_layerTreeContext;
+}
+
+void LayerTreeHostMac::scheduleLayerFlush()
+{
+ CFRunLoopRef currentRunLoop = CFRunLoopGetCurrent();
+
+ // Make sure we wake up the loop or the observer could be delayed until some other source fires.
+ CFRunLoopWakeUp(currentRunLoop);
+
+ if (m_flushPendingLayerChangesRunLoopObserver)
+ return;
+
+ // Run before the Core Animation commit observer, which has order 2000000.
+ const CFIndex runLoopOrder = 2000000 - 1;
+ CFRunLoopObserverContext context = { 0, this, 0, 0, 0 };
+ m_flushPendingLayerChangesRunLoopObserver.adoptCF(CFRunLoopObserverCreate(0, kCFRunLoopBeforeWaiting | kCFRunLoopExit, true, runLoopOrder, flushPendingLayerChangesRunLoopObserverCallback, &context));
+
+ CFRunLoopAddObserver(currentRunLoop, m_flushPendingLayerChangesRunLoopObserver.get(), kCFRunLoopCommonModes);
+}
+
+void LayerTreeHostMac::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
+{
+ ASSERT(graphicsLayer);
+
+ m_nonCompositedContentLayer->removeAllChildren();
+
+ // Add the accelerated layer tree hierarchy.
+ m_nonCompositedContentLayer->addChild(graphicsLayer);
+}
+
+void LayerTreeHostMac::invalidate()
+{
+ ASSERT(m_isValid);
+
+ if (m_flushPendingLayerChangesRunLoopObserver) {
+ CFRunLoopObserverInvalidate(m_flushPendingLayerChangesRunLoopObserver.get());
+ m_flushPendingLayerChangesRunLoopObserver = nullptr;
+ }
+
+ WKCARemoteLayerClientInvalidate(m_remoteLayerClient.get());
+ m_remoteLayerClient = nullptr;
+ m_rootLayer = nullptr;
+ m_isValid = false;
+}
+
+void LayerTreeHostMac::setNonCompositedContentsNeedDisplay(const IntRect& rect)
+{
+ m_nonCompositedContentLayer->setNeedsDisplayInRect(rect);
+ if (m_pageOverlayLayer)
+ m_pageOverlayLayer->setNeedsDisplayInRect(rect);
+
+ scheduleLayerFlush();
+}
+
+void LayerTreeHostMac::scrollNonCompositedContents(const IntRect& scrollRect, const IntSize& scrollOffset)
+{
+ setNonCompositedContentsNeedDisplay(scrollRect);
+}
+
+void LayerTreeHostMac::sizeDidChange(const IntSize& newSize)
+{
+ m_rootLayer->setSize(newSize);
+ m_nonCompositedContentLayer->setSize(newSize);
+
+ if (m_pageOverlayLayer)
+ m_pageOverlayLayer->setSize(newSize);
+
+ scheduleLayerFlush();
+ flushPendingLayerChanges();
+
+ [CATransaction flush];
+ [CATransaction synchronize];
+}
+
+void LayerTreeHostMac::didInstallPageOverlay()
+{
+ createPageOverlayLayer();
+ scheduleLayerFlush();
+}
+
+void LayerTreeHostMac::didUninstallPageOverlay()
+{
+ destroyPageOverlayLayer();
+ scheduleLayerFlush();
+}
+
+void LayerTreeHostMac::setPageOverlayNeedsDisplay(const IntRect& rect)
+{
+ ASSERT(m_pageOverlayLayer);
+ m_pageOverlayLayer->setNeedsDisplayInRect(rect);
+ scheduleLayerFlush();
+}
+
+void LayerTreeHostMac::notifyAnimationStarted(const WebCore::GraphicsLayer*, double time)
+{
+}
+
+void LayerTreeHostMac::notifySyncRequired(const WebCore::GraphicsLayer*)
+{
+}
+
+void LayerTreeHostMac::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& graphicsContext, GraphicsLayerPaintingPhase, const IntRect& clipRect)
+{
+ if (graphicsLayer == m_nonCompositedContentLayer) {
+ m_webPage->drawRect(graphicsContext, clipRect);
+ return;
+ }
+
+ if (graphicsLayer == m_pageOverlayLayer) {
+ m_webPage->drawPageOverlay(graphicsContext, clipRect);
+ return;
+ }
+}
+
+bool LayerTreeHostMac::showDebugBorders() const
+{
+ return m_webPage->corePage()->settings()->showDebugBorders();
+}
+
+bool LayerTreeHostMac::showRepaintCounter() const
+{
+ return m_webPage->corePage()->settings()->showRepaintCounter();
+}
+
+void LayerTreeHostMac::flushPendingLayerChangesRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void* context)
+{
+ static_cast<LayerTreeHostMac*>(context)->flushPendingLayerChangesRunLoopObserverCallback();
+}
+
+void LayerTreeHostMac::flushPendingLayerChangesRunLoopObserverCallback()
+{
+ {
+ RefPtr<LayerTreeHostMac> protect(this);
+ m_webPage->layoutIfNeeded();
+
+ if (!m_isValid)
+ return;
+ }
+
+ if (!flushPendingLayerChanges())
+ return;
+
+ // We successfully flushed the pending layer changes, remove the run loop observer.
+ ASSERT(m_flushPendingLayerChangesRunLoopObserver);
+ CFRunLoopObserverInvalidate(m_flushPendingLayerChangesRunLoopObserver.get());
+ m_flushPendingLayerChangesRunLoopObserver = 0;
+}
+
+bool LayerTreeHostMac::flushPendingLayerChanges()
+{
+ m_rootLayer->syncCompositingStateForThisLayerOnly();
+ m_nonCompositedContentLayer->syncCompositingStateForThisLayerOnly();
+ if (m_pageOverlayLayer)
+ m_pageOverlayLayer->syncCompositingStateForThisLayerOnly();
+
+ return m_webPage->corePage()->mainFrame()->view()->syncCompositingStateIncludingSubframes();
+}
+
+void LayerTreeHostMac::createPageOverlayLayer()
+{
+ ASSERT(!m_pageOverlayLayer);
+
+ m_pageOverlayLayer = GraphicsLayer::create(this);
+#ifndef NDEBUG
+ m_pageOverlayLayer->setName("LayerTreeHost page overlay content");
+#endif
+
+ m_pageOverlayLayer->setDrawsContent(true);
+ m_pageOverlayLayer->setSize(m_webPage->size());
+
+ m_rootLayer->addChild(m_pageOverlayLayer.get());
+}
+
+void LayerTreeHostMac::destroyPageOverlayLayer()
+{
+ ASSERT(m_pageOverlayLayer);
+ m_pageOverlayLayer->removeFromParent();
+ m_pageOverlayLayer = nullptr;
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm
index 83909be..f053cab 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm
+++ b/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#import "config.h"
#import "WebInspector.h"
#import <wtf/text/WTFString.h>
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
index f3211f2..71bbf78 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
+++ b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
@@ -23,28 +23,29 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "WebPage.h"
+#import "config.h"
+#import "WebPage.h"
-#include "AccessibilityWebPageObject.h"
-#include "DataReference.h"
-#include "PluginView.h"
-#include "WebCoreArgumentCoders.h"
-#include "WebEvent.h"
-#include "WebFrame.h"
-#include "WebPageProxyMessages.h"
-#include "WebProcess.h"
-#include <WebCore/AXObjectCache.h>
-#include <WebCore/FocusController.h>
-#include <WebCore/Frame.h>
-#include <WebCore/FrameView.h>
-#include <WebCore/HitTestResult.h>
-#include <WebCore/KeyboardEvent.h>
-#include <WebCore/Page.h>
-#include <WebCore/PlatformKeyboardEvent.h>
-#include <WebCore/ScrollView.h>
-#include <WebCore/TextIterator.h>
-#include <WebCore/WindowsKeyboardCodes.h>
-#include <WebKitSystemInterface.h>
+#import "AccessibilityWebPageObject.h"
+#import "DataReference.h"
+#import "PluginView.h"
+#import "WebCoreArgumentCoders.h"
+#import "WebEvent.h"
+#import "WebFrame.h"
+#import "WebPageProxyMessages.h"
+#import "WebProcess.h"
+#import <WebCore/AXObjectCache.h>
+#import <WebCore/FocusController.h>
+#import <WebCore/Frame.h>
+#import <WebCore/FrameView.h>
+#import <WebCore/HitTestResult.h>
+#import <WebCore/KeyboardEvent.h>
+#import <WebCore/Page.h>
+#import <WebCore/PlatformKeyboardEvent.h>
+#import <WebCore/ScrollView.h>
+#import <WebCore/TextIterator.h>
+#import <WebCore/WindowsKeyboardCodes.h>
+#import <WebKitSystemInterface.h>
using namespace WebCore;
@@ -65,7 +66,7 @@ void WebPage::platformInitialize()
// send data back over
NSData* remoteToken = (NSData *)WKAXRemoteTokenForElement(mockAccessibilityElement);
CoreIPC::DataReference dataToken = CoreIPC::DataReference(reinterpret_cast<const uint8_t*>([remoteToken bytes]), [remoteToken length]);
- send(Messages::WebPageProxy::DidReceiveAccessibilityPageToken(dataToken));
+ send(Messages::WebPageProxy::RegisterWebProcessAccessibilityToken(dataToken));
m_mockAccessibilityElement = mockAccessibilityElement;
#endif
}
@@ -230,10 +231,11 @@ void WebPage::firstRectForCharacterRange(uint64_t location, uint64_t length, Web
resultRect.setSize(IntSize(0, 0));
RefPtr<Range> range = convertToRange(frame, NSMakeRange(location, length));
- if (range) {
- ASSERT(range->startContainer());
- ASSERT(range->endContainer());
- }
+ if (!range)
+ return;
+
+ ASSERT(range->startContainer());
+ ASSERT(range->endContainer());
IntRect rect = frame->editor()->firstRectForRange(range.get());
resultRect = frame->view()->contentsToWindow(rect);
@@ -334,11 +336,16 @@ bool WebPage::performDefaultBehaviorForKeyEvent(const WebKeyboardEvent& keyboard
return true;
}
-void WebPage::sendAccessibilityPresenterToken(const CoreIPC::DataReference& data)
+void WebPage::registerUIProcessAccessibilityTokens(const CoreIPC::DataReference& elementToken, const CoreIPC::DataReference& windowToken)
{
#if !defined(BUILDING_ON_SNOW_LEOPARD)
- NSData* tokenData = [NSData dataWithBytes:data.data() length:data.size()];
- [m_mockAccessibilityElement.get() setRemoteParent:WKAXRemoteElementForToken((CFDataRef)tokenData)];
+ NSData* elementTokenData = [NSData dataWithBytes:elementToken.data() length:elementToken.size()];
+ NSData* windowTokenData = [NSData dataWithBytes:windowToken.data() length:windowToken.size()];
+ id remoteElement = WKAXRemoteElementForToken(elementTokenData);
+ id remoteWindow = WKAXRemoteElementForToken(windowTokenData);
+ WKAXSetWindowForRemoteElement(remoteWindow, remoteElement);
+
+ [accessibilityRemoteObject() setRemoteParent:remoteElement];
#endif
}
@@ -357,6 +364,16 @@ bool WebPage::platformHasLocalDataForURL(const WebCore::KURL& url)
return cachedResponse;
}
+String WebPage::cachedResponseMIMETypeForURL(const WebCore::KURL& url)
+{
+ NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:url];
+ [request setValue:(NSString*)userAgent() forHTTPHeaderField:@"User-Agent"];
+ NSCachedURLResponse *cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request];
+ [request release];
+
+ return [[cachedResponse response] MIMEType];
+}
+
bool WebPage::canHandleRequest(const WebCore::ResourceRequest& request)
{
if ([NSURLConnection canHandleRequest:request.nsURLRequest()])
diff --git a/Source/WebKit2/WebProcess/WebPage/qt/ChunkedUpdateDrawingAreaQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/ChunkedUpdateDrawingAreaQt.cpp
index 25ed3e7..ec65b4e 100644
--- a/Source/WebKit2/WebProcess/WebPage/qt/ChunkedUpdateDrawingAreaQt.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/qt/ChunkedUpdateDrawingAreaQt.cpp
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "ChunkedUpdateDrawingArea.h"
#include "UpdateChunk.h"
diff --git a/Source/WebKit2/WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp
index b7ad782..c9ae03d 100644
--- a/Source/WebKit2/WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp
@@ -23,10 +23,11 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if ENABLE(TILED_BACKING_STORE)
-
+#include "config.h"
#include "TiledDrawingArea.h"
+#if ENABLE(TILED_BACKING_STORE)
+
#include "UpdateChunk.h"
#include "WebPage.h"
#include <WebCore/GraphicsContext.h>
diff --git a/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp
index 99aa1eb..1675d77 100644
--- a/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebInspector.h"
#if ENABLE(INSPECTOR)
diff --git a/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp
index fe1a89c..cad0c04 100644
--- a/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebPage.h"
#include "WebEvent.h"
@@ -270,6 +271,12 @@ bool WebPage::platformHasLocalDataForURL(const WebCore::KURL&)
return false;
}
+String WebPage::cachedResponseMIMETypeForURL(const WebCore::KURL&)
+{
+ // FIXME: Implement
+ return String();
+}
+
bool WebPage::canHandleRequest(const WebCore::ResourceRequest&)
{
// FIXME: Implement
diff --git a/Source/WebKit2/WebProcess/WebPage/win/ChunkedUpdateDrawingAreaWin.cpp b/Source/WebKit2/WebProcess/WebPage/win/ChunkedUpdateDrawingAreaWin.cpp
index aa1f975..13f1e3f 100644
--- a/Source/WebKit2/WebProcess/WebPage/win/ChunkedUpdateDrawingAreaWin.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/win/ChunkedUpdateDrawingAreaWin.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "ChunkedUpdateDrawingArea.h"
#include "UpdateChunk.h"
diff --git a/Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp b/Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp
index cae79c2..3c2f3c9 100644
--- a/Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp
@@ -23,10 +23,11 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if USE(ACCELERATED_COMPOSITING)
-
+#include "config.h"
#include "LayerBackedDrawingArea.h"
+#if USE(ACCELERATED_COMPOSITING)
+
using namespace WebCore;
namespace WebKit {
diff --git a/Source/WebKit2/WebProcess/WebPage/win/WebInspectorWin.cpp b/Source/WebKit2/WebProcess/WebPage/win/WebInspectorWin.cpp
index 4c30b8b..3ae0dae 100644
--- a/Source/WebKit2/WebProcess/WebPage/win/WebInspectorWin.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/win/WebInspectorWin.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebInspector.h"
#if ENABLE(INSPECTOR)
diff --git a/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp b/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp
index d41972c..e20af3a 100644
--- a/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebPage.h"
#include "FontSmoothingLevel.h"
@@ -261,6 +262,27 @@ bool WebPage::platformHasLocalDataForURL(const WebCore::KURL& url)
#endif
}
+String WebPage::cachedResponseMIMETypeForURL(const WebCore::KURL& url)
+{
+#if USE(CFNETWORK)
+ RetainPtr<CFURLRef> cfURL(AdoptCF, url.createCFURL());
+ RetainPtr<CFMutableURLRequestRef> request(AdoptCF, CFURLRequestCreateMutable(0, cfURL.get(), kCFURLRequestCachePolicyReloadIgnoringCache, 60, 0));
+
+ RetainPtr<CFStringRef> userAgent(AdoptCF, userAgent().createCFString());
+ CFURLRequestSetHTTPHeaderFieldValue(request.get(), CFSTR("User-Agent"), userAgent.get());
+
+ RetainPtr<CFURLCacheRef> cache(AdoptCF, CFURLCacheCopySharedURLCache());
+
+ RetainPtr<CFCachedURLResponseRef> cachedResponse(AdoptCF, CFURLCacheCopyResponseForRequest(cache.get(), request.get()));
+
+ CFURLResponseRef response = CFCachedURLResponseGetWrappedResponse(cachedResponse.get());
+
+ return response ? CFURLResponseGetMIMEType(response) : String();
+#else
+ return String();
+#endif
+}
+
bool WebPage::canHandleRequest(const WebCore::ResourceRequest& request)
{
#if USE(CFNETWORK)